KDockMainWindow class Reference (kdeui Library)

| # kdeui Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# KDockMainWindow Class Reference

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

`#include <kdockwidget.h>`

Inheritance diagram for KDockMainWindow:

[legend]
Collaboration diagram for KDockMainWindow:

[legend]
List of all members.

## Signals
void | dockWidgetHasUndocked (KDockWidget *)
| Signals a certain dockwidget is undocked now.
## Public Member Functions
| KDockMainWindow (QWidget *parent=0L, const char *name=0L, WFlags f=WType_TopLevel|WDestructiveClose)
| Constructs a dockmainwindow.
virtual | ~KDockMainWindow ()
| Destructs a dockmainwindow.
KDockManager * | manager () const
| Returns the dockmanager of this.
void | setMainDockWidget (KDockWidget *)
| Sets a new main dockwidget.
KDockWidget * | getMainDockWidget () const
| Returns the main dockwidget.
KDockWidget * | createDockWidget (const QString &name, const QPixmap &pixmap, QWidget *parent=0L, const QString &strCaption=QString::null, const QString &strTabPageLabel=QString::fromLatin1(""))
| This is one of the most important methods! The KDockMainWindow creates a new dockwidget object here that usually should encapsulate the user's widget.
void | writeDockConfig (QDomElement &base)
| Saves the current dock window layout into a DOM tree below the given element.
void | readDockConfig (QDomElement &base)
| Reads the current dock window layout from a DOM tree below the given element.
void | writeDockConfig (KConfig *c=0L, QString group=QString::null)
| It writes the current dock state in the given section of KConfig.
void | readDockConfig (KConfig *c=0L, QString group=QString::null)
| It reads the current dock state from the given section of KConfig.
void | 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.
QPopupMenu * | dockHideShowMenu () const
| Returns a popup menu that contains entries for all controlled dockwidgets making hiding and showing them possible.
void | makeDockVisible (KDockWidget *dock)
| This method shows the given dockwidget.
void | makeDockInvisible (KDockWidget *dock)
| This method hides the given dockwidget.
void | makeWidgetDockVisible (QWidget *widget)
| This is an overloaded member function, provided for convenience.
void | setView (QWidget *)
| This method calls the base class method.
## Protected Slots
void | slotDockWidgetUndocked ()
| Called whenever one of the dockwidgets of this has been undocked.
## Protected Member Functions
virtual void | virtual_hook (int id, void *data)
## Protected Attributes
KDockWidget * | mainDockWidget
| A pointer to the main dockwidget (where one can manualDock() to.
KDockManager * | dockManager
| A pointer to the manager for the dock process.

## 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.

Author:
  Max Judin (documentation: Falk Brettschneider).

Definition at line 1209 of file kdockwidget.h.

## Constructor & Destructor Documentation

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

  | 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
Definition at line 96 of file kdockwidget.cpp. References dockManager, QString::latin1(), mainDockWidget, and KStdAccel::name().

KDockMainWindow::~KDockMainWindow | ( |  | ) | `[virtual]`

| Destructs a dockmainwindow. Definition at line 104 of file kdockwidget.cpp. References dockManager.

## Member Function Documentation

KDockManager* KDockMainWindow::manager | ( |  | ) | const`[inline]`

| Returns the dockmanager of this. (see KDockManager) Returns: pointer to the wanted dockmanager Definition at line 1238 of file kdockwidget.h.

void KDockMainWindow::setMainDockWidget | ( | KDockWidget * |  | ) |

  | Sets a new main dockwidget. Additionally, the toolbar is re-initialized. Parameters:
  _ | dockwidget that become the new main dockwidget
Definition at line 109 of file kdockwidget.cpp. References dockManager, mainDockWidget, and KDockManager::setMainDockWidget2(). Referenced by KDockManager::readConfig().

KDockWidget* KDockMainWindow::getMainDockWidget | ( |  | ) | const`[inline]`

| Returns the main dockwidget. Returns: pointer to the main dockwidget Definition at line 1253 of file kdockwidget.h. Referenced by KDockManager::writeConfig().

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

  | 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 Definition at line 129 of file kdockwidget.cpp. References dockManager, QString::latin1(), and KStdAccel::name().

void KDockMainWindow::writeDockConfig | ( | QDomElement & | base | ) |

| Saves the current dock window layout into a DOM tree below the given element. Definition at line 151 of file kdockwidget.cpp. References dockManager, and KDockManager::writeConfig().

void KDockMainWindow::readDockConfig | ( | QDomElement & | base | ) |

| Reads the current dock window layout from a DOM tree below the given element. Definition at line 156 of file kdockwidget.cpp. References dockManager, and KDockManager::readConfig().

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

  | 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
Definition at line 162 of file kdockwidget.cpp. References dockManager, and KDockManager::writeConfig().

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

  | 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
Definition at line 167 of file kdockwidget.cpp. References dockManager, and KDockManager::readConfig().

void KDockMainWindow::activateDock | ( |  | ) | `[inline]`

| 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. Definition at line 1302 of file kdockwidget.h. References KDockManager::activate().

QPopupMenu* KDockMainWindow::dockHideShowMenu | ( |  | ) | const`[inline]`

| Returns a popup menu that contains entries for all controlled dockwidgets making hiding and showing them possible. Returns: the wanted popup menu Definition at line 1310 of file kdockwidget.h. References KDockManager::dockHideShowMenu().

void KDockMainWindow::makeDockVisible | ( | KDockWidget * | dock | ) |

  | 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
Definition at line 134 of file kdockwidget.cpp. References KDockWidget::makeDockVisible(). Referenced by makeWidgetDockVisible().

void KDockMainWindow::makeDockInvisible | ( | KDockWidget * | dock | ) |

  | This method hides the given dockwidget. Parameters:
  dock | the dockwidget that is to be shown
Definition at line 140 of file kdockwidget.cpp. References KDockWidget::undock().

void KDockMainWindow::makeWidgetDockVisible | ( | QWidget * | widget | ) |

| This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Definition at line 146 of file kdockwidget.cpp. References dockManager, KDockManager::findWidgetParentDock(), and makeDockVisible().

void KDockMainWindow::setView | ( | QWidget * |  | ) |

  | 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
Definition at line 116 of file kdockwidget.cpp. References QMainWindow::setCentralWidget(). Referenced by KDockManager::readConfig().

void KDockMainWindow::dockWidgetHasUndocked | ( | KDockWidget * |  | ) | `[signal]`

| Signals a certain dockwidget is undocked now. Referenced by slotDockWidgetUndocked().

void KDockMainWindow::slotDockWidgetUndocked | ( |  | ) | `[protected, slot]`

| Called whenever one of the dockwidgets of this has been undocked. Definition at line 173 of file kdockwidget.cpp. References dockWidgetHasUndocked(), and QObject::inherits().

## Member Data Documentation

KDockWidget* KDockMainWindow::mainDockWidget`[protected]`

| A pointer to the main dockwidget (where one can manualDock() to. Definition at line 1353 of file kdockwidget.h. Referenced by KDockMainWindow(), and setMainDockWidget().

KDockManager* KDockMainWindow::dockManager`[protected]`

| A pointer to the manager for the dock process. Definition at line 1358 of file kdockwidget.h. Referenced by createDockWidget(), KDockMainWindow(), makeWidgetDockVisible(), readDockConfig(), setMainDockWidget(), writeDockConfig(), and ~KDockMainWindow().

The documentation for this class was generated from the following files:

- kdockwidget.h
- kdockwidget.cpp

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 12:59:50 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001