A PropertyComponent that contains an on/off toggle button. More...
Inherits PropertyComponent.
Public Member Functions | |
| BooleanPropertyComponent (const Value &valueToControl, const String &propertyName, const String &buttonText) | |
| Creates a button component. | |
| ~BooleanPropertyComponent () | |
| Destructor. | |
| virtual void | setState (bool newState) |
| Called to change the state of the boolean value. | |
| virtual bool | getState () const |
| Must return the current value of the property. | |
| void | paint (Graphics &g) |
| The default paint method fills the background and draws a label for the item's name. | |
| void | refresh () |
| Updates the property component if the item it refers to has changed. | |
| void | buttonClicked (Button *) |
Protected Member Functions | |
| BooleanPropertyComponent (const String &propertyName, const String &buttonTextWhenTrue, const String &buttonTextWhenFalse) | |
| Creates a button component. | |
A PropertyComponent that contains an on/off toggle button.
This type of property component can be used if you have a boolean value to toggle on/off.
| BooleanPropertyComponent::BooleanPropertyComponent | ( | const String & | propertyName, |
| const String & | buttonTextWhenTrue, | ||
| const String & | buttonTextWhenFalse | ||
| ) | [protected] |
Creates a button component.
If you use this constructor, you must override the getState() and setState() methods.
| propertyName | the property name to be passed to the PropertyComponent |
| buttonTextWhenTrue | the text shown in the button when the value is true |
| buttonTextWhenFalse | the text shown in the button when the value is false |
| BooleanPropertyComponent::BooleanPropertyComponent | ( | const Value & | valueToControl, |
| const String & | propertyName, | ||
| const String & | buttonText | ||
| ) |
Creates a button component.
| valueToControl | a Value object that this property should refer to. |
| propertyName | the property name to be passed to the PropertyComponent |
| buttonText | the text shown in the ToggleButton component |
| BooleanPropertyComponent::~BooleanPropertyComponent | ( | ) |
Destructor.
| virtual void BooleanPropertyComponent::setState | ( | bool | newState ) | [virtual] |
Called to change the state of the boolean value.
| virtual bool BooleanPropertyComponent::getState | ( | ) | const [virtual] |
Must return the current value of the property.
| void BooleanPropertyComponent::paint | ( | Graphics & | g ) | [virtual] |
The default paint method fills the background and draws a label for the item's name.
Reimplemented from PropertyComponent.
| void BooleanPropertyComponent::refresh | ( | ) | [virtual] |
Updates the property component if the item it refers to has changed.
A subclass must implement this method, and other objects may call it to force it to refresh itself.
The subclass should be economical in the amount of work is done, so for example it should check whether it really needs to do a repaint rather than just doing one every time this method is called, as it may be called when the value being displayed hasn't actually changed.
Implements PropertyComponent.
| void BooleanPropertyComponent::buttonClicked | ( | Button * | ) |