home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / qt3_emx.zip / include / qmainwindow.h < prev    next >
C/C++ Source or Header  |  2001-10-11  |  8KB  |  258 lines

  1. /****************************************************************************
  2. ** $Id:  qt/qmainwindow.h   3.0.0   edited Sep 21 17:17 $
  3. **
  4. ** Definition of QMainWindow class
  5. **
  6. ** Created : 980316
  7. **
  8. ** Copyright (C) 1992-2000 Trolltech AS.  All rights reserved.
  9. **
  10. ** This file is part of the widgets module of the Qt GUI Toolkit.
  11. **
  12. ** This file may be distributed under the terms of the Q Public License
  13. ** as defined by Trolltech AS of Norway and appearing in the file
  14. ** LICENSE.QPL included in the packaging of this file.
  15. **
  16. ** This file may be distributed and/or modified under the terms of the
  17. ** GNU General Public License version 2 as published by the Free Software
  18. ** Foundation and appearing in the file LICENSE.GPL included in the
  19. ** packaging of this file.
  20. **
  21. ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
  22. ** licenses may use this file in accordance with the Qt Commercial License
  23. ** Agreement provided with the Software.
  24. **
  25. ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
  26. ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  27. **
  28. ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
  29. **   information about Qt Commercial License Agreements.
  30. ** See http://www.trolltech.com/qpl/ for QPL licensing information.
  31. ** See http://www.trolltech.com/gpl/ for GPL licensing information.
  32. **
  33. ** Contact info@trolltech.com if any conditions of this licensing are
  34. ** not clear to you.
  35. **
  36. **********************************************************************/
  37.  
  38. #ifndef QMAINWINDOW_H
  39. #define QMAINWINDOW_H
  40.  
  41. #ifndef QT_H
  42. #include "qwidget.h"
  43. #include "qtoolbar.h"
  44. #include "qptrlist.h"
  45. #include "qtextstream.h"
  46. #endif // QT_H
  47.  
  48. #ifndef QT_NO_MAINWINDOW
  49.  
  50. class QMenuBar;
  51. class QStatusBar;
  52. class QToolTipGroup;
  53. class QMainWindowPrivate;
  54. class QMainWindowLayout;
  55. class QPopupMenu;
  56.  
  57. class Q_EXPORT QMainWindow: public QWidget
  58. {
  59.     Q_OBJECT
  60.     Q_PROPERTY( bool rightJustification READ rightJustification WRITE setRightJustification )
  61.     Q_PROPERTY( bool usesBigPixmaps READ usesBigPixmaps WRITE setUsesBigPixmaps )
  62.     Q_PROPERTY( bool usesTextLabel READ usesTextLabel WRITE setUsesTextLabel )
  63.     Q_PROPERTY( bool dockWindowsMovable READ dockWindowsMovable WRITE setDockWindowsMovable )
  64.     Q_PROPERTY( bool opaqueMoving READ opaqueMoving WRITE setOpaqueMoving )
  65.  
  66. public:
  67.     QMainWindow( QWidget* parent=0, const char* name=0, WFlags f = WType_TopLevel );
  68.     ~QMainWindow();
  69.  
  70. #ifndef QT_NO_MENUBAR
  71.     QMenuBar * menuBar() const;
  72. #endif
  73.     QStatusBar * statusBar() const;
  74. #ifndef QT_NO_TOOLTIP
  75.     QToolTipGroup * toolTipGroup() const;
  76. #endif
  77.  
  78.     virtual void setCentralWidget( QWidget * );
  79.     QWidget * centralWidget() const;
  80.  
  81.     virtual void setDockEnabled( Dock dock, bool enable );
  82.     bool isDockEnabled( Dock dock ) const;
  83.     bool isDockEnabled( QDockArea *area ) const;
  84.     virtual void setDockEnabled( QDockWindow *tb, Dock dock, bool enable );
  85.     bool isDockEnabled( QDockWindow *tb, Dock dock ) const;
  86.     bool isDockEnabled( QDockWindow *tb, QDockArea *area ) const;
  87.  
  88.     virtual void addDockWindow( QDockWindow *, Dock = DockTop, bool newLine = FALSE );
  89.     virtual void addDockWindow( QDockWindow *, const QString &label,
  90.                 Dock = DockTop, bool newLine = FALSE );
  91.     virtual void moveDockWindow( QDockWindow *, Dock = DockTop );
  92.     virtual void moveDockWindow( QDockWindow *, Dock, bool nl, int index, int extraOffset = -1 );
  93.     virtual void removeDockWindow( QDockWindow * );
  94.  
  95.     void show();
  96.     QSize sizeHint() const;
  97.     QSize minimumSizeHint() const;
  98.  
  99.     bool rightJustification() const;
  100.     bool usesBigPixmaps() const;
  101.     bool usesTextLabel() const;
  102.     bool dockWindowsMovable() const;
  103.     bool opaqueMoving() const;
  104.  
  105.     bool eventFilter( QObject*, QEvent* );
  106.  
  107.     bool getLocation( QDockWindow *tb, Dock &dock, int &index, bool &nl, int &extraOffset ) const;
  108.  
  109.     QPtrList<QDockWindow> dockWindows( Dock dock ) const;
  110.     QPtrList<QDockWindow> dockWindows() const;
  111.     void lineUpDockWindows( bool keepNewLines = FALSE );
  112.  
  113.     bool isDockMenuEnabled() const;
  114.  
  115.     // compatibility stuff
  116.     bool hasDockWindow( QDockWindow *dw );
  117. #ifndef QT_NO_TOOLBAR
  118.     void addToolBar( QDockWindow *, Dock = DockTop, bool newLine = FALSE );
  119.     void addToolBar( QDockWindow *, const QString &label,
  120.              Dock = DockTop, bool newLine = FALSE );
  121.     void moveToolBar( QDockWindow *, Dock = DockTop );
  122.     void moveToolBar( QDockWindow *, Dock, bool nl, int index, int extraOffset = -1 );
  123.     void removeToolBar( QDockWindow * );
  124.  
  125.     bool toolBarsMovable() const;
  126.     QPtrList<QToolBar> toolBars( Dock dock ) const;
  127.     void lineUpToolBars( bool keepNewLines = FALSE );
  128. #endif
  129.  
  130.     virtual QDockArea *dockingArea( const QPoint &p );
  131.     QDockArea *leftDock() const;
  132.     QDockArea *rightDock() const;
  133.     QDockArea *topDock() const;
  134.     QDockArea *bottomDock() const;
  135.  
  136.     virtual bool isCustomizable() const;
  137.  
  138.     bool appropriate( QDockWindow *dw ) const;
  139.  
  140.     enum DockWindows { OnlyToolBars, NoToolBars, AllDockWindows };
  141.     QPopupMenu *createDockWindowMenu( DockWindows dockWindows = AllDockWindows ) const;
  142.  
  143. public slots:
  144.     virtual void setRightJustification( bool );
  145.     virtual void setUsesBigPixmaps( bool );
  146.     virtual void setUsesTextLabel( bool );
  147.     virtual void setDockWindowsMovable( bool );
  148.     virtual void setOpaqueMoving( bool );
  149.     virtual void setDockMenuEnabled( bool );
  150.     virtual void whatsThis();
  151.     virtual void setAppropriate( QDockWindow *dw, bool a );
  152.     virtual void customize();
  153.  
  154.     // compatibility stuff
  155.     void setToolBarsMovable( bool );
  156.  
  157. signals:
  158.     void pixmapSizeChanged( bool );
  159.     void usesTextLabelChanged( bool );
  160.     void dockWindowPositionChanged( QDockWindow * );
  161.  
  162. #ifndef QT_NO_TOOLBAR
  163.     // compatibility stuff
  164.     void toolBarPositionChanged( QToolBar * );
  165. #endif
  166.  
  167. protected slots:
  168.     virtual void setUpLayout();
  169.     virtual bool showDockMenu( const QPoint &globalPos );
  170.     void menuAboutToShow();
  171.  
  172. protected:
  173.     void paintEvent( QPaintEvent * );
  174.     void childEvent( QChildEvent * );
  175.     bool event( QEvent * );
  176.     void styleChange( QStyle& );
  177.  
  178. private slots:
  179.     void slotPlaceChanged();
  180.     void doLineUp() { lineUpDockWindows( TRUE ); }
  181.  
  182. private:
  183.     QMainWindowPrivate * d;
  184.     void triggerLayout( bool deleteLayout = TRUE);
  185.     bool dockMainWindow( QObject *dock );
  186.  
  187. #ifndef QT_NO_MENUBAR
  188.     virtual void setMenuBar( QMenuBar * );
  189. #endif
  190.     virtual void setStatusBar( QStatusBar * );
  191. #ifndef QT_NO_TOOLTIP
  192.     virtual void setToolTipGroup( QToolTipGroup * );
  193. #endif
  194.  
  195.     friend class QDockWindow;
  196.     friend class QMenuBar;
  197.     friend class QHideDock;
  198.     friend class QToolBar;
  199.     friend class QMainWindowLayout;
  200. private:    // Disabled copy constructor and operator=
  201. #if defined(Q_DISABLE_COPY)
  202.     QMainWindow( const QMainWindow & );
  203.     QMainWindow& operator=( const QMainWindow & );
  204. #endif
  205. };
  206.  
  207. #ifndef QT_NO_TOOLBAR
  208. inline void QMainWindow::addToolBar( QDockWindow *w, ToolBarDock dock, bool newLine )
  209. {
  210.     addDockWindow( w, dock, newLine );
  211. }
  212.  
  213. inline void QMainWindow::addToolBar( QDockWindow *w, const QString &label,
  214.                   ToolBarDock dock, bool newLine )
  215. {
  216.     addDockWindow( w, label, dock, newLine );
  217. }
  218.  
  219. inline void QMainWindow::moveToolBar( QDockWindow *w, ToolBarDock dock )
  220. {
  221.     moveDockWindow( w, dock );
  222. }
  223.  
  224. inline void QMainWindow::moveToolBar( QDockWindow *w, ToolBarDock dock, bool nl, int index, int extraOffset )
  225. {
  226.     moveDockWindow( w, dock, nl, index, extraOffset );
  227. }
  228.  
  229. inline void QMainWindow::removeToolBar( QDockWindow *w )
  230. {
  231.     removeDockWindow( w );
  232. }
  233.  
  234. inline bool QMainWindow::toolBarsMovable() const
  235. {
  236.     return dockWindowsMovable();
  237. }
  238.  
  239. inline void QMainWindow::lineUpToolBars( bool keepNewLines )
  240. {
  241.     lineUpDockWindows( keepNewLines );
  242. }
  243.  
  244. inline void QMainWindow::setToolBarsMovable( bool b )
  245. {
  246.     setDockWindowsMovable( b );
  247. }
  248. #endif
  249.  
  250. #ifndef QT_NO_TEXTSTREAM
  251. Q_EXPORT QTextStream &operator<<( QTextStream &, const QMainWindow & );
  252. Q_EXPORT QTextStream &operator>>( QTextStream &, QMainWindow & );
  253. #endif
  254.  
  255. #endif // QT_NO_MAINWINDOW
  256.  
  257. #endif // QMAINWINDOW_H
  258.