7 #ifndef __window_WindowEvent_h__ 8 #define __window_WindowEvent_h__ 15 #ifndef FE_EVENT_LAYOUT 16 #define FE_EVENT_LAYOUT "WindowEvent" 61 e_sourceMousePosition= 0x0001,
62 e_sourceMouseButton= 0x0002,
63 e_sourceKeyboard= 0x0004,
64 e_sourceSystem= 0x0008,
70 e_sourceWheel0= 0x1000,
71 e_sourceWheel1= 0x2000,
72 e_sourceWheel2= 0x4000,
73 e_sourceWheel3= 0x8000,
74 e_sourceAny= 0x7fffffff
83 e_itemAny= 0x7fffffff,
99 e_keyCarriageReturn= 0x0D,
103 e_keyAsciiMask= 0xFF,
105 e_keyCursorUp= 0x101,
106 e_keyCursorDown= 0x102,
107 e_keyCursorLeft= 0x103,
108 e_keyCursorRight= 0x104,
109 e_keyCursorMask= 0x107,
110 e_keyFunction= 0x200,
111 e_keyFunction1= 0x201,
112 e_keyFunction2= 0x202,
113 e_keyFunction3= 0x203,
114 e_keyFunction4= 0x204,
115 e_keyFunction5= 0x205,
116 e_keyFunction6= 0x206,
117 e_keyFunction7= 0x207,
118 e_keyFunction8= 0x208,
119 e_keyFunction9= 0x209,
120 e_keyFunction10= 0x20A,
121 e_keyFunction11= 0x20B,
122 e_keyFunction12= 0x20C,
123 e_keyFunctionMask= 0x20F,
128 e_keyModifiers= (e_keyShift|e_keyCapLock|
129 e_keyControl|e_keyAlt),
136 e_itemCloseWindow= 0x08,
144 e_windowSwapBuffers= 0x02,
147 e_joyLeftStickX= 0x0000001,
148 e_joyLeftStickY= 0x0000002,
149 e_joyLeftPadX= 0x0000004,
150 e_joyLeftPadY= 0x0000008,
151 e_joyRightStickX= 0x0000010,
152 e_joyRightStickY= 0x0000020,
153 e_joyLeftTrigger= 0x0000040,
154 e_joyRightTrigger= 0x0000080,
156 e_joySelect= 0x0000100,
157 e_joyBack= 0x0000100,
158 e_joyGuide= 0x0000200,
159 e_joyStart= 0x0000400,
161 e_joyLeftUp= 0x0001000,
162 e_joyLeftDown= 0x0002000,
163 e_joyLeftLeft= 0x0004000,
164 e_joyLeftRight= 0x0008000,
166 e_joyLeftHigh= 0x0010000,
167 e_joyLeftLow= 0x0020000,
168 e_joyLeftDepress= 0x0040000,
170 e_joyRightUp= 0x0100000,
171 e_joyRightDown= 0x0200000,
172 e_joyRightLeft= 0x0400000,
173 e_joyRightRight= 0x0800000,
175 e_joyRightHigh= 0x1000000,
176 e_joyRightLow= 0x2000000,
177 e_joyRightDepress= 0x4000000,
179 e_joyAxes= 0x00000FF,
180 e_joyButtons= 0xFF7F700,
183 e_JoyWheel= e_joyLeftStickX,
184 e_JoyClutch= e_joyLeftStickY,
185 e_JoyGasPedal= e_joyRightStickX,
186 e_JoyBrake= e_joyRightStickY,
187 e_JoyShifterRight= e_joyLeftLow,
188 e_JoyShifterLeft= e_joyRightLow,
196 e_stateForceSigned= -1,
199 e_stateRelease= 0x02,
201 e_stateAny= 0x7fffffff,
203 e_state2ClickGeneric= 0x00,
204 e_state2ClickSingle= 0x01,
205 e_state2ClickDouble= 0x02,
206 e_state2ClickTriple= 0x03,
208 e_state2NoRelease= 0x04,
229 m_source=e_sourceNull;
239 bool operator <(
const Mask &a_other)
const 241 if(a_other.m_source > m_source) {
return true; }
242 if(a_other.m_source < m_source) {
return false; }
243 if(a_other.m_item > m_item) {
return true; }
244 if(a_other.m_item < m_item) {
return false; }
245 if(a_other.m_state > m_state) {
return true; }
246 if(a_other.m_state < m_state) {
return false; }
251 void setSource(
Source value)
253 void orSource(
Source value)
255 Item item(
void)
const 257 void setItem(
Item value)
259 void orItem(
Item value)
261 State state(
void)
const 263 void setState(
State value)
265 void orState(
State value)
278 static WindowEvent::Mask stringToMask(
const String &a_string);
285 FE_SPEC(
"evt:source",
286 "Origin of change (alleged)"));
288 FE_SPEC(
"evt:item",
"Aspect of change"));
290 FE_SPEC(
"evt:state",
"Effect of change"));
292 FE_SPEC(
"evt:state2",
"Orthogonal effect"));
294 FE_SPEC(
"evt:mouseX",
"X of mouse (optional)"));
296 FE_SPEC(
"evt:mouseY",
"Y of mouse (optional)"));
297 add(eventMouseButtons,
298 FE_SPEC(
"evt:mButtons",
299 "Mouse buttons (optional)"));
306 if( source() != e_sourceAny
307 && other.source() != e_sourceAny
308 && source() != other.source())
312 if( item() != e_itemAny
313 && other.item() != e_itemAny
314 && item() != other.item())
318 if( state() != e_stateAny
319 && other.state() != e_stateAny
320 && state() != other.state())
329 if(source() != e_sourceAny
330 && other.source() != e_sourceAny)
332 if(source() < other.source())
336 if(source() > other.source())
342 if(item() != e_itemAny
343 && other.item() != e_itemAny)
345 if(item() < other.item())
349 if(item() > other.item())
355 if(state() != e_stateAny
356 && other.state() != e_stateAny)
358 if(state() < other.state())
362 if(state() > other.state())
372 {
return Source(eventSource.check()?
373 eventSource(): e_sourceNull); }
374 void setSource(
Source value)
375 { eventSource()=value; }
377 Item item(
void)
const 378 {
return Item(eventItem.check()?
379 eventItem(): e_itemNull); }
380 void setItem(
Item value)
381 { eventItem()=value; }
383 State state(
void)
const 384 {
return State(eventState.check()?
385 eventState(): e_stateNull); }
386 void setState(
State value)
387 { eventState()=value; }
389 State state2(
void)
const 390 {
return State(eventState2.check()?
391 eventState2(): e_stateNull); }
392 void setState2(
State value)
393 { eventState2()=value; }
395 I32 mouseX(
void)
const 396 {
return eventMouseX.check()? eventMouseX(): -1; }
397 void setMouseX(I32 value)
398 { eventMouseX()=value; }
400 I32 mouseY(
void)
const 401 {
return eventMouseY.check()? eventMouseY(): -1; }
402 void setMouseY(I32 value)
403 { eventMouseY()=value; }
407 eventMouseButtons(): e_mbNone); }
409 { eventMouseButtons()=value; }
413 setSource(e_sourceNull);
415 setState(e_stateNull);
416 setState2(e_stateNull);
417 setMousePosition(0,0);
418 setMouseButtons(e_mbNone);
421 void getMousePosition(I32 *pMx,I32 *pMy)
const 425 void setMousePosition(I32 mx,I32 my)
434 BWORD matchesSource(
Source sourceMask)
const 435 {
return sourceMask==source() || sourceMask==e_sourceAny;}
436 BWORD matchesItem(
Item itemMask)
const 437 {
return itemMask==item() || itemMask==e_itemAny ||
438 itemMask==(item()&(e_itemAny^e_keyModifiers)); }
439 BWORD matchesItemUnmodified(
Item itemMask)
const 440 {
return itemMask==item() || itemMask==e_itemAny; }
441 BWORD matchesState(
State stateMask)
const 442 {
return stateMask==state() || stateMask==e_stateAny; }
445 {
return matchesSource(sourceMask) &&
446 matchesItem(itemMask) &&
447 matchesState(stateMask); }
449 {
return matchesSource(mask.source()) &&
450 matchesItem(mask.item()) &&
451 matchesState(mask.state()); }
452 BWORD is(
const Mask &mask)
const 453 {
return matchesSource(mask.source()) &&
454 matchesItem(mask.item()) &&
455 matchesState(mask.state()); }
456 BWORD isUnmodified(
Source sourceMask,
Item itemMask,
457 State stateMask)
const 458 {
return matchesSource(sourceMask) &&
459 matchesItemUnmodified(itemMask) &&
460 matchesState(stateMask); }
461 BWORD isModified(
void)
462 {
return (item()&e_keyModifiers)!=0x0; }
463 BWORD isModifiedBy(
Item itemMask)
464 {
return itemMask==(item()&e_keyModifiers); }
466 BWORD isNull(
void)
const 467 {
return is(e_sourceNull,e_itemAny,e_stateAny); }
468 BWORD isExpose(
void)
const 469 {
return is(e_sourceSystem,e_itemExpose,e_stateAny);}
470 BWORD isResize(
void)
const 471 {
return is(e_sourceSystem,e_itemResize,e_stateAny);}
472 BWORD isCloseWindow(
void)
const 473 {
return is(e_sourceSystem,e_itemCloseWindow,e_stateAny);}
474 BWORD isIdleMouse(
void)
const 475 {
return is(e_sourceSystem,e_itemIdle,e_stateAny); }
476 BWORD isPoll(
void)
const 477 {
return is(e_sourceSystem,e_itemPoll,e_stateAny); }
478 BWORD isContinuous(
void)
const 479 {
return isIdleMouse() || isPoll(); }
480 BWORD isMouseEnter(
void)
const 481 {
return is(e_sourceSystem,e_itemEnter,e_stateNull); }
482 BWORD isMouseExit(
void)
const 483 {
return is(e_sourceSystem,e_itemExit,e_stateNull); }
484 BWORD isMouseMotion(
void)
const 485 {
return is(e_sourceMousePosition,e_itemAny,e_stateAny); }
486 BWORD isMouseMove(
void)
const 487 {
return is(e_sourceMousePosition,e_itemMove,e_stateAny);}
488 BWORD isMouseDrag(
void)
const 489 {
return is(e_sourceMousePosition,e_itemDrag,e_stateAny);}
490 BWORD isKeyboard()
const 491 {
return is(e_sourceKeyboard,e_itemAny,e_stateAny);}
492 BWORD isKeyPress(
Item key)
const 493 {
return is(e_sourceKeyboard,key,e_statePress); }
494 BWORD isKeyRepeat(
Item key)
const 495 {
return is(e_sourceKeyboard,key,e_stateRepeat); }
496 BWORD isKeyRelease(
Item key)
const 497 {
return is(e_sourceKeyboard,key,e_stateRelease); }
498 BWORD isKeyTyped(
Item key)
const 499 {
return isKeyPress(key) || isKeyRepeat(key); }
500 BWORD isMouseButton(
Item item=e_itemAny)
const 501 {
return is(e_sourceMouseButton,item,e_stateAny); }
502 BWORD isMousePress(
Item item=e_itemAny)
const 503 {
return is(e_sourceMouseButton,item,e_statePress); }
504 BWORD isMouseRelease(
Item item=e_itemAny)
const 505 {
return is(e_sourceMouseButton,item,e_stateRelease); }
506 BWORD isMouseWheel(
void)
const 507 {
return is(e_sourceMouseButton,e_itemWheel,e_stateAny); }
508 BWORD isClear(
void)
const 509 {
return is(e_sourceUser,e_windowClear,e_stateAny); }
510 BWORD isSwap(
void)
const 511 {
return is(e_sourceUser,e_windowSwapBuffers,e_stateAny);}
512 BWORD isSystem(
void)
const 513 {
return matchesSource(e_sourceSystem); }
514 BWORD isUser(
void)
const 515 {
return matchesSource(e_sourceUser); }
516 BWORD isJoy(
void)
const 517 {
return matchesSource(e_sourceJoy0); }
518 BWORD isJoyAxis(
void)
const 519 {
return isJoy() && (item()&e_joyAxes); }
520 BWORD isJoyButton(
void)
const 521 {
return is(e_sourceJoy0,e_joyButtons,e_stateAny);}
526 {
return (source()==e_sourceMousePosition ||
527 source()==e_sourceMouseButton ||
528 source()==e_sourceKeyboard); }
virtual void addFunctors(void)
Called at instantiation to add functors.
Definition: WindowEvent.h:282
MouseButtons
State of the mouse buttons during an event.
Definition: WindowEvent.h:214
Item
Aspect of change in a window event.
Definition: WindowEvent.h:80
kernel
Definition: namespace.dox:3
Bound accessor in a RecordView.
Definition: RecordView.h:147
Source
Source of a window event.
Definition: WindowEvent.h:58
State
Effect of change in a window event.
Definition: WindowEvent.h:194
virtual void initializeRecord(void)
Called at instantiation to initialize attributes.
Definition: WindowEvent.h:302
BWORD usesModifiers(void) const
Returns TRUE if item can be affected by shift/control/caplock.
Definition: WindowEvent.h:525
Generalized windowing event.
Definition: WindowEvent.h:43
BWORD operator==(const DualString &s1, const DualString &s2)
Compare two DualString's.
Definition: DualString.h:208
Automatically reference-counted string container.
Definition: String.h:128
Bindable collection of accessor Functors.
Definition: RecordView.h:106