Guiliani  Version 2.4 revision 5970 (build 3)
CGUIObserver Class Reference

Observer Base class for Observer-Design-Pattern within Guiliani. More...

#include <GUIObserver.h>

Inheritance diagram for CGUIObserver:

Public Member Functions

 CGUIObserver ()
 Default constructor.
 
virtual ~CGUIObserver ()
 Default destructor. Notifies all subjects of destruction.
 
const eC_TListDoubleLinked< CGUISubject * > & GetSubjectList () const
 
virtual void OnNotification ()
 Called by CGUISubject whenever an observed object triggers an update.
 
virtual void OnNotification (const eC_String &kMessage)
 
virtual void OnNotification (const CGUIObject *const pkUpdatedObject)
 
virtual void OnNotification (const CGUIValue &kObservedValue, const CGUIObject *const pkUpdatedObject, const eC_UInt uiX=0, const eC_UInt uiY=0)
 
void SetAutoDelete (const eC_Bool bAutoDelete)
 

Protected Member Functions

virtual void AddSubject (CGUISubject *pSubjectToAdd)
 
virtual void RemoveSubject (CGUISubject *pSubjectToRemove)
 

Friends

class CGUISubject
 

Detailed Description

Observer Base class for Observer-Design-Pattern within Guiliani.

Use this base class if you wish to follow the observer-design-pattern within your application. Simply derive the class that you want to act as an observer from CGUIObserver, and implement the desired functionality within OnNotification(). This method will be called whenever an observed subject changes.

Member Function Documentation

◆ AddSubject()

void CGUIObserver::AddSubject ( CGUISubject pSubjectToAdd)
protectedvirtual

Called by the subject when the Observer is added. ATTENTION: Call base implementation when deriving from this method.

Parameters
pSubjectToAddThe Subject that shall be added to the internal list.

Called by the subject when the Observer is added.

Parameters
pSubjectToAddThe Subject that shall be added to the internal list.

◆ GetSubjectList()

const eC_TListDoubleLinked<CGUISubject*>& CGUIObserver::GetSubjectList ( ) const
inline
Returns
The list of all subjects to which this observer is registered

◆ OnNotification() [1/3]

virtual void CGUIObserver::OnNotification ( const eC_String &  kMessage)
inlinevirtual

Called by CGUISubject whenever an observed object triggers an update.

Parameters
kMessageThe updated string value.

◆ OnNotification() [2/3]

virtual void CGUIObserver::OnNotification ( const CGUIObject *const  pkUpdatedObject)
inlinevirtual

Called by a subject whenever the observed object triggers update.

Parameters
pkUpdatedObjectThe observed object (can be NULL)

◆ OnNotification() [3/3]

virtual void CGUIObserver::OnNotification ( const CGUIValue kObservedValue,
const CGUIObject *const  pkUpdatedObject,
const eC_UInt  uiX = 0,
const eC_UInt  uiY = 0 
)
inlinevirtual

Called by a subject whenever the observed value changes.

Parameters
kObservedValueThe updated observed value.
pkUpdatedObjectThe observed object (can be NULL)
uiXX-Index Additional X-Index in case the updated value is part of a multidimensional array
uiYY-Index Additional Y-Index in case the updated value is part of a multidimensional array

Reimplemented in CGUIComboBox, CGUIViewItemTreeElement, CDataPoolEntry, CGUIScrollBar, and CGUIViewItem.

◆ RemoveSubject()

void CGUIObserver::RemoveSubject ( CGUISubject pSubjectToRemove)
protectedvirtual

Called on destruction of the subject to reset the internal Subject pointer. ATTENTION: Call base implementation when deriving from this method.

Parameters
pSubjectToRemoveThe Subject that shall be removed from the internal list.

Called on destruction of the subject to reset the internal Subject pointer.

Parameters
pSubjectToRemoveThe Subject that shall be removed from the internal list.

◆ SetAutoDelete()

void CGUIObserver::SetAutoDelete ( const eC_Bool  bAutoDelete)
inline

Specifies if this observer will automatically delete itself when the number of observed subjects reaches zero.

Parameters
bAutoDeleteIf True, this observer will delete itself when RemoveSubject() is called for the last observed subject.

Friends And Related Function Documentation

◆ CGUISubject

friend class CGUISubject
friend

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