Signal to which the user can subscribe to get callbacks from.
More...
#include <TGUI/Signal.hpp>
|
| | Signal (std::string &&name, std::size_t extraParameters=0) |
| | Constructor. More...
|
| |
|
| Signal (const Signal &other) |
| | Copy constructor which will not copy the signal handlers.
|
| |
|
| Signal (Signal &&other) noexcept=default |
| | Default move constructor.
|
| |
|
Signal & | operator= (const Signal &other) |
| | Copy assignment operator which will not copy the signal handlers.
|
| |
|
Signal & | operator= (Signal &&other) noexcept=default |
| | Default move assignment operator.
|
| |
| unsigned int | connect (const Delegate &handler) |
| | Connects a signal handler that will be called when this signal is emitted. More...
|
| |
| unsigned int | connect (const DelegateEx &handler) |
| | Connects a signal handler that will be called when this signal is emitted. More...
|
| |
| bool | disconnect (unsigned int id) |
| | Disconnect a signal handler from this signal. More...
|
| |
|
void | disconnectAll () |
| | Disconnect all signal handler from this signal.
|
| |
| bool | emit (const Widget *widget) |
| | Call all connected signal handlers. More...
|
| |
| std::string | getName () const |
| | Returns the name given to the signal. More...
|
| |
| void | setEnabled (bool enabled) |
| | Changes whether this signal calls the connected functions when triggered. More...
|
| |
| bool | isEnabled () const |
| | Returns whether this signal calls the connected functions when triggered. More...
|
| |
Signal to which the user can subscribe to get callbacks from.
◆ Signal()
| tgui::Signal::Signal |
( |
std::string && |
name, |
|
|
std::size_t |
extraParameters = 0 |
|
) |
| |
|
inline |
Constructor.
- Parameters
-
| name | Name of the signal |
| extraParameters | Amount of extra parameters to reserve space for |
◆ connect() [1/2]
| unsigned int tgui::Signal::connect |
( |
const Delegate & |
handler | ) |
|
Connects a signal handler that will be called when this signal is emitted.
- Parameters
-
- Returns
- Unique id of the connection
◆ connect() [2/2]
| unsigned int tgui::Signal::connect |
( |
const DelegateEx & |
handler | ) |
|
Connects a signal handler that will be called when this signal is emitted.
- Parameters
-
| handler | Callback function that is given a pointer to the widget and the name of the signal as arguments |
- Returns
- Unique id of the connection
◆ disconnect()
| bool tgui::Signal::disconnect |
( |
unsigned int |
id | ) |
|
Disconnect a signal handler from this signal.
- Parameters
-
| id | Unique id of the connection returned by the connect function |
- Returns
- True when a connection with this id existed and was removed
◆ emit()
| bool tgui::Signal::emit |
( |
const Widget * |
widget | ) |
|
|
inline |
Call all connected signal handlers.
- Parameters
-
| widget | The sender of the signal |
- Returns
- True when at least one signal handler was called
◆ getName()
| std::string tgui::Signal::getName |
( |
| ) |
const |
|
inline |
Returns the name given to the signal.
- Returns
- signal name
◆ isEnabled()
| bool tgui::Signal::isEnabled |
( |
| ) |
const |
|
inline |
Returns whether this signal calls the connected functions when triggered.
- Returns
- Is the signal enabled?
Signals are enabled by default. Temporarily disabling the signal is the better alternative to disconnecting the handler and connecting it again a few lines later.
◆ setEnabled()
| void tgui::Signal::setEnabled |
( |
bool |
enabled | ) |
|
|
inline |
Changes whether this signal calls the connected functions when triggered.
- Parameters
-
| enabled | Is the signal enabled? |
Signals are enabled by default. Temporarily disabling the signal is the better alternative to disconnecting the handler and connecting it again a few lines later.
The documentation for this class was generated from the following file: