template class hiro::gui::TElement
Overview
A general element containing basic interface methods. More…
#include <GuiTypes.h> template <typename C> class TElement: public hiro::gui::Element { public: // methods C* SetConditionFunc(std::function<bool(void)> condition_func); C* SetConditionBool(bool* var, hiro::BoolFunc func = hiro::BoolFunc::equals_true); C* Subscribe(std::function<void(const C*)> callback_func); protected: // methods virtual void NotifyChange() const; };
Inherited Members
public: // methods bool TestCondition() const; uint32_t GetId() const; protected: // methods void SetConditionFuncImpl(std::function<bool(void)> condition_func);
Detailed Documentation
A general element containing basic interface methods.
Methods
C* SetConditionFunc(std::function<bool(void)> condition_func)
Set a visibility condition to this element.
The element will be visible only when specified condition function returns true. The condition function is called automatically on a GUI refresh.
C* SetConditionBool(bool* var, hiro::BoolFunc func = hiro::BoolFunc::equals_true)
Set a visibility condition to this element.
The element will be visible only when specified boolean variable passes the test. The condition variable is checked automatically on a GUI refresh.
Parameters:
var |
Pointer to a boolean variable that will be tested. |
func |
A function used to test the variable against. If the variable passes the function, the condition is satisfied. |
C* Subscribe(std::function<void(const C*)> callback_func)
Add a callback function to the subscriber list.
Every function in the subscriber list is called every time an element state changes.