OpenCOVER
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
coDragNDrop.h
Go to the documentation of this file.
1 /* This file is part of COVISE.
2 
3  You can use it under the terms of the GNU Lesser General Public License
4  version 2.1 or later, see lgpl-2.1.txt.
5 
6  * License: LGPL 2+ */
7 
8 #ifndef CO_DRAGNDROP_H
9 #define CO_DRAGNDROP_H
10 
11 #include <list>
13 
14 namespace vrui
15 {
16 
17 class vruiTransformNode;
18 
19 // ------------------------------------------------------------------
23 class OPENVRUIEXPORT coDragNDrop
24 {
25 public:
27  enum
28  {
29  MEDIA_UNKNOWN = 0,
30  MEDIA_MENUITEM
31  };
32 
34  coDragNDrop();
36  coDragNDrop(int);
37 
38  // destructor
39  virtual ~coDragNDrop();
40 
42  {
43  return mediaType;
44  }
45 
46 protected:
48  int mediaType;
49 
52 
55  bool processHit();
56 
58  void dragOperation();
59 
60  // this one is supposed to be overloaded and do what
61  // the target wants to do!
62  // it should return if the operation was sucessful,
63  // so the item can be removed or not.
64  virtual bool dropOperation(coDragNDrop *) = 0;
65 };
66 
67 // ------------------------------------------------------------------
72 {
73 public:
76 
78  void signOn(coDragNDrop *);
79 
81  void signOff(coDragNDrop *);
82 
84  void drag(coDragNDrop *);
85 
87  void drop(coDragNDrop *);
88 
90  coDragNDrop *first(int);
91 
92  // pointer on myself as hook
94 
95 private:
96  // static global storage of grabbed elements
97  std::list<coDragNDrop *> selection;
98 
99  // static global drag'n'drop classes, for update
100  std::list<coDragNDrop *> updateClasses;
101 
102  bool update();
103 };
104 }
105 #endif
vruiTransformNode * dragNode
this is the pfDCS that should be used for drag visualisation
Definition: coDragNDrop.h:51
Definition: coDragNDrop.h:71
static coDragNDropManager ddManager
Definition: coDragNDrop.h:93
Definition: vruiTransformNode.h:17
void signOn(coDragNDrop *)
register this item at the manager. It is updated then.
Definition: coDragNDrop.h:23
coDragNDrop * first(int)
deliver the first item which fits on the media type
void signOff(coDragNDrop *)
sign off from manager
void drop(coDragNDrop *)
drop the item out of the list
int mediaType
this objects media type
Definition: coDragNDrop.h:48
void drag(coDragNDrop *)
drag this item into the selection list
int getMediaType()
Definition: coDragNDrop.h:41
objects that are derived from this class are called once per frame
Definition: coUpdateManager.h:19