41#ifndef INCLUDED_DISTI_EVENTS_H
42#define INCLUDED_DISTI_EVENTS_H
96 SHIFT_STATE = 0x00010000,
97 CAPS_LOCK_STATE = 0x00020000,
98 CTRL_STATE = 0x00040000,
99 ALT_STATE = 0x00080000,
100 NUM_LOCK_STATE = 0x00100000,
101 META_STATE = 0x00400000,
102 SCROLL_LOCK_STATE = 0x00800000,
103 BUTTON1_STATE = 0x01000000,
104 BUTTON2_STATE = 0x02000000,
105 BUTTON3_STATE = 0x04000000
356 , _initiator( initiator )
360 int size = (int)strlen( eventName ) + 1;
361 _eventName =
new char[ size ];
363 strcpy_s( _eventName, size, eventName );
365 strcpy( _eventName, eventName );
369 size = (int)strlen( eventData ) + 1;
370 _eventData =
new char[ size ];
372 strcpy_s( _eventData, size, eventData );
374 strcpy( _eventData, eventData );
387 , _initiator( initiator )
438 int size = (int)strlen( newName ) + 1;
439 _eventName =
new char[ size ];
441 strcpy_s( _eventName, size, newName );
443 strcpy( _eventName, newName );
473 int size = (int)strlen( newData ) + 1;
474 _eventData =
new char[ size ];
476 strcpy_s( _eventData, size, newData );
478 strcpy( _eventData, newData );
487 if( !_eventName || !eventName )
492 return ( 0 == strcmp( _eventName, eventName ) );
499 if( !_eventData || !eventData )
504 return ( 0 == strcmp( _eventData, eventData ) );
542 bool is = ( objEvent && objEvent->
EventNameIs( eventName ) );
543 if( is && eventData )
551#define ON( event, subevent ) if( ( ev->eventType == ( event ) ) && ( ev->eventSubtype == ( subevent ) ) )
554#define ON_MOUSE_UP( btnMask ) if( ( ev->eventType == EVENT_MOUSE ) && ( ev->eventSubtype == MOUSE_UP ) && ( (btnMask)&mev->buttonMask ) )
557#define ON_MOUSE_DOWN( btnMask ) if( ( ev->eventType == EVENT_MOUSE ) && ( ev->eventSubtype == MOUSE_DOWN ) && ( (btnMask)&mev->buttonMask ) )
560#define ON_MOUSE_DRAG( btnMask ) if( ( ev->eventType == EVENT_MOUSE ) && ( ev->eventSubtype == MOUSE_DRAG ) && ( (btnMask)&mev->buttonMask ) )
563#define ON_KEY_DOWN( testKey ) if( ( ev->eventType == EVENT_KEYBOARD ) && OnKeyEvent( kev, true, int( testKey ) ) )
566#define ON_KEY_UP( testKey ) if( ( ev->eventType == EVENT_KEYBOARD_UP ) && OnKeyEvent( kev, true, int( testKey ) ) )
569#define ON_KEY_DOWN_WITH_MODIFIER( testKey, modifierMask ) if( ( ev->eventType == EVENT_KEYBOARD ) && OnKeyEvent( kev, true, int( testKey ), modifierMask ) )
572#define ON_KEY_UP_WITH_MODIFIER( testKey, modifierMask ) if( ( ev->eventType == EVENT_KEYBOARD_UP ) && OnKeyEvent( kev, true, int( testKey ), modifierMask ) )
575#define ON_SPECIAL_KEY_DOWN( keySym ) if( ( ev->eventType == EVENT_KEYBOARD ) && OnKeyEvent( kev, false, int( keySym ) ) )
578#define ON_SPECIAL_KEY_UP( keySym ) if( ( ev->eventType == EVENT_KEYBOARD_UP ) && OnKeyEvent( kev, false, int( keySym ) ) )
581#define ON_SPECIAL_KEY_DOWN_WITH_MODIFIER( keySym, modifierMask ) if( ( ev->eventType == EVENT_KEYBOARD ) && OnKeyEvent( kev, false, int( keySym ), modifierMask ) )
584#define ON_SPECIAL_KEY_UP_WITH_MODIFIER( keySym, modifierMask ) if( ( ev->eventType == EVENT_KEYBOARD_UP ) && OnKeyEvent( kev, false, int( keySym ), modifierMask ) )
587#define ON_ANY_KEY_DOWN() if( ( ev->eventType == EVENT_KEYBOARD ) )
590#define ON_ANY_KEY_UP() if( ( ev->eventType == EVENT_KEYBOARD_UP ) )
625 bool keySuccess =
false;
633 if( CTRL_STATE & modifierMask )
636 key = std::tolower( key );
637 keySuccess = ( key == kev->
keysym );
646 keySuccess = ( key == kev->
keysym );
654 bool modSuccess = ( 0 != ( modifierMask & kev->
modifiers ) || ( 0 == modifierMask && 0 == (
int( SHIFT_STATE | CTRL_STATE | ALT_STATE | META_STATE ) & kev->
modifiers ) ) );
656 return ( keySuccess && modSuccess );
706 bool compressed =
false;
Definition: component_base.h:68
virtual ~DisplayEvent()
Definition: events.h:134
DisplayEvent(const DisplayEvent &source)
Definition: events.h:127
unsigned short eventSubtype
Definition: events.h:116
unsigned short eventType
Definition: events.h:115
DisplayEvent()
Definition: events.h:119
virtual DisplayObject * handle(DisplayEvent *ev)
virtual void ParentGroup(Group *group)
bool _lastEventWasCompressed
If true, the event we're passing along was compressed.
Definition: events.h:668
bool CompressEvent(const DisplayEvent &ev)
Definition: events.h:699
void SendAnyCompressedEvents()
Passes along the resulting compressed event to the target object's callback function.
Definition: events.h:729
bool _sendingCompressed
Flag set to avoid compressing an already compressed event (infinite loop).
Definition: events.h:671
EventCompressor(T *objectPtr, EventSenderCbType cb)
Definition: events.h:685
T * _objectPtr
The object containing the callback function.
Definition: events.h:670
EventSenderCbType _handleCb
The callback function that will process this event.
Definition: events.h:669
bool _active
If active, events will be compressed, i.e. multiple MOUSE_DRAG will be boiled down to one equivalent ...
Definition: events.h:672
MouseEvent _lastCompressedEvent
The result of event compression, i.e. what all the other events boiled down to.
Definition: events.h:667
DisplayObject *(T::* EventSenderCbType)(DisplayEvent *ev)
Typedef for a event callback function pointer.
Definition: events.h:664
void Active(bool val)
Definition: events.h:677
bool Active()
Definition: events.h:680
KeyboardEvent()
Default Constructor.
Definition: events.h:285
int modifiers
Definition: events.h:327
KeyboardEvent(const KeyboardEvent &source)
Definition: events.h:295
int event_text
Definition: events.h:326
int keysym
Definition: events.h:325
KeyboardEvent(const LocationEvent &source)
Definition: events.h:305
KeyboardEvent operator=(const KeyboardEvent &source)
Definition: events.h:316
float & y
Definition: events.h:161
float & oy
Definition: events.h:169
float & ox
Definition: events.h:168
Vector winLoc
Definition: events.h:150
float & ly
Definition: events.h:165
float & lz
Definition: events.h:166
float & z
Definition: events.h:162
Vector lCoords
Definition: events.h:153
float & oz
Definition: events.h:170
Vector oCoords
Definition: events.h:156
LocationEvent()
Definition: events.h:176
LocationEvent(const LocationEvent &source)
Definition: events.h:192
float & lx
Definition: events.h:164
float & x
Definition: events.h:160
LocationEvent operator=(const LocationEvent &source)
Definition: events.h:212
unsigned char buttonMask
Definition: events.h:274
int modifiers
Definition: events.h:276
MouseEvent(const LocationEvent &source)
Definition: events.h:251
unsigned int cursorID
Definition: events.h:277
unsigned char clicks
Definition: events.h:275
MouseEvent()
Definition: events.h:228
MouseEvent operator=(const MouseEvent &source)
Definition: events.h:264
MouseEvent(const MouseEvent &source)
Definition: events.h:240
ObjectEvent(DisplayObject *initiator, const char *eventName, const char *eventData=NULL)
Definition: events.h:354
const char * EventData() const
Definition: events.h:450
ObjectEvent(DisplayObject *initiator, unsigned short eventSubtypeArg)
Definition: events.h:385
void EventData(const char *newData)
Definition: events.h:466
bool EventDataIs(const char *eventData) const
Definition: events.h:497
DisplayObject * Initiator() const
Definition: events.h:406
const char * EventName() const
Definition: events.h:415
void EventName(const char *newName)
Definition: events.h:431
void Initiator(DisplayObject *initiator)
Definition: events.h:411
bool EventNameIs(const char *eventName) const
Definition: events.h:485
The disti::ComponentBase class.
The disti::DisplayObject class and global enumerations.
A file for all GL Studio files to include.
The disti::Group class. Implements groups of objects.
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47
MouseButtonType_e
Definition: events.h:85
@ MOUSE_BUTTON_ANY
Definition: events.h:89
@ MOUSE_LBUTTON
Definition: events.h:86
@ MOUSE_RBUTTON
Definition: events.h:88
@ MOUSE_MBUTTON
Definition: events.h:87
void EmitObjectEvent(DisplayObject *self, ObjectEvent *event)
Definition: events.h:511
bool OnKeyEvent(KeyboardEvent *kev, bool alphaNumeric, int key, int modifierMask=0)
Definition: events.h:623
EventType_e
Definition: events.h:59
@ EVENT_MOUSE
Definition: events.h:60
@ EVENT_KEYBOARD_UP
Definition: events.h:64
@ EVENT_OBJECT
Definition: events.h:63
@ EVENT_TIMER
Definition: events.h:62
@ EVENT_KEYBOARD
Definition: events.h:61
SpecialKeyState_e
Definition: events.h:94
bool ObjectEventIs(DisplayEvent *event, const char *eventName, const char *eventData=NULL)
Definition: events.h:539
MouseEventType_e
Definition: events.h:69
@ MOUSE_DOWN
Definition: events.h:70
@ MOUSE_ENTER
Definition: events.h:75
@ MOUSE_UP
Definition: events.h:71
@ MOUSE_DRAG
Definition: events.h:73
@ MOUSE_CANCEL
Definition: events.h:79
@ MOUSE_MOVE
Definition: events.h:72
@ MOUSE_WHEEL_PLUS
Definition: events.h:77
@ MOUSE_RECEIVE_MULTITOUCH
Definition: events.h:78
@ MOUSE_LEAVE
Definition: events.h:74
@ MOUSE_WHEEL_MINUS
Definition: events.h:76
@ MOUSE_DOUBLE
Definition: events.h:80
The disti::Timer class. An OS portable timing class.