Eneboo - Documentación para desarrolladores
src/qt/src/widgets/qsplitter.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qsplitter.h   3.3.8   edited Jan 11 14:39 $
00003 **
00004 ** Definition of QSplitter class
00005 **
00006 **  Created : 980105
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 QSPLITTER_H
00039 #define QSPLITTER_H
00040 
00041 #ifndef QT_H
00042 #include "qframe.h"
00043 #include "qvaluelist.h"
00044 #endif // QT_H
00045 
00046 #ifndef QT_NO_SPLITTER
00047 
00048 class QSplitterHandle;
00049 class QSplitterPrivate;
00050 class QSplitterLayoutStruct;
00051 class QTextStream;
00052 
00053 class Q_EXPORT QSplitter : public QFrame
00054 {
00055     Q_OBJECT
00056     Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
00057     Q_PROPERTY( bool opaqueResize READ opaqueResize WRITE setOpaqueResize )
00058     Q_PROPERTY( int handleWidth READ handleWidth WRITE setHandleWidth )
00059     Q_PROPERTY( bool childrenCollapsible READ childrenCollapsible WRITE setChildrenCollapsible )
00060 
00061 public:
00062     // ### Qt 4.0: remove Auto from public API
00063     enum ResizeMode { Stretch, KeepSize, FollowSizeHint, Auto };
00064 
00065     QSplitter( QWidget* parent = 0, const char* name = 0 );
00066     QSplitter( Orientation, QWidget* parent = 0, const char* name = 0 );
00067     ~QSplitter();
00068 
00069     virtual void setOrientation( Orientation );
00070     Orientation orientation() const { return orient; }
00071 
00072     // ### Qt 4.0: make setChildrenCollapsible() and setCollapsible() virtual
00073 
00074     void setChildrenCollapsible( bool );
00075     bool childrenCollapsible() const;
00076 
00077     void setCollapsible( QWidget *w, bool );
00078     virtual void setResizeMode( QWidget *w, ResizeMode );
00079     virtual void setOpaqueResize( bool = TRUE );
00080     bool opaqueResize() const;
00081 
00082     void moveToFirst( QWidget * );
00083     void moveToLast( QWidget * );
00084 
00085     void refresh() { recalc( TRUE ); }
00086     QSize sizeHint() const;
00087     QSize minimumSizeHint() const;
00088 
00089     QValueList<int> sizes() const;
00090     void setSizes( QValueList<int> );
00091 
00092     int handleWidth() const;
00093     void setHandleWidth( int );
00094 
00095 protected:
00096     void childEvent( QChildEvent * );
00097 
00098     bool event( QEvent * );
00099     void resizeEvent( QResizeEvent * );
00100 
00101     int idAfter( QWidget* ) const;
00102 
00103     void moveSplitter( QCOORD pos, int id );
00104     virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
00105                                QCOORD w, QCOORD h );
00106     void styleChange( QStyle& );
00107     int adjustPos( int, int );
00108     virtual void setRubberband( int );
00109     void getRange( int id, int *, int * );
00110 
00111 private:
00112     enum { DefaultResizeMode = 3 };
00113 
00114     void init();
00115     void recalc( bool update = FALSE );
00116     void doResize();
00117     void storeSizes();
00118     void getRange( int id, int *, int *, int *, int * );
00119     void addContribution( int, int *, int *, bool );
00120     int adjustPos( int, int, int *, int *, int *, int * );
00121     bool collapsible( QSplitterLayoutStruct * );
00122     void processChildEvents();
00123     QSplitterLayoutStruct *findWidget( QWidget * );
00124     QSplitterLayoutStruct *addWidget( QWidget *, bool prepend = FALSE );
00125     void recalcId();
00126     void doMove( bool backwards, int pos, int id, int delta, bool upLeft,
00127                  bool mayCollapse );
00128     void setGeo( QWidget *w, int pos, int size, bool splitterMoved );
00129     int findWidgetJustBeforeOrJustAfter( int id, int delta, int &collapsibleSize );
00130     void updateHandles();
00131 
00132     inline QCOORD pick( const QPoint &p ) const
00133     { return orient == Horizontal ? p.x() : p.y(); }
00134     inline QCOORD pick( const QSize &s ) const
00135     { return orient == Horizontal ? s.width() : s.height(); }
00136 
00137     inline QCOORD trans( const QPoint &p ) const
00138     { return orient == Vertical ? p.x() : p.y(); }
00139     inline QCOORD trans( const QSize &s ) const
00140     { return orient == Vertical ? s.width() : s.height(); }
00141 
00142     QSplitterPrivate *d;
00143 
00144     Orientation orient;
00145     friend class QSplitterHandle;
00146 
00147 #ifndef QT_NO_TEXTSTREAM
00148     friend Q_EXPORT QTextStream& operator<<( QTextStream&, const QSplitter& );
00149     friend Q_EXPORT QTextStream& operator>>( QTextStream&, QSplitter& );
00150 #endif
00151 
00152 private:
00153 #if defined(Q_DISABLE_COPY)
00154     QSplitter( const QSplitter & );
00155     QSplitter& operator=( const QSplitter & );
00156 #endif
00157 };
00158 
00159 #ifndef QT_NO_TEXTSTREAM
00160 Q_EXPORT QTextStream& operator<<( QTextStream&, const QSplitter& );
00161 Q_EXPORT QTextStream& operator>>( QTextStream&, QSplitter& );
00162 #endif
00163 
00164 #endif // QT_NO_SPLITTER
00165 
00166 #endif // QSPLITTER_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'