home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qdial.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  4KB  |  149 lines

  1. /****************************************************************************
  2. ** $Id:  qt/qdial.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Definition of the dial widget
  5. **
  6. ** Created : 1999.01.04
  7. **
  8. ** Copyright (C) 1999-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the widgets module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37.  
  38.  
  39. #ifndef QDIAL_H
  40. #define QDIAL_H
  41.  
  42. #ifndef QT_H
  43. #include "qwidget.h"
  44. #include "qrangecontrol.h"
  45. #endif // QT_H
  46.  
  47. #ifndef QT_NO_DIAL
  48.  
  49. class QDialPrivate;
  50.  
  51. class Q_EXPORT QDial: public QWidget, public QRangeControl
  52. {
  53.     Q_OBJECT
  54.     Q_PROPERTY( bool tracking READ tracking WRITE setTracking )
  55.     Q_PROPERTY( bool wrapping READ wrapping WRITE setWrapping )
  56.     Q_PROPERTY( int notchSize READ notchSize )
  57.     Q_PROPERTY( double notchTarget READ notchTarget WRITE setNotchTarget )
  58.     Q_PROPERTY( bool notchesVisible READ notchesVisible WRITE setNotchesVisible )
  59.     Q_PROPERTY( int minValue READ minValue WRITE setMinValue )
  60.     Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
  61.     Q_PROPERTY( int lineStep READ lineStep WRITE setLineStep )
  62.     Q_PROPERTY( int pageStep READ pageStep WRITE setPageStep )
  63.     Q_PROPERTY( int value READ value WRITE setValue )
  64.     
  65. public:
  66.     QDial( QWidget* parent=0, const char* name=0, WFlags f = 0 );
  67.     QDial( int minValue, int maxValue, int pageStep, int value,
  68.        QWidget* parent=0, const char* name=0 );
  69.     ~QDial();
  70.  
  71.     bool tracking() const;
  72.  
  73.     bool wrapping() const;
  74.  
  75.     int notchSize() const;
  76.  
  77.     virtual void setNotchTarget( double );
  78.     double notchTarget() const;
  79.  
  80.     bool notchesVisible() const;
  81.  
  82.     QSize sizeHint() const;
  83.     QSize minimumSizeHint() const;
  84.  
  85.     int     minValue() const;
  86.     int     maxValue() const;
  87.     void setMinValue( int );
  88.     void setMaxValue( int );
  89.     int     lineStep() const;
  90.     int     pageStep() const;
  91.     void setLineStep( int );
  92.     void setPageStep( int );
  93.     int  value() const;
  94.  
  95. public slots:
  96.     virtual void setValue( int );
  97.     void addLine();
  98.     void subtractLine();
  99.     void addPage();
  100.     void subtractPage();
  101.     virtual void setNotchesVisible( bool b );
  102.     virtual void setWrapping( bool on );
  103.     virtual void setTracking( bool enable );
  104.  
  105. signals:
  106.     void valueChanged( int value );
  107.     void dialPressed();
  108.     void dialMoved( int value );
  109.     void dialReleased();
  110.  
  111. protected:
  112.     void resizeEvent( QResizeEvent * );
  113.     void paintEvent( QPaintEvent * );
  114.  
  115.     void keyPressEvent( QKeyEvent * );
  116.     void mousePressEvent( QMouseEvent * );
  117.     void mouseReleaseEvent( QMouseEvent * );
  118.     void mouseMoveEvent( QMouseEvent * );
  119.     void wheelEvent( QWheelEvent * );
  120.     void focusInEvent( QFocusEvent * );
  121.     void focusOutEvent( QFocusEvent * );
  122.  
  123.     void valueChange();
  124.     void rangeChange();
  125.  
  126.     virtual void repaintScreen( const QRect *cr = 0 );
  127.  
  128. private:
  129.     QDialPrivate * d;
  130.  
  131.     int valueFromPoint( const QPoint & ) const;
  132.     double angle( const QPoint &, const QPoint & ) const;
  133.     QPointArray calcArrow( double &a ) const;
  134.     QRect calcDial() const;
  135.     int calcBigLineSize() const;
  136.     void calcLines();
  137.  
  138. private: // Disabled copy constructor and operator=
  139. #if defined(Q_DISABLE_COPY)
  140.     QDial( const QDial & );
  141.     QDial &operator=( const QDial & );
  142. #endif
  143.  
  144. };
  145.  
  146. #endif  // QT_NO_DIAL
  147.  
  148. #endif
  149.