KDockMainWindow Class Reference

`#include <kdockwidget.h>`

Inheritance diagram for KDockMainWindow:

## Signals

void | dockWidgetHasUndocked (KDockWidget *)

## Public Member Functions

| KDockMainWindow (QWidget *parent=0L, const char *name=0L, WFlags f=WType_TopLevel|WDestructiveClose)
virtual | ~KDockMainWindow ()
KDockManager * | manager () const
void | setMainDockWidget (KDockWidget *dockwidget)
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 *widget)
Public Member Functions inherited from KMainWindow
| KMainWindow (QWidget *parent=0, const char *name=0, WFlags f=WType_TopLevel|WDestructiveClose)
| KMainWindow (int cflags, QWidget *parent=0, const char *name=0, WFlags f=WType_TopLevel|WDestructiveClose)
virtual | ~KMainWindow ()
KPopupMenu * | helpMenu (const QString &aboutAppText=QString::null, bool showWhatsThis=true)
KPopupMenu * | customHelpMenu (bool showWhatsThis=true)
virtual void | show ()
virtual void | hide ()
bool | restore (int number, bool show=true)
virtual KXMLGUIFactory * | guiFactory ()
void | createGUI (const QString &xmlfile=QString::null, bool _conserveMemory=true)
void | setHelpMenuEnabled (bool showHelpMenu=true)
bool | isHelpMenuEnabled ()
bool | hasMenuBar ()
KMenuBar * | menuBar ()
KStatusBar * | statusBar ()
KToolBar * | toolBar (const char *name=0)
QPtrListIterator< KToolBar > | toolBarIterator ()
KAccel * | accel ()
void | setFrameBorderWidth (int)
void | setAutoSaveSettings (const QString &groupName=QString::fromLatin1("MainWindow"), bool saveWindowSize=true)
void | resetAutoSaveSettings ()
bool | autoSaveSettings () const
QString | autoSaveGroup () const
void | applyMainWindowSettings (KConfig *config, const QString &groupName, bool force)
void | applyMainWindowSettings (KConfig *config, const QString &groupName=QString::null)
void | saveMainWindowSettings (KConfig *config, const QString &groupName=QString::null)
void | setStandardToolBarMenuEnabled (bool enable)
bool | isStandardToolBarMenuEnabled () const
void | createStandardStatusBarAction ()
void | setupGUI (int options=ToolBar|Keys|StatusBar|Save|Create, const QString &xmlfile=QString::null)
void | setupGUI (QSize defaultSize, int options=ToolBar|Keys|StatusBar|Save|Create, const QString &xmlfile=QString::null)
KAction * | toolBarMenuAction ()
void | setupToolbarMenuActions ()
virtual void | finalizeGUI (KXMLGUIClient *client)
void | finalizeGUI (bool force)
bool | initialGeometrySet () const
void | ignoreInitialGeometry ()
QSize | sizeForCentralWidgetSize (QSize size) KDE_DEPRECATED
virtual void | setIcon (const QPixmap &)
Public Member Functions inherited from KXMLGUIBuilder
| KXMLGUIBuilder (QWidget *widget)
KXMLGUIClient * | builderClient () const
void | setBuilderClient (KXMLGUIClient *client)
KInstance * | builderInstance () const
void | setBuilderInstance (KInstance *instance)
QWidget * | widget ()
virtual QStringList | containerTags () const
virtual QWidget * | createContainer (QWidget *parent, int index, const QDomElement &element, int &id)
virtual void | removeContainer (QWidget *container, QWidget *parent, QDomElement &element, int id)
virtual QStringList | customTags () const
virtual int | createCustomElement (QWidget *parent, int index, const QDomElement &element)
virtual void | removeCustomElement (QWidget *parent, int id)
Public Member Functions inherited from KXMLGUIClient
| KXMLGUIClient ()
| KXMLGUIClient (KXMLGUIClient *parent)
virtual | ~KXMLGUIClient ()
KAction * | action (const char *name) const
virtual KAction * | action (const QDomElement &element) const
virtual KActionCollection * | actionCollection () const
virtual KInstance * | instance () const
virtual QDomDocument | domDocument () const
virtual QString | xmlFile () const
virtual QString | localXMLFile () const
void | setXMLGUIBuildDocument (const QDomDocument &doc)
QDomDocument | xmlguiBuildDocument () const
void | setFactory (KXMLGUIFactory *factory)
KXMLGUIFactory * | factory () const
KXMLGUIClient * | parentClient () const
void | insertChildClient (KXMLGUIClient *child)
void | removeChildClient (KXMLGUIClient *child)
const QPtrList< KXMLGUIClient > * | childClients ()
void | setClientBuilder (KXMLGUIBuilder *builder)
KXMLGUIBuilder * | clientBuilder () const
void | reloadXML ()
void | plugActionList (const QString &name, const QPtrList< KAction > &actionList)
void | unplugActionList (const QString &name)
void | addStateActionEnabled (const QString &state, const QString &action)
void | addStateActionDisabled (const QString &state, const QString &action)
StateChange | getActionsToChangeForState (const QString &state)
void | beginXMLPlug (QWidget *)
void | endXMLPlug ()
void | prepareXMLUnplug (QWidget *)

## Protected Slots

void | slotDockWidgetUndocked ()
Protected Slots inherited from KMainWindow
void | saveNewToolbarConfig ()
virtual void | showAboutApplication ()
void | saveAutoSaveSettings ()

## Protected Member Functions

virtual void | virtual_hook (int id, void *data)
Protected Member Functions inherited from KMainWindow
void | paintEvent (QPaintEvent *e)
void | childEvent (QChildEvent *e)
void | resizeEvent (QResizeEvent *e)
virtual void | closeEvent (QCloseEvent *)
virtual bool | queryExit ()
virtual bool | queryClose ()
virtual void | saveProperties (KConfig *)
virtual void | readProperties (KConfig *)
virtual void | saveGlobalProperties (KConfig *sessionConfig)
virtual void | readGlobalProperties (KConfig *sessionConfig)
void | savePropertiesInternal (KConfig *, int)
bool | readPropertiesInternal (KConfig *, int)
bool | settingsDirty () const
QString | settingsGroup () const
void | saveWindowSize (KConfig *config) const
void | restoreWindowSize (KConfig *config)
void | parseGeometry (bool parsewidth)
Protected Member Functions inherited from KXMLGUIClient
virtual void | setInstance (KInstance *instance)
virtual void | setXMLFile (const QString &file, bool merge=false, bool setXMLDoc=true)
virtual void | setLocalXMLFile (const QString &file)
virtual void | setXML (const QString &document, bool merge=false)
virtual void | setDOMDocument (const QDomDocument &document, bool merge=false)
virtual void | conserveMemory ()
virtual void | stateChanged (const QString &newstate, ReverseStateChange reverse=StateNoReverse)

## Protected Attributes

KDockWidget * | mainDockWidget
KDockManager * | dockManager

## Friends

class | KDockManager

## Additional Inherited Members

Public Types inherited from KMainWindow
enum | CreationFlags { NoDCOPObject = 1 }
enum | StandardWindowOptions { ToolBar = 1, Keys = 2, StatusBar = 4, Save = 8, Create = 16 }
Public Types inherited from KXMLGUIClient
enum | ReverseStateChange { StateNoReverse, StateReverse }
Public Slots inherited from KMainWindow
int | configureToolbars ()
virtual void | setCaption (const QString &caption)
virtual void | setCaption (const QString &caption, bool modified)
virtual void | setPlainCaption (const QString &caption)
void | appHelpActivated (void)
virtual void | slotStateChanged (const QString &newstate)
void | slotStateChanged (const QString &newstate, KXMLGUIClient::ReverseStateChange)
void | setSettingsDirty ()
Static Public Member Functions inherited from KMainWindow
static bool | canBeRestored (int number)
static const QString | classNameOfToplevel (int number)
static QPtrList< KMainWindow > * | getMemberList ()
Static Public Member Functions inherited from KXMLGUIClient
static QString | findMostRecentXMLFile (const QStringList &files, QString &doc)
Static Public Attributes inherited from KMainWindow
static QPtrList< KMainWindow > * | memberList = 0L

## 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 dynamic 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 1307 of file kdockwidget.h.

## Constructor & Destructor Documentation

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

Constructs a dockmainwindow.

A special kind of KMainWindow that is able to have dockwidget child widgets.

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

  parent | Parent widget for the dock main widget
  name | internal object name
  f | Qt::WidgetFlags widget flags

The main widget should be a dockwidget where other dockwidgets can be docked to the left, right, top, bottom or to the middle. Furthermore, the KDockMainWindow has got the KDocManager and some data about the dock states.

Author
  Max Judin.

Definition at line 102 of file kdockwidget.cpp.

KDockMainWindow::~KDockMainWindow | ( |  | ) |

virtual

Destructs a dockmainwindow.

Definition at line 110 of file kdockwidget.cpp.

## Member Function Documentation

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 1402 of file kdockwidget.h.

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 135 of file kdockwidget.cpp.

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 1410 of file kdockwidget.h.

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

signal

Signals a certain dockwidget is undocked now.

KDockWidget* KDockMainWindow::getMainDockWidget | ( |  | ) | const

inline

Returns the main dockwidget.

Returns
  pointer to the main dockwidget

Definition at line 1353 of file kdockwidget.h.

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

This method hides the given dockwidget.

Parameters

  dock | the dockwidget that is to be shown

Definition at line 146 of file kdockwidget.cpp.

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 140 of file kdockwidget.cpp.

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 152 of file kdockwidget.cpp.

KDockManager* KDockMainWindow::manager | ( |  | ) | const

inline

Returns the dockmanager of this.

(see KDockManager)

Returns
  pointer to the wanted dockmanager

Definition at line 1338 of file kdockwidget.h.

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

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

Definition at line 162 of file kdockwidget.cpp.

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 173 of file kdockwidget.cpp.

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

Sets a new main dockwidget.

Additionally, the toolbar is re-initialized.

Parameters

  dockwidget | dockwidget that become the new main dockwidget

Definition at line 115 of file kdockwidget.cpp.

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

This method calls the base class method.

If the given widget inherits KDockWidget, applyToWidget(this) is called.

Parameters

  widget | any widget that should become the main view

Definition at line 122 of file kdockwidget.cpp.

void KDockMainWindow::slotDockWidgetUndocked | ( |  | ) |

protected slot

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

Definition at line 179 of file kdockwidget.cpp.

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

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

Definition at line 157 of file kdockwidget.cpp.

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 168 of file kdockwidget.cpp.

## Member Data Documentation

KDockManager* KDockMainWindow::dockManager

protected

A pointer to the manager for the dock process.

Definition at line 1458 of file kdockwidget.h.

KDockWidget* KDockMainWindow::mainDockWidget

protected

A pointer to the main dockwidget (where one can manualDock() to.

Definition at line 1453 of file kdockwidget.h.

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

- kdockwidget.h
- kdockwidget.cpp

KDE Home | KDE Accessibility Home | Description of Access Keys