libyui
|
00001 /************************************************************************** 00002 Copyright (C) 2000 - 2010 Novell, Inc. 00003 All Rights Reserved. 00004 00005 This program is free software; you can redistribute it and/or modify 00006 it under the terms of the GNU General Public License as published by 00007 the Free Software Foundation; either version 2 of the License, or 00008 (at your option) any later version. 00009 00010 This program is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 GNU General Public License for more details. 00014 00015 You should have received a copy of the GNU General Public License along 00016 with this program; if not, write to the Free Software Foundation, Inc., 00017 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00018 00019 **************************************************************************/ 00020 00021 00022 /*---------------------------------------------------------------------\ 00023 | | 00024 | __ __ ____ _____ ____ | 00025 | \ \ / /_ _/ ___|_ _|___ \ | 00026 | \ V / _` \___ \ | | __) | | 00027 | | | (_| |___) || | / __/ | 00028 | |_|\__,_|____/ |_| |_____| | 00029 | | 00030 | core system | 00031 | (C) SuSE GmbH | 00032 \----------------------------------------------------------------------/ 00033 00034 File: YIntField.h 00035 00036 Author: Stefan Hundhammer <sh@suse.de> 00037 00038 /-*/ 00039 00040 #ifndef YIntField_h 00041 #define YIntField_h 00042 00043 #include "YWidget.h" 00044 00045 class YIntFieldPrivate; 00046 00047 using std::string; 00048 00049 00054 class YIntField : public YWidget 00055 { 00056 protected: 00067 YIntField( YWidget * parent, 00068 const string & label, 00069 int minValue, 00070 int maxValue ); 00071 00072 public: 00076 virtual ~YIntField(); 00077 00082 virtual const char * widgetClass() const { return "YIntField"; } 00083 00090 virtual int value() = 0; 00091 00097 void setValue( int val ) { setValueInternal( enforceRange( val ) ); } 00098 00099 protected: 00100 00108 virtual void setValueInternal( int val ) = 0; 00109 00115 int enforceRange( int val ) const; 00116 00117 public: 00118 00122 int minValue() const; 00123 00128 void setMinValue( int val ); 00129 00133 int maxValue() const; 00134 00139 void setMaxValue( int val ); 00140 00144 string label() const; 00145 00152 virtual void setLabel( const string & label ); 00153 00164 virtual bool setProperty( const string & propertyName, 00165 const YPropertyValue & val ); 00166 00173 virtual YPropertyValue getProperty( const string & propertyName ); 00174 00181 virtual const YPropertySet & propertySet(); 00182 00188 virtual string shortcutString() const { return label(); } 00189 00195 virtual void setShortcutString( const string & str ) 00196 { setLabel( str ); } 00197 00202 const char * userInputProperty() { return YUIProperty_Value; } 00203 00204 00205 private: 00206 00207 ImplPtr<YIntFieldPrivate> priv; 00208 }; 00209 00210 00211 #endif // YIntField_h