Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

qsplitter.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 ** $Id: qsplitter.h,v 1.1 2004/01/13 21:15:13 mickeyl Exp $
00003 **
00004 ** Defintion of  QSplitter class
00005 **
00006 **  Created:  980105
00007 **
00008 ** Copyright (C) 1992-2000 Trolltech AS.  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 AS 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 QSPLITTER_H
00038 #define QSPLITTER_H
00039 
00040 #ifndef QT_H
00041 #include "qframe.h"
00042 #include "qvaluelist.h"
00043 #endif // QT_H
00044 
00045 class QSplitterHandle;
00046 class QSplitterData;
00047 class QSplitterLayoutStruct;
00048 
00049 class Q_EXPORT QSplitter : public QFrame
00050 {
00051     Q_OBJECT
00052     Q_PROPERTY( Orientation orientation READ orientation WRITE setOrientation )
00053 
00054 public:
00055     enum ResizeMode { Stretch, KeepSize, FollowSizeHint };
00056 
00057     QSplitter( QWidget *parent=0, const char *name=0 );
00058     QSplitter( Orientation, QWidget *parent=0, const char *name=0 );
00059     ~QSplitter();
00060 
00061     virtual void setOrientation( Orientation );
00062     Orientation orientation() const { return orient; }
00063 
00064     virtual void setResizeMode( QWidget *w, ResizeMode );
00065     virtual void setOpaqueResize( bool = TRUE );
00066     bool opaqueResize() const;
00067 
00068     void moveToFirst( QWidget * );
00069     void moveToLast( QWidget * );
00070 
00071     void refresh() { recalc( TRUE ); }
00072     QSize sizeHint() const;
00073     QSize minimumSizeHint() const;
00074     QSizePolicy sizePolicy() const;
00075 
00076     QValueList<int> sizes() const;
00077     void setSizes( QValueList<int> );
00078 
00079 protected:
00080     void childEvent( QChildEvent * );
00081 
00082     bool event( QEvent * );
00083     void resizeEvent( QResizeEvent * );
00084 
00085     int idAfter( QWidget* ) const;
00086 
00087     void moveSplitter( QCOORD pos, int id );
00088     virtual void drawSplitter( QPainter*, QCOORD x, QCOORD y,
00089                                QCOORD w, QCOORD h );
00090     void styleChange( QStyle& );
00091     int adjustPos( int , int );
00092     virtual void setRubberband( int );
00093     void getRange( int id, int*, int* );
00094 
00095 private:
00096     void init();
00097     void recalc( bool update = FALSE );
00098     void doResize();
00099     void storeSizes();
00100     void processChildEvents();
00101     QSplitterLayoutStruct *addWidget( QWidget*, bool first = FALSE );
00102     void recalcId();
00103     void moveBefore( int pos, int id, bool upLeft );
00104     void moveAfter( int pos, int id, bool upLeft );
00105     void setG( QWidget *w, int p, int s );
00106 
00107     QCOORD pick( const QPoint &p ) const
00108     { return orient == Horizontal ? p.x() : p.y(); }
00109     QCOORD pick( const QSize &s ) const
00110     { return orient == Horizontal ? s.width() : s.height(); }
00111 
00112     QCOORD trans( const QPoint &p ) const
00113     { return orient == Vertical ? p.x() : p.y(); }
00114     QCOORD trans( const QSize &s ) const
00115     { return orient == Vertical ? s.width() : s.height(); }
00116 
00117     QSplitterData *data;
00118 
00119     Orientation orient;
00120     friend class QSplitterHandle;
00121 private:        // Disabled copy constructor and operator=
00122 #if defined(Q_DISABLE_COPY)
00123     QSplitter( const QSplitter & );
00124     QSplitter& operator=( const QSplitter & );
00125 #endif
00126 };
00127 
00128 #endif // QSPLITTER_H

Generated on Sat Nov 5 16:16:31 2005 for OPIE by  doxygen 1.4.2