Medical Imaging Interaction Toolkit  2018.4.99-dcb22cd7
Medical Imaging Interaction Toolkit
berryIDropTargetListener.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 
14 #ifndef BERRYIDROPTARGETLISTENER_H
15 #define BERRYIDROPTARGETLISTENER_H
16 
18 
19 #include "berryMessage.h"
20 
21 class QDragEnterEvent;
22 class QDragLeaveEvent;
23 class QDragMoveEvent;
24 class QDropEvent;
25 
26 namespace berry {
27 
29 {
30 
31  virtual ~IDropTargetListener();
32 
33  struct Events {
34 
35  enum Type {
36  NONE = 0x00000000,
37  ENTER = 0x00000001,
38  LEAVE = 0x00000002,
39  MOVE = 0x00000004,
40  DROP = 0x00000008,
41 
42  ALL = 0xffffffff
43  };
44 
45  Q_DECLARE_FLAGS(Types, Type)
46 
47  typedef Message1<QDragEnterEvent*> DragEnterEventType;
48  typedef Message1<QDragLeaveEvent*> DragLeaveEventType;
49  typedef Message1<QDragMoveEvent*> DragMoveEventType;
50  typedef Message1<QDropEvent*> DropEventType;
51 
52  DragEnterEventType dragEnter;
53  DragLeaveEventType dragLeave;
54  DragMoveEventType dragMove;
55  DropEventType drop;
56 
57  void AddListener(IDropTargetListener* listener);
58  void RemoveListener(IDropTargetListener* listener);
59 
60  private:
61  typedef MessageDelegate1<IDropTargetListener, QDragEnterEvent*> DragEnterDelegate;
62  typedef MessageDelegate1<IDropTargetListener, QDragLeaveEvent*> DragLeaveDelegate;
63  typedef MessageDelegate1<IDropTargetListener, QDragMoveEvent*> DragMoveDelegate;
64  typedef MessageDelegate1<IDropTargetListener, QDropEvent*> DropDelegate;
65  };
66 
67  virtual Events::Types GetDropTargetEventTypes() const = 0;
68 
69  virtual void DragEnterEvent(QDragEnterEvent* /*event*/) {}
70  virtual void DragLeaveEvent(QDragLeaveEvent* /*event*/) {}
71  virtual void DragMoveEvent(QDragMoveEvent* /*event*/) {}
72  virtual void DropEvent(QDropEvent* /*event*/) {}
73 
74 };
75 
76 }
77 
78 Q_DECLARE_OPERATORS_FOR_FLAGS(berry::IDropTargetListener::Events::Types)
79 
80 #endif // BERRYIDROPTARGETLISTENER_H
virtual void DropEvent(QDropEvent *)
virtual void DragLeaveEvent(QDragLeaveEvent *)
virtual void DragMoveEvent(QDragMoveEvent *)
#define BERRY_UI_QT