Eneboo - Documentación para desarrolladores
src/qt/src/widgets/qdockwindow.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qdockwindow.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of the QDockWindow 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 QDOCKWINDOW_H
00039 #define QDOCKWINDOW_H
00040 
00041 #ifndef QT_H
00042 #include "qframe.h"
00043 #endif // QT_H
00044 
00045 #ifndef QT_NO_MAINWINDOW
00046 
00047 class QDockWindowHandle;
00048 class QDockWindowTitleBar;
00049 class QPainter;
00050 class QDockWindowResizeHandle;
00051 class QBoxLayout;
00052 class QHBoxLayout;
00053 class QVBoxLayout;
00054 class QDockArea;
00055 class QWidgetResizeHandler;
00056 class QMainWindow;
00057 class QDockAreaLayout;
00058 class QDockWindowPrivate;
00059 class QToolBar;
00060 class QWindowsXPStyle;
00061 
00062 class Q_EXPORT QDockWindow : public QFrame
00063 {
00064     Q_OBJECT
00065     Q_ENUMS( CloseMode Place )
00066     Q_PROPERTY( int closeMode READ closeMode  WRITE setCloseMode ) //### this shouldn't be of type int?!
00067     Q_PROPERTY( bool resizeEnabled READ isResizeEnabled  WRITE setResizeEnabled )
00068     Q_PROPERTY( bool movingEnabled READ isMovingEnabled  WRITE setMovingEnabled )
00069     Q_PROPERTY( bool horizontallyStretchable READ isHorizontallyStretchable  WRITE setHorizontallyStretchable )
00070     Q_PROPERTY( bool verticallyStretchable READ isVerticallyStretchable  WRITE setVerticallyStretchable )
00071     Q_PROPERTY( bool stretchable READ isStretchable )
00072     Q_PROPERTY( bool newLine READ newLine  WRITE setNewLine )
00073     Q_PROPERTY( bool opaqueMoving READ opaqueMoving  WRITE setOpaqueMoving )
00074     Q_PROPERTY( int offset READ offset  WRITE setOffset )
00075     Q_PROPERTY( Place place READ place )
00076 
00077     friend class QDockWindowHandle;
00078     friend class QDockWindowTitleBar;
00079     friend class QDockArea;
00080     friend class QDockAreaLayout;
00081     friend class QMainWindow;
00082     friend class QCEMainWindow;
00083     friend class QToolBar;
00084     friend class QWindowsXPStyle;
00085 
00086 public:
00087     enum Place { InDock, OutsideDock };
00088     enum CloseMode { Never = 0, Docked = 1, Undocked = 2, Always = Docked | Undocked };
00089 
00090     QDockWindow( Place p = InDock, QWidget* parent=0, const char* name=0, WFlags f = 0 );
00091     QDockWindow( QWidget* parent, const char* name=0, WFlags f = 0 );
00092     ~QDockWindow();
00093 
00094     virtual void setWidget( QWidget *w );
00095     QWidget *widget() const;
00096 
00097     Place place() const { return curPlace; }
00098 
00099     QDockArea *area() const;
00100 
00101     virtual void setCloseMode( int m );
00102     bool isCloseEnabled() const;
00103     int closeMode() const;
00104 
00105     virtual void setResizeEnabled( bool b );
00106     virtual void setMovingEnabled( bool b );
00107     bool isResizeEnabled() const;
00108     bool isMovingEnabled() const;
00109 
00110     virtual void setHorizontallyStretchable( bool b );
00111     virtual void setVerticallyStretchable( bool b );
00112     bool isHorizontallyStretchable() const;
00113     bool isVerticallyStretchable() const;
00114     void setHorizontalStretchable( bool b ) { setHorizontallyStretchable( b ); }
00115     void setVerticalStretchable( bool b ) { setVerticallyStretchable( b ); }
00116     bool isHorizontalStretchable() const { return isHorizontallyStretchable(); }
00117     bool isVerticalStretchable() const { return isVerticallyStretchable(); }
00118     bool isStretchable() const;
00119 
00120     virtual void setOffset( int o );
00121     int offset() const;
00122 
00123     virtual void setFixedExtentWidth( int w );
00124     virtual void setFixedExtentHeight( int h );
00125     QSize fixedExtent() const;
00126 
00127     virtual void setNewLine( bool b );
00128     bool newLine() const;
00129 
00130     Qt::Orientation orientation() const;
00131 
00132     QSize sizeHint() const;
00133     QSize minimumSize() const;
00134     QSize minimumSizeHint() const;
00135 
00136     QBoxLayout *boxLayout();
00137 
00138     virtual void setOpaqueMoving( bool b );
00139     bool opaqueMoving() const;
00140 
00141     bool eventFilter( QObject *o, QEvent *e );
00142 
00143 #ifdef QT_NO_WIDGET_TOPEXTRA
00144     QString caption() const;
00145 #endif
00146 
00147 signals:
00148     void orientationChanged( Orientation o );
00149     void placeChanged( QDockWindow::Place p );
00150     void visibilityChanged( bool );
00151 
00152 public slots:
00153     virtual void undock( QWidget *w );
00154     virtual void undock() { undock( 0 ); }
00155     virtual void dock();
00156     virtual void setOrientation( Orientation o );
00157     void setCaption( const QString &s );
00158 
00159 protected:
00160     void resizeEvent( QResizeEvent *e );
00161     void showEvent( QShowEvent *e );
00162     void hideEvent( QHideEvent *e );
00163     void contextMenuEvent( QContextMenuEvent *e );
00164 
00165     void drawFrame( QPainter * );
00166     void drawContents( QPainter * );
00167 
00168     bool event( QEvent *e );
00169 
00170 private slots:
00171     void toggleVisible() { if ( !isVisible() ) show(); else hide(); }
00172 
00173 private:
00174     QDockWindow( Place p, QWidget* parent, const char* name, WFlags f, bool toolbar );
00175 
00176     void handleMove( const QPoint &pos, const QPoint &gp, bool drawRect );
00177     void updateGui();
00178     void updateSplitterVisibility( bool visible );
00179 
00180     void startRectDraw( const QPoint &so, bool drawRect );
00181     void endRectDraw( bool drawRect );
00182     void updatePosition( const QPoint &globalPos  );
00183     QWidget *areaAt( const QPoint &gp );
00184     void removeFromDock( bool fixNewLines = TRUE );
00185     void swapRect( QRect &r, Qt::Orientation o, const QPoint &offset, QDockArea *area );
00186     void init();
00187 
00188 private:
00189     QDockWindowHandle *horHandle, *verHandle;
00190     QDockWindowTitleBar *titleBar;
00191     QWidget *wid;
00192     QPainter *unclippedPainter;
00193     QDockArea *dockArea, *tmpDockArea;
00194     QRect currRect;
00195     Place curPlace;
00196     Place state;
00197     bool resizeEnabled : 1;
00198     bool moveEnabled : 1;
00199     bool nl : 1;
00200     bool opaque : 1;
00201     bool isToolbar : 1;
00202     bool stretchable[ 3 ];
00203     Orientation startOrientation;
00204     int cMode;
00205     QPoint startOffset;
00206     int offs;
00207     QSize fExtent;
00208     QDockWindowResizeHandle *hHandleTop, *hHandleBottom, *vHandleLeft, *vHandleRight;
00209     QVBoxLayout *hbox;
00210     QHBoxLayout *vbox;
00211     QBoxLayout *childBox;
00212     void *dockWindowData;
00213     QPoint lastPos;
00214     QSize lastSize;
00215     QWidgetResizeHandler *widgetResizeHandler;
00216     QDockWindowPrivate *d;
00217 
00218 private:        // Disabled copy constructor and operator=
00219 #if defined(Q_DISABLE_COPY)
00220     QDockWindow( const QDockWindow & );
00221     QDockWindow& operator=( const QDockWindow & );
00222 #endif
00223 };
00224 
00225 inline QDockArea *QDockWindow::area() const
00226 {
00227     return dockArea;
00228 }
00229 
00230 #define Q_DEFINED_QDOCKWINDOW
00231 #include "qwinexport.h"
00232 #endif
00233 
00234 #endif // QDOCKWINDOW_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'