Eneboo - Documentación para desarrolladores
src/qt/include/qscrollbar.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qscrollbar.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QScrollBar 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 QSCROLLBAR_H
00039 #define QSCROLLBAR_H
00040 
00041 class QTimer;
00042 
00043 #ifndef QT_H
00044 #include "qwidget.h"
00045 #include "qrangecontrol.h"
00046 #endif // QT_H
00047 
00048 #ifndef QT_NO_SCROLLBAR
00049 
00050 class Q_EXPORT QScrollBar : public QWidget, public QRangeControl
00051 {
00052     Q_OBJECT
00053     Q_PROPERTY( int minValue READ minValue WRITE setMinValue )
00054     Q_PROPERTY( int maxValue READ maxValue WRITE setMaxValue )
00055     Q_PROPERTY( int lineStep READ lineStep WRITE setLineStep )
00056     Q_PROPERTY( int pageStep READ pageStep WRITE setPageStep )
00057     Q_PROPERTY( int value READ value WRITE setValue )
00058     Q_PROPERTY( bool tracking READ tracking WRITE setTracking )
00059     Q_PROPERTY( bool draggingSlider READ draggingSlider )
00060     Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
00061 
00062 public:
00063     QScrollBar( QWidget *parent, const char* name = 0 );
00064     QScrollBar( Orientation, QWidget *parent, const char* name = 0 );
00065     QScrollBar( int minValue, int maxValue, int lineStep, int pageStep,
00066                 int value, Orientation, QWidget *parent, const char* name = 0 );
00067     ~QScrollBar();
00068 
00069     virtual void setOrientation( Orientation );
00070     Orientation orientation() const;
00071     virtual void setTracking( bool enable );
00072     bool        tracking() const;
00073     bool        draggingSlider() const;
00074 
00075     virtual void setPalette( const QPalette & );
00076     virtual QSize sizeHint() const;
00077     virtual void setSizePolicy( QSizePolicy sp );
00078     void setSizePolicy( QSizePolicy::SizeType hor, QSizePolicy::SizeType ver, bool hfw = FALSE );
00079 
00080     int  minValue() const;
00081     int  maxValue() const;
00082     void setMinValue( int );
00083     void setMaxValue( int );
00084     int  lineStep() const;
00085     int  pageStep() const;
00086     void setLineStep( int );
00087     void setPageStep( int );
00088     int  value() const;
00089 
00090     int         sliderStart() const;
00091     QRect       sliderRect() const;
00092 
00093 public slots:
00094     void setValue( int );
00095 
00096 signals:
00097     void        valueChanged( int value );
00098     void        sliderPressed();
00099     void        sliderMoved( int value );
00100     void        sliderReleased();
00101     void        nextLine();
00102     void        prevLine();
00103     void        nextPage();
00104     void        prevPage();
00105 
00106 protected:
00107 #ifndef QT_NO_WHEELEVENT
00108     void        wheelEvent( QWheelEvent * );
00109 #endif
00110     void        keyPressEvent( QKeyEvent * );
00111     void        resizeEvent( QResizeEvent * );
00112     void        paintEvent( QPaintEvent * );
00113 
00114     void        mousePressEvent( QMouseEvent * );
00115     void        mouseReleaseEvent( QMouseEvent * );
00116     void        mouseMoveEvent( QMouseEvent * );
00117     void        contextMenuEvent( QContextMenuEvent * );
00118     void        hideEvent( QHideEvent* );
00119 
00120     void        valueChange();
00121     void        stepChange();
00122     void        rangeChange();
00123 
00124     void        styleChange( QStyle& );
00125 
00126 private slots:
00127     void doAutoRepeat();
00128 
00129 private:
00130     void init();
00131     void positionSliderFromValue();
00132     int calculateValueFromSlider() const;
00133 
00134     void startAutoRepeat();
00135     void stopAutoRepeat();
00136 
00137     int rangeValueToSliderPos( int val ) const;
00138     int sliderPosToRangeValue( int val ) const;
00139 
00140     void action( int control );
00141 
00142     void drawControls( uint controls, uint activeControl ) const;
00143     void drawControls( uint controls, uint activeControl,
00144                        QPainter *p ) const;
00145 
00146     uint pressedControl;
00147     bool track;
00148     bool clickedAt;
00149     Orientation orient;
00150 
00151     int slidePrevVal;
00152     QCOORD sliderPos;
00153     QCOORD clickOffset;
00154 
00155     QTimer * repeater;
00156     void * d;
00157 
00158 private:        // Disabled copy constructor and operator=
00159 #if defined(Q_DISABLE_COPY)
00160     QScrollBar( const QScrollBar & );
00161     QScrollBar &operator=( const QScrollBar & );
00162 #endif
00163 };
00164 
00165 
00166 inline void QScrollBar::setTracking( bool t )
00167 {
00168     track = t;
00169 }
00170 
00171 inline bool QScrollBar::tracking() const
00172 {
00173     return track;
00174 }
00175 
00176 inline QScrollBar::Orientation QScrollBar::orientation() const
00177 {
00178     return orient;
00179 }
00180 
00181 inline int QScrollBar::sliderStart() const
00182 {
00183     return sliderPos;
00184 }
00185 
00186 inline void QScrollBar::setSizePolicy( QSizePolicy::SizeType hor, QSizePolicy::SizeType ver, bool hfw )
00187 { 
00188     QWidget::setSizePolicy( hor, ver, hfw ); 
00189 }
00190 
00191 
00192 #endif // QT_NO_SCROLLBAR
00193 
00194 #endif // QSCROLLBAR_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'