Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
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;
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;
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
berry::IDropTargetListener::DragLeaveEvent
virtual void DragLeaveEvent(QDragLeaveEvent *)
Definition: berryIDropTargetListener.h:70
berry::IDropTargetListener::DropEvent
virtual void DropEvent(QDropEvent *)
Definition: berryIDropTargetListener.h:72
org_blueberry_ui_qt_Export.h
berryMessage.h
berry::Message1
Definition: berryMessage.h:787
berry::MessageDelegate1
Definition: berryMessage.h:170
BERRY_UI_QT
#define BERRY_UI_QT
Definition: org_blueberry_ui_qt_Export.h:26
berry::IDropTargetListener::Events
Definition: berryIDropTargetListener.h:33
berry::IDropTargetListener::DragMoveEvent
virtual void DragMoveEvent(QDragMoveEvent *)
Definition: berryIDropTargetListener.h:71
berry::IDropTargetListener::Events::Type
Type
Definition: berryIDropTargetListener.h:35
berry
Definition: QmitkPropertyItemModel.h:24
berry::IDropTargetListener
Definition: berryIDropTargetListener.h:28