Eneboo - Documentación para desarrolladores
src/qt/include/qmainwindow.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qmainwindow.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QMainWindow class
00005 **
00006 ** Created : 980316
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 QMAINWINDOW_H
00039 #define QMAINWINDOW_H
00040 
00041 #ifndef QT_H
00042 #include "qwidget.h"
00043 #include "qtoolbar.h"
00044 #include "qptrlist.h"
00045 #include "qtextstream.h"
00046 #endif // QT_H
00047 
00048 #ifndef QT_NO_MAINWINDOW
00049 
00050 class QMenuBar;
00051 class QStatusBar;
00052 class QToolTipGroup;
00053 class QMainWindowPrivate;
00054 class QMainWindowLayout;
00055 class QPopupMenu;
00056 
00057 class Q_EXPORT QMainWindow: public QWidget
00058 {
00059     Q_OBJECT
00060     Q_PROPERTY( bool rightJustification READ rightJustification WRITE setRightJustification DESIGNABLE false )
00061     Q_PROPERTY( bool usesBigPixmaps READ usesBigPixmaps WRITE setUsesBigPixmaps )
00062     Q_PROPERTY( bool usesTextLabel READ usesTextLabel WRITE setUsesTextLabel )
00063     Q_PROPERTY( bool dockWindowsMovable READ dockWindowsMovable WRITE setDockWindowsMovable )
00064     Q_PROPERTY( bool opaqueMoving READ opaqueMoving WRITE setOpaqueMoving )
00065 
00066 public:
00067     QMainWindow( QWidget* parent=0, const char* name=0, WFlags f = WType_TopLevel );
00068     ~QMainWindow();
00069 
00070 #ifndef QT_NO_MENUBAR
00071     QMenuBar * menuBar() const;
00072 #endif
00073     QStatusBar * statusBar() const;
00074 #ifndef QT_NO_TOOLTIP
00075     QToolTipGroup * toolTipGroup() const;
00076 #endif
00077 
00078     virtual void setCentralWidget( QWidget * );
00079     QWidget * centralWidget() const;
00080 
00081     virtual void setDockEnabled( Dock dock, bool enable );
00082     bool isDockEnabled( Dock dock ) const;
00083     bool isDockEnabled( QDockArea *area ) const;
00084     virtual void setDockEnabled( QDockWindow *tb, Dock dock, bool enable );
00085     bool isDockEnabled( QDockWindow *tb, Dock dock ) const;
00086     bool isDockEnabled( QDockWindow *tb, QDockArea *area ) const;
00087 
00088     virtual void addDockWindow( QDockWindow *, Dock = DockTop, bool newLine = FALSE );
00089     virtual void addDockWindow( QDockWindow *, const QString &label,
00090                                 Dock = DockTop, bool newLine = FALSE );
00091     virtual void moveDockWindow( QDockWindow *, Dock = DockTop );
00092     virtual void moveDockWindow( QDockWindow *, Dock, bool nl, int index, int extraOffset = -1 );
00093     virtual void removeDockWindow( QDockWindow * );
00094 
00095     void show();
00096     void hide();
00097     QSize sizeHint() const;
00098     QSize minimumSizeHint() const;
00099 
00100     bool rightJustification() const;
00101     bool usesBigPixmaps() const;
00102     bool usesTextLabel() const;
00103     bool dockWindowsMovable() const;
00104     bool opaqueMoving() const;
00105 
00106     bool eventFilter( QObject*, QEvent* );
00107 
00108     bool getLocation( QDockWindow *tb, Dock &dock, int &index, bool &nl, int &extraOffset ) const;
00109 
00110     QPtrList<QDockWindow> dockWindows( Dock dock ) const;
00111     QPtrList<QDockWindow> dockWindows() const;
00112     void lineUpDockWindows( bool keepNewLines = FALSE );
00113 
00114     bool isDockMenuEnabled() const;
00115 
00116     // compatibility stuff
00117     bool hasDockWindow( QDockWindow *dw );
00118 #ifndef QT_NO_TOOLBAR
00119     void addToolBar( QDockWindow *, Dock = DockTop, bool newLine = FALSE );
00120     void addToolBar( QDockWindow *, const QString &label,
00121                      Dock = DockTop, bool newLine = FALSE );
00122     void moveToolBar( QDockWindow *, Dock = DockTop );
00123     void moveToolBar( QDockWindow *, Dock, bool nl, int index, int extraOffset = -1 );
00124     void removeToolBar( QDockWindow * );
00125 
00126     bool toolBarsMovable() const;
00127     QPtrList<QToolBar> toolBars( Dock dock ) const;
00128     void lineUpToolBars( bool keepNewLines = FALSE );
00129 #endif
00130 
00131     virtual QDockArea *dockingArea( const QPoint &p );
00132     QDockArea *leftDock() const;
00133     QDockArea *rightDock() const;
00134     QDockArea *topDock() const;
00135     QDockArea *bottomDock() const;
00136 
00137     virtual bool isCustomizable() const;
00138 
00139     bool appropriate( QDockWindow *dw ) const;
00140 
00141     enum DockWindows { OnlyToolBars, NoToolBars, AllDockWindows };
00142     QPopupMenu *createDockWindowMenu( DockWindows dockWindows = AllDockWindows ) const;
00143 
00144 public slots:
00145     virtual void setRightJustification( bool );
00146     virtual void setUsesBigPixmaps( bool );
00147     virtual void setUsesTextLabel( bool );
00148     virtual void setDockWindowsMovable( bool );
00149     virtual void setOpaqueMoving( bool );
00150     virtual void setDockMenuEnabled( bool );
00151     virtual void whatsThis();
00152     virtual void setAppropriate( QDockWindow *dw, bool a );
00153     virtual void customize();
00154 
00155     // compatibility stuff
00156     void setToolBarsMovable( bool );
00157 
00158 signals:
00159     void pixmapSizeChanged( bool );
00160     void usesTextLabelChanged( bool );
00161     void dockWindowPositionChanged( QDockWindow * );
00162 
00163 #ifndef QT_NO_TOOLBAR
00164     // compatibility stuff
00165     void toolBarPositionChanged( QToolBar * );
00166 #endif
00167 
00168 protected slots:
00169     virtual void setUpLayout();
00170     virtual bool showDockMenu( const QPoint &globalPos );
00171     void menuAboutToShow();
00172 
00173 protected:
00174     void paintEvent( QPaintEvent * );
00175     void childEvent( QChildEvent * );
00176     bool event( QEvent * );
00177     void styleChange( QStyle& );
00178 
00179 private slots:
00180     void slotPlaceChanged();
00181     void doLineUp() { lineUpDockWindows( TRUE ); }
00182 
00183 private:
00184     QMainWindowPrivate * d;
00185     void triggerLayout( bool deleteLayout = TRUE);
00186     bool dockMainWindow( QObject *dock );
00187 
00188 #ifndef QT_NO_MENUBAR
00189     virtual void setMenuBar( QMenuBar * );
00190 #endif
00191     virtual void setStatusBar( QStatusBar * );
00192 #ifndef QT_NO_TOOLTIP
00193     virtual void setToolTipGroup( QToolTipGroup * );
00194 #endif
00195 
00196     friend class QDockWindow;
00197     friend class QMenuBar;
00198     friend class QHideDock;
00199     friend class QToolBar;
00200     friend class QMainWindowLayout;
00201 private:        // Disabled copy constructor and operator=
00202 #if defined(Q_DISABLE_COPY)
00203     QMainWindow( const QMainWindow & );
00204     QMainWindow& operator=( const QMainWindow & );
00205 #endif
00206 };
00207 
00208 #ifndef QT_NO_TOOLBAR
00209 inline void QMainWindow::addToolBar( QDockWindow *w, ToolBarDock dock, bool newLine )
00210 {
00211     addDockWindow( w, dock, newLine );
00212 }
00213 
00214 inline void QMainWindow::addToolBar( QDockWindow *w, const QString &label,
00215                               ToolBarDock dock, bool newLine )
00216 {
00217     addDockWindow( w, label, dock, newLine );
00218 }
00219 
00220 inline void QMainWindow::moveToolBar( QDockWindow *w, ToolBarDock dock )
00221 {
00222     moveDockWindow( w, dock );
00223 }
00224 
00225 inline void QMainWindow::moveToolBar( QDockWindow *w, ToolBarDock dock, bool nl, int index, int extraOffset )
00226 {
00227     moveDockWindow( w, dock, nl, index, extraOffset );
00228 }
00229 
00230 inline void QMainWindow::removeToolBar( QDockWindow *w )
00231 {
00232     removeDockWindow( w );
00233 }
00234 
00235 inline bool QMainWindow::toolBarsMovable() const
00236 {
00237     return dockWindowsMovable();
00238 }
00239 
00240 inline void QMainWindow::lineUpToolBars( bool keepNewLines )
00241 {
00242     lineUpDockWindows( keepNewLines );
00243 }
00244 
00245 inline void QMainWindow::setToolBarsMovable( bool b )
00246 {
00247     setDockWindowsMovable( b );
00248 }
00249 #endif
00250 
00251 #ifndef QT_NO_TEXTSTREAM
00252 Q_EXPORT QTextStream &operator<<( QTextStream &, const QMainWindow & );
00253 Q_EXPORT QTextStream &operator>>( QTextStream &, QMainWindow & );
00254 #endif
00255 
00256 #endif // QT_NO_MAINWINDOW
00257 
00258 #endif // QMAINWINDOW_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'