26 #define YUILogComponent "ui"
29 #include "YIntField.h"
38 , minValue( minValue )
39 , maxValue( maxValue )
51 const std::string & label,
57 YUI_CHECK_NEW( priv );
76 if ( val > priv->maxValue )
86 return priv->minValue;
95 int oldValue =
value();
98 if ( oldValue != newValue )
106 return priv->maxValue;
113 priv->maxValue = val;
115 int oldValue =
value();
118 if ( oldValue != newValue )
151 propSet.
add(
YProperty( YUIProperty_Value, YIntegerProperty ) );
152 propSet.
add(
YProperty( YUIProperty_MinValue, YIntegerProperty ) );
153 propSet.
add(
YProperty( YUIProperty_MaxValue, YIntegerProperty ) );
154 propSet.
add(
YProperty( YUIProperty_Label, YStringProperty ) );
167 if ( propertyName == YUIProperty_Value )
setValue ( val.integerVal() );
168 else if ( propertyName == YUIProperty_MinValue )
setMinValue( val.integerVal() );
169 else if ( propertyName == YUIProperty_MaxValue )
setMaxValue( val.integerVal() );
void add(const YProperty &prop)
Add a property to this property set.
virtual const YPropertySet & propertySet()
Return this class's property set.
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
void setMaxValue(int val)
Set a new maximum value.
A set of properties to check names and types against.
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.
std::string label() const
Get the label (the caption above the input field).
YPropertyType type() const
Returns the type of this property value.
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
YIntField(YWidget *parent, const std::string &label, int minValue, int maxValue)
Constructor.
Class for widget properties.
virtual ~YIntField()
Destructor.
int maxValue() const
Return the maximum value.
int minValue() const
Return the minimum value.
void check(const std::string &propertyName) const
Check if a property 'propertyName' exists in this property set.
void setMinValue(int val)
Set a new minimum value.
Transport class for the value of simple properties.
void setValue(int val)
Set the current value (the number entered by the user or set from the outside) of this IntField.
virtual void setLabel(const std::string &label)
Set the label (the caption above the input field).
int enforceRange(int val) const
Enforce 'val' to be between minValue and maxValue.
virtual int value()=0
Get the current value (the number entered by the user or set from the outside) of this IntField.