Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qrangecontrol.h 3.3.8 edited Jan 11 14:38 $ 00003 ** 00004 ** Definition of QRangeControl class 00005 ** 00006 ** Created : 940427 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 QRANGECONTROL_H 00039 #define QRANGECONTROL_H 00040 00041 #ifndef QT_H 00042 #include "qglobal.h" 00043 #include "qframe.h" 00044 #endif // QT_H 00045 00046 #ifndef QT_NO_RANGECONTROL 00047 00048 00049 class QRangeControlPrivate; 00050 00051 00052 class Q_EXPORT QRangeControl 00053 { 00054 public: 00055 QRangeControl(); 00056 QRangeControl( int minValue, int maxValue, 00057 int lineStep, int pageStep, int value ); 00058 virtual ~QRangeControl(); 00059 int value() const; 00060 void setValue( int ); 00061 void addPage(); 00062 void subtractPage(); 00063 void addLine(); 00064 void subtractLine(); 00065 00066 int minValue() const; 00067 int maxValue() const; 00068 void setRange( int minValue, int maxValue ); 00069 void setMinValue( int minVal ); 00070 void setMaxValue( int minVal ); 00071 00072 int lineStep() const; 00073 int pageStep() const; 00074 void setSteps( int line, int page ); 00075 00076 int bound( int ) const; 00077 00078 protected: 00079 int positionFromValue( int val, int space ) const; 00080 int valueFromPosition( int pos, int space ) const; 00081 void directSetValue( int val ); 00082 int prevValue() const; 00083 00084 virtual void valueChange(); 00085 virtual void rangeChange(); 00086 virtual void stepChange(); 00087 00088 private: 00089 int minVal, maxVal; 00090 int line, page; 00091 int val, prevVal; 00092 00093 QRangeControlPrivate * d; 00094 00095 private: // Disabled copy constructor and operator= 00096 #if defined(Q_DISABLE_COPY) 00097 QRangeControl( const QRangeControl & ); 00098 QRangeControl &operator=( const QRangeControl & ); 00099 #endif 00100 }; 00101 00102 00103 inline int QRangeControl::value() const 00104 { return val; } 00105 00106 inline int QRangeControl::prevValue() const 00107 { return prevVal; } 00108 00109 inline int QRangeControl::minValue() const 00110 { return minVal; } 00111 00112 inline int QRangeControl::maxValue() const 00113 { return maxVal; } 00114 00115 inline int QRangeControl::lineStep() const 00116 { return line; } 00117 00118 inline int QRangeControl::pageStep() const 00119 { return page; } 00120 00121 00122 #endif // QT_NO_RANGECONTROL 00123 00124 #ifndef QT_NO_SPINWIDGET 00125 00126 class QSpinWidgetPrivate; 00127 class Q_EXPORT QSpinWidget : public QWidget 00128 { 00129 Q_OBJECT 00130 public: 00131 QSpinWidget( QWidget* parent=0, const char* name=0 ); 00132 ~QSpinWidget(); 00133 00134 void setEditWidget( QWidget * widget ); 00135 QWidget * editWidget(); 00136 00137 QRect upRect() const; 00138 QRect downRect() const; 00139 00140 void setUpEnabled( bool on ); 00141 void setDownEnabled( bool on ); 00142 00143 bool isUpEnabled() const; 00144 bool isDownEnabled() const; 00145 00146 enum ButtonSymbols { UpDownArrows, PlusMinus }; 00147 virtual void setButtonSymbols( ButtonSymbols bs ); 00148 ButtonSymbols buttonSymbols() const; 00149 00150 void arrange(); 00151 00152 signals: 00153 void stepUpPressed(); 00154 void stepDownPressed(); 00155 00156 public slots: 00157 void stepUp(); 00158 void stepDown(); 00159 00160 protected: 00161 void mousePressEvent( QMouseEvent *e ); 00162 void resizeEvent( QResizeEvent* ev ); 00163 void mouseReleaseEvent( QMouseEvent *e ); 00164 void mouseMoveEvent( QMouseEvent *e ); 00165 #ifndef QT_NO_WHEELEVENT 00166 void wheelEvent( QWheelEvent * ); 00167 #endif 00168 void styleChange( QStyle& ); 00169 void paintEvent( QPaintEvent * ); 00170 void enableChanged( bool old ); 00171 void windowActivationChange( bool ); 00172 00173 private slots: 00174 void timerDone(); 00175 void timerDoneEx(); 00176 00177 private: 00178 QSpinWidgetPrivate * d; 00179 00180 void updateDisplay(); 00181 00182 private: // Disabled copy constructor and operator= 00183 #if defined(Q_DISABLE_COPY) 00184 QSpinWidget( const QSpinWidget& ); 00185 QSpinWidget& operator=( const QSpinWidget& ); 00186 #endif 00187 }; 00188 00189 #endif // QT_NO_SPINWIDGET 00190 00191 #endif // QRANGECONTROL_H