Public Member Functions | Protected Member Functions

BooleanPropertyComponent Class Reference

A PropertyComponent that contains an on/off toggle button. More...

Inherits PropertyComponent.

List of all members.

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.

Detailed Description

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.

See also:
PropertyComponent

Constructor & Destructor Documentation

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.

Parameters:
propertyNamethe property name to be passed to the PropertyComponent
buttonTextWhenTruethe text shown in the button when the value is true
buttonTextWhenFalsethe 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.

Parameters:
valueToControla Value object that this property should refer to.
propertyNamethe property name to be passed to the PropertyComponent
buttonTextthe text shown in the ToggleButton component
BooleanPropertyComponent::~BooleanPropertyComponent (  )

Destructor.


Member Function Documentation

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.

See also:
LookAndFeel::drawPropertyComponentBackground(), LookAndFeel::drawPropertyComponentLabel()

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  )

The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines