|
|
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. That tab widget is a KDockTabCtl .
Furthermore, the KDockMainWindow has got the KDocManager 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);
AnyContentsWidget* cw = new AnyContentsWidget( mainDock);
mainDock->setWidget( cw);
setView( mainDock);
setMainDockWidget( mainDock);
...
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.
| |
Constructs a tab bar widget. The parent and name argument are sent to the QWidget constructor.
| ~ |
Destructs this.
| enum |
For clearer setting (or asking for) the current tab page position.
| void |
Set the position to tabpos and repaints this.
Parameters:
| tabpos | Either TAB_TOP or TAB_RIGHT, just where you
want it to be
|
| int |
Insert a new empty tab page to the tab bar.
If id is not specified, the tab is simply added. Otherwise
it's inserted at the specified position.
Parameters:
| label | The title in the tab page header. |
| id | Suggest an identification number for access operations but it will be shifted to the next free value. |
| index | The tab page position (default=-1 means append) |
Returns: The new allocated id.
| void |
Set an icon for the tab page with that id.
Parameters:
| id | The identification number of that desired page. |
| pix | The new pixmap. |
| void |
Set a tooltip for the tab page with that id.
Parameters:
| id | The identification number of that desired page. |
| toolTipStr | The new tooltip. |
| void |
Set the text colour for the tab page with that id.
Parameters:
| id | The identification number of that desired page. |
| color | The new text colour. |
| const QColor& |
Retrieve the text colour for the tab page with that id.
Parameters:
| id | the identification number of that desired tab page |
Returns: the current text colour of that tab page
| void |
Removes the tab page with that id.
Parameters:
| id | The identification number of that desired page. |
| int |
Retrieve the current tab page.
Returns: The id of the tab page.
| void |
Set the current tab page to the page with that id.
Parameters:
| id | The identification number of that desired page. |
| allowDisable | Disables the tab page. |
| void |
Enable or disable the tab page with that id.
| bool |
Returns if the tab page with that id is enabled or disabled.
| void |
Set the title of the tab page with that id.
Parameters:
| id | The identification number of that desired page. |
| caption | A string for the title. |
| QString |
Retrieve the title of the tab page with that id.
Parameters:
| id | the identification number of that desired page |
| void |
[virtual]
Calls QWidget::show() and showPage() for the current tab page, additionally.
| void |
[virtual]
Set the font of this.
| void |
Show or hide the icons for the tab pages in the header.
| bool |
Returns if the icons for the tab pages are shown in the header.
| void |
[signal]
Signals that a tab page with that id is selected.
Parameters:
| id | the identification number of that desired page |
| void |
[signal]
Signals that the right mouse buttons is pressed on the tab page with that @pid.
Parameters:
| id | The identification number of that desired page. |
| void |
[protected slot]
Does things that should be done if someone has clicked the left mouse button.
| void |
[protected slot]
Does things that should be done if someone has clicked the right mouse button.
| void |
[protected virtual]
Handles paint events for this widgets Reimplemented from QWidget
| void |
[protected virtual]
Handles resize events for this widgets Reimplemented from QWidget
| void |
[protected virtual]
Handles key press events for this widgets Reimplemented from QWidget
| QString |
returns the tooltip string of the tab at this position
| QRect |
returns the tab rectangle at this position
| void |
[protected virtual]
Handles mouse press events for this widgets Reimplemented from QWidget
| void |
[protected virtual]
Handles mouse release events for this widgets Reimplemented from QWidget
| void |
[protected virtual]
Handles resize events for this widgets Reimplemented from QWidget
| void |
[protected virtual]
Handles paint events for this widgets Reimplemented from QWidget
| |
Constructs a dock-tab control object.
| ~ |
Destructs this.
| void |
[virtual]
Calls KDockTabBar::setTabPos of its embedded tab bar but does layout actions, additionally.
| KDockTabBar::TabPos |
Returns the current tab position of its docktabbar.
| int |
Inserts a new tab page in the encapsulated docktabbar. Mainly it calls KDockTabBar::insertTab and does additional management operations.
Parameters:
| w | the widget that is inserted |
| label | the title for the caption bar of the tab page |
| id | suggest an identification number for access operations but it will be shifted to the next free value |
| index | the tab page position (default=-1 means append) |
Returns: the id of the new inserted page
| void |
Sets the title of the tab page. Mainly it calls KDockTabBar::setPageCaption but calls it internally by the page id.
Parameters:
| w | the widget we want to give a new caption |
| s | well, what the heck could that be? ;-) |
| void |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| QString |
Returns the title of the tab page. Mainly it calls KDockTabBar::setPageCaption but calls it internally by the page id.
Parameters:
| w | the widget for that we want to know its caption |
Returns: a string containing the title of the page
| QString |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| void |
Sets an icon for the tab page (shown in the tab header).
Parameters:
| w | the widget we want to give a new icon |
| pix | the new icon |
| void |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| void |
Sets a toolTip for the tab page (shown in the tab header).
Parameters:
| w | the widget we want to give the tooltip |
| toolTipStr | the new tooltip string |
| void |
Sets the text colour of the tab page. Mainly it calls KDockTabBar::setTextColor but calls it internally by the page id.
Parameters:
| w | the widget we want to give a new text colour |
| color | the colour of the tab header |
| void |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| const QColor& |
Returns the text colour of the tab page. Mainly it calls KDockTabBar::textColor but calls it internally by the page id.
Parameters:
| w | the widget we want to ask for its text colour |
| const QColor& |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| bool |
Returns if the tab page is enabled (if it can get the focus).
Parameters:
| w | the widget we want to ask if its page is enabled |
| bool |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| void |
Enable or disable the tab page (whether it can get the focus or not). Mainly it calls KDockTabBar::setPageEnabled but calls it internally by the page id.
Parameters:
| w | the widget that should be enabled |
| e | boolean value whether enabled or disabled |
| void |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| QWidget* |
/
/** Returns the widget that embedded in a page.
Parameters:
| id | the identification number of the page |
| int |
Returns the widget's Id.
Parameters:
| w | the widget that should return its id |
| int |
Returns the widget's index. (tab page position)
Parameters:
| w | the widget that should return its index |
| void |
Removes the tab page from the covered tab bar. Mainly it calls KDockTabBar::removeTab but calls it internally by the page id.
Parameters:
| w | the tab page that should be removed |
| void |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| QWidget* |
Returns the current (visible) tab page.
| int |
Returns the id of the current (visible) tab page.
| void |
Sets the given tab page as the active (and visible) one.
| void |
Sets the font for the tab pages. It just calls the appropriate method of its KDockTabBar.
| QFont |
Returns the font for the tab pages. It simply calls KDockTabBar::tabFont .
| void |
Enables or disables the showing of the icons for every tab page. It simply calls KDockTabBar::showTabIcon .
| bool |
Returns if the tab icon is shown. It simply calls KDockTabBar::isShowTabIcon .
| int |
Returns the number of inserted tab pages.
| QWidget* |
Returns the first tab page in its KDockTabBar.
| QWidget* |
Returns the last tab page in its KDockTabBar.
| QWidget* |
Returns the tab page that is at the right side of the given tab widget.
| QWidget* |
Returns the tab page that is at the left side of the given tab widget.
| void |
[virtual]
Shows its encapsulated tab bar and shows the current tab page.
| bool |
[virtual]
Catches some events that are of interest for this class.
| void |
[virtual slot]
Enables or disables this and its KDockTabBar.
| void |
[slot]
Sets the visible page by its id.
| void |
[protected]
Handles paint events for this widgets Reimplemented from QWidget
| void |
[signal]
Signals that the given widget is about to show.
| void |
[signal]
Signals that that tab page is selected.
| void |
[signal]
Signals that the right mouse button is pressed on this.
| void |
[protected slot]
Do some things that should be done when someone has pressed the right mouse button on this.
| KDockTabCtl_PrivateStruct* |
[protected]
Returns the appropriate data for the widget from the parameter list.
| KDockTabCtl_PrivateStruct* |
[protected]
Returns the appropriate data for the widget from the parameter list described by its id.
| void |
[protected]
Shows the tab page.
| QWidgetStack* |
[protected]
a data structure that contains all embedded widgets.
| QBoxLayout* |
[protected]
The layout manager for automatic positioning and resizing of the embedded tab pages.
| QBoxLayout* |
[protected]
The layout manager for the widget stack.
| QList<KDockTabCtl_PrivateStruct> * |
[protected]
An internal list for managing the tab pages. It stores data items for every tab page in the tab bar. An data item is of type KDockTabCtl_PrivateStruct (a struct) that contains the widget, its id and information about whether it is enabled or disabled.
| QWidget* |
[protected]
A pointer to the widget that is the current tab page in the covered tab bar.
| KDockTabBar* |
[protected]
The actual tab bar widget that is encapsulated by this control class. Often this manager puts only method calls through and does some additional management functions.
| KDockTabBar::TabPos |
[protected]
The current tab position.
| |
Constructs this. It just calls the method of the base class.
| ~ |
[virtual]
Destructs a KDockTabGroup.
| |
Construct a dockwidget.
Initially, docking to another and docking to this is allowed for
every DockPosition. It is supposed to be no (tab) group. It will
taken under control of its dockmanager.
Parameters:
| dockManager | The responsible manager (dock helper) |
| name | Object instance name |
| pixmap | An icon (for instance shown when docked centered) |
| parent | Parent widget |
| strCaption | Title of the dockwidget window (shown when toplevel) |
| strTabPageLabel | The title of the tab page (shown when in tab page mode), if it is "", only the icon will be shown, if it is 0L, the label is set to strCaption |
| ~ |
[virtual]
Destructs a dockwidget.
| enum |
The possible positions where a dockwidget can dock to another dockwidget
| KDockWidget* |
This is a key method of this class! Use it to dock dockwidgets to another dockwidget at the right position within its KDockMainWindow or a toplevel dockwidget.
If the target is null, it will become a toplevel dockwidget at position pos; Note: Docking to another dockwidget means exactly: A new parent dockwidget will be created, that replaces the target dockwidget and contains another single helper widget (tab widget or panner) which contains both dockwidgets, this and the target dockwidget. So consider parent<->child relationships change completely during such actions.
Parameters:
| target | The dockwidget to dock to |
| dockPos | One of the DockPositions this is going to dock to |
| spliPos | The split relation (in percent) between both dockwidgets, target and this |
| pos | The dock position, mainly of interest for docking to the desktop (as toplevel dockwidget) |
| check | Only for internal use; |
| tabIndex | The position index of the tab widget (when in tab page mode), -1 (default) means append |
Returns: result The group dockwidget that replaces the target dockwidget and will be grandparent of target and this.
| void |
Specify where it is either possible or impossible for this to dock to another dockwidget.
Parameters:
| pos | An OR'ed set of DockPositions
|
| int |
Returns: Where it is either possible or impossible for this to dock to another dockwidget (an OR'ed set of DockPositions).
| void |
Specify where it is either possible or impossible for another dockwidget to dock to this.
Parameters:
| pos | An OR'ed set of DockPositions
|
| int |
Returns: There it is either possible or impossible for another dockwidget to dock to this (an OR'ed set of DockPositions).
| void |
Set the embedded widget.
A QLayout takes care about proper resizing, automatically.
Parameters:
| w | The pointer to the dockwidget's child widget. |
| QWidget* |
Get the embedded widget.
Returns: The pointer to the dockwidget's child widget, 0L if there's no such child.
| void |
Set the header of this dockwidget.
A QLayout takes care about proper resizing, automatically. The header contains the drag panel, the close button and the stay button.
Parameters:
| ah | A base class pointer to the dockwidget header |
| void |
Normally it simply shows the dockwidget.
But additionally, if it is docked to a tab widget (DockCenter), it is set as the active (visible) tab page.
| bool |
There are reasons that it's impossible:
Returns: If it may be possible to hide this.
| bool |
KDockMainWindow.
Returns: If it may be possible to show this. There are reasons that it's impossible:
| KDockManager* |
Returns: The dockmanager that is responsible for this.
| void |
Stores a string for a tooltip.
That tooltip string has only a meaning when this dockwidget is shown as tab page. In this case the tooltip is shown when one holds the mouse cursor on the tab page header. Such tooltip will for instance be useful, if you use only icons there. Note: Setting an empty string switches the tooltip off.
Parameters:
| ttStr | A string for the tooltip on the tab. |
| const QString& |
Returns: The tooltip string being shown on the appropriate tab page header when in dock-centered mode.
| bool |
Returns: result true, if a dockback is possible, otherwise false.
| void |
Set a string that is used for the label of the tab page when in tab page mode
Parameters:
| label | The new tab page label. |
| const QString& |
Returns: A string that is used for the label of the tab page when in tab page mode.
| bool |
[virtual]
Catches and processes some QWidget events that are interesting for dockwidgets.
| void |
[virtual]
Add dockwidget management actions to QWidget::show.
| KDockTabGroup* |
Returns: the parent widget of this if it inherits class KDockTabGroup
| void |
[slot]
Docks a dockwidget back to the dockwidget that was the neighbor widget before the current dock position.
| void |
[slot]
Toggles the visibility state of the dockwidget if it is able to be shown or to be hidden.
| void |
[slot]
Undocks this. It means it becomes a toplevel widget framed by the system window manager. A small panel at the top of this undocked widget gives the possibility to drag it into another dockwidget by mouse (docking).
| KDockTabGroup* |
[protected]
Returns: the parent widget of this if it inherits class KDockTabGroup Warning: This will be removed in KDE-3.0. Use parentDockTabGroup instead.
| void |
[protected]
Check some conditions and show or hide the dockwidget header (drag panel). The header is hidden if:
| void |
[signal]
Emits that another dockwidget is docking to this.
Parameters:
| dw | the dockwidget that is docking to this |
| dp | the DockPosition where it wants to dock to |
| void |
[signal]
Signals that the dock default position is set.
| void |
[signal]
Signals that the close button of the panel (KDockWidgetHeader) has been clicked.
| void |
[signal]
Signals that the dockback button of the panel (KDockWidgetHeader) has been clicked.
| void |
[signal]
Signals that the widget processes a close event.
| void |
[signal]
Signals that the widget is undocked now.
| void |
[protected slot]
Does several things here when it has noticed that the former brother widget (closest neighbor) gets lost. The former brother widget is needed for a possible dockback action, to speak with the Beatles: "To get back to where you once belonged" ;-)
| KDockWidget* |
[protected]
earlier closest neighbor widget, so it's possible to dock back to it.
| DockPosition |
[protected]
the current dock position.
| DockPosition |
[protected]
the former dock position when it really was at another position before.
| QString |
[protected]
a string used as tooltip for the tab page header when in dock-centered mode.
| QString |
[protected]
a string used as title of the tab page when in tab page mode
| |
Constructs a dockmanager. Some initialization happen:
Parameters:
| mainWindow | the main window controlled by this |
| name | the internal QOject name |
| ~ |
[virtual]
Destructs a dockmanager.
| void |
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 |
| void |
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 |
| void |
Saves the current dock window layout into a DOM tree below the given element.
| void |
Reads the current dock window layout from a DOM tree below the given element.
| void |
Shows all encapsulated widgets of all controlled dockwidgets and shows all dockwidgets which are parent of a dockwidget tab group.
| bool |
[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
| KDockWidget* |
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
| void |
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. |
| QPopupMenu* |
Returns: the popupmenu for showing/hiding dockwidgets
| KDockWidget* |
Parameters:
| dockName | an internal QObject name |
Returns: the dockwidget that has got that internal QObject name
| void |
[signal]
Signals changes of the docking state of a dockwidget. Usually the dock-toolbar will be updated then.
| void |
[signal]
Signals a dockwidget is replaced with another one.
| void |
[signal]
Signals a dockwidget without parent (toplevel) is shown.
| |
Constructs a dockmainwindow. It calls its base class constructor and does additional things concerning to the dock stuff:
Parameters:
| name | object name |
| ~ |
[virtual]
Destructs a dockmainwindow.
| KDockManager* |
Returns the dockmanager of this. (see KDockManager)
Returns: pointer to the wanted dockmanager
| void |
Sets a new main dockwidget. Additionally, the toolbar is re-initialized.
Parameters:
| _ | dockwidget that become the new main dockwidget |
| KDockWidget* |
Returns the main dockwidget.
Returns: pointer to the main dockwidget
| KDockWidget* |
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 |
Saves the current dock window layout into a DOM tree below the given element.
| void |
Reads the current dock window layout from a DOM tree below the given element.
| void |
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 |
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 |
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* |
Returns a popup menu that contains entries for all controlled dockwidgets making hiding and showing them possible.
Returns: the wanted popup menu
| void |
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 |
This method hides the given dockwidget.
Parameters:
| dock | the dockwidget that is to be shown |
| void |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
| void |
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 |
[signal]
Signals a certain dockwidget is undocked now.
| KDockWidget* |
[protected]
A pointer to the main dockwidget (where one can manualDock() to
| KDockManager* |
[protected]
A pointer to the manager for the dock process
| void |
[protected slot]
Called whenever one of the dockwidgets of this has been undocked.