• Skip to content
  • Skip to link menu
Trinity API Reference
  • Trinity API Reference
  • tdeui
 

tdeui

Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | Friends | List of all members
KDockWidget Class Reference

#include <kdockwidget.h>

Inherits TQWidget.

Public Types

enum  DockPosition {
  DockNone = 0 , DockTop = 0x0001 , DockLeft = 0x0002 , DockRight = 0x0004 ,
  DockBottom = 0x0008 , DockCenter = 0x0010 , DockDesktop = 0x0020 , DockToSpecialSites =0x0040 ,
  DockCorner = DockTop | DockLeft | DockRight | DockBottom , DockFullSite = DockCorner | DockCenter , DockFullDocking = DockFullSite | DockDesktop
}
 

Public Slots

void setForcedFixedWidth (int)
 
void setForcedFixedHeight (int)
 
void restoreFromForcedFixedSize ()
 
int forcedFixedWidth ()
 
int forcedFixedHeight ()
 
void dockBack ()
 
void changeHideShowState ()
 
void undock ()
 
void toDesktop ()
 

Signals

void widgetSet (TQWidget *)
 
void docking (KDockWidget *dw, KDockWidget::DockPosition dp)
 
void setDockDefaultPos ()
 
void headerCloseButtonClicked ()
 
void headerDockbackButtonClicked ()
 
void iMBeingClosed ()
 
void hasUndocked ()
 

Public Member Functions

 KDockWidget (KDockManager *dockManager, const char *name, const TQPixmap &pixmap, TQWidget *parent=0L, const TQString &strCaption=TQString::null, const TQString &strTabPageLabel=TQString::fromLatin1(" "), WFlags f=0)
 
virtual ~KDockWidget ()
 
KDockWidget * manualDock (KDockWidget *target, DockPosition dockPos, int spliPos=50, TQPoint pos=TQPoint(0, 0), bool check=false, int tabIndex=-1)
 
void setEnableDocking (int pos)
 
int enableDocking () const
 
void setDockSite (int pos)
 
int dockSite () const
 
void setWidget (TQWidget *w)
 
TQWidget * getWidget () const
 
void setHeader (KDockWidgetAbstractHeader *ah)
 
KDockWidgetAbstractHeader * getHeader ()
 
void makeDockVisible ()
 
bool mayBeHide () const
 
bool mayBeShow () const
 
KDockManager * dockManager () const
 
void setToolTipString (const TQString &ttStr)
 
const TQString & toolTipString () const
 
bool isDockBackPossible () const
 
void setTabPageLabel (const TQString &label)
 
const TQString & tabPageLabel () const
 
virtual bool event (TQEvent *)
 
virtual void show ()
 
KDockTabGroup * parentDockTabGroup () const
 
TQWidget * parentDockContainer () const
 
void setDockWindowType (NET::WindowType windowType)
 
void setDockWindowTransient (TQWidget *parent, bool transientEnabled)
 
TQWidget * transientTo ()
 
KDockWidget * findNearestDockWidget (DockPosition pos)
 
void setPixmap (const TQPixmap &pixmap=TQPixmap())
 
const TQPixmap & pixmap () const
 
KDockWidget::DockPosition currentDockPosition () const
 

Protected Slots

void loseFormerBrotherDockWidget ()
 
virtual void paintEvent (TQPaintEvent *)
 
virtual void mousePressEvent (TQMouseEvent *)
 
virtual void mouseReleaseEvent (TQMouseEvent *)
 
virtual void mouseMoveEvent (TQMouseEvent *)
 
virtual void leaveEvent (TQEvent *)
 

Protected Member Functions

void updateHeader ()
 
void setLatestKDockContainer (TQWidget *)
 
TQWidget * latestKDockContainer ()
 
void setFormerBrotherDockWidget (KDockWidget *)
 
virtual void virtual_hook (int id, void *data)
 

Protected Attributes

KDockWidget * formerBrotherDockWidget
 
DockPosition currentDockPos
 
DockPosition formerDockPos
 
TQString toolTipStr
 
TQString tabPageTitle
 

Friends

class KDockManager
 
class KDockSplitter
 
class KDockMainWindow
 
class KDockArea
 
class KMdiMainFrm
 
class KMDI::MainWindow
 
class KDockWidgetHeader
 

Detailed Description

Floatable widget that can be dragged around with the mouse and encapsulate the actual widgets (and member of the dockwidget class set).

You just grip the double-lined panel, tear it off its parent widget, drag it somewhere and let it loose. Depending on the position where you leave it, the dockwidget becomes a toplevel window on the desktop (floating mode) or docks to a new widget (dock mode). Note: A KDockWidget can only be docked to a KDockWidget.

If you want to use this kind of widget, your main application window has to be a KDockMainWindow. That is because it has got several additional dock management features, for instance a KDockManager that has an overview over all dockwidgets and and a dockmovemanager (internal class) that handles the dock process.

Usually you create an KDockWidget that covers the actual widget in this way:

...
KDockMainWindow* mainWidget;
...
KDockWidget* dock = 0L;
dock = mainWidget->createDockWidget( "Any window caption", nicePixmap, 0L, i18n("window caption")); // 0L==no parent
TQWidget* actualWidget = new TQWidget( dock);
dock->setWidget( actualWidget); // embed it
dock->setToolTipString(i18n("That's me")); // available when appearing as tab page
...

See KDockMainWindow how a dockwidget is docked in.

Author
Max Judin (documentation: Falk Brettschneider).

Definition at line 428 of file kdockwidget.h.

Member Enumeration Documentation

◆ DockPosition

enum KDockWidget::DockPosition

The possible positions where a dockwidget can dock to another dockwidget.

Enumerator
DockToSpecialSites 
Since
3.1

Definition at line 465 of file kdockwidget.h.

Constructor & Destructor Documentation

◆ KDockWidget()

KDockWidget::KDockWidget ( KDockManager *  dockManager,
const char *  name,
const TQPixmap &  pixmap,
TQWidget *  parent = 0L,
const TQString &  strCaption = TQString::null,
const TQString &  strTabPageLabel = TQString::fromLatin1( " " ),
WFlags  f = 0 
)

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
dockManagerThe responsible manager (dock helper)
nameObject instance name
pixmapAn icon (for instance shown when docked centered)
parentParent widget
strCaptionTitle of the dockwidget window (shown when toplevel)
strTabPageLabelThe 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
fTQt::WidgetFlags widget flags

Definition at line 479 of file kdockwidget.cpp.

◆ ~KDockWidget()

KDockWidget::~KDockWidget ( )
virtual

Destructs a dockwidget.

Definition at line 549 of file kdockwidget.cpp.

Member Function Documentation

◆ changeHideShowState

void KDockWidget::changeHideShowState ( )
slot

Toggles the visibility state of the dockwidget if it is able to be shown or to be hidden.

Definition at line 1518 of file kdockwidget.cpp.

◆ currentDockPosition()

KDockWidget::DockPosition KDockWidget::currentDockPosition ( ) const
Returns
the current dock position.
Since
3.3

Definition at line 1286 of file kdockwidget.cpp.

◆ dockBack

void KDockWidget::dockBack ( )
slot

Docks a dockwidget back to the dockwidget that was the neighbor widget before the current dock position.

Definition at line 1576 of file kdockwidget.cpp.

◆ docking

void KDockWidget::docking ( KDockWidget *  dw,
KDockWidget::DockPosition  dp 
)
signal

Emitted when another dock widget is docking to this.

Parameters
dwthe dockwidget that is docking to this
dpthe DockPosition where it wants to dock to

◆ dockManager()

KDockManager * KDockWidget::dockManager ( ) const
inline
Returns
The dockmanager that is responsible for this.

Definition at line 591 of file kdockwidget.h.

◆ dockSite()

int KDockWidget::dockSite ( ) const
inline
Returns
There it is either possible or impossible for another dockwidget to dock to this (an OR'ed set of DockPositions).

Definition at line 528 of file kdockwidget.h.

◆ enableDocking()

int KDockWidget::enableDocking ( ) const
inline
Returns
Where it is either possible or impossible for this to dock to another dockwidget (an OR'ed set of DockPositions).

Definition at line 516 of file kdockwidget.h.

◆ event()

bool KDockWidget::event ( TQEvent *  event)
virtual

Catches and processes some TQWidget events that are interesting for dockwidgets.

Definition at line 877 of file kdockwidget.cpp.

◆ findNearestDockWidget()

KDockWidget * KDockWidget::findNearestDockWidget ( DockPosition  pos)

Lookup the nearest dockwidget docked left/right/top/bottom to this one or return 0.

Parameters
posis the position the wanted widget is docked to this one
Since
3.1

Definition at line 920 of file kdockwidget.cpp.

◆ forcedFixedHeight

int KDockWidget::forcedFixedHeight ( )
slot
Since
3.1

Definition at line 1258 of file kdockwidget.cpp.

◆ forcedFixedWidth

int KDockWidget::forcedFixedWidth ( )
slot
Since
3.1

Definition at line 1253 of file kdockwidget.cpp.

◆ getHeader()

KDockWidgetAbstractHeader * KDockWidget::getHeader ( )
Since
3.2 get the pointer to the header widget

Definition at line 738 of file kdockwidget.cpp.

◆ getWidget()

TQWidget * KDockWidget::getWidget ( ) const
inline

Get the embedded widget.

Returns
The pointer to the dockwidget's child widget, 0L if there's no such child.

Definition at line 544 of file kdockwidget.h.

◆ hasUndocked

void KDockWidget::hasUndocked ( )
signal

Emitted when the widget has undocked.

◆ headerCloseButtonClicked

void KDockWidget::headerCloseButtonClicked ( )
signal

Emitted when the close button of the panel ( KDockWidgetHeader) has been clicked.

◆ headerDockbackButtonClicked

void KDockWidget::headerDockbackButtonClicked ( )
signal

Emitted when the dockback button of the panel ( KDockWidgetHeader) has been clicked.

◆ iMBeingClosed

void KDockWidget::iMBeingClosed ( )
signal

Emitted when the widget processes a close event.

◆ isDockBackPossible()

bool KDockWidget::isDockBackPossible ( ) const
Returns
result true, if a dockback is possible, otherwise false.

Definition at line 1608 of file kdockwidget.cpp.

◆ latestKDockContainer()

TQWidget * KDockWidget::latestKDockContainer ( )
protected
Since
3.1

Definition at line 729 of file kdockwidget.cpp.

◆ leaveEvent

void KDockWidget::leaveEvent ( TQEvent *  e)
protectedvirtualslot

Definition at line 581 of file kdockwidget.cpp.

◆ loseFormerBrotherDockWidget

void KDockWidget::loseFormerBrotherDockWidget ( )
protectedslot

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" ;-)

Definition at line 1567 of file kdockwidget.cpp.

◆ makeDockVisible()

void KDockWidget::makeDockVisible ( )

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.

Definition at line 1534 of file kdockwidget.cpp.

◆ manualDock()

KDockWidget * KDockWidget::manualDock ( KDockWidget *  target,
DockPosition  dockPos,
int  spliPos = 50,
TQPoint  pos = TQPoint(0,0),
bool  check = false,
int  tabIndex = -1 
)

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
targetThe dockwidget to dock to
dockPosOne of the DockPositions this is going to dock to
spliPosThe split relation (in percent, or percent*100 in high resolution) between both dockwidgets, target and this
posThe dock position, mainly of interest for docking to the desktop (as toplevel dockwidget)
checkOnly for internal use;
tabIndexThe 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.
Note
Since KDE 3.5 the splitter position spliPos is always a value between [0..100]. If the value is > 100, it will be treated like the old code and normalized to a value between 0 and 100. Example: If the value was 4000, it will be fixed to 40. In short: The old and the new behavior both work, so it is compatible with older KDE-versions.

Definition at line 947 of file kdockwidget.cpp.

◆ mayBeHide()

bool KDockWidget::mayBeHide ( ) const
Returns
If it may be possible to hide this.

There are reasons that it's impossible:

  • It is a (tab) group.
  • It is already invisible ;-)
  • The parent of this is the KDockMainWindow.
  • It isn't able to dock to another widget.

Definition at line 1506 of file kdockwidget.cpp.

◆ mayBeShow()

bool KDockWidget::mayBeShow ( ) const
Returns
If it may be possible to show this. There are reasons that it's impossible:
  • It is a (tab) group.
  • It is already visible ;-)
  • The parent of this is the KDockMainWindow.

Definition at line 1512 of file kdockwidget.cpp.

◆ mouseMoveEvent

void KDockWidget::mouseMoveEvent ( TQMouseEvent *  mme)
protectedvirtualslot

Definition at line 659 of file kdockwidget.cpp.

◆ mousePressEvent

void KDockWidget::mousePressEvent ( TQMouseEvent *  mme)
protectedvirtualslot

Definition at line 590 of file kdockwidget.cpp.

◆ mouseReleaseEvent

void KDockWidget::mouseReleaseEvent ( TQMouseEvent *  ev)
protectedvirtualslot

Definition at line 650 of file kdockwidget.cpp.

◆ paintEvent

void KDockWidget::paintEvent ( TQPaintEvent *  pe)
protectedvirtualslot

Definition at line 572 of file kdockwidget.cpp.

◆ parentDockContainer()

TQWidget * KDockWidget::parentDockContainer ( ) const
Since
3.1

Definition at line 1226 of file kdockwidget.cpp.

◆ parentDockTabGroup()

KDockTabGroup * KDockWidget::parentDockTabGroup ( ) const
Returns
the parent widget of this if it inherits class KDockTabGroup

Definition at line 1218 of file kdockwidget.cpp.

◆ pixmap()

const TQPixmap & KDockWidget::pixmap ( ) const

Returns the dockwidget's associated caption/dock tab pixmap.

Since
3.2

Definition at line 545 of file kdockwidget.cpp.

◆ restoreFromForcedFixedSize

void KDockWidget::restoreFromForcedFixedSize ( )
slot
Since
3.1

Definition at line 1263 of file kdockwidget.cpp.

◆ setDockDefaultPos

void KDockWidget::setDockDefaultPos ( )
signal

Signals that the dock default position is set.

◆ setDockSite()

void KDockWidget::setDockSite ( int  pos)
inline

Specify where it is either possible or impossible for another dockwidget to dock to this.

Parameters
posAn OR'ed set of DockPositions

Definition at line 523 of file kdockwidget.h.

◆ setDockWindowTransient()

void KDockWidget::setDockWindowTransient ( TQWidget *  parent,
bool  transientEnabled 
)

Definition at line 866 of file kdockwidget.cpp.

◆ setDockWindowType()

void KDockWidget::setDockWindowType ( NET::WindowType  windowType)

Sets the type of the dock window.

Parameters
windowTypeis type of dock window

Definition at line 858 of file kdockwidget.cpp.

◆ setEnableDocking()

void KDockWidget::setEnableDocking ( int  pos)

Specify where it is either possible or impossible for this to dock to another dockwidget.

Parameters
posAn OR'ed set of DockPositions

Definition at line 762 of file kdockwidget.cpp.

◆ setForcedFixedHeight

void KDockWidget::setForcedFixedHeight ( int  h)
slot

subject to changes.

It doesn't completely work yet without small hacks from within the calling application (Perhaps KDE 3.1.x oder 3.2 height is in pixel. It only affects a widget, which is placed directly into a vertical KDockSplitter

Since
3.1

Definition at line 1244 of file kdockwidget.cpp.

◆ setForcedFixedWidth

void KDockWidget::setForcedFixedWidth ( int  w)
slot

subject to changes.

It doesn't completely work yet without small hacks from within the calling application (Perhaps KDE 3.1.x oder 3.2 width is in pixel. It only affects a widget, which is placed directly into a horizontal KDockSplitter

Since
3.1

Definition at line 1235 of file kdockwidget.cpp.

◆ setFormerBrotherDockWidget()

void KDockWidget::setFormerBrotherDockWidget ( KDockWidget *  dockWidget)
protected
Since
3.2

Definition at line 1559 of file kdockwidget.cpp.

◆ setHeader()

void KDockWidget::setHeader ( KDockWidgetAbstractHeader *  ah)

Sets the header of this dockwidget.

A TQLayout takes care about proper resizing, automatically. The header contains the drag panel, the close button and the stay button.

Parameters
ahA base class pointer to the dockwidget header

Definition at line 742 of file kdockwidget.cpp.

◆ setLatestKDockContainer()

void KDockWidget::setLatestKDockContainer ( TQWidget *  container)
protected
Since
3.1

Definition at line 718 of file kdockwidget.cpp.

◆ setPixmap()

void KDockWidget::setPixmap ( const TQPixmap &  pixmap = TQPixmap())

Allows changing the pixmap which is used for the caption or dock tabs.

Parameters
pixmapis the pixmap to set
Since
3.2

Definition at line 529 of file kdockwidget.cpp.

◆ setTabPageLabel()

void KDockWidget::setTabPageLabel ( const TQString &  label)
inline

Sets a string that is used for the label of the tab page when in tab page mode.

Parameters
labelThe new tab page label.

Definition at line 619 of file kdockwidget.h.

◆ setToolTipString()

void KDockWidget::setToolTipString ( const TQString &  ttStr)
inline

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
ttStrA string for the tooltip on the tab.

Definition at line 603 of file kdockwidget.h.

◆ setWidget()

void KDockWidget::setWidget ( TQWidget *  w)

Sets the embedded widget.

A TQLayout takes care about proper resizing, automatically.

Parameters
wThe pointer to the dockwidget's child widget.

Definition at line 1448 of file kdockwidget.cpp.

◆ show()

void KDockWidget::show ( void  )
virtual

Add dockwidget management actions to TQWidget::show.

Definition at line 840 of file kdockwidget.cpp.

◆ tabPageLabel()

const TQString & KDockWidget::tabPageLabel ( ) const
inline
Returns
A string that is used for the label of the tab page when in tab page mode.

Definition at line 624 of file kdockwidget.h.

◆ toDesktop

void KDockWidget::toDesktop ( )
slot

Docks the widget to the desktop (as a toplevel widget)

Since
3.1

Definition at line 1276 of file kdockwidget.cpp.

◆ toolTipString()

const TQString & KDockWidget::toolTipString ( ) const
inline
Returns
The tooltip string being shown on the appropriate tab page header when in dock-centered mode.

Definition at line 608 of file kdockwidget.h.

◆ transientTo()

TQWidget * KDockWidget::transientTo ( )

Returns the widget this dockwidget is set transient to, otherwise 0.

Since
3.2

Definition at line 873 of file kdockwidget.cpp.

◆ undock

void KDockWidget::undock ( )
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).

Definition at line 1291 of file kdockwidget.cpp.

◆ updateHeader()

void KDockWidget::updateHeader ( )
protected

Checks some conditions and shows or hides the dockwidget header (drag panel).

The header is hidden if:

  • the parent widget is the KDockMainWindow
  • this is a (tab) group dockwidget
  • it is not able to dock to another dockwidget

Definition at line 772 of file kdockwidget.cpp.

◆ virtual_hook()

void KDockWidget::virtual_hook ( int  id,
void *  data 
)
protectedvirtual

Definition at line 3316 of file kdockwidget.cpp.

◆ widgetSet

void KDockWidget::widgetSet ( TQWidget *  )
signal
Since
3.2 is emitted after the setWidget method has finished

Friends And Related Function Documentation

◆ KDockArea

friend class KDockArea
friend

Definition at line 435 of file kdockwidget.h.

◆ KDockMainWindow

friend class KDockMainWindow
friend

Definition at line 434 of file kdockwidget.h.

◆ KDockManager

friend class KDockManager
friend

Definition at line 432 of file kdockwidget.h.

◆ KDockSplitter

friend class KDockSplitter
friend

Definition at line 433 of file kdockwidget.h.

◆ KDockWidgetHeader

friend class KDockWidgetHeader
friend

Definition at line 812 of file kdockwidget.h.

◆ KMDI::MainWindow

friend class KMDI::MainWindow
friend

Definition at line 740 of file kdockwidget.h.

◆ KMdiMainFrm

friend class KMdiMainFrm
friend

Definition at line 739 of file kdockwidget.h.

Member Data Documentation

◆ currentDockPos

DockPosition KDockWidget::currentDockPos
protected

the current dock position.

Definition at line 820 of file kdockwidget.h.

◆ formerBrotherDockWidget

KDockWidget* KDockWidget::formerBrotherDockWidget
protected

earlier closest neighbor widget, so it's possible to dock back to it.

Definition at line 816 of file kdockwidget.h.

◆ formerDockPos

DockPosition KDockWidget::formerDockPos
protected

the former dock position when it really was at another position before.

Definition at line 824 of file kdockwidget.h.

◆ tabPageTitle

TQString KDockWidget::tabPageTitle
protected

a string used as title of the tab page when in tab page mode

Definition at line 832 of file kdockwidget.h.

◆ toolTipStr

TQString KDockWidget::toolTipStr
protected

a string used as tooltip for the tab page header when in dock-centered mode.

Definition at line 828 of file kdockwidget.h.


The documentation for this class was generated from the following files:
  • kdockwidget.h
  • kdockwidget.cpp

tdeui

Skip menu "tdeui"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

tdeui

Skip menu "tdeui"
  • arts
  • dcop
  • dnssd
  • interfaces
  •   kspeech
  •     interface
  •     library
  •   tdetexteditor
  • kate
  • kded
  • kdoctools
  • kimgio
  • kjs
  • libtdemid
  • libtdescreensaver
  • tdeabc
  • tdecmshell
  • tdecore
  • tdefx
  • tdehtml
  • tdeinit
  • tdeio
  •   bookmarks
  •   httpfilter
  •   kpasswdserver
  •   kssl
  •   tdefile
  •   tdeio
  •   tdeioexec
  • tdeioslave
  •   http
  • tdemdi
  •   tdemdi
  • tdenewstuff
  • tdeparts
  • tdeprint
  • tderandr
  • tderesources
  • tdespell2
  • tdesu
  • tdeui
  • tdeunittest
  • tdeutils
  • tdewallet
Generated for tdeui by doxygen 1.9.4
This website is maintained by Timothy Pearson.