libyui
 
Loading...
Searching...
No Matches
YIntField.h
1/*
2 Copyright (C) 2000-2012 Novell, Inc
3 This library is free software; you can redistribute it and/or modify
4 it under the terms of the GNU Lesser General Public License as
5 published by the Free Software Foundation; either version 2.1 of the
6 License, or (at your option) version 3.0 of the License. This library
7 is distributed in the hope that it will be useful, but WITHOUT ANY
8 WARRANTY; without even the implied warranty of MERCHANTABILITY or
9 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
10 License for more details. You should have received a copy of the GNU
11 Lesser General Public License along with this library; if not, write
12 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
13 Floor, Boston, MA 02110-1301 USA
14*/
15
16
17/*-/
18
19 File: YIntField.h
20
21 Author: Stefan Hundhammer <shundhammer@suse.de>
22
23/-*/
24
25#ifndef YIntField_h
26#define YIntField_h
27
28#include "YWidget.h"
29
31
32
33
38class YIntField : public YWidget
39{
40protected:
52 const std::string & label,
53 int minValue,
54 int maxValue );
55
56public:
60 virtual ~YIntField();
61
66 virtual const char * widgetClass() const { return "YIntField"; }
67
74 virtual int value() = 0;
75
81 void setValue( int val ) { setValueInternal( enforceRange( val ) ); }
82
83protected:
84
92 virtual void setValueInternal( int val ) = 0;
93
99 int enforceRange( int val ) const;
100
101public:
102
106 int minValue() const;
107
112 void setMinValue( int val );
113
117 int maxValue() const;
118
123 void setMaxValue( int val );
124
128 std::string label() const;
129
136 virtual void setLabel( const std::string & label );
137
148 virtual bool setProperty( const std::string & propertyName,
149 const YPropertyValue & val );
150
157 virtual YPropertyValue getProperty( const std::string & propertyName );
158
165 virtual const YPropertySet & propertySet();
166
172 virtual std::string shortcutString() const { return label(); }
173
179 virtual void setShortcutString( const std::string & str )
180 { setLabel( str ); }
181
186 const char * userInputProperty() { return YUIProperty_Value; }
187
188
189private:
190
192};
193
194
195#endif // YIntField_h
Definition ImplPtr.h:43
virtual void setLabel(const std::string &label)
Definition YIntField.cc:133
void setMinValue(int val)
Definition YIntField.cc:93
virtual void setValueInternal(int val)=0
int maxValue() const
Definition YIntField.cc:106
virtual bool setProperty(const std::string &propertyName, const YPropertyValue &val)
Definition YIntField.cc:165
int enforceRange(int val) const
Definition YIntField.cc:73
virtual void setShortcutString(const std::string &str)
Definition YIntField.h:179
YIntField(YWidget *parent, const std::string &label, int minValue, int maxValue)
Definition YIntField.cc:52
virtual YPropertyValue getProperty(const std::string &propertyName)
Definition YIntField.cc:183
virtual const YPropertySet & propertySet()
Definition YIntField.cc:141
void setValue(int val)
Definition YIntField.h:81
virtual std::string shortcutString() const
Definition YIntField.h:172
int minValue() const
Definition YIntField.cc:86
std::string label() const
Definition YIntField.cc:126
virtual const char * widgetClass() const
Definition YIntField.h:66
virtual int value()=0
const char * userInputProperty()
Definition YIntField.h:186
void setMaxValue(int val)
Definition YIntField.cc:113
virtual ~YIntField()
Definition YIntField.cc:66
Definition YProperty.h:198
Definition YProperty.h:105
YWidget(YWidget *parent)
Definition YWidget.cc:106
YWidget * parent() const
Definition YWidget.cc:277
Definition YIntField.cc:35