TGUI  v0.6.10
Public Member Functions | List of all members
tgui::CallbackManager Class Reference
Inheritance diagram for tgui::CallbackManager:
tgui::Widget tgui::ChatBox tgui::ClickableWidget tgui::ComboBox tgui::Container tgui::Knob tgui::ListBox tgui::MenuBar tgui::Scrollbar tgui::Slider tgui::Tab tgui::TextBox

Public Member Functions

void bindCallback (std::function< void()> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallback (void(T::*func)(), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallbackEx (std::function< void(const Callback &)> func, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
template<typename T >
void bindCallbackEx (void(T::*func)(const Callback &), T *const classPtr, unsigned int trigger)
 Bind a function to one or more specific callback trigger(s). More...
 
void bindCallback (unsigned int trigger)
 Bind one or more specific callback trigger(s) to the parent widget. More...
 
void unbindCallback (unsigned int trigger)
 Unbind all callback function bound to the given trigger. More...
 
void unbindAllCallback ()
 Unbind all callback functions bound to any callback. More...
 

Member Function Documentation

void tgui::CallbackManager::bindCallback ( std::function< void()>  func,
unsigned int  trigger 
)

Bind a function to one or more specific callback trigger(s).

Parameters
funcFree function without parameters. This can actually also take more advanced stuff like a functor or lambda function.
triggerIn which situation(s) do you want the callback function to be called?

Usage example:

void function() {}
widget->bindCallback(function, tgui::Widget::Focus);
template<typename T >
void tgui::CallbackManager::bindCallback ( void(T::*)()  func,
T *const  classPtr,
unsigned int  trigger 
)
inline

Bind a function to one or more specific callback trigger(s).

Parameters
funcMember function without parameters.
classPtrPointer to the widget of the class.
triggerIn which situation(s) do you want the callback function to be called?

Usage example:

class myClass {
void function() {};
} myObj;
widget->bindCallback(&myClass::function, &myObj, tgui::Widget::Focus);
void tgui::CallbackManager::bindCallback ( unsigned int  trigger)

Bind one or more specific callback trigger(s) to the parent widget.

Parameters
triggerIn which situation(s) do you want the widget to alert its parent about a callback?

The widget will tell its parent about the callback and you will receive the callback through the parent widget. If the callback reaches the window, then you will later have to poll the callbacks from this window.

Usage example:

widget->bindCallback(tgui::Widget::Focus);
void tgui::CallbackManager::bindCallbackEx ( std::function< void(const Callback &)>  func,
unsigned int  trigger 
)

Bind a function to one or more specific callback trigger(s).

Parameters
funcFree function with a constant reference to a Callback widget as parameter.
triggerIn which situation(s) do you want the callback function to be called?

Usage example:

void function(const Callback& callback) {}
widget->bindCallbackEx(function, tgui::Widget::Focus);
template<typename T >
void tgui::CallbackManager::bindCallbackEx ( void(T::*)(const Callback &)  func,
T *const  classPtr,
unsigned int  trigger 
)
inline

Bind a function to one or more specific callback trigger(s).

Parameters
funcMember function with a constant reference to a Callback widget as parameter.
classPtrPointer to the widget of the class.
triggerIn which situation(s) do you want the callback function to be called?

Usage example:

class myClass {
void function(const Callback& callback) {};
} myObj;
widget->bindCallbackEx(&myClass::function, &myObj, tgui::Widget::Focus);
void tgui::CallbackManager::unbindAllCallback ( )

Unbind all callback functions bound to any callback.

After calling this function, the widget will no longer send any callback.

void tgui::CallbackManager::unbindCallback ( unsigned int  trigger)

Unbind all callback function bound to the given trigger.

Parameters
triggerIn which situation(s) do you no longer want to retreive callback?

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