26 #define YUILogComponent "ui"
29 #include "YIntField.h"
40 , minValue( minValue )
41 , maxValue( maxValue )
59 YUI_CHECK_NEW( priv );
78 if ( val > priv->maxValue )
88 return priv->minValue;
97 int oldValue =
value();
100 if ( oldValue != newValue )
108 return priv->maxValue;
115 priv->maxValue = val;
117 int oldValue =
value();
120 if ( oldValue != newValue )
153 propSet.
add(
YProperty( YUIProperty_Value, YIntegerProperty ) );
154 propSet.
add(
YProperty( YUIProperty_MinValue, YIntegerProperty ) );
155 propSet.
add(
YProperty( YUIProperty_MaxValue, YIntegerProperty ) );
156 propSet.
add(
YProperty( YUIProperty_Label, YStringProperty ) );
169 if ( propertyName == YUIProperty_Value )
setValue ( val.integerVal() );
170 else if ( propertyName == YUIProperty_MinValue )
setMinValue( val.integerVal() );
171 else if ( propertyName == YUIProperty_MaxValue )
setMaxValue( val.integerVal() );
virtual void setLabel(const std::string &label)
Set the label (the caption above the input field).
void setMinValue(int val)
Set a new minimum value.
int maxValue() const
Return the maximum value.
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Set a property.
int enforceRange(int val) const
Enforce 'val' to be between minValue and maxValue.
YIntField(YWidget *parent, const std::string &label, int minValue, int maxValue)
Constructor.
virtual YPropertyValue getProperty(const std::string &propertyName)
Get a property.
virtual const YPropertySet & propertySet()
Return this class's property set.
void setValue(int val)
Set the current value (the number entered by the user or set from the outside) of this IntField.
int minValue() const
Return the minimum value.
std::string label() const
Get the label (the caption above the input field).
virtual int value()=0
Get the current value (the number entered by the user or set from the outside) of this IntField.
void setMaxValue(int val)
Set a new maximum value.
virtual ~YIntField()
Destructor.
A set of properties to check names and types against.
void check(const std::string &propertyName) const
Check if a property 'propertyName' exists in this property set.
bool isEmpty() const
Returns 'true' if this property set does not contain anything.
void add(const YProperty &prop)
Add a property to this property set.
Transport class for the value of simple properties.
std::string stringVal() const
Methods to get the value of this property.
YPropertyType type() const
Returns the type of this property value.
Class for widget properties.