27 #define YUILogComponent "ui-events" 35 unsigned long YEvent::_nextSerial = 0;
39 : _eventType( eventType )
42 _serial = _nextSerial++;
55 return _eventType != InvalidEvent;
62 _eventType = InvalidEvent;
71 case NoEvent:
return "NoEvent";
72 case UnknownEvent:
return "UnknownEvent";
73 case WidgetEvent:
return "WidgetEvent";
74 case MenuEvent:
return "MenuEvent";
75 case KeyEvent:
return "KeyEvent";
76 case CancelEvent:
return "CancelEvent";
77 case TimeoutEvent:
return "TimeoutEvent";
78 case DebugEvent:
return "DebugEvent";
79 case InvalidEvent:
return "InvalidEvent";
85 return "<Unknown event type - internal error>";
94 case UnknownReason:
return "Unknown";
95 case Activated:
return "Activated";
96 case SelectionChanged:
return "SelectionChanged";
97 case ValueChanged:
return "ValueChanged";
98 case ContextMenuActivated:
return "ContextMenuActivated";
104 return "<Unknown event reason - internal error>";
126 , _keySymbol( keySymbol )
127 , _focusWidget( focusWidget )
134 operator<<( std::ostream & stream,
const YEvent * event )
139 <<
" at " << std::hex << (
void *)
event << std::dec;
143 stream <<
"<NULL event>";
bool isValid() const
Check if this event is valid.
void setDialog(YDialog *dia)
Set the dialog this event belongs to.
virtual ~YEvent()
Protected destructor - events can only be deleted via YDialog::deleteEvent().
Abstract base class for events to be returned upon UI::UserInput() and related functions.
EventType eventType() const
Returns the event type.
YKeyEvent(const std::string &keySymbol, YWidget *focusWidget=0)
Constructor.
void invalidate()
Mark this event as invalid.
static YDialog * currentDialog(bool doThrow=true)
Return the current (topmost) dialog.
YEvent(EventType eventType=UnknownEvent)
Constructor.
virtual YWidget * widget() const
Returns the widget that caused this event or 0 if there is none.
static const char * toString(EventType eventType)
Returns the character representation of an event type.