Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb::TBWidgetListener Class Reference

TBWidgetListener listens to some callbacks from TBWidget. More...

#include <tb_widgets_listener.h>

Inheritance diagram for tb::TBWidgetListener:
tb::TBLinkOf< TBWidgetListener > tb::TBWidgetListenerGlobalLink tb::TBLink tb::TBLinkOf< TBWidgetListenerGlobalLink > tb::TBLink tb::TBMessageWindow tb::TBPopupWindow tb::TBSimpleLayoutItemWidget tb::TBWidgetSafePointer tb::TBWidgetsAnimationManager tb::TBMenuWindow

Public Member Functions

virtual void OnWidgetDelete (TBWidget *)
 Called when widget is being deleted (in its destructor, so virtual functions are already gone). More...
 
virtual bool OnWidgetDying (TBWidget *)
 This is called when the widget request to be deleted. More...
 
virtual void OnWidgetAdded (TBWidget *, TBWidget *)
 Called when the child has been added to parent, after its parents OnChildAdded. More...
 
virtual void OnWidgetRemove (TBWidget *, TBWidget *)
 Called when the child is about to be removed from parent, after its parents OnChildRemove. More...
 
virtual void OnWidgetFocusChanged (TBWidget *, bool)
 Called when widget focus has changed on a widget. More...
 
virtual bool OnWidgetInvokeEvent (TBWidget *, const TBWidgetEvent &)
 Called when a event is about to be invoked on a widget. More...
 

Static Public Member Functions

static void AddGlobalListener (TBWidgetListener *listener)
 Add a listener to all widgets. More...
 
static void RemoveGlobalListener (TBWidgetListener *listener)
 

Friends

class TBWidget
 

Additional Inherited Members

Detailed Description

TBWidgetListener listens to some callbacks from TBWidget.

It may either listen to all widgets globally, or one specific widget.

Local listeners (added with TBWidget:AddListener) will be invoked before global listeners (added with TBWidgetListener::AddGlobalListener).

Member Function Documentation

void tb::TBWidgetListener::AddGlobalListener ( TBWidgetListener listener)
static

Add a listener to all widgets.

virtual void tb::TBWidgetListener::OnWidgetAdded ( TBWidget ,
TBWidget  
)
inlinevirtual

Called when the child has been added to parent, after its parents OnChildAdded.

Local listeners are invoked on the parent widget.

virtual void tb::TBWidgetListener::OnWidgetDelete ( TBWidget )
inlinevirtual

Called when widget is being deleted (in its destructor, so virtual functions are already gone).

virtual bool tb::TBWidgetListener::OnWidgetDying ( TBWidget )
inlinevirtual

This is called when the widget request to be deleted.

Return true if you want the widget to not die immediately, f.ex. to fade it out before it is deleted. If you return true, it's up to you to finally remove it from its parent delete it.

Remember that the widget may still be deleted prematurely for many other reasons (f.ex if its parent is deleted or several listeners respond true and take on the task to delete it at some point). You can use TBWidgetSafePointer to safely handle that.

virtual void tb::TBWidgetListener::OnWidgetFocusChanged ( TBWidget ,
bool   
)
inlinevirtual

Called when widget focus has changed on a widget.

virtual bool tb::TBWidgetListener::OnWidgetInvokeEvent ( TBWidget ,
const TBWidgetEvent  
)
inlinevirtual

Called when a event is about to be invoked on a widget.

This make it possible to intercept events before they are handled, and block it (by returning true). Note, if returning true, other global listeners will still also be notified.

virtual void tb::TBWidgetListener::OnWidgetRemove ( TBWidget ,
TBWidget  
)
inlinevirtual

Called when the child is about to be removed from parent, after its parents OnChildRemove.

Local listeners are invoked on the parent widget.


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