kdgantt

KDGanttMinimizeSplitter Class Reference

#include <KDGanttMinimizeSplitter.h>

Inheritance diagram for KDGanttMinimizeSplitter:

KDGanttView List of all members.

Detailed Description

The KDGanttMinimizeSplitter class implements a splitter widget with minimize buttons.

This class (and its documentation) is largely a copy of Qt's QSplitter; the copying was necessary because QSplitter is not extensible at all. QSplitter and its documentation are licensed according to the GPL and the Qt Professional License (if you hold such a license) and are (C) Trolltech AS.

A splitter lets the user control the size of child widgets by dragging the boundary between the children. Any number of widgets may be controlled.

To show a QListBox, a QListView and a QTextEdit side by side:

    KDGanttMinimizeSplitter *split = new KDGanttMinimizeSplitter( parent );
    QListBox *lb = new QListBox( split );
    QListView *lv = new QListView( split );
    QTextEdit *ed = new QTextEdit( split );

In KDGanttMinimizeSplitter, the boundary can be either horizontal or vertical. The default is horizontal (the children are side by side) but you can use setOrientation( QSplitter::Vertical ) to set it to vertical.

Use setResizeMode() to specify that a widget should keep its size when the splitter is resized.

Although KDGanttMinimizeSplitter normally resizes the children only at the end of a resize operation, if you call setOpaqueResize( TRUE ) the widgets are resized as often as possible.

The initial distribution of size between the widgets is determined by the initial size of each widget. You can also use setSizes() to set the sizes of all the widgets. The function sizes() returns the sizes set by the user.

If you hide() a child, its space will be distributed among the other children. It will be reinstated when you show() it again. It is also possible to reorder the widgets within the splitter using moveToFirst() and moveToLast().

Definition at line 47 of file KDGanttMinimizeSplitter.h.


Public Types

enum  ResizeMode { Stretch, KeepSize, FollowSizeHint }
enum  Direction { Left, Right, Up, Down }

Public Member Functions

 KDGanttMinimizeSplitter (QWidget *parent=0, const char *name=0)
 KDGanttMinimizeSplitter (Orientation, QWidget *parent=0, const char *name=0)
 ~KDGanttMinimizeSplitter ()
virtual void setOrientation (Orientation)
Orientation orientation () const
void setMinimizeDirection (Direction)
Direction minimizeDirection () const
virtual void setResizeMode (QWidget *w, ResizeMode)
virtual void setOpaqueResize (bool=TRUE)
bool opaqueResize () const
void moveToFirst (QWidget *)
void moveToLast (QWidget *)
void refresh ()
virtual QSize sizeHint () const
virtual QSize minimumSizeHint () const
QValueList< int > sizes () const
void setSizes (QValueList< int >)
void expandPos (int id, int *min, int *max)

Protected Member Functions

void childEvent (QChildEvent *)
bool event (QEvent *)
void resizeEvent (QResizeEvent *)
int idAfter (QWidget *) const
void moveSplitter (QCOORD pos, int id)
virtual void drawSplitter (QPainter *, QCOORD x, QCOORD y, QCOORD w, QCOORD h)
void styleChange (QStyle &)
int adjustPos (int, int)
virtual void setRubberband (int)
void getRange (int id, int *, int *)

Properties

Orientation orientation []
Direction minimizeDirection []

Friends

class KDGanttSplitterHandle

Member Enumeration Documentation

This enum type describes how KDGanttMinimizeSplitter will resize each of its child widgets. The currently defined values are:

Stretch: the widget will be resized when the splitter itself is resized.

KeepSize: KDGanttMinimizeSplitter will try to keep this widget's size unchanged.

FollowSizeHint: KDGanttMinimizeSplitter will resize the widget when the widget's size hint changes.

Definition at line 55 of file KDGanttMinimizeSplitter.h.

The values of this enumeration describe into which direction the splitter will collapse its child widgets. By extension, it also specifies the orientation of the splitter; collapsing to the left or to the right results in a horizontal splitter, collapsing to the top or bottom in a vertical splitter.

Definition at line 56 of file KDGanttMinimizeSplitter.h.


Constructor & Destructor Documentation

KDGanttMinimizeSplitter::KDGanttMinimizeSplitter ( QWidget *  parent = 0,
const char *  name = 0 
)

Constructs a horizontal splitter with the parent and name arguments being passed on to the QFrame constructor.

Definition at line 394 of file KDGanttMinimizeSplitter.cpp.

KDGanttMinimizeSplitter::KDGanttMinimizeSplitter ( Orientation  o,
QWidget *  parent = 0,
const char *  name = 0 
)

Constructs a splitter with orientation o with the parent and name arguments being passed on to the QFrame constructor.

Definition at line 407 of file KDGanttMinimizeSplitter.cpp.

KDGanttMinimizeSplitter::~KDGanttMinimizeSplitter (  ) 

Destroys the splitter and any children.

Definition at line 419 of file KDGanttMinimizeSplitter.cpp.


Member Function Documentation

void KDGanttMinimizeSplitter::setOrientation ( Orientation  o  )  [virtual]

the orientation of the splitter

By default the orientation is horizontal (the widgets are side by side). The possible orientations are Qt:Vertical and Qt::Horizontal (the default).

Definition at line 447 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::setMinimizeDirection ( Direction  direction  ) 

Specifies the direction of the minimize buttons. If the orientation of the splitter is horizontal then with KDGanttMinimizeSplitter::Left or KDGanttMinimizeSplitter::Right should be used, otherwise either KDGanttMinimizeSplitter::Up or KDGanttMinimizeSplitter::Down should be used.

Definition at line 1353 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::setResizeMode ( QWidget *  w,
ResizeMode  mode 
) [virtual]

Sets resize mode of w to mode.

See also:
ResizeMode

Definition at line 1016 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::setOpaqueResize ( bool  on = TRUE  )  [virtual]

If on is TRUE then opaque resizing is turned on; otherwise opaque resizing is turned off. Opaque resizing is initially turned off.

See also:
opaqueResize()

Definition at line 1052 of file KDGanttMinimizeSplitter.cpp.

bool KDGanttMinimizeSplitter::opaqueResize (  )  const

Returns TRUE if opaque resize is on; otherwise returns FALSE.

See also:
setOpaqueResize()

Definition at line 1038 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::moveToFirst ( QWidget *  w  ) 

Moves widget w to the leftmost/top position.

Definition at line 1062 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::moveToLast ( QWidget *  w  ) 

Moves widget w to the rightmost/bottom position.

Definition at line 1091 of file KDGanttMinimizeSplitter.cpp.

QSize KDGanttMinimizeSplitter::sizeHint (  )  const [virtual]

Reimplemented from superclass.

Reimplemented in KDGanttView.

Definition at line 1129 of file KDGanttMinimizeSplitter.cpp.

QSize KDGanttMinimizeSplitter::minimumSizeHint (  )  const [virtual]

Reimplemented from superclass.

Definition at line 1159 of file KDGanttMinimizeSplitter.cpp.

QValueList< int > KDGanttMinimizeSplitter::sizes (  )  const

Returns a list of the size parameters of all the widgets in this splitter.

Giving the values to another splitter's setSizes() function will produce a splitter with the same layout as this one.

Note that if you want to iterate over the list, you should iterate over a copy, e.g.

    QValueList<int> list = mySplitter.sizes();
    QValueList<int>::Iterator it = list.begin();
    while( it != list.end() ) {
    myProcessing( *it );
    ++it;
    }

See also:
setSizes()

Definition at line 1269 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::setSizes ( QValueList< int >  list  ) 

Sets the size parameters to the values given in list. If the splitter is horizontal, the values set the sizes from left to right. If it is vertical, the sizes are applied from top to bottom. Extra values in list are ignored.

If list contains too few values, the result is undefined but the program will still be well-behaved.

See also:
sizes()

Definition at line 1300 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::childEvent ( QChildEvent *  c  )  [protected]

Tells the splitter that a child widget has been inserted or removed. The event is passed in c.

Definition at line 530 of file KDGanttMinimizeSplitter.cpp.

bool KDGanttMinimizeSplitter::event ( QEvent *  e  )  [protected]

Reimplemented from superclass.

Definition at line 604 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::resizeEvent ( QResizeEvent *   )  [protected]

Reimplemented from superclass.

Definition at line 474 of file KDGanttMinimizeSplitter.cpp.

int KDGanttMinimizeSplitter::idAfter ( QWidget *  w  )  const [protected]

Returns the id of the splitter to the right of or below the widget w, or 0 if there is no such splitter (i.e. it is either not in this KDGanttMinimizeSplitter or it is at the end).

Definition at line 636 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::moveSplitter ( QCOORD  p,
int  id 
) [protected]

Moves the left/top edge of the splitter handle with id id as close as possible to position p, which is the distance from the left (or top) edge of the widget.

For Arabic and Hebrew the layout is reversed, and using this function to set the position of the splitter might lead to unexpected results, since in Arabic and Hebrew the position of splitter one is to the left of the position of splitter zero.

See also:
idAfter()

Definition at line 663 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::drawSplitter ( QPainter *  p,
QCOORD  x,
QCOORD  y,
QCOORD  w,
QCOORD  h 
) [protected, virtual]

Deprecated:
Draws the splitter handle in the rectangle described by x, y, w, h using painter p.
See also:
QStyle::drawPrimitive()

Definition at line 622 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::styleChange ( QStyle &  old  )  [protected]

Reimplemented from superclass.

Definition at line 1331 of file KDGanttMinimizeSplitter.cpp.

int KDGanttMinimizeSplitter::adjustPos ( int  p,
int  id 
) [protected]

Returns the closest legal position to p of the splitter with id id.

See also:
idAfter()

Definition at line 881 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::setRubberband ( int  p  )  [protected, virtual]

Shows a rubber band at position p. If p is negative, the rubber band is removed.

Definition at line 577 of file KDGanttMinimizeSplitter.cpp.

void KDGanttMinimizeSplitter::getRange ( int  id,
int *  min,
int *  max 
) [protected]

Returns the valid range of the splitter with id id in *min and *max.

See also:
idAfter()

Definition at line 825 of file KDGanttMinimizeSplitter.cpp.


Property Documentation

Orientation KDGanttMinimizeSplitter::orientation [read, write]

Returns the orientation of the splitter.

Definition at line 51 of file KDGanttMinimizeSplitter.h.

KDGanttMinimizeSplitter::Direction KDGanttMinimizeSplitter::minimizeDirection [read, write]

Returns the direction of the minimize buttons.

Definition at line 52 of file KDGanttMinimizeSplitter.h.


The documentation for this class was generated from the following files:
KDE Home | KDE Accessibility Home | Description of Access Keys