vdk 2.4.0
sigc_eventtraits.h
1 /* -*- c++ -*- */
2 #ifndef _sigc_eventtraits_h_
3 #define _sigc_eventtraits_h_
4 
5 /**** This file has to be excluded from doxygen ****/
6 /*
7  The static memebers are defined in this file,In order to not confuse
8  the linker, t
9  */
10 #define MAKE_EVENTTRAIT_1_OPEN(ID,GETYPE,VCMP,GCMP) \
11 template<>\
12 class W2_Trait<ID>\
13 {\
14 public:\
15  typedef GETYPE ge_type;\
16  typedef VCMP T_vcmp;\
17  typedef GCMP T_gcmp;\
18  static const T_vcmp EN1;\
19  static const T_gcmp GN1;\
20  static const char* const signame;\
21  static T_gcmp Field(GdkEvent* eve);\
22 };
23 
24 #define MAKE_EVENTTRAIT_2_OPEN(ID,GETYPE,VCMP,GCMP) \
25 template<>\
26 class W2_Trait<ID>\
27 {\
28 public:\
29  typedef GETYPE ge_type;\
30  typedef VCMP T_vcmp;\
31  typedef GCMP T_gcmp;\
32  static const T_vcmp EN1;\
33  static const T_gcmp GN1;\
34  static const T_vcmp EN2;\
35  static const T_gcmp GN2;\
36  static const char* const signame;\
37  static T_gcmp Field(GdkEvent* eve);\
38 };
39 
40 #define MAKE_EVENTTRAIT_3_OPEN(ID,GETYPE,VCMP,GCMP) \
41 template<>\
42 class W2_Trait<ID>\
43 {\
44 public:\
45  typedef GETYPE ge_type;\
46  typedef VCMP T_vcmp;\
47  typedef GCMP T_gcmp;\
48  static const T_vcmp EN1;\
49  static const T_gcmp GN1;\
50  static const T_vcmp EN2;\
51  static const T_gcmp GN2;\
52  static const T_vcmp EN3;\
53  static const T_gcmp GN3;\
54  static const char* const signame;\
55  static T_gcmp Field(GdkEvent* eve);\
56 };
57 
58 
59 
60 
61 #define MAKE_EVENTTRAIT_CLOSE_DEFAULT(ID) \
62 inline \
63 W2_Trait<ID>::T_gcmp W2_Trait<ID>::Field(GdkEvent* eve){return eve->type;}
64 
65 /* ok, here we go .. */
66 // BUTTON_PRESS
67 MAKE_EVENTTRAIT_3_OPEN(BUTTON_PRESS,GdkEventButton,VDKButtonEventFilter,GdkEventType)
68 MAKE_EVENTTRAIT_CLOSE_DEFAULT(BUTTON_PRESS)
69 
70 // BUTTON_RELEASE
71 MAKE_EVENTTRAIT_1_OPEN(BUTTON_RELEASE,GdkEventButton,VDKButtonEventFilter,\
72  GdkEventType)
73 MAKE_EVENTTRAIT_CLOSE_DEFAULT(BUTTON_RELEASE)
74 
75 // FOCUS_KEY_IN
76 MAKE_EVENTTRAIT_1_OPEN(FOCUS_KEY_IN, GdkEventFocus, VDKFocusEventFilter,\
77  int)
78 inline
79 int
80 W2_Trait<FOCUS_KEY_IN>::Field(GdkEvent* eve)
81 {return reinterpret_cast<GdkEventFocus*>(eve)->in;}
82 
83 
84 // FOCUS_KEY_OUT
85 MAKE_EVENTTRAIT_1_OPEN(FOCUS_KEY_OUT, GdkEventFocus, VDKFocusEventFilter,\
86  int)
87 inline
88 int
89 W2_Trait<FOCUS_KEY_OUT>::Field(GdkEvent* eve)
90 {return reinterpret_cast<GdkEventFocus*>(eve)->in;}
91 
92 
93 // FOCUS_POINTER_IN
94 MAKE_EVENTTRAIT_1_OPEN(FOCUS_POINTER_IN,GdkEventCrossing,VDKFocusEventFilter,\
95  GdkEventType)
96 MAKE_EVENTTRAIT_CLOSE_DEFAULT(FOCUS_POINTER_IN)
97 
98 
99 // FOCUS_POINTER_OUT
100 MAKE_EVENTTRAIT_1_OPEN(FOCUS_POINTER_OUT,GdkEventCrossing,VDKFocusEventFilter,\
101  GdkEventType)
102 MAKE_EVENTTRAIT_CLOSE_DEFAULT(FOCUS_POINTER_OUT)
103 
104 // GEOMETRY (for direct signal)
105 MAKE_EVENTTRAIT_1_OPEN(GEOMETRY,GdkEventConfigure,int,int)
106 
107 
108 // PAINT (also direct signal)
109 MAKE_EVENTTRAIT_1_OPEN(PAINT,GdkEventExpose,int,int)
110 
111 
112 // KEY_PRESS
113 MAKE_EVENTTRAIT_1_OPEN(KEY_PRESS,GdkEventKey,VDKKeyEventFilter,\
114  GdkEventType)
115 
116 MAKE_EVENTTRAIT_CLOSE_DEFAULT(KEY_PRESS)
117 
118 // KEY_RELEASE
119 MAKE_EVENTTRAIT_1_OPEN(KEY_RELEASE,GdkEventKey,VDKKeyEventFilter,\
120  GdkEventType)
121 
122 MAKE_EVENTTRAIT_CLOSE_DEFAULT(KEY_RELEASE)
123 
124 // POINTER_PRESSED
125 MAKE_EVENTTRAIT_1_OPEN(POINTER_PRESSED,GdkEventMotion,VDKPointerEventFilter,\
126  bool)
127 inline
128 bool
129 W2_Trait<POINTER_PRESSED>::Field(GdkEvent* eve)
130 {return (reinterpret_cast<GdkEventMotion*>(eve)->state != 0);}
131 
132 // POINTER_MOVE
133 MAKE_EVENTTRAIT_1_OPEN(POINTER_MOVE,GdkEventMotion,VDKPointerEventFilter,\
134  bool)
135 inline
136 bool
137 W2_Trait<POINTER_MOVE>::Field(GdkEvent* eve)
138  {return true;}
139 
140 // MAP
141 /*
142  MAKE_EVENTTRAIT_3_OPEN(MAPEVENT, GdkEventVisibility, "visibility_notify_event",\
143  FULLY_VISIBLE,GDK_VISIBILITY_UNOBSCURED,\
144  NOT_VISIBLE,GDK_VISIBILITY_FULLY_OBSCURED,\
145  PARTIAL_VISIBLE, GDK_VISIBILITY_PARTIAL)
146  static int Field(GdkEvent* eve)
147  {return reinterpret_cast<GdkEventVisibility*>(eve)->state;}
148  };
149 */
150 
151 class W2_Trait<MAPEVENT>
152 {
153 public:
154  typedef GdkEventVisibility ge_type;
155  typedef VDKMapEventFilter T_vcmp;
156  typedef int T_gcmp;
157  static const char* const signame;
158  static const T_vcmp EN1;
159  static const int GN1;
160  static const T_vcmp EN2;
161  static const int GN2;
162  static const T_vcmp EN3;
163  static const int GN3;
164  static int Field(GdkEvent* eve);
165 };
166 
167 
168 
169 
170 #endif /* !_sigc_eventtraits_h_ */
171