Eneboo - Documentación para desarrolladores
|
00001 /**************************************************************************** 00002 ** $Id: qt/qdial.h 3.3.8 edited Jan 11 14:46 $ 00003 ** 00004 ** Definition of the dial widget 00005 ** 00006 ** Created : 990104 00007 ** 00008 ** Copyright (C) 1999-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 00039 #ifndef QDIAL_H 00040 #define QDIAL_H 00041 00042 #ifndef QT_H 00043 #include "qwidget.h" 00044 #include "qrangecontrol.h" 00045 #endif // QT_H 00046 00047 #ifndef QT_NO_DIAL 00048 00049 class QDialPrivate; 00050 00051 class Q_EXPORT QDial: public QWidget, public QRangeControl 00052 { 00053 Q_OBJECT 00054 Q_PROPERTY( bool tracking READ tracking WRITE setTracking ) 00055 Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping ) 00056 Q_PROPERTY( int notchSize READ notchSize ) 00057 Q_PROPERTY( double notchTarget READ notchTarget WRITE setNotchTarget ) 00058 Q_PROPERTY( bool notchesVisible READ notchesVisible WRITE setNotchesVisible ) 00059 Q_PROPERTY( int minValue READ minValue WRITE setMinValue ) 00060 Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue ) 00061 Q_PROPERTY( int lineStep READ lineStep WRITE setLineStep ) 00062 Q_PROPERTY( int pageStep READ pageStep WRITE setPageStep ) 00063 Q_PROPERTY( int value READ value WRITE setValue ) 00064 00065 public: 00066 QDial( QWidget* parent=0, const char* name=0, WFlags f = 0 ); 00067 QDial( int minValue, int maxValue, int pageStep, int value, 00068 QWidget* parent=0, const char* name=0 ); 00069 ~QDial(); 00070 00071 bool tracking() const; 00072 00073 bool wrapping() const; 00074 00075 int notchSize() const; 00076 00077 virtual void setNotchTarget( double ); 00078 double notchTarget() const; 00079 00080 bool notchesVisible() const; 00081 00082 QSize sizeHint() const; 00083 QSize minimumSizeHint() const; 00084 00085 int minValue() const; 00086 int maxValue() const; 00087 void setMinValue( int ); 00088 void setMaxValue( int ); 00089 int lineStep() const; 00090 int pageStep() const; 00091 void setLineStep( int ); 00092 void setPageStep( int ); 00093 int value() const; 00094 00095 public slots: 00096 virtual void setValue( int ); 00097 void addLine(); 00098 void subtractLine(); 00099 void addPage(); 00100 void subtractPage(); 00101 virtual void setNotchesVisible( bool b ); 00102 virtual void setWrapping( bool on ); 00103 virtual void setTracking( bool enable ); 00104 00105 signals: 00106 void valueChanged( int value ); 00107 void dialPressed(); 00108 void dialMoved( int value ); 00109 void dialReleased(); 00110 00111 protected: 00112 void resizeEvent( QResizeEvent * ); 00113 void paintEvent( QPaintEvent * ); 00114 00115 void keyPressEvent( QKeyEvent * ); 00116 void mousePressEvent( QMouseEvent * ); 00117 void mouseReleaseEvent( QMouseEvent * ); 00118 void mouseMoveEvent( QMouseEvent * ); 00119 #ifndef QT_NO_WHEELEVENT 00120 void wheelEvent( QWheelEvent * ); 00121 #endif 00122 void focusInEvent( QFocusEvent * ); 00123 void focusOutEvent( QFocusEvent * ); 00124 00125 void valueChange(); 00126 void rangeChange(); 00127 00128 virtual void repaintScreen( const QRect *cr = 0 ); 00129 00130 private: 00131 QDialPrivate * d; 00132 00133 int valueFromPoint( const QPoint & ) const; 00134 double angle( const QPoint &, const QPoint & ) const; 00135 QPointArray calcArrow( double &a ) const; 00136 QRect calcDial() const; 00137 int calcBigLineSize() const; 00138 void calcLines(); 00139 00140 private: // Disabled copy constructor and operator= 00141 #if defined(Q_DISABLE_COPY) 00142 QDial( const QDial & ); 00143 QDial &operator=( const QDial & ); 00144 #endif 00145 00146 }; 00147 00148 #endif // QT_NO_DIAL 00149 00150 #endif