Hasty Badger
Small UI library (a branch of Turbo Badger)
 All Classes Namespaces Functions Variables Enumerations Enumerator Friends Groups Pages
tb::TBWidgetValue Class Reference

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 TBValueGetValue () const
 Get the TBValue used to store the value. More...
 
TBID GetName () const
 Get the name id. More...
 

Friends

class TBWidgetValueConnection
 

Detailed Description

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!

Member Function Documentation

double tb::TBWidgetValue::GetDouble ( ) const
inline

Get the value as double.

long tb::TBWidgetValue::GetInt ( ) const
inline

Get value as integer.

TBID tb::TBWidgetValue::GetName ( ) const
inline

Get the name id.

bool tb::TBWidgetValue::GetText ( TBStr text) const
inline

Get value as text.

Return false on fail.

TBStr tb::TBWidgetValue::GetText ( ) const
inline

Get value as text.

const TBValue& tb::TBWidgetValue::GetValue ( ) const
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.

void tb::TBWidgetValue::SetInt ( int  value)
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.


The documentation for this class was generated from the following files: