26 #define YUILogComponent "ui"
29 #include "YUISymbols.h"
30 #include "YComboBox.h"
31 #include "YUIException.h"
37 : editable( editable )
38 , inputMaxLength( -1 )
42 std::string validChars;
54 YUI_CHECK_NEW( priv );
66 return priv->editable;
72 return priv->validChars;
78 priv->validChars= newValidChars;
84 return priv->inputMaxLength;
90 priv->inputMaxLength = len;
138 std::string currentText =
text();
165 selectedItems.push_back( item );
186 propSet.
add(
YProperty( YUIProperty_Value, YOtherProperty ) );
187 propSet.
add(
YProperty( YUIProperty_Items, YOtherProperty ) );
188 propSet.
add(
YProperty( YUIProperty_Label, YStringProperty ) );
189 propSet.
add(
YProperty( YUIProperty_ValidChars, YStringProperty ) );
190 propSet.
add(
YProperty( YUIProperty_InputMaxLength, YIntegerProperty ) );
191 propSet.
add(
YProperty( YUIProperty_IconPath, YStringProperty ) );
204 if ( propertyName == YUIProperty_Value )
return false;
205 else if ( propertyName == YUIProperty_Items )
return false;
208 else if ( propertyName == YUIProperty_InputMaxLength )
setInputMaxLength( val.integerVal() );
224 if ( propertyName == YUIProperty_Value )
return YPropertyValue( YOtherProperty );
225 else if ( propertyName == YUIProperty_Items )
return YPropertyValue( YOtherProperty );
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
bool editable() const
Return 'true' if this ComboBox is editable, i.e.
Transport class for the value of simple properties.
std::vector< YItem * > YItemCollection
Collection of pointers to YItem.
void check(const std::string &propertyName) const
Check if a property 'propertyName' exists in this property set.
int inputMaxLength() const
The maximum input length, i.e., the maximum number of characters the user can enter.
void add(const YProperty &prop)
Add a property to this property set.
virtual void setInputMaxLength(int numberOfChars)
Set the maximum input length, i.e., the maximum number of characters the user can enter...
A set of properties to check names and types against.
void setValue(const std::string &newText)
Set the value of this ComboBox by string: Try to find a list item with that label and select it...
std::string validChars()
Get the valid input characters.
YComboBox(YWidget *parent, const std::string &label, bool editable)
Constructor.
std::string stringVal() const
Methods to get the value of this property.
void setSelected(bool sel=true)
Select or unselect this item.
virtual void selectItem(YItem *item, bool selected=true)
Select or deselect an item.
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
bool isEmpty() const
Returns 'true' if this property set does not contain anything.
virtual std::string text()=0
Return this ComboBox's current value as text.
Class for widget properties.
Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc.
virtual ~YComboBox()
Destructor.
virtual YItem * selectedItem()
Return the (first) selected item or 0 if none is selected or if this ComboBox is editable and the use...
std::string value()
Return the value of this ComboBox:
YPropertyType type() const
Returns the type of this property value.
virtual void setText(const std::string &newText)=0
Set this ComboBox's current value as text.
virtual YItemCollection selectedItems()
Return all selected items.
Base class for UI Exceptions.
std::string label() const
Return this item's label.
virtual const YPropertySet & propertySet()
Return this class's property set.
virtual void setValidChars(const std::string &validChars)
Set the valid input characters.