# kdeui Library API Documentation

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

# KDockManager Class Reference

The manager that knows all dockwidgets and handles the dock process (and member of the dockwidget class set). More...

`#include <kdockwidget.h>`

Inheritance diagram for KDockManager:

[legend]
Collaboration diagram for KDockManager:

[legend]
List of all members.

## Signals

void | change ()
| Signals changes of the docking state of a dockwidget.
void | replaceDock (KDockWidget *oldDock, KDockWidget *newDock)
| Signals a dockwidget is replaced with another one.
void | setDockDefaultPos (KDockWidget *)
| Signals a dockwidget without parent (toplevel) is shown.

## Public Member Functions

| KDockManager (QWidget *mainWindow, const char *name=0L)
| Constructs a dockmanager.
virtual | ~KDockManager ()
| Destructs a dockmanager.
void | writeConfig (KConfig *c=0L, QString group=QString::null)
| Saves the current state of the dockmanager and of all controlled widgets.
void | readConfig (KConfig *c=0L, QString group=QString::null)
| Like writeConfig but reads the whole stuff in.
void | setMainDockWidget2 (KDockWidget *)

Since:
  3.1

void | writeConfig (QDomElement &base)
| Saves the current dock window layout into a DOM tree below the given element.
void | readConfig (QDomElement &base)
| Reads the current dock window layout from a DOM tree below the given element.
void | activate ()
| Shows all encapsulated widgets of all controlled dockwidgets and shows all dockwidgets which are parent of a dockwidget tab group.
virtual bool | eventFilter (QObject *, QEvent *)
| It's more or less a method that catches several events which are interesting for the dockmanager.
KDockWidget * | findWidgetParentDock (QWidget *w) const
| This method finds out what a widgets' dockwidget is.
void | makeWidgetDockVisible (QWidget *w)
| Works like makeDockVisible() but can be called for widgets that covered by a dockwidget.
QPopupMenu * | dockHideShowMenu () const
KDockWidget * | getDockWidgetFromName (const QString &dockName)
void | setSplitterOpaqueResize (bool b=true)
| Enables opaque resizing.
bool | splitterOpaqueResize () const
| Returns TRUE if opaque resizing is enabled, FALSE otherwise.
void | setSplitterKeepSize (bool b=true)
| Try to preserve the widget's size.
bool | splitterKeepSize () const
| Returns TRUE if the KeepSize is enabled, FALSE otherwise.
void | setSplitterHighResolution (bool b=true)
| Operate the splitter with a higher resolution.
bool | splitterHighResolution () const
| Returns TRUE if the splitter uses the high resolution, FALSE otherwise.

## Protected Member Functions

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

## Friends

class | KDockMainWindow

## Detailed Description

The manager that knows all dockwidgets and handles the dock process (and member of the dockwidget class set).

More or less a helper class for the KDockWidget class set but of interest for some functionality that can be called within a KDockMainWindow or a KDockWidget .

An important feature is the ability to read or save the current state of all things concerning to dockwidgets to KConfig .

The dockmanager is also often used when a certain dockwidget or a child of such dockwidget must be found.

Author:
  Max Judin (documentation: Falk Brettschneider).

Definition at line 834 of file kdockwidget.h.

## Constructor & Destructor Documentation

KDockManager::KDockManager | ( | QWidget * | mainWindow,
|  | const char * | name = 0L
| ) |

Constructs a dockmanager.

Some initialization happen:

- It installs an event filter for the main window,
- a control list for dock objects
- a control list for menu items concerning to menus provided by the dockmanager
- Some state variables are set

Parameters:

  mainWindow | the main window controlled by this
  name | the internal QOject name

Definition at line 1404 of file kdockwidget.cpp.

References QObject::connect(), KStdAccel::name(), and QPtrList< MenuDockData >::setAutoDelete().

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

| Destructs a dockmanager. Definition at line 1450 of file kdockwidget.cpp.

## Member Function Documentation

void KDockManager::writeConfig | ( | KConfig * | c = 0L,
|  | QString | group = QString::null
| ) |

Saves the current state of the dockmanager and of all controlled widgets.

State means here to save the geometry, visibility, parents, internal object names, orientation, separator positions, dockwidget-group information, tab widget states (if it is a tab group) and last but not least some necessary things for recovering the dockmainwindow state.

Parameters:

  c | the KDE configuration saver
  group | the name of the section in KConfig

Definition at line 2154 of file kdockwidget.cpp.

References QMainWindow::centralWidget(), KGlobal::config(), KDockWidget::d, KDockWidget::firstName, QWidget::frameGeometry(), getDockWidgetFromName(), KDockMainWindow::getMainDockWidget(), KDockWidget::header, KDockWidgetPrivate::isContainer, QString::isEmpty(), KDockWidget::isGroup, KDockWidget::isTabGroup, QWidget::isVisible(), KDockWidget::lastName, QString::latin1(), KDockWidgetAbstractHeader::saveConfig(), KConfigBase::setGroup(), QWidget::size(), KDockWidget::splitterOrientation, KConfigBase::sync(), KDockWidget::widget, and KConfigBase::writeEntry().

Referenced by KDockMainWindow::writeDockConfig().

void KDockManager::readConfig | ( | KConfig * | c = 0L,
|  | QString | group = QString::null
| ) |

Like writeConfig but reads the whole stuff in.

In order to restore a window configuration from a config file, it looks up widgets by name (QObject::name) in the childDock variable of KDockManager. This list in turn contains all KDockWidgets (according to the KDockWidget constructor). So in principle, in order to restore a window layout, one must first construct all widgets, put each of them in a KDockWidget and then call readConfig(). And for all that to work, each widget must have a unique name.

Parameters:

  c | the KDE configuration saver
  group | the name of the section in KConfig

Definition at line 2282 of file kdockwidget.cpp.

References activate(), KDockWidget::applyToWidget(), KGlobal::config(), KDockWidget::d, getDockWidgetFromName(), KDockWidget::header, QWidget::hide(), KDockWidgetPrivate::isContainer, QString::isEmpty(), KDockWidget::isGroup, KDockWidget::isTabGroup, QWidget::isVisible(), QString::latin1(), KDockWidgetAbstractHeader::loadConfig(), KDockWidget::manualDock(), QWidget::move(), QTabWidget::page(), KConfigBase::readBoolEntry(), KConfigBase::readEntry(), KConfigBase::readListEntry(), KConfigBase::readNumEntry(), KConfigBase::readRectEntry(), QWidget::resize(), QWidget::setGeometry(), KConfigBase::setGroup(), KDockMainWindow::setMainDockWidget(), KDockMainWindow::setView(), QWidget::show(), KDockWidget::show(), QTabWidget::showPage(), QRect::size(), QRect::topLeft(), KDockWidget::undock(), and KDockWidget::widget.

Referenced by KDockMainWindow::readDockConfig().

void KDockManager::setMainDockWidget2 | ( | KDockWidget * |  | ) |

Since:
  3.1

Definition at line 1445 of file kdockwidget.cpp.

Referenced by KDockMainWindow::setMainDockWidget().

void KDockManager::writeConfig | ( | QDomElement & | base | ) |

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

Definition at line 1938 of file kdockwidget.cpp.

References QMainWindow::centralWidget(), QDomDocument::createElement(), KDockWidgetHeader::dragEnabled(), KDockWidget::firstName, QWidget::frameGeometry(), QString::fromLatin1(), getDockWidgetFromName(), KDockMainWindow::getMainDockWidget(), KDockWidget::header, KDockWidget::isGroup, KDockWidget::isTabGroup, QWidget::isVisible(), KDockWidget::lastName, QString::latin1(), QWidget::size(), KDockWidget::splitterOrientation, and KDockWidget::widget.

void KDockManager::readConfig | ( | QDomElement & | base | ) |

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

Definition at line 2025 of file kdockwidget.cpp.

References activate(), KDockWidget::applyToWidget(), getDockWidgetFromName(), KDockWidget::header, QWidget::hide(), QString::isEmpty(), KDockWidget::isGroup, KDockWidget::isTabGroup, QWidget::isVisible(), QString::latin1(), KDockWidget::manualDock(), QWidget::move(), KStdAccel::name(), QObject::name(), QTabWidget::page(), QWidget::resize(), QMainWindow::setCentralWidget(), KDockWidgetHeader::setDragEnabled(), QWidget::setGeometry(), KDockMainWindow::setMainDockWidget(), QWidget::show(), KDockWidget::show(), QTabWidget::showPage(), QRect::size(), QDomElement::tagName(), QRect::topLeft(), KDockWidget::undock(), and KDockWidget::widget.

void KDockManager::activate | ( |  | ) |

| Shows all encapsulated widgets of all controlled dockwidgets and shows all dockwidgets which are parent of a dockwidget tab group. Definition at line 1466 of file kdockwidget.cpp. References KDockWidget::parentDockTabGroup(), KDockWidget::show(), QWidget::show(), and KDockWidget::widget. Referenced by KDockMainWindow::activateDock(), and readConfig().

bool KDockManager::eventFilter | ( | QObject * | ,
|  | QEvent * |
| ) | `[virtual]`

It's more or less a method that catches several events which are interesting for the dockmanager.

Mainly mouse events during the drag process of a dockwidgets are of interest here.

Parameters:

  _ | the object that sends the event
  _ | the event

Returns:
  the return value of the method call of the base class method

Reimplemented from QObject.

Definition at line 1481 of file kdockwidget.cpp.

References KDockWidget::currentDockPos, KDockWidget::dockBack(), KDockWidget::eDocking, KNotifyClient::event(), QObject::eventFilter(), QWidget::geometry(), QObject::inherits(), QWidget::mapFromGlobal(), QWidget::mapToGlobal(), QWidget::move(), QCursor::pos(), QWidget::setFocus(), and KDockWidget::toDesktop().

KDockWidget * KDockManager::findWidgetParentDock | ( | QWidget * | w | ) | const

This method finds out what a widgets' dockwidget is.

That means the dockmanager has a look at all dockwidgets it knows and tells you when one of those dockwidgets covers the given widget.

Parameters:

  w | any widget that is supposed to be encapsulated by one of the controlled dockwidgets

Returns:
  the dockwidget that encapsulates that widget, otherwise 0

Definition at line 2500 of file kdockwidget.cpp.

References KDockWidget::widget.

Referenced by KDockMainWindow::makeWidgetDockVisible().

void KDockManager::makeWidgetDockVisible | ( | QWidget * | w | ) | `[inline]`

Works like makeDockVisible() but can be called for widgets that covered by a dockwidget.

Parameters:

  w | the widget that is encapsulated by a dockwidget that turns to visible.

Definition at line 931 of file kdockwidget.h.

References KDockWidget::makeDockVisible().

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

Returns:
  the popupmenu for showing/hiding dockwidgets

Definition at line 936 of file kdockwidget.h.

Referenced by KDockMainWindow::dockHideShowMenu().

KDockWidget * KDockManager::getDockWidgetFromName | ( | const QString & | dockName | ) |

Parameters:

  dockName | an internal QObject name

Returns:
  the dockwidget that has got that internal QObject name

Definition at line 2424 of file kdockwidget.cpp.

References QString::latin1().

Referenced by readConfig(), and writeConfig().

void KDockManager::setSplitterOpaqueResize | ( | bool | b = true | ) |

| Enables opaque resizing. Opaque resizing is initially turned off. Call this method before you create any dock widgets! Definition at line 2440 of file kdockwidget.cpp.

bool KDockManager::splitterOpaqueResize | ( |  | ) | const

| Returns TRUE if opaque resizing is enabled, FALSE otherwise. Definition at line 2445 of file kdockwidget.cpp. Referenced by KDockWidget::manualDock().

void KDockManager::setSplitterKeepSize | ( | bool | b = true | ) |

| Try to preserve the widget's size. Works like KeepSize resize mode of QSplitter. Off by default. Call this method before you create any dock widgets! Definition at line 2450 of file kdockwidget.cpp.

bool KDockManager::splitterKeepSize | ( |  | ) | const

| Returns TRUE if the KeepSize is enabled, FALSE otherwise. Definition at line 2455 of file kdockwidget.cpp. Referenced by KDockWidget::manualDock().

void KDockManager::setSplitterHighResolution | ( | bool | b = true | ) |

| Operate the splitter with a higher resolution. Off by default. Call this method before you create any dock widgets! If high resolution is used all splitter position parameters are percent*100 instead of percent. Definition at line 2460 of file kdockwidget.cpp.

bool KDockManager::splitterHighResolution | ( |  | ) | const

| Returns TRUE if the splitter uses the high resolution, FALSE otherwise. Definition at line 2465 of file kdockwidget.cpp. Referenced by KDockWidget::manualDock().

void KDockManager::change | ( |  | ) | `[signal]`

| Signals changes of the docking state of a dockwidget. Usually the dock-toolbar will be updated then. Referenced by KDockWidget::event(), KDockWidget::manualDock(), and KDockWidget::undock().

void KDockManager::replaceDock | ( | KDockWidget * | oldDock,
|  | KDockWidget * | newDock
| ) | `[signal]`

| Signals a dockwidget is replaced with another one. Referenced by KDockWidget::manualDock(), and KDockWidget::undock().

void KDockManager::setDockDefaultPos | ( | KDockWidget * |  | ) | `[signal]`

| Signals a dockwidget without parent (toplevel) is shown. Referenced by KDockWidget::show().

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