Eneboo - Documentación para desarrolladores
src/qt/src/widgets/qdockarea.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qdockarea.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of the QDockArea class
00005 **
00006 ** Created : 001010
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the workspace 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 licenses may use this
00022 ** file in accordance with the Qt Commercial License Agreement provided
00023 ** 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 QDOCKAREA_H
00039 #define QDOCKAREA_H
00040 
00041 #ifndef QT_H
00042 #include "qwidget.h"
00043 #include "qptrlist.h"
00044 #include "qdockwindow.h"
00045 #include "qlayout.h"
00046 #include "qvaluelist.h"
00047 #include "qguardedptr.h"
00048 #include "qtextstream.h"
00049 #endif // QT_H
00050 
00051 #ifndef QT_NO_MAINWINDOW
00052 
00053 class QSplitter;
00054 class QBoxLayout;
00055 class QDockAreaLayout;
00056 class QMouseEvent;
00057 class QDockWindowResizeHandle;
00058 class QDockAreaPrivate;
00059 
00060 class Q_EXPORT QDockAreaLayout : public QLayout
00061 {
00062     Q_OBJECT
00063     friend class QDockArea;
00064 
00065 public:
00066     QDockAreaLayout( QWidget* parent, Qt::Orientation o, QPtrList<QDockWindow> *wl, int space = -1, int margin = -1, const char *name = 0 )
00067         : QLayout( parent, space, margin, name ), orient( o ), dockWindows( wl ), parentWidget( parent ) { init(); }
00068     ~QDockAreaLayout() {}
00069 
00070     void addItem( QLayoutItem * ) {}
00071     bool hasHeightForWidth() const;
00072     int heightForWidth( int ) const;
00073     int widthForHeight( int ) const;
00074     QSize sizeHint() const;
00075     QSize minimumSize() const;
00076     QLayoutIterator iterator();
00077     QSizePolicy::ExpandData expanding() const { return QSizePolicy::NoDirection; }
00078     void invalidate();
00079     Qt::Orientation orientation() const { return orient; }
00080     QValueList<QRect> lineList() const { return lines; }
00081     QPtrList<QDockWindow> lineStarts() const { return ls; }
00082 
00083 protected:
00084     void setGeometry( const QRect& );
00085 
00086 private:
00087     void init();
00088     int layoutItems( const QRect&, bool testonly = FALSE );
00089     Qt::Orientation orient;
00090     bool dirty;
00091     int cached_width, cached_height;
00092     int cached_hfw, cached_wfh;
00093     QPtrList<QDockWindow> *dockWindows;
00094     QWidget *parentWidget;
00095     QValueList<QRect> lines;
00096     QPtrList<QDockWindow> ls;
00097 #if defined(Q_DISABLE_COPY) // Disabled copy constructor and operator=
00098     QDockAreaLayout( const QDockAreaLayout & );
00099     QDockAreaLayout &operator=( const QDockAreaLayout & );
00100 #endif
00101 };
00102 
00103 class Q_EXPORT QDockArea : public QWidget
00104 {
00105     Q_OBJECT
00106     Q_ENUMS( HandlePosition )
00107     Q_PROPERTY( Orientation orientation READ orientation )
00108     Q_PROPERTY( int count READ count )
00109     Q_PROPERTY( bool empty READ isEmpty )
00110     Q_PROPERTY( HandlePosition handlePosition READ handlePosition )
00111 
00112     friend class QDockWindow;
00113     friend class QDockWindowResizeHandle;
00114     friend class QDockAreaLayout;
00115 
00116 public:
00117     enum HandlePosition { Normal, Reverse };
00118 
00119     QDockArea( Orientation o, HandlePosition h = Normal, QWidget* parent=0, const char* name=0 );
00120     ~QDockArea();
00121 
00122     void moveDockWindow( QDockWindow *w, const QPoint &globalPos, const QRect &rect, bool swap );
00123     void removeDockWindow( QDockWindow *w, bool makeFloating, bool swap, bool fixNewLines = TRUE );
00124     void moveDockWindow( QDockWindow *w, int index = -1 );
00125     bool hasDockWindow( QDockWindow *w, int *index = 0 );
00126 
00127     void invalidNextOffset( QDockWindow *dw );
00128 
00129     Orientation orientation() const { return orient; }
00130     HandlePosition handlePosition() const { return hPos; }
00131 
00132     bool eventFilter( QObject *, QEvent * );
00133     bool isEmpty() const;
00134     int count() const;
00135     QPtrList<QDockWindow> dockWindowList() const;
00136 
00137     bool isDockWindowAccepted( QDockWindow *dw );
00138     void setAcceptDockWindow( QDockWindow *dw, bool accept );
00139 
00140 public slots:
00141     void lineUp( bool keepNewLines );
00142 
00143 private:
00144     struct DockWindowData
00145     {
00146         int index;
00147         int offset;
00148         int line;
00149         QSize fixedExtent;
00150         QGuardedPtr<QDockArea> area;
00151     };
00152 
00153     // ### AbanQ
00154 public:
00155     int findDockWindow( QDockWindow *w );
00156 private:
00157     // ### AbanQ
00158     
00159     int lineOf( int index );
00160     DockWindowData *dockWindowData( QDockWindow *w );
00161     void dockWindow( QDockWindow *dockWindow, DockWindowData *data );
00162     void updateLayout();
00163     void invalidateFixedSizes();
00164     int maxSpace( int hint, QDockWindow *dw );
00165     void setFixedExtent( int d, QDockWindow *dw );
00166     bool isLastDockWindow( QDockWindow *dw );
00167 
00168 private:
00169     Orientation orient;
00170     QPtrList<QDockWindow> *dockWindows;
00171     QDockAreaLayout *layout;
00172     HandlePosition hPos;
00173     QPtrList<QDockWindow> forbiddenWidgets;
00174     QDockAreaPrivate *d;
00175 
00176 private:        // Disabled copy constructor and operator=
00177 #if defined(Q_DISABLE_COPY)
00178     QDockArea( const QDockArea & );
00179     QDockArea& operator=( const QDockArea & );
00180 #endif
00181 
00182 };
00183 
00184 #ifndef QT_NO_TEXTSTREAM
00185 Q_EXPORT QTextStream &operator<<( QTextStream &, const QDockArea & );
00186 Q_EXPORT QTextStream &operator>>( QTextStream &, QDockArea & );
00187 #endif
00188 
00189 #define Q_DEFINED_QDOCKAREA
00190 #include "qwinexport.h"
00191 #endif
00192 
00193 #endif //QT_NO_MAINWINDOW
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'