ChoicePropertyComponent Class Reference

Inheritance diagram for ChoicePropertyComponent:

PropertyComponent ComboBoxListener Component MouseListener MessageListener List of all members.

Detailed Description

A PropertyComponent that shows its value as a combo box.

This type of property component contains a list of options and has a combo box to choose one.

Your subclass's constructor must add some strings to the choices StringArray and these are shown in the list.

The getIndex() method will be called to find out which option is the currently selected one. If you call refresh() it will call getIndex() to check whether the value has changed, and will update the combo box if needed.

If the user selects a different item from the list, setIndex() will be called to let your class process this.

See also:
PropertyComponent, PropertyPanel


Public Member Functions

 ChoicePropertyComponent (const String &propertyName)
 Creates the component.
 ~ChoicePropertyComponent ()
 Destructor.
virtual void setIndex (const int newIndex)=0
 Called when the user selects an item from the combo box.
virtual int getIndex () const =0
 Returns the index of the item that should currently be shown.
const StringArraygetChoices () const throw ()
 Returns the list of options.
void refresh ()
void comboBoxChanged (ComboBox *)

Protected Attributes

StringArray choices
 The list of options that will be shown in the combo box.


Constructor & Destructor Documentation

ChoicePropertyComponent::ChoicePropertyComponent const String propertyName  ) 
 

Creates the component.

Your subclass's constructor must add a list of options to the choices member variable.

ChoicePropertyComponent::~ChoicePropertyComponent  ) 
 

Destructor.


Member Function Documentation

virtual void ChoicePropertyComponent::setIndex const int  newIndex  )  [pure virtual]
 

Called when the user selects an item from the combo box.

Your subclass must use this callback to update the value that this component represents. The index is the index of the chosen item in the choices StringArray.

virtual int ChoicePropertyComponent::getIndex  )  const [pure virtual]
 

Returns the index of the item that should currently be shown.

This is the index of the item in the choices StringArray that will be shown.

const StringArray& ChoicePropertyComponent::getChoices  )  const throw ()
 

Returns the list of options.

void ChoicePropertyComponent::refresh  )  [virtual]
 

For internal use only.

Implements PropertyComponent.

void ChoicePropertyComponent::comboBoxChanged ComboBox  )  [virtual]
 

For internal use only.

Implements ComboBoxListener.


Member Data Documentation

StringArray ChoicePropertyComponent::choices [protected]
 

The list of options that will be shown in the combo box.

Your subclass must populate this array in its constructor. If any empty strings are added, these will be replaced with horizontal separators (see ComboBox::addSeparator() for more info).


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