Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qspinbox.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QSpinBox widget class 00005 ** 00006 ** Created : 970101 00007 ** 00008 ** Copyright (C) 1992-2007 Trolltech ASA. All rights reserved. 00009 ** 00010 ** This file is part of the widgets module of the Qt GUI Toolkit. 00011 ** 00012 ** This file may be distributed under the terms of the Q Public License 00013 ** as defined by Trolltech ASA of Norway and appearing in the file 00014 ** LICENSE.QPL included in the packaging of this file. 00015 ** 00016 ** This file may be distributed and/or modified under the terms of the 00017 ** GNU General Public License version 2 as published by the Free Software 00018 ** Foundation and appearing in the file LICENSE.GPL included in the 00019 ** packaging of this file. 00020 ** 00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition 00022 ** licenses may use this file in accordance with the Qt Commercial License 00023 ** Agreement provided with the Software. 00024 ** 00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 00027 ** 00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for 00029 ** information about Qt Commercial License Agreements. 00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information. 00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information. 00032 ** 00033 ** Contact info@trolltech.com if any conditions of this licensing are 00034 ** not clear to you. 00035 ** 00036 **********************************************************************/ 00037 00038 #ifndef QSPINBOX_H 00039 #define QSPINBOX_H 00040 00041 #ifndef QT_H 00042 #include "qwidget.h" 00043 #include "qrangecontrol.h" 00044 #endif // QT_H 00045 00046 #ifndef QT_NO_SPINBOX 00047 00048 class QLineEdit; 00049 class QValidator; 00050 class QSpinBoxPrivate; 00051 00052 class Q_EXPORT QSpinBox: public QWidget, public QRangeControl 00053 { 00054 Q_OBJECT 00055 Q_ENUMS( ButtonSymbols ) 00056 Q_PROPERTY( QString text READ text ) 00057 Q_PROPERTY( QString prefix READ prefix WRITE setPrefix ) 00058 Q_PROPERTY( QString suffix READ suffix WRITE setSuffix ) 00059 Q_PROPERTY( QString cleanText READ cleanText ) 00060 Q_PROPERTY( QString specialValueText READ specialValueText WRITE setSpecialValueText ) 00061 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) 00062 Q_PROPERTY( ButtonSymbols buttonSymbols READ buttonSymbols WRITE setButtonSymbols ) 00063 Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) 00064 Q_PROPERTY( int minValue READ minValue WRITE setMinValue ) 00065 Q_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) 00066 Q_PROPERTY( int value READ value WRITE setValue ) 00067 00068 public: 00069 QSpinBox( QWidget* parent=0, const char* name=0 ); 00070 QSpinBox( int minValue, int maxValue, int step = 1, 00071 QWidget* parent=0, const char* name=0 ); 00072 ~QSpinBox(); 00073 00074 QString text() const; 00075 00076 virtual QString prefix() const; 00077 virtual QString suffix() const; 00078 virtual QString cleanText() const; 00079 00080 virtual void setSpecialValueText( const QString &text ); 00081 QString specialValueText() const; 00082 00083 virtual void setWrapping( bool on ); 00084 bool wrapping() const; 00085 00086 enum ButtonSymbols { UpDownArrows, PlusMinus }; 00087 virtual void setButtonSymbols( ButtonSymbols ); 00088 ButtonSymbols buttonSymbols() const; 00089 00090 virtual void setValidator( const QValidator* v ); 00091 const QValidator * validator() const; 00092 00093 QSize sizeHint() const; 00094 QSize minimumSizeHint() const; 00095 00096 int minValue() const; 00097 int maxValue() const; 00098 void setMinValue( int ); 00099 void setMaxValue( int ); 00100 int lineStep() const; 00101 void setLineStep( int ); 00102 int value() const; 00103 00104 QRect upRect() const; 00105 QRect downRect() const; 00106 00107 public slots: 00108 virtual void setValue( int value ); 00109 virtual void setPrefix( const QString &text ); 00110 virtual void setSuffix( const QString &text ); 00111 virtual void stepUp(); 00112 virtual void stepDown(); 00113 virtual void setEnabled( bool enabled ); 00114 virtual void selectAll(); 00115 00116 signals: 00117 void valueChanged( int value ); 00118 void valueChanged( const QString &valueText ); 00119 00120 protected: 00121 virtual QString mapValueToText( int value ); 00122 virtual int mapTextToValue( bool* ok ); 00123 QString currentValueText(); 00124 00125 virtual void updateDisplay(); 00126 virtual void interpretText(); 00127 00128 QLineEdit* editor() const; 00129 00130 virtual void valueChange(); 00131 virtual void rangeChange(); 00132 00133 bool eventFilter( QObject* obj, QEvent* ev ); 00134 void resizeEvent( QResizeEvent* ev ); 00135 #ifndef QT_NO_WHEELEVENT 00136 void wheelEvent( QWheelEvent * ); 00137 #endif 00138 void leaveEvent( QEvent* ); 00139 00140 void styleChange( QStyle& ); 00141 00142 protected slots: 00143 void textChanged(); 00144 00145 private: 00146 void initSpinBox(); 00147 QSpinBoxPrivate* d; 00148 QLineEdit* vi; 00149 QValidator* validate; 00150 QString pfix; 00151 QString sfix; 00152 QString specText; 00153 00154 uint wrap : 1; 00155 uint edited : 1; 00156 00157 void arrangeWidgets(); 00158 00159 private: // Disabled copy constructor and operator= 00160 #if defined(Q_DISABLE_COPY) 00161 QSpinBox( const QSpinBox& ); 00162 QSpinBox& operator=( const QSpinBox& ); 00163 #endif 00164 00165 }; 00166 00167 #endif // QT_NO_SPINBOX 00168 00169 #endif // QSPINBOX_H