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 );
YComboBox(YWidget *parent, const std::string &label, bool editable)
Constructor.
std::string label() const
Return this item's label.
void add(const YProperty &prop)
Add a property to this property set.
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::vector< YItem * > YItemCollection
Collection of pointers to YItem.
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
bool editable() const
Return 'true' if this ComboBox is editable, i.e.
std::string validChars()
Get the valid input characters.
A set of properties to check names and types against.
virtual ~YComboBox()
Destructor.
virtual YItemCollection selectedItems()
Return all selected items.
bool isEmpty() const
Returns 'true' if this property set does not contain anything.
std::string stringVal() const
Methods to get the value of this property.
virtual void setText(const std::string &newText)=0
Set this ComboBox's current value as text.
YPropertyType type() const
Returns the type of this property value.
Class for widget properties.
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
void setSelected(bool sel=true)
Select or unselect this item.
virtual void selectItem(YItem *item, bool selected=true)
Select or deselect an item.
int inputMaxLength() const
The maximum input length, i.e., the maximum number of characters the user can enter.
virtual std::string text()=0
Return this ComboBox's current value as text.
void check(const std::string &propertyName) const
Check if a property 'propertyName' exists in this property set.
Transport class for the value of simple properties.
std::string value()
Return the value of this ComboBox:
virtual YItem * selectedItem()
Return the (first) selected item or 0 if none is selected or if this ComboBox is editable and the use...
virtual const YPropertySet & propertySet()
Return this class's property set.
virtual void setInputMaxLength(int numberOfChars)
Set the maximum input length, i.e., the maximum number of characters the user can enter.
Base class for UI Exceptions.
virtual void setValidChars(const std::string &validChars)
Set the valid input characters.
Simple item class for SelectionBox, ComboBox, MultiSelectionBox etc.