Eneboo - Documentación para desarrolladores
src/qt/include/qslider.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qslider.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QSlider class
00005 **
00006 ** Created : 961019
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 QSLIDER_H
00039 #define QSLIDER_H
00040 
00041 #ifndef QT_H
00042 #include "qwidget.h"
00043 #include "qrangecontrol.h"
00044 #endif // QT_H
00045 
00046 #ifndef QT_NO_SLIDER
00047 
00048 struct QSliderPrivate;
00049 
00050 class QTimer;
00051 
00052 class Q_EXPORT QSlider : public QWidget, public QRangeControl
00053 {
00054     Q_OBJECT
00055     Q_ENUMS( TickSetting )
00056     Q_PROPERTY( int minValue READ minValue WRITE setMinValue )
00057     Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
00058     Q_PROPERTY( int lineStep READ lineStep WRITE setLineStep )
00059     Q_PROPERTY( int pageStep READ pageStep WRITE setPageStep )
00060     Q_PROPERTY( int value READ value WRITE setValue )
00061     Q_PROPERTY( bool tracking READ tracking WRITE setTracking )
00062     Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
00063     Q_PROPERTY( TickSetting tickmarks READ tickmarks WRITE setTickmarks )
00064     Q_PROPERTY( int tickInterval READ tickInterval WRITE setTickInterval )
00065         
00066 public:
00067     enum TickSetting { NoMarks = 0, Above = 1, Left = Above,
00068                        Below = 2, Right = Below, Both = 3 };
00069 
00070     QSlider( QWidget *parent, const char* name = 0 );
00071     QSlider( Orientation, QWidget *parent, const char* name = 0 );
00072     QSlider( int minValue, int maxValue, int pageStep, int value, Orientation,
00073              QWidget *parent, const char* name = 0 );
00074     ~QSlider();
00075 
00076     virtual void        setOrientation( Orientation );
00077     Orientation orientation() const;
00078     virtual void        setTracking( bool enable );
00079     bool        tracking() const;
00080     virtual void        setPalette( const QPalette & );
00081 
00082     int sliderStart() const;
00083     QRect sliderRect() const;
00084     QSize sizeHint() const;
00085     void setSizePolicy( QSizePolicy sp );
00086     void setSizePolicy( QSizePolicy::SizeType hor, QSizePolicy::SizeType ver, bool hfw = FALSE );
00087 
00088     QSizePolicy sizePolicy() const;
00089     QSize minimumSizeHint() const;
00090 
00091     virtual void setTickmarks( TickSetting );
00092     TickSetting tickmarks() const { return ticks; }
00093 
00094     virtual void setTickInterval( int );
00095     int         tickInterval() const { return tickInt; }
00096 
00097     int  minValue() const;
00098     int  maxValue() const;
00099     void setMinValue( int );
00100     void setMaxValue( int );
00101     int  lineStep() const;
00102     int  pageStep() const;
00103     void setLineStep( int );
00104     void setPageStep( int );
00105     int  value() const;
00106 
00107 public slots:
00108     virtual void        setValue( int );
00109     void        addStep();
00110     void        subtractStep();
00111     void        addLine();
00112     void        subtractLine();
00113 
00114 signals:
00115     void        valueChanged( int value );
00116     void        sliderPressed();
00117     void        sliderMoved( int value );
00118     void        sliderReleased();
00119 
00120 protected:
00121     void        resizeEvent( QResizeEvent * );
00122     void        paintEvent( QPaintEvent * );
00123 
00124     void        keyPressEvent( QKeyEvent * );
00125     void        mousePressEvent( QMouseEvent * );
00126     void        mouseReleaseEvent( QMouseEvent * );
00127     void        mouseMoveEvent( QMouseEvent * );
00128 #ifndef QT_NO_WHEELEVENT
00129     void        wheelEvent( QWheelEvent * );
00130 #endif
00131     void        focusInEvent( QFocusEvent *e );
00132     void        focusOutEvent( QFocusEvent *e );
00133 
00134     void        styleChange( QStyle& );
00135 
00136     void        valueChange();
00137     void        rangeChange();
00138 
00139 private slots:
00140     void        repeatTimeout();
00141 
00142 private:
00143     enum State { Idle, Dragging, TimingUp, TimingDown };
00144 
00145     void        init();
00146     int         positionFromValue( int ) const;
00147     int         valueFromPosition( int ) const;
00148     void        moveSlider( int );
00149     void        reallyMoveSlider( int );
00150     void        resetState();
00151     int         available() const;
00152     int         goodPart( const QPoint& ) const;
00153     void        initTicks();
00154 
00155     QSliderPrivate *d;
00156     QTimer      *timer;
00157     QCOORD      sliderPos;
00158     int         sliderVal;
00159     QCOORD      clickOffset;
00160     State       state;
00161     bool        track;
00162     QCOORD      tickOffset;
00163     TickSetting ticks;
00164     int         tickInt;
00165     Orientation orient;
00166 
00167 private:        // Disabled copy constructor and operator=
00168 #if defined(Q_DISABLE_COPY)
00169     QSlider( const QSlider & );
00170     QSlider &operator=( const QSlider & );
00171 #endif
00172 };
00173 
00174 inline bool QSlider::tracking() const
00175 {
00176     return track;
00177 }
00178 
00179 inline QSlider::Orientation QSlider::orientation() const
00180 {
00181     return orient;
00182 }
00183 
00184 inline int QSlider::sliderStart() const
00185 {
00186     return sliderPos;
00187 }
00188 
00189 inline void QSlider::setSizePolicy( QSizePolicy::SizeType hor, QSizePolicy::SizeType ver, bool hfw )
00190 { 
00191     QWidget::setSizePolicy( hor, ver, hfw ); 
00192 }
00193 
00194 #endif // QT_NO_SLIDER
00195 
00196 #endif // QSLIDER_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'