Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
berryIDropTargetListener.h
Go to the documentation of this file.
1 /*===================================================================
2 
3 BlueBerry Platform
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 
18 #ifndef BERRYIDROPTARGETLISTENER_H
19 #define BERRYIDROPTARGETLISTENER_H
20 
22 
23 #include "berryMessage.h"
24 
25 class QDragEnterEvent;
26 class QDragLeaveEvent;
27 class QDragMoveEvent;
28 class QDropEvent;
29 
30 namespace berry {
31 
33 {
34 
35  virtual ~IDropTargetListener();
36 
37  struct Events {
38 
39  enum Type {
40  NONE = 0x00000000,
41  ENTER = 0x00000001,
42  LEAVE = 0x00000002,
43  MOVE = 0x00000004,
44  DROP = 0x00000008,
45 
46  ALL = 0xffffffff
47  };
48 
49  Q_DECLARE_FLAGS(Types, Type)
50 
51  typedef Message1<QDragEnterEvent*> DragEnterEventType;
52  typedef Message1<QDragLeaveEvent*> DragLeaveEventType;
53  typedef Message1<QDragMoveEvent*> DragMoveEventType;
54  typedef Message1<QDropEvent*> DropEventType;
55 
56  DragEnterEventType dragEnter;
57  DragLeaveEventType dragLeave;
58  DragMoveEventType dragMove;
59  DropEventType drop;
60 
61  void AddListener(IDropTargetListener* listener);
62  void RemoveListener(IDropTargetListener* listener);
63 
64  private:
65  typedef MessageDelegate1<IDropTargetListener, QDragEnterEvent*> DragEnterDelegate;
66  typedef MessageDelegate1<IDropTargetListener, QDragLeaveEvent*> DragLeaveDelegate;
67  typedef MessageDelegate1<IDropTargetListener, QDragMoveEvent*> DragMoveDelegate;
68  typedef MessageDelegate1<IDropTargetListener, QDropEvent*> DropDelegate;
69  };
70 
71  virtual Events::Types GetDropTargetEventTypes() const = 0;
72 
73  virtual void DragEnterEvent(QDragEnterEvent* /*event*/) {}
74  virtual void DragLeaveEvent(QDragLeaveEvent* /*event*/) {}
75  virtual void DragMoveEvent(QDragMoveEvent* /*event*/) {}
76  virtual void DropEvent(QDropEvent* /*event*/) {}
77 
78 };
79 
80 }
81 
82 Q_DECLARE_OPERATORS_FOR_FLAGS(berry::IDropTargetListener::Events::Types)
83 
84 #endif // BERRYIDROPTARGETLISTENER_H
virtual void DropEvent(QDropEvent *)
virtual void DragLeaveEvent(QDragLeaveEvent *)
virtual void DragMoveEvent(QDragMoveEvent *)
#define BERRY_UI_QT