HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
UI_Event.h
Go to the documentation of this file.
1 #ifndef __UI_Event__
2 #define __UI_Event__
3 
4 #include "UI_API.h"
5 #include <string.h>
6 #ifdef DEBUG_TRIGGER
7 #include "UI_Global.h" // Need debug macros for inline function...
8 #endif
9 #include "UI_DeviceEvent.h"
10 #include "UI_Value.h"
11 
12 template<typename T> class UT_Array;
13 
15 public:
16  UI_Event();
17  ~UI_Event();
18 
19  UI_Event(const UI_Event &e);
20 
21  UI_Event &operator=(const UI_Event &e);
22 
23  UI_Event(
24  UI_EventType t,
25  UI_Object *to,
26  UI_Object *from = (UI_Object *)0,
28  );
29 
30  UI_Event(
31  UI_Value *v,
32  UI_Object *to,
33  UI_Object *from = (UI_Object *)0,
35  );
36 
37  UI_Event(
38  UI_Value *v,
39  UI_Object *to,
40  UI_EventMethod callback,
41  UI_Object *from = (UI_Object *)0,
43  );
44 
45  UI_Event(
46  UI_EventType t,
47  UI_Object *to,
48  UI_EventMethod callback,
49  UI_Object *from = (UI_Object *)0
50  );
51 
57 
59 
61 
62  // history of collapsed events, 0 if no events were collapsed.
63  // Because of how we merge, this is a STACK.
64  // Ie, event->state is the most recent event and
65  // (*event->myStateHistory)[0] is the oldest, with
66  // *event->myStateHistory->last() the event just before event->state.
67  // This lets the usual process of merging events to just
68  // append to the list rather than prepend.
70 
71  void trigger()
72  {
73 #ifdef DEBUG_TRIGGER
74  UI_DEBUG(DBG_EVENTS,
75  UI_debug("Trigger %s, source: %s, target: %s\n",
76  name(),
77  source ? source->className() : "NULL",
78  target ? target->className() : "NULL"));
79 #endif
80  if( target )
81  (target->*method)(this);
82  }
83 
84  const char *name() const;
85  const char *className() const { return "UI_Event"; }
86  void display() const;
87  static const char *type_name(UI_EventType type);
88  static const char *reason_name(UI_Reason reason);
89 
90  // Contents of prevevent are somehow merged into this.
91  // Used to consolidate mouse moves into the UI_DeviceEvent history.
92  void mergeEvent(const UI_Event *prevevent);
93 };
94 
95 
96 #endif
const GLdouble * v
Definition: glcorearb.h:836
const char * className() const
Definition: UI_Event.h:85
UI_Object * target
Definition: UI_Event.h:53
int method
Definition: png.h:1924
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
UI_EventType
Definition: UI_EventType.h:20
GLenum target
Definition: glcorearb.h:1666
UI_Value * value
Definition: UI_Event.h:55
UI_DeviceEvent state
Definition: UI_Event.h:58
GLuint const GLchar * name
Definition: glcorearb.h:785
void trigger()
Definition: UI_Event.h:71
UI_Reason
Definition: UI_Value.h:25
UI_Object * source
Definition: UI_Event.h:52
void(UI_Object::* UI_EventMethod)(UI_Event *)
Definition: UI_Object.h:42
#define UI_API
Definition: UI_API.h:10
GLint GLint GLsizei GLint GLenum GLenum type
Definition: glcorearb.h:107
UI_EventMethod method
Definition: UI_Event.h:54
UI_Reason reason
Definition: UI_Event.h:60
GLboolean r
Definition: glcorearb.h:1221
UI_EventType type
Definition: UI_Event.h:56
UT_Array< UI_DeviceEvent > * myStateHistory
Definition: UI_Event.h:69