class KDockMainWindow

# class KDockMainWindow | A special kind of KMainWindow that is able to have dockwidget child widgets (and member of the dockwidget class set). More...
Definition | `#include <kdockwidget.h>`
Inherits | KMainWindow [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Methods

- KDockMainWindow ( QWidget* parent = 0L, const char *name = 0L, WFlags f = WType_TopLevel | WDestructiveClose )
- virtual ~KDockMainWindow ()
- KDockManager* manager () const
- void setMainDockWidget ( KDockWidget* )
- KDockWidget* getMainDockWidget () const
- KDockWidget* createDockWidget ( const QString& name, const QPixmap &pixmap, QWidget* parent = 0L, const QString& strCaption = QString::null, const QString& strTabPageLabel = QString::fromLatin1( " " ) )
- void writeDockConfig (QDomElement &base)
- void readDockConfig (QDomElement &base)
- void writeDockConfig ( KConfig* c = 0L, QString group = QString::null )
- void readDockConfig ( KConfig* c = 0L, QString group = QString::null )
- void activateDock ()
- QPopupMenu* dockHideShowMenu () const
- void makeDockVisible ( KDockWidget* dock )
- void makeDockInvisible ( KDockWidget* dock )
- void makeWidgetDockVisible ( QWidget* widget )
- void setView ( QWidget* )

#### Signals

- void dockWidgetHasUndocked (KDockWidget*)

#### Protected Methods

- virtual void virtual_hook ( int id, void* data )

#### Protected Slots

- void slotDockWidgetUndocked ()

#### Protected Members

- KDockWidget* mainDockWidget
- KDockManager* dockManager

## Detailed Description

A special kind of KMainWindow that is able to have dockwidget child widgets (and member of the dockwidget class set).

The main widget should be a KDockWidget where other KDockWidget can be docked to the left, right, top, bottom or to the middle. Note: dock to the middle means to drop on a dockwidget and to unite them to a new widget, a tab control.

Furthermore, the KDockMainWindow has got the KDockManager and some data about the dock states.

If you've got some dockwidgets, you can dock them to the dockmainwindow to initialize a start scene: Here an example:

     DockApplication::DockApplication( const char* name) : KDockMainWindow( name)
     {
       ...
       KDockWidget* mainDock;
       mainDock = createDockWidget( "Falk's MainDockWidget", mainPixmap, 0L, "main_dock_widget");
       AnyContentsWidget* cw = new AnyContentsWidget( mainDock);
       mainDock->setWidget( cw);
       // allow others to dock to the 4 sides
       mainDock->setDockSite(KDockWidget::DockCorner);
       // forbit docking abilities of mainDock itself
       mainDock->setEnableDocking(KDockWidget::DockNone);
       setView( mainDock); // central widget in a KDE mainwindow
       setMainDockWidget( mainDock); // master dockwidget
       ...
       KDockWidget* dockLeft;
       dockLeft = createDockWidget( "Intially left one", anyOtherPixmap, 0L, i18n("The left dockwidget"));
       AnotherWidget* aw = new AnotherWidget( dockLeft);
       dockLeft->setWidget( aw);
       dockLeft->manualDock( mainDock,              // dock target
                             KDockWidget::DockLeft, // dock site
                             20 );                  // relation target/this (in percent)
       ...

Docking is fully dynamical at runtime. That means you can always move dockwidgets via drag and drop.

And last but not least you can use the popupmenu for showing or hiding any controlled dockwidget of this class and insert it to your main menu bar or anywhere else.

KDockMainWindow ( QWidget* parent = 0L, const char *name = 0L, WFlags f = WType_TopLevel | WDestructiveClose ) | ### KDockMainWindow

Constructs a dockmainwindow. It calls its base class constructor and does additional things concerning to the dock stuff:

- information about the dock state of this' children gets initialized
- a dockmanager is created...
- ...and gets initialized
- the main dockwidget is set to 0

Parameters:

name | object name

~KDockMainWindow () | ### ~KDockMainWindow

[virtual]

Destructs a dockmainwindow.

KDockManager* manager () | ### manager

[const]

Returns the dockmanager of this. (see KDockManager)

Returns: pointer to the wanted dockmanager

void setMainDockWidget ( KDockWidget* ) | ### setMainDockWidget

Sets a new main dockwidget. Additionally, the toolbar is re-initialized.

Parameters:

_ | dockwidget that become the new main dockwidget

KDockWidget* getMainDockWidget () | ### getMainDockWidget

[const]

Returns the main dockwidget.

Returns: pointer to the main dockwidget

KDockWidget* createDockWidget ( const QString& name, const QPixmap &pixmap, QWidget* parent = 0L, const QString& strCaption = QString::null, const QString& strTabPageLabel = QString::fromLatin1( " " ) ) | ### createDockWidget

This is one of the most important methods! The KDockMainWindow creates a new dockwidget object here that usually should encapsulate the user's widget. The new dockwidget is automatically taken under control by the dockmanager of the dockmainwindow.

Parameters:

name | QObject name (default dockwidget caption)
pixmap | window icon (for instance shown when docked as tabwidget entry)
parent | parent widget for the new dockwidget
strCaption | window title (shown when toplevel)
strTabPageLabel | title of the tab page (visible when in tab page mode), if it is "", only the icon will be shown; if it is 0L, the label is set to strCaption

Returns: a pointer to the new created dockwidget

void writeDockConfig (QDomElement &base) | ### writeDockConfig

Saves the current dock window layout into a DOM tree below the given element.

void readDockConfig (QDomElement &base) | ### readDockConfig

Reads the current dock window layout from a DOM tree below the given element.

void writeDockConfig ( KConfig* c = 0L, QString group = QString::null ) | ### writeDockConfig

It writes the current dock state in the given section of KConfig.

Parameters:

c | KDE class for saving configurations
group | name of section to write to

void readDockConfig ( KConfig* c = 0L, QString group = QString::null ) | ### readDockConfig

It reads the current dock state from the given section of KConfig.

Parameters:

c | KDE class for saving configurations
group | name of section to read from

void activateDock () | ### activateDock

It runs through all dockwidgets which are under control of the dockmanager and calls show() for every encapsulated widget and show() for the dockwidget itself if it is not in tab mode. Additionally, if the main dockwidget is not a QDialog, it will be shown.

QPopupMenu* dockHideShowMenu () | ### dockHideShowMenu

[const]

Returns a popup menu that contains entries for all controlled dockwidgets making hiding and showing them possible.

Returns: the wanted popup menu

void makeDockVisible ( KDockWidget* dock ) | ### makeDockVisible

This method shows the given dockwidget. The clue is that it also considers the dockwidget could be a tab page and must set to be the activate one.

Parameters:

dock | the dockwidget that is to be shown

void makeDockInvisible ( KDockWidget* dock ) | ### makeDockInvisible

This method hides the given dockwidget.

Parameters:

dock | the dockwidget that is to be shown

void makeWidgetDockVisible ( QWidget* widget ) | ### makeWidgetDockVisible

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

void setView ( QWidget* ) | ### setView

This method calls the base class method. If the given widget inherits KDockWidget, applyToWidget(this) is called.

Parameters:

_ | any widget that should become the main view

void dockWidgetHasUndocked (KDockWidget*) | ### dockWidgetHasUndocked

[signal]

Signals a certain dockwidget is undocked now.

KDockWidget* mainDockWidget | ### mainDockWidget

[protected]

KDockManager* dockManager | ### dockManager

[protected]

void slotDockWidgetUndocked () | ### slotDockWidgetUndocked

[protected slots slot]

Called whenever one of the dockwidgets of this has been undocked.

void virtual_hook ( int id, void* data ) | ### virtual_hook

[protected virtual]

Reimplemented from KMainWindow.

- Author: Max Judin (documentation: Falk Brettschneider).
- Generated: root on macppc.ports.openbsd.org on Sat Sep 6 10:36:37 2003, using kdoc 2.0a54.