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

  1. /****************************************************************************
  2. ** $Id:  qt/qrangecontrol.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Definition of QRangeControl class
  5. **
  6. ** Created : 940427
  7. **
  8. ** Copyright (C) 1992-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. #ifndef QRANGECONTROL_H
  39. #define QRANGECONTROL_H
  40.  
  41. #ifndef QT_H
  42. #include "qglobal.h"
  43. #include "qframe.h"
  44. #endif // QT_H
  45.  
  46. #ifndef QT_NO_RANGECONTROL
  47.  
  48.  
  49. class QRangeControlPrivate;
  50.  
  51.  
  52. class Q_EXPORT QRangeControl
  53. {
  54. public:
  55.     QRangeControl();
  56.     QRangeControl( int minValue, int maxValue,
  57.            int lineStep, int pageStep, int value );
  58.     virtual ~QRangeControl();
  59.     int        value()        const;
  60.     void    setValue( int );
  61.     void    addPage();
  62.     void    subtractPage();
  63.     void    addLine();
  64.     void    subtractLine();
  65.  
  66.     int        minValue()    const;
  67.     int        maxValue()    const;
  68.     void    setRange( int minValue, int maxValue );
  69.     void    setMinValue( int minVal );
  70.     void    setMaxValue( int minVal );
  71.  
  72.     int        lineStep()    const;
  73.     int        pageStep()    const;
  74.     void    setSteps( int line, int page );
  75.  
  76.     int        bound( int ) const;
  77.  
  78. protected:
  79.     int        positionFromValue( int val, int space ) const;
  80.     int        valueFromPosition( int pos, int space ) const;
  81.     void    directSetValue( int val );
  82.     int        prevValue()    const;
  83.  
  84.     virtual void valueChange();
  85.     virtual void rangeChange();
  86.     virtual void stepChange();
  87.  
  88. private:
  89.     int        minVal, maxVal;
  90.     int        line, page;
  91.     int        val, prevVal;
  92.  
  93.     QRangeControlPrivate * d;
  94.  
  95. private:    // Disabled copy constructor and operator=
  96. #if defined(Q_DISABLE_COPY)
  97.     QRangeControl( const QRangeControl & );
  98.     QRangeControl &operator=( const QRangeControl & );
  99. #endif
  100. };
  101.  
  102.  
  103. inline int QRangeControl::value() const
  104. { return val; }
  105.  
  106. inline int QRangeControl::prevValue() const
  107. { return prevVal; }
  108.  
  109. inline int QRangeControl::minValue() const
  110. { return minVal; }
  111.  
  112. inline int QRangeControl::maxValue() const
  113. { return maxVal; }
  114.  
  115. inline int QRangeControl::lineStep() const
  116. { return line; }
  117.  
  118. inline int QRangeControl::pageStep() const
  119. { return page; }
  120.  
  121.  
  122. #endif // QT_NO_RANGECONTROL
  123.  
  124. #ifndef QT_NO_SPINWIDGET
  125.  
  126. class QSpinWidgetPrivate;
  127. class Q_EXPORT QSpinWidget : public QWidget
  128. {
  129.     Q_OBJECT
  130. public:
  131.     QSpinWidget( QWidget* parent=0, const char* name=0 );
  132.     ~QSpinWidget();
  133.  
  134.     void     setEditWidget( QWidget * widget );
  135.     QWidget *     editWidget();
  136.     
  137.     QRect upRect() const;
  138.     QRect downRect() const;
  139.  
  140.     void setUpEnabled( bool on );
  141.     void setDownEnabled( bool on );
  142.  
  143.     bool isUpEnabled() const;
  144.     bool isDownEnabled() const;
  145.  
  146.     enum ButtonSymbols { UpDownArrows, PlusMinus };
  147.     virtual void    setButtonSymbols( ButtonSymbols bs );
  148.     ButtonSymbols    buttonSymbols() const;
  149.  
  150.     void arrange();
  151.  
  152. signals:
  153.     void stepUpPressed();
  154.     void stepDownPressed();
  155.  
  156. public slots:
  157.     void stepUp();
  158.     void stepDown();
  159.  
  160. protected:
  161.     void mousePressEvent( QMouseEvent *e );
  162.     void resizeEvent( QResizeEvent* ev );
  163.     void mouseReleaseEvent( QMouseEvent *e );
  164.     void mouseMoveEvent( QMouseEvent *e );
  165.     void wheelEvent( QWheelEvent * );
  166.     void styleChange( QStyle& );
  167.     void paintEvent( QPaintEvent * );
  168.     void enableChanged( bool old );
  169.  
  170. private:
  171.     QSpinWidgetPrivate * d;
  172.  
  173.     void updateDisplay();
  174.  
  175. private:    // Disabled copy constructor and operator=
  176. #if defined(Q_DISABLE_COPY)
  177.     QSpinWidget( const QSpinWidget& );
  178.     QSpinWidget& operator=( const QSpinWidget& );
  179. #endif
  180. };
  181.  
  182. #endif // QT_NO_SPINWIDGET
  183.  
  184. #endif // QRANGECONTROL_H
  185.