kmdimainfrm.h
//----------------------------------------------------------------------------
// filename : kmdimainfrm.h
//----------------------------------------------------------------------------
// Project : KDE MDI extension
//
// begin : 07/1999 by Szymon Stefanek as part of kvirc
// (an IRC application)
// changes : 09/1999 by Falk Brettschneider to create an
// - 06/2000 stand-alone Qt extension set of
// classes and a Qt-based library
// : 02/2000 by Massimo Morin (mmorin@schedsys.com)
// 2000-2003 maintained by the KDevelop project
// patches : */2000 by Lars Beikirch (Lars.Beikirch@gmx.net)
// : 01/2003 by Jens Zurheide (jens.zurheide@gmx.de)
//
// copyright : (C) 1999-2003 by Falk Brettschneider
// and
// Szymon Stefanek (stefanek@tin.it)
// email : falkbr@kdevelop.org (Falk Brettschneider)
//----------------------------------------------------------------------------
//
//----------------------------------------------------------------------------
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
//----------------------------------------------------------------------------
#ifndef _KMDIMAINFRM_H_
#define _KMDIMAINFRM_H_
#include <kparts/dockmainwindow.h>
#include <kmenubar.h>
#include <kpopupmenu.h>
#include <qptrlist.h>
#include <qrect.h>
#include <qapplication.h>
#include <qdom.h>
#include <qguardedptr.h>
#include "kmditaskbar.h"
#include "kmdichildarea.h"
#include "kmdichildview.h"
#include "kmdiiterator.h"
#include "kmdilistiterator.h"
#include "kmdinulliterator.h"
#include "kmditoolviewaccessor.h"
class QTimer;
class QPopupMenu;
class QMenuBar;
class QToolButton;
namespace KMDIPrivate
{
class KMDIGUIClient;
}
class KMdiDockContainer;
class KMdiMainFrmPrivate;
class KMDI_EXPORT KMdiViewCloseEvent : public QCustomEvent
{
public:
KMdiViewCloseEvent( KMdiChildView* pWnd ) : QCustomEvent( QEvent::User, pWnd ) {}
};
class KMDI_EXPORT KMdiMainFrm : public KParts::DockMainWindow
{
friend class KMdiChildView;
friend class KMdiTaskBar;
Q_OBJECT
friend class KMdiToolViewAccessor;
// attributes
protected:
KMdi::MdiMode m_mdiMode;
KMdiChildArea *m_pMdi;
KMdiTaskBar *m_pTaskBar;
QPtrList<KMdiChildView> *m_pDocumentViews;
QMap<QWidget*, KMdiToolViewAccessor*> *m_pToolViews;
KMdiChildView *m_pCurrentWindow;
QPopupMenu *m_pWindowPopup;
QPopupMenu *m_pTaskBarPopup;
QPopupMenu *m_pWindowMenu;
QPopupMenu *m_pDockMenu;
QPopupMenu *m_pMdiModeMenu;
QPopupMenu *m_pPlacingMenu;
KMenuBar *m_pMainMenuBar;
QPixmap *m_pUndockButtonPixmap;
QPixmap *m_pMinButtonPixmap;
QPixmap *m_pRestoreButtonPixmap;
QPixmap *m_pCloseButtonPixmap;
QToolButton *m_pUndock;
QToolButton *m_pMinimize;
QToolButton *m_pRestore;
QToolButton *m_pClose;
QPoint m_undockPositioningOffset;
bool m_bMaximizedChildFrmMode;
int m_oldMainFrmHeight;
int m_oldMainFrmMinHeight;
int m_oldMainFrmMaxHeight;
static KMdi::FrameDecor m_frameDecoration;
bool m_bSDIApplication;
KDockWidget* m_pDockbaseAreaOfDocumentViews;
QDomDocument* m_pTempDockSession;
bool m_bClearingOfWindowMenuBlocked;
QTimer* m_pDragEndTimer;
bool m_bSwitching;
KDockWidget* m_leftContainer;
KDockWidget* m_rightContainer;
KDockWidget* m_topContainer;
KDockWidget* m_bottomContainer;
private:
KMdiMainFrmPrivate* d;
KMDIPrivate::KMDIGUIClient* m_mdiGUIClient;
bool m_managedDockPositionMode;
// methods
public:
KMdiMainFrm( QWidget* parentWidget, const char* name = "", KMdi::MdiMode mdiMode = KMdi::ChildframeMode, WFlags flags = WType_TopLevel | WDestructiveClose );
virtual ~KMdiMainFrm();
void setStandardMDIMenuEnabled( bool showModeMenu = true );
void setManagedDockPositionModeEnabled( bool enabled );
bool isInMaximizedChildFrmMode() { return m_bMaximizedChildFrmMode; }
KMdi::MdiMode mdiMode() { return m_mdiMode; }
KMdiChildView* activeWindow();
virtual QPopupMenu * taskBarPopup( KMdiChildView *pWnd, bool bIncludeWindowPopup = false );
virtual QPopupMenu * windowPopup( KMdiChildView *pWnd, bool bIncludeTaskbarPopup = true );
virtual void applyOptions();
KMdiChildView * findWindow( const QString& caption );
enum ExistsAs {DocumentView, ToolView, AnyView};
bool windowExists( KMdiChildView *pWnd, ExistsAs as );
virtual bool event( QEvent* e );
virtual void setSysButtonsAtMenuPosition();
virtual int taskBarHeight() { return m_pTaskBar ? m_pTaskBar->height() : 0; }
virtual void setUndockPositioningOffset( QPoint offset ) { m_undockPositioningOffset = offset; }
// FIXME And what exactly are we supposed to fix? -mattr
KMdiIterator<KMdiChildView*>* createIterator()
{
if ( m_pDocumentViews == 0L )
{
return new KMdiNullIterator<KMdiChildView*>();
}
else
{
return new KMdiListIterator<KMdiChildView>( *m_pDocumentViews );
}
}
void deleteIterator( KMdiIterator<KMdiChildView*>* pIt )
{
delete pIt;
}
QPopupMenu* windowMenu() const { return m_pWindowMenu; };
virtual void setBackgroundColor( const QColor &c ) { m_pMdi->setBackgroundColor( c ); }
virtual void setBackgroundPixmap( const QPixmap &pm ) { m_pMdi->setBackgroundPixmap( pm ); }
void setDefaultChildFrmSize( const QSize& sz ) { m_pMdi->m_defaultChildFrmSize = sz; }
QSize defaultChildFrmSize() { return m_pMdi->m_defaultChildFrmSize; }
virtual void setMinimumSize( int minw, int minh );
int childFrameModeHeight() { return m_oldMainFrmHeight; };
virtual void setMenuForSDIModeSysButtons( KMenuBar* menuBar = 0 );
static int frameDecorOfAttachedViews() { return m_frameDecoration; }
void fakeSDIApplication();
bool isFakingSDIApplication() const { return m_bSDIApplication; }
virtual bool eventFilter( QObject *obj, QEvent *e );
void findRootDockWidgets( QPtrList<KDockWidget>* pRootDockWidgetList, QValueList<QRect>* pPositionList );
void setSwitching( const bool switching ) { m_bSwitching = switching; }
bool switching( void ) const { return m_bSwitching; }
public slots:
KMdiChildView* createWrapper( QWidget *view, const QString& name, const QString& shortName );
virtual void addWindow( KMdiChildView* pWnd, int flags = KMdi::StandardAdd );
//KDE4: merge the two methods
void addWindow( KMdiChildView* pWnd, int flags, int index );
virtual void addWindow( KMdiChildView* pWnd, QPoint pos, int flags = KMdi::StandardAdd );
virtual void addWindow( KMdiChildView* pWnd, QRect rectNormal, int flags = KMdi::StandardAdd );
virtual KMdiToolViewAccessor *addToolWindow( QWidget* pWnd, KDockWidget::DockPosition pos = KDockWidget::DockNone,
QWidget* pTargetWnd = 0L, int percent = 50, const QString& tabToolTip = 0,
const QString& tabCaption = 0 );
virtual void deleteToolWindow( QWidget* pWnd );
virtual void deleteToolWindow( KMdiToolViewAccessor *accessor );
KMdiToolViewAccessor *createToolWindow();
virtual void removeWindowFromMdi( KMdiChildView *pWnd );
virtual void closeWindow( KMdiChildView *pWnd, bool layoutTaskBar = true );
virtual void slot_toggleTaskBar();
virtual void attachWindow( KMdiChildView *pWnd, bool bShow = true, bool bAutomaticResize = false );
virtual void detachWindow( KMdiChildView *pWnd, bool bShow = true );
virtual void childWindowCloseRequest( KMdiChildView *pWnd );
virtual void closeAllViews();
virtual void iconifyAllViews();
virtual void closeActiveView();
virtual void switchToToplevelMode();
virtual void finishToplevelMode();
virtual void switchToChildframeMode();
virtual void finishChildframeMode();
virtual void switchToTabPageMode();
virtual void finishTabPageMode();
virtual void switchToIDEAlMode();
virtual void finishIDEAlMode( bool full = true );
void setIDEAlModeStyle( int flags ) KDE_DEPRECATED;
//KDE4: Get rid of the above.
void setToolviewStyle( int flags );
bool isViewTaskBarOn();
virtual void showViewTaskBar();
virtual void hideViewTaskBar();
virtual void fillWindowMenu();
virtual void cascadeWindows() { m_pMdi->cascadeWindows(); }
virtual void cascadeMaximized() { m_pMdi->cascadeMaximized(); }
virtual void expandVertical() { m_pMdi->expandVertical(); }
virtual void expandHorizontal() { m_pMdi->expandHorizontal(); }
virtual void tilePragma() { m_pMdi->tilePragma(); }
virtual void tileAnodine() { m_pMdi->tileAnodine(); }
virtual void tileVertically() { m_pMdi->tileVertically(); }
virtual void setFrameDecorOfAttachedViews( int frameDecor );
virtual void setEnableMaximizedChildFrmMode( bool bEnable );
virtual void activateNextWin();
virtual void activatePrevWin();
virtual void activateFirstWin();
virtual void activateLastWin();
virtual void activateView( int index );
private:
void setupToolViewsForIDEALMode();
void setupTabbedDocumentViewSpace();
class KMdiDocumentViewTabWidget * m_documentTabWidget;
protected:
virtual void resizeEvent( QResizeEvent * );
virtual void createTaskBar();
virtual void createMdiManager();
void blockClearingOfWindowMenu( bool bBlocked ) { m_bClearingOfWindowMenuBlocked = bBlocked; }
void findToolViewsDockedToMain( QPtrList<KDockWidget>* list, KDockWidget::DockPosition dprtmw );
void dockToolViewsIntoContainers( QPtrList<KDockWidget>& widgetsToReparent, KDockWidget *container );
QStringList prepareIdealToTabs( KDockWidget* container );
void idealToolViewsToStandardTabs( QStringList widgetNames, KDockWidget::DockPosition pos, int sizee );
KMdi::TabWidgetVisibility tabWidgetVisibility();
void setTabWidgetVisibility( KMdi::TabWidgetVisibility );
class KTabWidget * tabWidget() const;
protected slots: // Protected slots
virtual void activateView( KMdiChildView *pWnd );
virtual void taskbarButtonRightClicked( KMdiChildView *pWnd );
void switchOffMaximizeModeForMenu( KMdiChildFrm* oldChild );
void updateSysButtonConnections( KMdiChildFrm* oldChild, KMdiChildFrm* newChild );
void windowMenuItemActivated( int id );
void dockMenuItemActivated( int id );
void popupWindowMenu( QPoint p );
void dragEndTimeOut();
void closeViewButtonPressed();
signals:
void lastChildFrmClosed();
void lastChildViewClosed();
void leftTopLevelMode();
void childViewIsDetachedNow( QWidget* );
void collapseOverlapContainers();
void mdiModeHasBeenChangedTo( KMdi::MdiMode );
void viewActivated( KMdiChildView* );
void viewDeactivated( KMdiChildView* );
public slots:
void prevToolViewInDock();
void nextToolViewInDock();
private slots:
void setActiveToolDock( KMdiDockContainer* );
void removeFromActiveDockList( KMdiDockContainer* );
void slotDocCurrentChanged( QWidget* );
void verifyToplevelHeight();
#define protected public
signals:
#undef protected
void toggleTop();
void toggleLeft();
void toggleRight();
void toggleBottom();
};
#endif //_KMDIMAINFRM_H_
// kate: space-indent off; tab-width 4; replace-tabs off; indent-mode csands;
KMdiMainFrm::blockClearingOfWindowMenu
void blockClearingOfWindowMenu(bool bBlocked)
prevents fillWindowMenu() from m_pWindowMenu->clear().
Definition: kmdimainfrm.h:764
KMdiMainFrm::taskBarHeight
virtual int taskBarHeight()
Returns the height of the taskbar.
Definition: kmdimainfrm.h:378
KMdiMainFrm::windowMenu
QPopupMenu * windowMenu() const
Returns a popup menu that contains the MDI controlled view list.
Definition: kmdimainfrm.h:418
KMdiMainFrm::expandHorizontal
virtual void expandHorizontal()
Maximizes only in horizontal direction.
Definition: kmdimainfrm.h:688
KMdiMainFrm
Base class for all your special main frames.
Definition: kmdimainfrm.h:239
KMdiMainFrm::deleteIterator
void deleteIterator(KMdiIterator< KMdiChildView * > *pIt)
Deletes an KMdiIterator created in the KMdi library (needed for the windows dll problem).
Definition: kmdimainfrm.h:408
KMdiMainFrm::childFrameModeHeight
int childFrameModeHeight()
Returns the Childframe mode height of this.
Definition: kmdimainfrm.h:449
KMdiMainFrm::setBackgroundPixmap
virtual void setBackgroundPixmap(const QPixmap &pm)
Sets a background pixmap for the MDI view area widget.
Definition: kmdimainfrm.h:428
KMdiMainFrm::tileAnodine
virtual void tileAnodine()
Tile Anodine.
Definition: kmdimainfrm.h:698
KMdiMainFrm::isFakingSDIApplication
bool isFakingSDIApplication() const
Definition: kmdimainfrm.h:474
KMdiMainFrm::setUndockPositioningOffset
virtual void setUndockPositioningOffset(QPoint offset)
Sets an offset value that is used on detachWindow() .
Definition: kmdimainfrm.h:384
KMdiMainFrm::createIterator
KMdiIterator< KMdiChildView * > * createIterator()
If you don't want to know about the inner structure of the KMdi system, you can use this iterator to ...
Definition: kmdimainfrm.h:393
KMdiMainFrm::defaultChildFrmSize
QSize defaultChildFrmSize()
Returns the default size for a newly added KMdiChildView.
Definition: kmdimainfrm.h:439
KMdiMainFrm::setBackgroundColor
virtual void setBackgroundColor(const QColor &c)
Sets a background color for the MDI view area widget.
Definition: kmdimainfrm.h:423
KMdiMainFrm::isInMaximizedChildFrmMode
bool isInMaximizedChildFrmMode()
Returns whether the application's MDI views are in maximized state or not.
Definition: kmdimainfrm.h:313
KMdiMainFrm::setSwitching
void setSwitching(const bool switching)
We're switching something.
Definition: kmdimainfrm.h:480
KMdiMainFrm::tileVertically
virtual void tileVertically()
Tile Vertically.
Definition: kmdimainfrm.h:703
KMdiDocumentViewTabWidget
A reimplementation of KTabWidget for KMDI.
Definition: kmdidocumentviewtabwidget.h:22
KMdiChildFrm
Internal class.
Definition: kmdichildfrm.h:130
KMdi::StandardAdd
standard is: show normal, attached, visible, document view (not toolview).
Definition: kmdidefines.h:72
KMdiMainFrm::cascadeMaximized
virtual void cascadeMaximized()
Cascades the windows resizing them to the maximum available size.
Definition: kmdimainfrm.h:678
KMdiTaskBar
Internal class.
Definition: kmditaskbar.h:129
KMdiMainFrm::frameDecorOfAttachedViews
static int frameDecorOfAttachedViews()
Definition: kmdimainfrm.h:461
KMdiMainFrm::cascadeWindows
virtual void cascadeWindows()
Cascades the windows without resizing them.
Definition: kmdimainfrm.h:673
KMdiMainFrm::mdiMode
KMdi::MdiMode mdiMode()
Returns the MDI mode.
Definition: kmdimainfrm.h:318
KMdiMainFrm::setDefaultChildFrmSize
void setDefaultChildFrmSize(const QSize &sz)
Sets a size that is used as the default size for a newly to the MDI system added KMdiChildView ...
Definition: kmdimainfrm.h:434
KMdiViewCloseEvent
Internal class.
Definition: kmdimainfrm.h:72
KMdiDocumentViewTabWidget::setTabWidgetVisibility
void setTabWidgetVisibility(KMdi::TabWidgetVisibility)
Get the tab widget's visibility.
Definition: kmdidocumentviewtabwidget.cpp:125
KMDIPrivate::KMDIGUIClient
A class derived from KXMLGUIClient that handles the various KMDI modes.
Definition: kmdiguiclient.h:41
KMdiMainFrm::expandVertical
virtual void expandVertical()
Maximizes only in vertical direction.
Definition: kmdimainfrm.h:683
KMdiChildView
Base class for all your special view windows.
Definition: kmdichildview.h:108
KMdiChildArea
Internal class.
Definition: kmdichildarea.h:52
KMdiDocumentViewTabWidget::tabWidgetVisibility
KMdi::TabWidgetVisibility tabWidgetVisibility()
Set the tab widget's visibility and then make the change to match the new setting.
Definition: kmdidocumentviewtabwidget.cpp:137
KMdiMainFrm::tilePragma
virtual void tilePragma()
Tile Pragma.
Definition: kmdimainfrm.h:693

KDE Home | KDE Accessibility Home | Description of Access Keys