CEGUI::EventSet Class Reference

Class that collects together a set of Event objects. More...

Inherited by CEGUI::GlobalEventSet, CEGUI::MouseCursor, CEGUI::Renderer, CEGUI::System, and CEGUI::Window.

List of all members.

Public Types

typedef ConstBaseIterator
< EventMap > 
Iterator

Public Member Functions

 EventSet ()
 Constructor for EventSet objects.
virtual ~EventSet (void)
 Destructor for EventSet objects.
void addEvent (const String &name)
 Add a new Event to the EventSet with the given name.
void removeEvent (const String &name)
 Removes the Event with the given name. All connections to the event are disconnected.
void removeAllEvents (void)
 Remove all Event objects from the EventSet.
bool isEventPresent (const String &name)
 Checks to see if an Event with the given name is present in the EventSet.
virtual Event::Connection subscribeEvent (const String &name, Event::Subscriber subscriber)
 Subscribes a handler to the named Event. If the named Event is not yet present in the EventSet, it is created and added.
virtual Event::Connection subscribeEvent (const String &name, Event::Group group, Event::Subscriber subscriber)
 Subscribes a handler to the specified group of the named Event. If the named Event is not yet present in the EventSet, it is created and added.
virtual Event::Connection subscribeScriptedEvent (const String &name, const String &subscriber_name)
 Subscribes the named Event to a scripted funtion.
virtual Event::Connection subscribeScriptedEvent (const String &name, Event::Group group, const String &subscriber_name)
 Subscribes the specified group of the named Event to a scripted funtion.
virtual void fireEvent (const String &name, EventArgs &args, const String &eventNamespace="")
 Fires the named event passing the given EventArgs object.
bool isMuted (void) const
 Return whether the EventSet is muted or not.
void setMutedState (bool setting)
 Set the mute state for this EventSet.
Iterator getIterator (void) const
 Return a EventSet::Iterator object to iterate over the events currently added to the EventSet.

Protected Types

typedef std::map< String,
Event
*, String::FastLessCompare
EventMap

Protected Member Functions

EventgetEventObject (const String &name, bool autoAdd=false)
 Return a pointer to the Event object with the given name, optionally adding such an Event object to the EventSet if it does not already exist.
void fireEvent_impl (const String &name, EventArgs &args)
 Implementation event firing member.
 EventSet (EventSet &e)
EventSetoperator= (EventSet &e)

Protected Attributes

EventMap d_events
bool d_muted
 true if events for this EventSet have been muted.


Detailed Description

Class that collects together a set of Event objects.

The EventSet is a means for code to attach a handler function to some named event, and later, for that event to be fired and the subscribed handler(s) called.

As of 0.5, the EventSet no longer needs to be filled with available events. Events are now added to the set as they are first used; that is, the first time a handler is subscribed to an event for a given EventSet, an Event object is created and added to the EventSet.
Instead of throwing an exception when firing an event that does not actually exist in the set, we now do nothing (if the Event does not exist, then it has no handlers subscribed, and therefore doing nothing is the correct course action).

Member Function Documentation

void CEGUI::EventSet::addEvent ( const String name  ) 

Add a new Event to the EventSet with the given name.

Parameters:
name String object containing the name to give the new Event. The name must be unique for the EventSet.
Returns:
Nothing
Exceptions:
AlreadyExistsException Thrown if an Event already exists named name.

References isEventPresent().

Referenced by CEGUI::Tree::addTreeEvents(), and getEventObject().

void CEGUI::EventSet::fireEvent ( const String name,
EventArgs args,
const String eventNamespace = "" 
) [virtual]

Fires the named event passing the given EventArgs object.

Parameters:
name String object holding the name of the Event that is to be fired (triggered)
args The EventArgs (or derived) object that is to be bassed to each subscriber of the Event. Once all subscribers have been called the 'handled' field of the event is updated appropriately.
eventNamespace String object describing the global event namespace prefix for this event.
Returns:
Nothing.

Reimplemented in CEGUI::GlobalEventSet.

References CEGUI::GlobalEventSet::fireEvent(), fireEvent_impl(), and CEGUI::GlobalEventSet::getSingleton().

Referenced by CEGUI::ScrollablePane::handleAutoSizePaneChanged(), CEGUI::Window::onActivated(), CEGUI::Window::onAlphaChanged(), CEGUI::Window::onAlwaysOnTopChanged(), CEGUI::ScrolledContainer::onAutoSizeSettingChanged(), CEGUI::ScrollablePane::onAutoSizeSettingChanged(), CEGUI::Tree::onBranchClosed(), CEGUI::Tree::onBranchOpened(), CEGUI::Window::onCaptureGained(), CEGUI::Window::onCaptureLost(), CEGUI::MultiLineEditbox::onCaratMoved(), CEGUI::Editbox::onCaratMoved(), CEGUI::Combobox::onCaratMoved(), CEGUI::Window::onCharacter(), CEGUI::Window::onChildAdded(), CEGUI::Window::onChildRemoved(), CEGUI::ListHeaderSegment::onClickableSettingChanged(), CEGUI::TabButton::onClicked(), CEGUI::PushButton::onClicked(), CEGUI::MenuItem::onClicked(), CEGUI::Window::onClippingChanged(), CEGUI::FrameWindow::onCloseClicked(), CEGUI::ScrolledContainer::onContentChanged(), CEGUI::ScrollablePane::onContentPaneChanged(), CEGUI::ScrollablePane::onContentPaneScrolled(), CEGUI::Window::onDeactivated(), CEGUI::Window::onDestructionStarted(), CEGUI::Window::onDisabled(), CEGUI::Tooltip::onDisplayTimeChanged(), CEGUI::DragContainer::onDragAlphaChanged(), CEGUI::Window::onDragDropItemDropped(), CEGUI::Window::onDragDropItemEnters(), CEGUI::Window::onDragDropItemLeaves(), CEGUI::DragContainer::onDragDropTargetChanged(), CEGUI::DragContainer::onDragEnabledChanged(), CEGUI::DragContainer::onDragEnded(), CEGUI::DragContainer::onDragMouseCursorChanged(), CEGUI::ListHeader::onDragMoveSettingChanged(), CEGUI::DragContainer::onDragPositionChanged(), CEGUI::ListHeader::onDragSizeSettingChanged(), CEGUI::DragContainer::onDragStarted(), CEGUI::DragContainer::onDragThresholdChanged(), CEGUI::Combobox::onDropListDisplayed(), CEGUI::Combobox::onDroplistRemoved(), CEGUI::MultiLineEditbox::onEditboxFullEvent(), CEGUI::Editbox::onEditboxFullEvent(), CEGUI::Combobox::onEditboxFullEvent(), CEGUI::Window::onEnabled(), CEGUI::Tooltip::onFadeTimeChanged(), CEGUI::Window::onFontChanged(), CEGUI::Window::onHidden(), CEGUI::Window::onHorizontalAlignmentChanged(), CEGUI::Tree::onHorzScrollbarModeChanged(), CEGUI::ScrollablePane::onHorzScrollbarModeChanged(), CEGUI::MultiLineEditbox::onHorzScrollbarModeChanged(), CEGUI::MultiColumnList::onHorzScrollbarModeChanged(), CEGUI::Listbox::onHorzScrollbarModeChanged(), CEGUI::Combobox::onHorzScrollbarModeChanged(), CEGUI::Tooltip::onHoverTimeChanged(), CEGUI::Window::onIDChanged(), CEGUI::MouseCursor::onImageChanged(), CEGUI::Window::onInheritsAlphaChanged(), CEGUI::Editbox::onInvalidEntryAttempted(), CEGUI::Combobox::onInvalidEntryAttempted(), CEGUI::Window::onKeyDown(), CEGUI::Window::onKeyUp(), CEGUI::MultiColumnList::onListColumnMoved(), CEGUI::MultiColumnList::onListColumnSized(), CEGUI::Tree::onListContentsChanged(), CEGUI::MultiColumnList::onListContentsChanged(), CEGUI::Listbox::onListContentsChanged(), CEGUI::ItemListBase::onListContentsChanged(), CEGUI::Combobox::onListContentsChanged(), CEGUI::ComboDropList::onListSelectionAccepted(), CEGUI::Combobox::onListSelectionAccepted(), CEGUI::Combobox::onListSelectionChanged(), CEGUI::Editbox::onMaskCodePointChanged(), CEGUI::Editbox::onMaskedRenderingModeChanged(), CEGUI::MultiLineEditbox::onMaximumTextLengthChanged(), CEGUI::Editbox::onMaximumTextLengthChanged(), CEGUI::Combobox::onMaximumTextLengthChanged(), CEGUI::Spinner::onMaximumValueChanged(), CEGUI::Spinner::onMinimumValueChanged(), CEGUI::Window::onMouseButtonDown(), CEGUI::TabButton::onMouseButtonDown(), CEGUI::Window::onMouseButtonUp(), CEGUI::Window::onMouseClicked(), CEGUI::Window::onMouseDoubleClicked(), CEGUI::Window::onMouseEnters(), CEGUI::Window::onMouseLeaves(), CEGUI::Window::onMouseMove(), CEGUI::TabButton::onMouseMove(), CEGUI::Window::onMouseTripleClicked(), CEGUI::Window::onMouseWheel(), CEGUI::TabButton::onMouseWheel(), CEGUI::ListHeaderSegment::onMovableSettingChanged(), CEGUI::Window::onMoved(), CEGUI::Tree::onMultiselectModeChanged(), CEGUI::Listbox::onMultiselectModeChanged(), CEGUI::MultiColumnList::onNominatedSelectColumnChanged(), CEGUI::MultiColumnList::onNominatedSelectRowChanged(), CEGUI::Window::onParentDestroyChanged(), CEGUI::Window::onParentSized(), CEGUI::MenuBase::onPopupClosed(), CEGUI::MenuBase::onPopupOpened(), CEGUI::ProgressBar::onProgressChanged(), CEGUI::ProgressBar::onProgressDone(), CEGUI::MultiLineEditbox::onReadOnlyChanged(), CEGUI::Editbox::onReadOnlyChanged(), CEGUI::Combobox::onReadOnlyChanged(), CEGUI::Window::onRenderingEnded(), CEGUI::Window::onRenderingStarted(), CEGUI::FrameWindow::onRollupToggled(), CEGUI::Scrollbar::onScrollConfigChanged(), CEGUI::Scrollbar::onScrollPositionChanged(), CEGUI::ListHeader::onSegmentAdded(), CEGUI::ListHeaderSegment::onSegmentClicked(), CEGUI::ListHeader::onSegmentClicked(), CEGUI::ListHeaderSegment::onSegmentDragPositionChanged(), CEGUI::ListHeaderSegment::onSegmentDragStart(), CEGUI::ListHeaderSegment::onSegmentDragStop(), CEGUI::ListHeader::onSegmentOffsetChanged(), CEGUI::ListHeader::onSegmentRemoved(), CEGUI::ListHeader::onSegmentSequenceChanged(), CEGUI::ListHeaderSegment::onSegmentSized(), CEGUI::ListHeader::onSegmentSized(), CEGUI::Tree::onSelectionChanged(), CEGUI::TabControl::onSelectionChanged(), CEGUI::MultiColumnList::onSelectionChanged(), CEGUI::Listbox::onSelectionChanged(), CEGUI::ItemEntry::onSelectionChanged(), CEGUI::MultiColumnList::onSelectionModeChanged(), CEGUI::Checkbox::onSelectStateChange(), CEGUI::RadioButton::onSelectStateChanged(), CEGUI::Window::onShown(), CEGUI::Window::onSized(), CEGUI::ListHeaderSegment::onSizingSettingChanged(), CEGUI::MultiColumnList::onSortColumnChanged(), CEGUI::ListHeader::onSortColumnChanged(), CEGUI::MultiColumnList::onSortDirectionChanged(), CEGUI::ListHeaderSegment::onSortDirectionChanged(), CEGUI::ListHeader::onSortDirectionChanged(), CEGUI::ItemListBase::onSortEnabledChanged(), CEGUI::Tree::onSortModeChanged(), CEGUI::Listbox::onSortModeChanged(), CEGUI::ItemListBase::onSortModeChanged(), CEGUI::Combobox::onSortModeChanged(), CEGUI::ListHeader::onSortSettingChanged(), CEGUI::ListHeaderSegment::onSplitterDoubleClicked(), CEGUI::ListHeader::onSplitterDoubleClicked(), CEGUI::Spinner::onStepChanged(), CEGUI::Editbox::onTextAcceptedEvent(), CEGUI::Combobox::onTextAcceptedEvent(), CEGUI::Window::onTextChanged(), CEGUI::Spinner::onTextInputModeChanged(), CEGUI::Editbox::onTextInvalidatedEvent(), CEGUI::Combobox::onTextInvalidatedEvent(), CEGUI::MultiLineEditbox::onTextSelectionChanged(), CEGUI::Editbox::onTextSelectionChanged(), CEGUI::Combobox::onTextSelectionChanged(), CEGUI::Thumb::onThumbPositionChanged(), CEGUI::Thumb::onThumbTrackEnded(), CEGUI::Slider::onThumbTrackEnded(), CEGUI::Scrollbar::onThumbTrackEnded(), CEGUI::Thumb::onThumbTrackStarted(), CEGUI::Slider::onThumbTrackStarted(), CEGUI::Scrollbar::onThumbTrackStarted(), CEGUI::Tooltip::onTooltipActive(), CEGUI::Tooltip::onTooltipInactive(), CEGUI::Editbox::onValidationStringChanged(), CEGUI::Combobox::onValidationStringChanged(), CEGUI::Spinner::onValueChanged(), CEGUI::Slider::onValueChanged(), CEGUI::Window::onVerticalAlignmentChanged(), CEGUI::Tree::onVertScrollbarModeChanged(), CEGUI::ScrollablePane::onVertScrollbarModeChanged(), CEGUI::MultiLineEditbox::onVertScrollbarModeChanged(), CEGUI::MultiColumnList::onVertScrollbarModeChanged(), CEGUI::Listbox::onVertScrollbarModeChanged(), CEGUI::Combobox::onVertScrollbarModeChanged(), CEGUI::Window::onWindowRendererAttached(), CEGUI::Window::onWindowRendererDetached(), CEGUI::MultiLineEditbox::onWordWrapModeChanged(), CEGUI::Window::onZChanged(), CEGUI::DirectX81Renderer::setDisplaySize(), CEGUI::OpenGLRenderer::setDisplaySize(), CEGUI::IrrlichtRenderer::setDisplaySize(), CEGUI::DirectX9Renderer::setDisplaySize(), CEGUI::DirectX10Renderer::setDisplaySize(), and CEGUI::Window::update().

Event * CEGUI::EventSet::getEventObject ( const String name,
bool  autoAdd = false 
) [protected]

Return a pointer to the Event object with the given name, optionally adding such an Event object to the EventSet if it does not already exist.

Parameters:
name String object holding the name of the Event to return.
autoAdd 
  • true if an Event object named name should be added to the set if such an Event does not currently exist.
  • false if no object should automatically be added to the set. In this case, if the Event does not already exist 0 will be returned.
Returns:
Pointer to the Event object in this EventSet with the specifed name. Or 0 if such an Event does not exist and autoAdd was false.

References addEvent().

Referenced by fireEvent_impl(), and subscribeEvent().

bool CEGUI::EventSet::isEventPresent ( const String name  ) 

Checks to see if an Event with the given name is present in the EventSet.

Returns:
true if an Event named name was found, or false if the Event was not found

Referenced by addEvent().

bool CEGUI::EventSet::isMuted ( void   )  const

Return whether the EventSet is muted or not.

Returns:
  • true if the EventSet is muted. All requests to fire events will be ignored.
  • false if the EventSet is not muted. All requests to fire events are processed as normal.

References d_muted.

Referenced by CEGUI::Spinner::onTextInputModeChanged(), and CEGUI::Spinner::onValueChanged().

void CEGUI::EventSet::removeAllEvents ( void   ) 

Remove all Event objects from the EventSet.

Returns:
Nothing

Referenced by ~EventSet().

void CEGUI::EventSet::removeEvent ( const String name  ) 

Removes the Event with the given name. All connections to the event are disconnected.

Parameters:
name String object containing the name of the Event to remove. If no such Event exists, nothing happens.
Returns:
Nothing.

void CEGUI::EventSet::setMutedState ( bool  setting  ) 

Set the mute state for this EventSet.

Parameters:
setting 
  • true if the EventSet is to be muted (no further event firing requests will be honoured until EventSet is unmuted).
  • false if the EventSet is not to be muted and all events should fired as requested.
Returns:
Nothing.

References d_muted.

Referenced by CEGUI::Spinner::onTextInputModeChanged(), and CEGUI::Spinner::onValueChanged().

Event::Connection CEGUI::EventSet::subscribeEvent ( const String name,
Event::Group  group,
Event::Subscriber  subscriber 
) [virtual]

Subscribes a handler to the specified group of the named Event. If the named Event is not yet present in the EventSet, it is created and added.

Parameters:
name String object containing the name of the Event to subscribe to.
group Group which is to be subscribed to. Subscription groups are called in ascending order.
subscriber Function or object that is to be subscribed to the Event.
Returns:
Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

References getEventObject(), and CEGUI::Event::subscribe().

Event::Connection CEGUI::EventSet::subscribeEvent ( const String name,
Event::Subscriber  subscriber 
) [virtual]

Event::Connection CEGUI::EventSet::subscribeScriptedEvent ( const String name,
Event::Group  group,
const String subscriber_name 
) [virtual]

Subscribes the specified group of the named Event to a scripted funtion.

Parameters:
name String object containing the name of the Event to subscribe to.
group Group which is to be subscribed to. Subscription groups are called in ascending order.
subscriber_name String object containing the name of the script funtion that is to be subscribed to the Event.
Returns:
Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

References CEGUI::System::getScriptingModule(), CEGUI::System::getSingletonPtr(), and CEGUI::ScriptModule::subscribeEvent().

Event::Connection CEGUI::EventSet::subscribeScriptedEvent ( const String name,
const String subscriber_name 
) [virtual]

Subscribes the named Event to a scripted funtion.

Parameters:
name String object containing the name of the Event to subscribe to.
subscriber_name String object containing the name of the script funtion that is to be subscribed to the Event.
Returns:
Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.

References CEGUI::System::getScriptingModule(), CEGUI::System::getSingletonPtr(), and CEGUI::ScriptModule::subscribeEvent().


Generated on Thu Nov 27 20:34:27 2008 for Crazy Eddies GUI System by  doxygen 1.5.7.1