|
RADLib
RADical C++ application framework
|
Push-button state model. More...
#include <RADWidgets.h>
Inheritance diagram for RADUi::ButtonModel:
Collaboration diagram for RADUi::ButtonModel:Public Member Functions | |
| ButtonModel (std::string text={}) | |
| Creates a button model with optional text. More... | |
| const std::string & | text () const |
| Returns button text. More... | |
| void | setText (std::string text) |
| Updates button text. More... | |
| bool | isEnabled () const |
| Returns true when the button can be clicked. More... | |
| void | setEnabled (bool enabled) |
| Enables or disables the button. More... | |
| void | click () |
| Emits clicked when enabled. More... | |
Public Member Functions inherited from RADCore::RADObject | |
| RADObject () | |
| Creates a RADObject bound to the current thread. More... | |
| virtual | ~RADObject () |
| Disconnects tracked event links and releases lifetime token. More... | |
| void | registerLink (const ConnectionRecord &record) |
| Registers a connection for cleanup when this object is destroyed. More... | |
| std::thread::id | threadId () const |
| Returns the thread id this object is currently associated with. More... | |
| EventLoop * | associatedEventLoop () const |
| Returns the associated event loop, if any. More... | |
| ThreadAffinity | threadAffinity () const |
| Returns both thread id and associated loop atomically. More... | |
| std::weak_ptr< void > | lifetimeToken () const |
| Returns a weak token used to drop queued callbacks after destruction. More... | |
| void | moveToThread (std::thread::id tId, EventLoop *loop=nullptr) |
| Moves the object's affinity to tId and optional loop. More... | |
Public Attributes | |
| RADCore::Event< void() > | changed |
| Raised when text or enabled state changes. More... | |
| RADCore::Event< void() > | clicked |
| Raised when click() is called while enabled. More... | |
Push-button state model.
|
explicit |
Creates a button model with optional text.
| void RADUi::ButtonModel::click | ( | ) |
Emits clicked when enabled.
| bool RADUi::ButtonModel::isEnabled | ( | ) | const |
Returns true when the button can be clicked.
| void RADUi::ButtonModel::setEnabled | ( | bool | enabled | ) |
Enables or disables the button.
| void RADUi::ButtonModel::setText | ( | std::string | text | ) |
Updates button text.
| const std::string& RADUi::ButtonModel::text | ( | ) | const |
Returns button text.
| RADCore::Event<void () > RADUi::ButtonModel::changed |
Raised when text or enabled state changes.
| RADCore::Event<void () > RADUi::ButtonModel::clicked |
Raised when click() is called while enabled.