Eneboo - Documentación para desarrolladores
src/qt/include/qscrollview.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qscrollview.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QScrollView class
00005 **
00006 ** Created : 970523
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 #ifndef QSCROLLVIEW_H
00038 #define QSCROLLVIEW_H
00039 
00040 #ifndef QT_H
00041 #include "qframe.h"
00042 #include "qscrollbar.h"
00043 #endif // QT_H
00044 
00045 #ifndef QT_NO_SCROLLVIEW
00046 
00047 class QScrollViewData;
00048 
00049 class Q_EXPORT QScrollView : public QFrame
00050 {
00051     Q_OBJECT
00052     Q_ENUMS( ResizePolicy ScrollBarMode )
00053     Q_PROPERTY( ResizePolicy resizePolicy READ resizePolicy WRITE setResizePolicy )
00054     Q_PROPERTY( ScrollBarMode vScrollBarMode READ vScrollBarMode WRITE setVScrollBarMode )
00055     Q_PROPERTY( ScrollBarMode hScrollBarMode READ hScrollBarMode WRITE setHScrollBarMode )
00056     Q_PROPERTY( int visibleWidth READ visibleWidth )
00057     Q_PROPERTY( int visibleHeight READ visibleHeight )
00058     Q_PROPERTY( int contentsWidth READ contentsWidth )
00059     Q_PROPERTY( int contentsHeight READ contentsHeight )
00060     Q_PROPERTY( int contentsX READ contentsX )
00061     Q_PROPERTY( int contentsY READ contentsY )
00062 #ifndef QT_NO_DRAGANDDROP
00063     Q_PROPERTY( bool dragAutoScroll READ dragAutoScroll WRITE setDragAutoScroll )
00064 #endif
00065 
00066 public:
00067     QScrollView(QWidget* parent=0, const char* name=0, WFlags f=0);
00068     ~QScrollView();
00069 
00070     enum ResizePolicy { Default, Manual, AutoOne, AutoOneFit };
00071     virtual void setResizePolicy( ResizePolicy );
00072     ResizePolicy resizePolicy() const;
00073 
00074     void styleChange( QStyle & );
00075     void removeChild(QWidget* child);
00076     virtual void addChild( QWidget* child, int x=0, int y=0 );
00077     virtual void moveChild( QWidget* child, int x, int y );
00078     int childX(QWidget* child);
00079     int childY(QWidget* child);
00080     bool childIsVisible(QWidget* child) { return child->isVisible(); } // obsolete functions
00081     void showChild(QWidget* child, bool yes=TRUE) {
00082         if ( yes )
00083             child->show();
00084         else
00085             child->hide();
00086     }
00087 
00088     enum ScrollBarMode { Auto, AlwaysOff, AlwaysOn };
00089 
00090     ScrollBarMode vScrollBarMode() const;
00091     virtual void  setVScrollBarMode( ScrollBarMode );
00092 
00093     ScrollBarMode hScrollBarMode() const;
00094     virtual void  setHScrollBarMode( ScrollBarMode );
00095 
00096     QWidget*     cornerWidget() const;
00097     virtual void setCornerWidget(QWidget*);
00098 
00099     // ### 4.0: Consider providing a factory function for scrollbars
00100     //          (e.g. make the two following functions virtual)
00101     QScrollBar*  horizontalScrollBar() const;
00102     QScrollBar*  verticalScrollBar() const;
00103     QWidget*     viewport() const;
00104     QWidget*     clipper() const;
00105 
00106     int         visibleWidth() const;
00107     int         visibleHeight() const;
00108 
00109     int         contentsWidth() const;
00110     int         contentsHeight() const;
00111     int         contentsX() const;
00112     int         contentsY() const;
00113 
00114     void        resize( int w, int h );
00115     void        resize( const QSize& );
00116     void        show();
00117 
00118     void        updateContents( int x, int y, int w, int h );
00119     void        updateContents( const QRect& r );
00120     void        updateContents();
00121     void        repaintContents( int x, int y, int w, int h, bool erase=TRUE );
00122     void        repaintContents( const QRect& r, bool erase=TRUE );
00123     void        repaintContents( bool erase=TRUE );
00124     void        contentsToViewport( int x, int y, int& vx, int& vy ) const;
00125     void        viewportToContents( int vx, int vy, int& x, int& y ) const;
00126     QPoint      contentsToViewport( const QPoint& ) const;
00127     QPoint      viewportToContents( const QPoint& ) const;
00128     void        enableClipper( bool y );
00129 
00130     void        setStaticBackground( bool y );
00131     bool        hasStaticBackground() const;
00132 
00133     QSize       viewportSize( int, int ) const;
00134     QSize       sizeHint() const;
00135     QSize       minimumSizeHint() const;
00136 
00137     void        removeChild(QObject* child);
00138 
00139     bool        isHorizontalSliderPressed();
00140     bool        isVerticalSliderPressed();
00141 
00142 #ifndef QT_NO_DRAGANDDROP
00143     virtual void setDragAutoScroll( bool b );
00144     bool         dragAutoScroll() const;
00145 #endif
00146 
00147 signals:
00148     void        contentsMoving(int x, int y);
00149     void        horizontalSliderPressed();
00150     void        horizontalSliderReleased();
00151     void        verticalSliderPressed();
00152     void        verticalSliderReleased();
00153 
00154 public slots:
00155     virtual void resizeContents( int w, int h );
00156     void        scrollBy( int dx, int dy );
00157     virtual void setContentsPos( int x, int y );
00158     void        ensureVisible(int x, int y);
00159     void        ensureVisible(int x, int y, int xmargin, int ymargin);
00160     void        center(int x, int y);
00161     void        center(int x, int y, float xmargin, float ymargin);
00162 
00163     void        updateScrollBars(); // ### virtual in 4.0
00164     void        setEnabled( bool enable );
00165 
00166 protected:
00167     virtual void drawContents(QPainter*, int cx, int cy, int cw, int ch);
00168     virtual void drawContentsOffset(QPainter*, int ox, int oy,
00169                     int cx, int cy, int cw, int ch);
00170 
00171 
00172     virtual void contentsMousePressEvent( QMouseEvent* );
00173     virtual void contentsMouseReleaseEvent( QMouseEvent* );
00174     virtual void contentsMouseDoubleClickEvent( QMouseEvent* );
00175     virtual void contentsMouseMoveEvent( QMouseEvent* );
00176 #ifndef QT_NO_DRAGANDDROP
00177     virtual void contentsDragEnterEvent( QDragEnterEvent * );
00178     virtual void contentsDragMoveEvent( QDragMoveEvent * );
00179     virtual void contentsDragLeaveEvent( QDragLeaveEvent * );
00180     virtual void contentsDropEvent( QDropEvent * );
00181 #endif
00182 #ifndef QT_NO_WHEELEVENT
00183     virtual void contentsWheelEvent( QWheelEvent * );
00184 #endif
00185     virtual void contentsContextMenuEvent( QContextMenuEvent * );
00186 
00187 
00188     virtual void viewportPaintEvent( QPaintEvent* );
00189     virtual void viewportResizeEvent( QResizeEvent* );
00190     virtual void viewportMousePressEvent( QMouseEvent* );
00191     virtual void viewportMouseReleaseEvent( QMouseEvent* );
00192     virtual void viewportMouseDoubleClickEvent( QMouseEvent* );
00193     virtual void viewportMouseMoveEvent( QMouseEvent* );
00194 #ifndef QT_NO_DRAGANDDROP
00195     virtual void viewportDragEnterEvent( QDragEnterEvent * );
00196     virtual void viewportDragMoveEvent( QDragMoveEvent * );
00197     virtual void viewportDragLeaveEvent( QDragLeaveEvent * );
00198     virtual void viewportDropEvent( QDropEvent * );
00199 #endif
00200 #ifndef QT_NO_WHEELEVENT
00201     virtual void viewportWheelEvent( QWheelEvent * );
00202 #endif
00203     virtual void viewportContextMenuEvent( QContextMenuEvent * );
00204 
00205     void        frameChanged();
00206 
00207     virtual void setMargins(int left, int top, int right, int bottom);
00208     int leftMargin() const;
00209     int topMargin() const;
00210     int rightMargin() const;
00211     int bottomMargin() const;
00212 
00213     bool focusNextPrevChild( bool next );
00214 
00215     virtual void setHBarGeometry(QScrollBar& hbar, int x, int y, int w, int h);
00216     virtual void setVBarGeometry(QScrollBar& vbar, int x, int y, int w, int h);
00217 
00218     void resizeEvent(QResizeEvent*);
00219     void  mousePressEvent( QMouseEvent * );
00220     void  mouseReleaseEvent( QMouseEvent * );
00221     void  mouseDoubleClickEvent( QMouseEvent * );
00222     void  mouseMoveEvent( QMouseEvent * );
00223 #ifndef QT_NO_WHEELEVENT
00224     void  wheelEvent( QWheelEvent * );
00225 #endif
00226     void contextMenuEvent( QContextMenuEvent * );
00227     bool eventFilter( QObject *, QEvent *e );
00228 
00229     void setCachedSizeHint( const QSize &sh ) const;
00230     QSize cachedSizeHint() const;
00231     void fontChange( const QFont & );
00232 
00233 private:
00234     void drawContents( QPainter* );
00235     void moveContents(int x, int y);
00236 
00237     QScrollViewData* d;
00238 
00239 private slots:
00240     void hslide(int);
00241     void vslide(int);
00242     void hbarIsPressed();
00243     void hbarIsReleased();
00244     void vbarIsPressed();
00245     void vbarIsReleased();
00246 #ifndef QT_NO_DRAGANDDROP
00247     void doDragAutoScroll();
00248     void startDragAutoScroll();
00249     void stopDragAutoScroll();
00250 #endif
00251 
00252 private: // Disabled copy constructor and operator=
00253 #if defined(Q_DISABLE_COPY)
00254     QScrollView( const QScrollView & );
00255     QScrollView &operator=( const QScrollView & );
00256 #endif
00257     void changeFrameRect(const QRect&);
00258 
00259 public:
00260     void disableSizeHintCaching();
00261 
00262 };
00263 
00264 #endif // QT_NO_SCROLLVIEW
00265 
00266 #endif // QSCROLLVIEW_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'