Sleeping Wombat GUI  0.100
swGUI
Public Member Functions | Private Attributes | List of all members
sw::gui::DelegatesContainerBase Class Referenceabstract

Base class for delegates containers. More...

#include <DelegateContainer.h>

Inheritance diagram for sw::gui::DelegatesContainerBase:
sw::gui::DelegatesContainer< EventArgType >

Public Member Functions

 DelegatesContainerBase (EventType eventID)
 
virtual ~DelegatesContainerBase ()=default
 
EventType GetEventType ()
 Call this function to check event type holded by derived class. More...
 
DelegatesContainerBaseGetNextContainer ()
 Gets next element on linked list. More...
 
void AddContainer (DelegatesContainerBaseOPtr &&container)
 Adds container on the end of list. More...
 
void RemoveNext ()
 Removed element following this object. More...
 
DelegatesContainerBaseOPtr StealRestOfList ()
 Steal list following this. More...
 
virtual void CallDelegates (UIElement *sender, IEventArgs *arguments)=0
 Invokes delegates functions. More...
 

Private Attributes

DelegatesContainerBaseOPtr m_next
 Intrusive list. More...
 
EventType m_eventType
 Type of event used to distinguish between Delegates Containers. More...
 

Detailed Description

Base class for delegates containers.

Purpose of this class is to provide interface for storing delegates of different types in one list. Derived classes are templates that can hold typed delegates. Note that each derived class can correspond to multiple events, because different event can be sent with the same structure that holds parameters.

Thats why there's m_eventType field. While looking for appropriate container EventManager will check this field to compare it with sent event type.

This class is designed to minimize memory footprint in Control classes. That's why I use intrusive list to store consecutive containers. Since there're only few delegates used at the same time, there's no sense to expose DelegatesContainer for each event.

This class owns next delegates container and is responsible for releasing memory.

Todo:
Consider extracting intrusive list as separate class.

Constructor & Destructor Documentation

sw::gui::DelegatesContainerBase::DelegatesContainerBase ( EventType  eventID)
inlineexplicit
virtual sw::gui::DelegatesContainerBase::~DelegatesContainerBase ( )
virtualdefault

Member Function Documentation

void sw::gui::DelegatesContainerBase::AddContainer ( DelegatesContainerBaseOPtr &&  container)
inline

Adds container on the end of list.

virtual void sw::gui::DelegatesContainerBase::CallDelegates ( UIElement sender,
IEventArgs arguments 
)
pure virtual

Invokes delegates functions.

Implemented in sw::gui::DelegatesContainer< EventArgType >.

EventType sw::gui::DelegatesContainerBase::GetEventType ( )
inline

Call this function to check event type holded by derived class.

DelegatesContainerBase* sw::gui::DelegatesContainerBase::GetNextContainer ( )
inline

Gets next element on linked list.

void sw::gui::DelegatesContainerBase::RemoveNext ( )
inline

Removed element following this object.

DelegatesContainerBaseOPtr sw::gui::DelegatesContainerBase::StealRestOfList ( )
inline

Steal list following this.

Member Data Documentation

EventType sw::gui::DelegatesContainerBase::m_eventType
private

Type of event used to distinguish between Delegates Containers.

DelegatesContainerBaseOPtr sw::gui::DelegatesContainerBase::m_next
private

Intrusive list.


The documentation for this class was generated from the following file: