Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions

TQDockArea Class Reference

The TQDockArea class manages and lays out TQDockWindows. More...

#include <ntqdockarea.h>

Inherits TQWidget.

List of all member functions.

Public Members

Public Slots

Properties

Related Functions


Detailed Description

The TQDockArea class manages and lays out TQDockWindows.

A TQDockArea is a container which manages a list of TQDockWindows which it lays out within its area. In cooperation with the TQDockWindows it is responsible for the docking and undocking of TQDockWindows and moving them inside the dock area. TQDockAreas also handle the wrapping of TQDockWindows to fill the available space as compactly as possible. TQDockAreas can contain TQToolBars since TQToolBar is a TQDockWindow subclass.

TQMainWindow contains four TQDockAreas which you can use for your TQToolBars and TQDockWindows, so in most situations you do not need to use the TQDockArea class directly. Although TQMainWindow contains support for its own dock areas it isn't convenient for adding new TQDockAreas. If you need to create your own dock areas we suggest that you create a subclass of TQWidget and add your TQDockAreas to your subclass.

TQMainWindow's TQDockAreas

Lines. TQDockArea uses the concept of lines. A line is a horizontal region which may contain dock windows side-by-side. A dock area may have room for more than one line. When dock windows are docked into a dock area they are usually added at the right hand side of the top-most line that has room (unless manually placed by the user). When users move dock windows they may leave empty lines or gaps in non-empty lines. Dock windows can be lined up to minimize wasted space using the lineUp() function.

The TQDockArea class maintains a position list of all its child dock windows. Dock windows are added to a dock area from position 0 onwards. Dock windows are laid out sequentially in position order from left to right, and in the case of multiple lines of dock windows, from top to bottom. If a dock window is floated it still retains its position since this is where the window will return if the user double clicks its caption. A dock window's position can be determined with hasDockWindow(). The position can be changed with moveDockWindow().

To dock or undock a dock window use TQDockWindow::dock() and TQDockWindow::undock() respectively. If you want to control which dock windows can dock in a dock area use setAcceptDockWindow(). To see if a dock area contains a particular dock window use hasDockWindow(); to see how many dock windows a dock area contains use count().

The streaming operators can write the positions of the dock windows in the dock area to a TQTextStream. The positions can be read back later to restore the saved positions.

Save the positions to a TQTextStream:

    ts << *myDockArea;
    

Restore the positions from a TQTextStream:

    ts >> *myDockArea;
    

See also Main Window and Related Classes.


Member Type Documentation

TQDockArea::HandlePosition

A dock window has two kinds of handles, the dock window handle used for dragging the dock window, and the splitter handle used to resize the dock window in relation to other dock windows using a splitter. (The splitter handle is only visible for docked windows.)

This enum specifies where the dock window splitter handle is placed in the dock area.


Member Function Documentation

TQDockArea::TQDockArea ( Orientation o, HandlePosition h = Normal, TQWidget * parent = 0, const char * name = 0 )

Constructs a TQDockArea with orientation o, HandlePosition h, parent parent and called name.

TQDockArea::~TQDockArea ()

Destroys the dock area and all the dock windows docked in the dock area.

Does not affect any floating dock windows or dock windows in other dock areas, even if they first appeared in this dock area. Floating dock windows are effectively top level windows and are not child windows of the dock area. When a floating dock window is docked (dragged into a dock area) its parent becomes the dock area.

int TQDockArea::count () const

Returns the number of dock windows in the dock area. See the "count" property for details.

TQPtrList<TQDockWindow> TQDockArea::dockWindowList () const

Returns a list of the dock windows in the dock area.

HandlePosition TQDockArea::handlePosition () const

Returns where the dock window splitter handle is placed in the dock area. See the "handlePosition" property for details.

bool TQDockArea::hasDockWindow ( TQDockWindow * w, int * index = 0 )

Returns TRUE if the dock area contains the dock window w; otherwise returns FALSE. If index is not 0 it will be set as follows: if the dock area contains the dock window *index is set to w's index position; otherwise *index is set to -1.

bool TQDockArea::isDockWindowAccepted ( TQDockWindow * dw )

Returns TRUE if dock window dw could be docked into the dock area; otherwise returns FALSE.

See also setAcceptDockWindow().

bool TQDockArea::isEmpty () const

Returns TRUE if the dock area is empty; otherwise returns FALSE. See the "empty" property for details.

void TQDockArea::lineUp ( bool keepNewLines ) [slot]

Lines up the dock windows in this dock area to minimize wasted space. If keepNewLines is TRUE, only space within lines is cleaned up. If keepNewLines is FALSE the number of lines might be changed.

void TQDockArea::moveDockWindow ( TQDockWindow * w, int index = -1 )

Moves the TQDockWindow w within the dock area. If w is not already docked in this area, w is docked first. If index is -1 or larger than the number of docked widgets, w is appended at the end, otherwise it is inserted at the position index.

void TQDockArea::moveDockWindow ( TQDockWindow * w, const TQPoint & p, const TQRect & r, bool swap )

This is an overloaded member function, provided for convenience. It behaves essentially like the above function.

Moves the dock window w inside the dock area where p is the new position (in global screen coordinates), r is the suggested rectangle of the dock window and swap specifies whether or not the orientation of the docked widget needs to be changed.

This function is used internally by TQDockWindow. You shouldn't need to call it yourself.

Orientation TQDockArea::orientation () const

Returns the dock area's orientation. See the "orientation" property for details.

void TQDockArea::removeDockWindow ( TQDockWindow * w, bool makeFloating, bool swap, bool fixNewLines = TRUE )

Removes the dock window w from the dock area. If makeFloating is TRUE, w gets floated, and if swap is TRUE, the orientation of w gets swapped. If fixNewLines is TRUE (the default) newlines in the area will be fixed.

You should never need to call this function yourself. Use TQDockWindow::dock() and TQDockWindow::undock() instead.

void TQDockArea::setAcceptDockWindow ( TQDockWindow * dw, bool accept )

If accept is TRUE, dock window dw can be docked in the dock area. If accept is FALSE, dock window dw cannot be docked in the dock area.

See also isDockWindowAccepted().


Property Documentation

int count

This property holds the number of dock windows in the dock area.

Get this property's value with count().

bool empty

This property holds whether the dock area is empty.

Get this property's value with isEmpty().

HandlePosition handlePosition

This property holds where the dock window splitter handle is placed in the dock area.

The default position is Normal.

Get this property's value with handlePosition().

Orientation orientation

This property holds the dock area's orientation.

There is no default value; the orientation is specified in the constructor.

Get this property's value with orientation().


Related Functions

TQTextStream & operator<< ( TQTextStream & ts, const TQDockArea & dockArea )

Writes the layout of the dock windows in dock area dockArea to the text stream ts.

See also operator>>().

TQTextStream & operator>> ( TQTextStream & ts, TQDockArea & dockArea )

Reads the layout description of the dock windows in dock area dockArea from the text stream ts and restores it. The layout description must have been previously written by the operator<<() function.

See also operator<<().


This file is part of the TQt toolkit. Copyright © 1995-2007 Trolltech. All Rights Reserved.


Copyright © 2007 TrolltechTrademarks
TQt 3.3.8