# kmdi Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | Source Files

# kmdimainfrm.h

    00001 //----------------------------------------------------------------------------
    00002 //    filename             : kmdimainfrm.h
    00003 //----------------------------------------------------------------------------
    00004 //    Project              : KDE MDI extension
    00005 //
    00006 //    begin                : 07/1999       by Szymon Stefanek as part of kvirc
    00007 //                                         (an IRC application)
    00008 //    changes              : 09/1999       by Falk Brettschneider to create an
    00009 //                           - 06/2000     stand-alone Qt extension set of
    00010 //                                         classes and a Qt-based library
    00011 //                         : 02/2000       by Massimo Morin (mmorin@schedsys.com)
    00012 //                           2000-2003     maintained by the KDevelop project
    00013 //    patches              : */2000        by Lars Beikirch (Lars.Beikirch@gmx.net)
    00014 //                         : 01/2003       by Jens Zurheide (jens.zurheide@gmx.de)
    00015 //
    00016 //    copyright            : (C) 1999-2003 by Falk Brettschneider
    00017 //                                         and
    00018 //                                         Szymon Stefanek (stefanek@tin.it)
    00019 //    email                :  falkbr@kdevelop.org (Falk Brettschneider)
    00020 //----------------------------------------------------------------------------
    00021 //
    00022 //----------------------------------------------------------------------------
    00023 //
    00024 //    This program is free software; you can redistribute it and/or modify
    00025 //    it under the terms of the GNU Library General Public License as
    00026 //    published by the Free Software Foundation; either version 2 of the
    00027 //    License, or (at your option) any later version.
    00028 //
    00029 //----------------------------------------------------------------------------
    00030
    00031 #ifndef _KMDIMAINFRM_H_
    00032 #define _KMDIMAINFRM_H_
    00033
    00034 #include <kparts/dockmainwindow.h>
    00035 #include <kmenubar.h>
    00036 #include <kpopupmenu.h>
    00037
    00038 #include <qptrlist.h>
    00039 #include <qrect.h>
    00040 #include <qapplication.h>
    00041 #include <qdom.h>
    00042 #include <qguardedptr.h>
    00043
    00044 #include "kmditaskbar.h"
    00045 #include "kmdichildarea.h"
    00046 #include "kmdichildview.h"
    00047 #include "kmdiiterator.h"
    00048 #include "kmdilistiterator.h"
    00049 #include "kmdinulliterator.h"
    00050 #include "kmditoolviewaccessor.h"
    00051
    00052 class QTimer;
    00053 class QPopupMenu;
    00054 class QMenuBar;
    00055
    00056
    00057 class QToolButton;
    00058
    00059 namespace KMDIPrivate
    00060 {
    00061 class KMDIGUIClient;
    00062 }
    00063
    00064 class KMdiDockContainer;
    00065 class KMdiMainFrmPrivate;
    00066
    00072 class KMDI_EXPORT KMdiViewCloseEvent : public QCustomEvent
    00073 {
    00074 public:
    00075     KMdiViewCloseEvent( KMdiChildView* pWnd ) : QCustomEvent( QEvent::User, pWnd ) {}
    00076 };
    00077
    00239 class KMDI_EXPORT KMdiMainFrm : public KParts::DockMainWindow
    00240 {
    00241     friend class KMdiChildView;
    00242     friend class KMdiTaskBar;
    00243     Q_OBJECT
    00244
    00245     friend class KMdiToolViewAccessor;
    00246     // attributes
    00247 protected:
    00248     KMdi::MdiMode m_mdiMode;
    00249     KMdiChildArea *m_pMdi;
    00250     KMdiTaskBar *m_pTaskBar;
    00251     QPtrList<KMdiChildView> *m_pDocumentViews;
    00252     QMap<QWidget*, KMdiToolViewAccessor*> *m_pToolViews;
    00253     KMdiChildView *m_pCurrentWindow;
    00254     QPopupMenu *m_pWindowPopup;
    00255     QPopupMenu *m_pTaskBarPopup;
    00256     QPopupMenu *m_pWindowMenu;
    00257     QPopupMenu *m_pDockMenu;
    00258     QPopupMenu *m_pMdiModeMenu;
    00259     QPopupMenu *m_pPlacingMenu;
    00260     KMenuBar *m_pMainMenuBar;
    00261
    00262     QPixmap *m_pUndockButtonPixmap;
    00263     QPixmap *m_pMinButtonPixmap;
    00264     QPixmap *m_pRestoreButtonPixmap;
    00265     QPixmap *m_pCloseButtonPixmap;
    00266
    00267     QToolButton *m_pUndock;
    00268     QToolButton *m_pMinimize;
    00269     QToolButton *m_pRestore;
    00270     QToolButton *m_pClose;
    00271     QPoint m_undockPositioningOffset;
    00272     bool m_bMaximizedChildFrmMode;
    00273     int m_oldMainFrmHeight;
    00274     int m_oldMainFrmMinHeight;
    00275     int m_oldMainFrmMaxHeight;
    00276     static KMdi::FrameDecor m_frameDecoration;
    00277     bool m_bSDIApplication;
    00278     KDockWidget* m_pDockbaseAreaOfDocumentViews;
    00279     QDomDocument* m_pTempDockSession;
    00280     bool m_bClearingOfWindowMenuBlocked;
    00281
    00282     QTimer* m_pDragEndTimer;
    00283
    00284     bool m_bSwitching;
    00285
    00286     KDockWidget* m_leftContainer;
    00287     KDockWidget* m_rightContainer;
    00288     KDockWidget* m_topContainer;
    00289     KDockWidget* m_bottomContainer;
    00290
    00291
    00292 private:
    00293     KMdiMainFrmPrivate* d;
    00294     KMDIPrivate::KMDIGUIClient* m_mdiGUIClient;
    00295     bool m_managedDockPositionMode;
    00296
    00297     // methods
    00298 public:
    00299     KMdiMainFrm( QWidget* parentWidget, const char* name = "", KMdi::MdiMode mdiMode = KMdi::ChildframeMode, WFlags flags = WType_TopLevel | WDestructiveClose );
    00300     virtual ~KMdiMainFrm();
    00301
    00306     void setStandardMDIMenuEnabled( bool showModeMenu = true );
    00307
    00308     void setManagedDockPositionModeEnabled( bool enabled );
    00309
    00313     bool isInMaximizedChildFrmMode() { return m_bMaximizedChildFrmMode; }
    00314
    00318     KMdi::MdiMode mdiMode() { return m_mdiMode; }
    00319
    00323     KMdiChildView* activeWindow();
    00324
    00332     virtual QPopupMenu * taskBarPopup( KMdiChildView *pWnd, bool bIncludeWindowPopup = false );
    00333
    00338     virtual QPopupMenu * windowPopup( KMdiChildView *pWnd, bool bIncludeTaskbarPopup = true );
    00339
    00343     virtual void applyOptions();
    00344
    00348     KMdiChildView * findWindow( const QString& caption );
    00349
    00350     enum ExistsAs {DocumentView, ToolView, AnyView};
    00354     bool windowExists( KMdiChildView *pWnd, ExistsAs as );
    00355
    00368     virtual bool event( QEvent* e );
    00369
    00373     virtual void setSysButtonsAtMenuPosition();
    00374
    00378     virtual int taskBarHeight() { return m_pTaskBar ? m_pTaskBar->height() : 0; }
    00379
    00384     virtual void setUndockPositioningOffset( QPoint offset ) { m_undockPositioningOffset = offset; }
    00385
    00391     // FIXME And what exactly are we supposed to fix? -mattr
    00392     KMdiIterator<KMdiChildView*>* createIterator()
    00393     {
    00394         if ( m_pDocumentViews == 0L )
    00395         {
    00396             return new KMdiNullIterator<KMdiChildView*>();
    00397         }
    00398         else
    00399         {
    00400             return new KMdiListIterator<KMdiChildView>( *m_pDocumentViews );
    00401         }
    00402     }
    00403
    00407     void deleteIterator( KMdiIterator<KMdiChildView*>* pIt )
    00408     {
    00409         delete pIt;
    00410     }
    00411
    00417     QPopupMenu* windowMenu() const  { return m_pWindowMenu; };
    00418
    00422     virtual void setBackgroundColor( const QColor &c ) { m_pMdi->setBackgroundColor( c ); }
    00423
    00427     virtual void setBackgroundPixmap( const QPixmap &pm ) { m_pMdi->setBackgroundPixmap( pm ); }
    00428
    00433     void setDefaultChildFrmSize( const QSize& sz ) { m_pMdi->m_defaultChildFrmSize = sz; }
    00434
    00438     QSize defaultChildFrmSize() { return m_pMdi->m_defaultChildFrmSize; }
    00439
    00443     virtual void setMinimumSize( int minw, int minh );
    00444
    00448     int childFrameModeHeight() { return m_oldMainFrmHeight; };
    00455     virtual void setMenuForSDIModeSysButtons( KMenuBar* menuBar = 0 );
    00456
    00460     static int frameDecorOfAttachedViews() { return m_frameDecoration; }
    00461
    00468     void fakeSDIApplication();
    00469
    00473     bool isFakingSDIApplication() const { return m_bSDIApplication; }
    00474
    00475     virtual bool eventFilter( QObject *obj, QEvent *e );
    00476     void findRootDockWidgets( QPtrList<KDockWidget>* pRootDockWidgetList, QValueList<QRect>* pPositionList );
    00477
    00479     void setSwitching( const bool switching ) { m_bSwitching = switching; }
    00480     bool switching( void ) const { return m_bSwitching; }
    00481
    00482 public slots:
    00487     KMdiChildView* createWrapper( QWidget *view, const QString& name, const QString& shortName );
    00488
    00497     virtual void addWindow( KMdiChildView* pView, int flags = KMdi::StandardAdd );
    00498
    00499     //KDE4: merge the two methods
    00512     void addWindow( KMdiChildView* pView, int flags, int index );
    00513
    00524     virtual void addWindow( KMdiChildView* pView, QPoint pos, int flags = KMdi::StandardAdd );
    00525
    00536     virtual void addWindow( KMdiChildView* pView, QRect rectNormal, int flags = KMdi::StandardAdd );
    00537
    00542     virtual KMdiToolViewAccessor *addToolWindow( QWidget* pWnd, KDockWidget::DockPosition pos = KDockWidget::DockNone,
    00543                                                  QWidget* pTargetWnd = 0L, int percent = 50, const QString& tabToolTip = 0,
    00544                                                  const QString& tabCaption = 0 );
    00545
    00546     virtual void deleteToolWindow( QWidget* pWnd );
    00547     virtual void deleteToolWindow( KMdiToolViewAccessor *accessor );
    00548
    00553     KMdiToolViewAccessor *createToolWindow();
    00554
    00560     virtual void removeWindowFromMdi( KMdiChildView *pWnd );
    00561
    00566     virtual void closeWindow( KMdiChildView *pWnd, bool layoutTaskBar = true );
    00567
    00571     virtual void slot_toggleTaskBar();
    00572
    00578     virtual void attachWindow( KMdiChildView *pWnd, bool bShow = true, bool bAutomaticResize = false );
    00579
    00584     virtual void detachWindow( KMdiChildView *pWnd, bool bShow = true );
    00585
    00590     virtual void childWindowCloseRequest( KMdiChildView *pWnd );
    00591
    00595     virtual void closeAllViews();
    00596
    00600     virtual void iconifyAllViews();
    00601
    00605     virtual void closeActiveView();
    00606
    00610     virtual void switchToToplevelMode();
    00611     virtual void finishToplevelMode();
    00612
    00616     virtual void switchToChildframeMode();
    00617     virtual void finishChildframeMode();
    00618
    00622     virtual void switchToTabPageMode();
    00623     virtual void finishTabPageMode();
    00624
    00628     virtual void switchToIDEAlMode();
    00629     virtual void finishIDEAlMode( bool full = true );
    00630
    00635     void setIDEAlModeStyle( int flags ) KDE_DEPRECATED;
    00636     //KDE4: Get rid of the above.
    00642     void setToolviewStyle( int flags );
    00646     bool isViewTaskBarOn();
    00647
    00651     virtual void showViewTaskBar();
    00652
    00656     virtual void hideViewTaskBar();
    00657
    00661     virtual void fillWindowMenu();
    00662
    00666     virtual void cascadeWindows() { m_pMdi->cascadeWindows(); }
    00667
    00671     virtual void cascadeMaximized() { m_pMdi->cascadeMaximized(); }
    00672
    00676     virtual void expandVertical() { m_pMdi->expandVertical(); }
    00677
    00681     virtual void expandHorizontal() { m_pMdi->expandHorizontal(); }
    00682
    00686     virtual void tilePragma() { m_pMdi->tilePragma(); }
    00687
    00691     virtual void tileAnodine() { m_pMdi->tileAnodine(); }
    00692
    00696     virtual void tileVertically() { m_pMdi->tileVertically(); }
    00697
    00702     virtual void setFrameDecorOfAttachedViews( int frameDecor );
    00703
    00707     virtual void setEnableMaximizedChildFrmMode( bool bEnable );
    00708
    00712     virtual void activateNextWin();
    00713
    00717     virtual void activatePrevWin();
    00718
    00722     virtual void activateFirstWin();
    00723
    00727     virtual void activateLastWin();
    00728
    00732     virtual void activateView( int index );
    00733
    00734 private:
    00735     void setupToolViewsForIDEALMode();
    00736     void setupTabbedDocumentViewSpace();
    00737     class KMdiDocumentViewTabWidget * m_documentTabWidget;
    00738
    00739 protected:
    00740
    00741     virtual void resizeEvent( QResizeEvent * );
    00742
    00746     virtual void createTaskBar();
    00747
    00751     virtual void createMdiManager();
    00752
    00757     void blockClearingOfWindowMenu( bool bBlocked ) { m_bClearingOfWindowMenuBlocked = bBlocked; }
    00758
    00759     void findToolViewsDockedToMain( QPtrList<KDockWidget>* list, KDockWidget::DockPosition dprtmw );
    00760     void dockToolViewsIntoContainers( QPtrList<KDockWidget>& widgetsToReparent, KDockWidget *container );
    00761     QStringList prepareIdealToTabs( KDockWidget* container );
    00762     void idealToolViewsToStandardTabs( QStringList widgetNames, KDockWidget::DockPosition pos, int sizee );
    00763
    00765     KMdi::TabWidgetVisibility tabWidgetVisibility();
    00766
    00768     void setTabWidgetVisibility( KMdi::TabWidgetVisibility );
    00769
    00771     class KTabWidget * tabWidget() const;
    00772
    00773
    00774 protected slots:  // Protected slots
    00779     virtual void activateView( KMdiChildView *pWnd );
    00780
    00784     virtual void taskbarButtonRightClicked( KMdiChildView *pWnd );
    00785
    00789     void switchOffMaximizeModeForMenu( KMdiChildFrm* oldChild );
    00790
    00794     void updateSysButtonConnections( KMdiChildFrm* oldChild, KMdiChildFrm* newChild );
    00795
    00799     void windowMenuItemActivated( int id );
    00800
    00804     void dockMenuItemActivated( int id );
    00805
    00809     void popupWindowMenu( QPoint p );
    00810
    00814     void dragEndTimeOut();
    00815
    00819     void closeViewButtonPressed();
    00820
    00821 signals:
    00825     void lastChildFrmClosed();
    00826
    00830     void lastChildViewClosed();
    00831
    00835     void leftTopLevelMode();
    00836
    00840     void childViewIsDetachedNow( QWidget* );
    00841
    00843     void collapseOverlapContainers();
    00844
    00846     void mdiModeHasBeenChangedTo( KMdi::MdiMode );
    00847
    00848     void viewActivated( KMdiChildView* );
    00849     void viewDeactivated( KMdiChildView* );
    00850
    00851 public slots:
    00852     void prevToolViewInDock();
    00853     void nextToolViewInDock();
    00854
    00855 private slots:
    00856     void setActiveToolDock( KMdiDockContainer* );
    00857     void removeFromActiveDockList( KMdiDockContainer* );
    00858     void slotDocCurrentChanged( QWidget* );
    00859     void verifyToplevelHeight();
    00860 #define protected public
    00861 signals:
    00862 #undef protected
    00863
    00864     void toggleTop();
    00865     void toggleLeft();
    00866     void toggleRight();
    00867     void toggleBottom();
    00868 };
    00869
    00870 #endif //_KMDIMAINFRM_H_
    00871
    00872 // kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;

This file is part of the documentation for kmdi Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:32:06 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003