|
TGUI 1.x-dev
|
Classes | |
| struct | SignalTuple |
| struct | ConnectedSignalTuple |
Public Types | |
| using | Ptr = std::shared_ptr<SignalManager> |
| Shared widget pointer. | |
| using | ConstPtr = std::shared_ptr<const SignalManager> |
| Shared constant widget pointer. | |
| using | Delegate = std::function<void()> |
| using | DelegateEx = std::function<void(std::shared_ptr<Widget>, const String&)> |
| using | Weak = std::weak_ptr<Widget> |
| using | SignalID = unsigned int |
Public Member Functions | |
| SignalManager ()=default | |
| Default constructor. | |
| virtual | ~SignalManager ()=default |
| Destructor. | |
| template<typename Func, typename... BoundArgs> | |
| unsigned int | connect (String widgetName, String signalName, Func &&handler, const BoundArgs &... args) |
| Connects a signal handler that will be called when this signal is emitted. | |
| virtual bool | disconnect (unsigned int id) |
| Disconnect a signal handler. | |
| virtual void | disconnectAll () |
| Disconnect all signal handler. | |
| virtual void | add (const Widget::Ptr &widgetPtr) |
| virtual void | remove (Widget *widget) |
Static Public Member Functions | |
| static void | setDefaultSignalManager (const SignalManager::Ptr &manager) |
| Sets Signal Manager that will be used to operate a signal. | |
| static SignalManager::Ptr | getSignalManager () |
| Retrieves Signal Manager that will be used to operate a signal. | |
Protected Member Functions | |
| virtual void | connect (SignalID id) |
| Function that is called each time new signal is created with it id. | |
Static Protected Member Functions | |
| static std::pair< Delegate, DelegateEx > | makeSignal (const Delegate &handle) |
| static std::pair< Delegate, DelegateEx > | makeSignalEx (const DelegateEx &handle) |
Protected Attributes | |
| std::vector< Weak > | m_widgets |
| std::unordered_map< SignalID, SignalTuple > | m_signals |
| std::vector< ConnectedSignalTuple > | m_connectedSignals |
Static Protected Attributes | |
| static SignalManager::Ptr | m_manager |
|
protectedvirtual |
Function that is called each time new signal is created with it id.
| id | Id of new signal |
| unsigned int tgui::SignalManager::connect | ( | String | widgetName, |
| String | signalName, | ||
| Func && | handler, | ||
| const BoundArgs &... | args ) |
Connects a signal handler that will be called when this signal is emitted.
| widgetName | Name of the widget to connect to |
| signalName | Name of the signal |
| handler | Callback function that is given the extra arguments provided to this function as arguments |
| args | Optional extra arguments to pass to the signal handler when the signal is emitted |
|
virtual |
Disconnect a signal handler.
| id | Unique id of the connection returned by the connect function |
|
staticnodiscard |
|
static |
Sets Signal Manager that will be used to operate a signal.
| manager | Manager that will be used to operate ours signals connected by loadWidgetsFromFile |