26 #define YUILogComponent "ui" 29 #include "YUISymbols.h" 30 #include "YComboBox.h" 31 #include "YUIException.h" 39 : editable( editable )
40 , inputMaxLength( -1 )
56 YUI_CHECK_NEW( priv );
68 return priv->editable;
74 return priv->validChars;
80 priv->validChars= newValidChars;
86 return priv->inputMaxLength;
92 priv->inputMaxLength = len;
140 string currentText =
text();
188 propSet.
add(
YProperty( YUIProperty_Value, YOtherProperty ) );
189 propSet.
add(
YProperty( YUIProperty_Items, YOtherProperty ) );
190 propSet.
add(
YProperty( YUIProperty_Label, YStringProperty ) );
191 propSet.
add(
YProperty( YUIProperty_ValidChars, YStringProperty ) );
192 propSet.
add(
YProperty( YUIProperty_InputMaxLength, YIntegerProperty ) );
193 propSet.
add(
YProperty( YUIProperty_IconPath, YStringProperty ) );
206 if ( propertyName == YUIProperty_Value )
return false;
207 else if ( propertyName == YUIProperty_Items )
return false;
210 else if ( propertyName == YUIProperty_InputMaxLength )
setInputMaxLength( val.integerVal() );
226 if ( propertyName == YUIProperty_Value )
return YPropertyValue( YOtherProperty );
227 else if ( propertyName == YUIProperty_Items )
return YPropertyValue( YOtherProperty );
std::string label() const
Return this item's label.
bool isEmpty() const
Returns 'true' if this property set does not contain anything.
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 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...
YComboBox(YWidget *parent, const std::string &label, bool editable)
Constructor.
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.
std::string stringVal() const
Methods to get the value of this property.
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.
std::string validChars()
Get the valid input characters.
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...
int inputMaxLength() const
The maximum input length, i.e., the maximum number of characters the user can enter.
void check(const std::string &propertyName) const
Check if a property 'propertyName' exists in this property set.
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 value()
Return the value of this ComboBox:
YPropertyType type() const
Returns the type of this property value.
virtual const YPropertySet & propertySet()
Return this class's property set.
virtual void setValidChars(const std::string &validChars)
Set the valid input characters.