Hasty Badger
Small UI library (a branch of Turbo Badger)
|
TBWidgetValue stores a TBValue that will be synchronized with all widgets connected to it. More...
#include <tb_widget_value.h>
Public Member Functions | |
TBWidgetValue (const TBID &name, TBValue::TYPE type=TBValue::TYPE_INT) | |
void | SetInt (long value) |
Set integer value and sync to connected widgets. More... | |
void | SetInt (int value) |
Set integer value and sync to connected widgets. More... | |
bool | SetText (const TBStr &text) |
Set text value and sync to connected widgets. More... | |
void | SetDouble (double value) |
Set double value and sync to connected widgets. More... | |
void | SetValue (const TBValue &value) |
Set tb value and sync to connected widgets. More... | |
void | SetFromWidget (TBWidget *source_widget) |
Set the value from the given widget. More... | |
long | GetInt () const |
Get value as integer. More... | |
bool | GetText (TBStr &text) const |
Get value as text. More... | |
TBStr | GetText () const |
Get value as text. More... | |
double | GetDouble () const |
Get the value as double. More... | |
const TBValue & | GetValue () const |
Get the TBValue used to store the value. More... | |
TBID | GetName () const |
Get the name id. More... | |
Friends | |
class | TBWidgetValueConnection |
TBWidgetValue stores a TBValue that will be synchronized with all widgets connected to it.
It has a TBID name, that can be used to identify this value within its TBValueGroup.
It will synchronize with widgets when any of the connected widgets change and trig the EVENT_TYPE_CHANGED event, and when the value is changed with any of the setters here.
The synchronization with widgets is done through the generic TBWidget setters/getters, TBWidget::SetValue/GetValue/SetValueDouble/GetValueDouble/GetText/SetText.
The type that is synchronized is determined by the TBValue::TYPE specified in the constructor.
Note: The type that is synchronized changes if you request it in a different format!
|
inline |
Get the value as double.
|
inline |
Get value as integer.
|
inline |
Get the name id.
|
inline |
Get value as text.
Return false on fail.
|
inline |
Get value as text.
|
inline |
Get the TBValue used to store the value.
void tb::TBWidgetValue::SetDouble | ( | double | value | ) |
Set double value and sync to connected widgets.
void tb::TBWidgetValue::SetFromWidget | ( | TBWidget * | source_widget | ) |
Set the value from the given widget.
Using the current format type.
void tb::TBWidgetValue::SetInt | ( | long | value | ) |
Set integer value and sync to connected widgets.
|
inline |
Set integer value and sync to connected widgets.
bool tb::TBWidgetValue::SetText | ( | const TBStr & | text | ) |
Set text value and sync to connected widgets.
void tb::TBWidgetValue::SetValue | ( | const TBValue & | value | ) |
Set tb value and sync to connected widgets.