Gadget class. More...
#include <ilviews/gadgets/splitgad.h>
Public Member Functions | |
IlvSplitterGadget (IlvDisplay *display, const IlvRect &rect, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
void | addIntersect (IlAny intersect) |
Adds an intersection point between two splitter gadgets. More... | |
IlvGraphicCallback | getCollapseCallback () const |
Returns a pointer to the first unnamed callback in the Collapse callback list. More... | |
IlvDirection | getDirection () const |
Returns the direction of the splitter gadget. More... | |
IlvGraphicCallback | getExpandCallback () const |
Returns a pointer to the first unnamed callback in the Expand callback list. More... | |
IlvPos | getMousePos () const |
Returns the last mouse position registered by the interactor. More... | |
IlBoolean | isCollapsed () const |
Indicates whether the splitter gadget is collapsed. More... | |
virtual void | moveGuide (IlvPos position) |
Moves the associated guide to the specified position. More... | |
void | setCollapseCallback (IlvGraphicCallback callback, IlAny arg) |
Sets a Collapse callback. More... | |
void | setCollapsed (IlBoolean collapsed) |
Specifies whether the splitter gadget should be collapsed. More... | |
void | setExpandCallback (IlvGraphicCallback callback, IlAny arg) |
Sets an Expand callback. More... | |
void | setMousePos (IlvPos pos) |
Memorizes the position of the mouse when the splitter gadget is being dragged. More... | |
Static Public Member Functions | |
static IlSymbol * | CollapseCallbackType () |
Returns the callback type of the Collapse callback. More... | |
static IlSymbol * | ExpandCallbackType () |
Returns the callback type of the Expand callback. More... | |
Friends | |
class | IlvDefaultSplitterGadgetLFHandler |
Gadget class.
Library: ilvadvgdt
A gadget container has vertical and horizontal guides to which graphic objects can be attached. These guides divide the container into several horizontal and vertical sections. An IlvSplitterGadget
object is associated with each guide. When the user moves a splitter gadget, its associated guide moves accordingly and the objects attached to the guides are also moved and reshaped.
IlvGraphicHolder
class.Each splitter gadget has the same direction as its associated guide, which can be either horizontal or vertical. A horizontal splitter can only be moved horizontally. Likewise, a vertical splitter can only be moved vertically.
It can be useful to have two intersecting splitters (one horizontal and one vertical) move at the same time in their own direction. You can use the IlvSplitterGadget::addIntersect()
method to have two intersecting splitters move simultaneously when the user drag their intersection point.
Each section of a container has a minimum size called the limit. The splitter gadget will never resize a section to a size smaller than its limit. When the section reaches its minimum size, it is said to be collapsed. In this case, the splitter simply invokes the Collapse callback defined with IlvSplitterGadget::setCollapseCallback()
, if any. When the user resizes a collapsed section, the splitter invokes the Expand callback (see IlvSplitterGadget::setExpandCallback()
), if it is set.
IlvGraphicHolder
, IlvMakeSplitterGadget
. IlvSplitterGadget::IlvSplitterGadget | ( | IlvDisplay * | display, |
const IlvRect & | rect, | ||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
IlvPalette * | palette = 0 |
||
) |
Constructor.
Do not call this constructor to create an IlvSplitterGadget
. Instead, use the global function IlvMakeSplitterGadget
to create it.
display | The connection to the display. |
rect | The size and position of the splitter gadget. |
thickness | The thickness of the splitter gadget. |
palette | The palette used to draw the splitter gadget. |
void IlvSplitterGadget::addIntersect | ( | IlAny | intersect | ) |
Adds an intersection point between two splitter gadgets.
The intersect parameter specifies the splitter gadget with which the intersection point should be established. For details, see the general description of the class. Suppose that you have created two splitter gadgets, A
and B
using IlvMakeSplitterGadget
. A
is created first. The right approach to establish an intersection point between A
and B
is to call the IlvSplitterGadget::addIntersect()
method with B
as its parameter, like this:
With this method, the order in which the splitters are created is very important. Do not call A's
addIntersect()
method by passing A
as an argument. Never call A's
addIntersect()
by passing B
as argument, at the same time as you call B's
addIntersect()
passing A
as argument, as this will cause a dead lock.
intersect | A pointer to the target splitter gadget. |
|
static |
Returns the callback type of the Collapse callback.
Each section of a container has a minimum size called the limit. The splitter gadget never resizes a section to a size smaller than its limit. In this case, it simply calls the Collapse callback function, if any, and does nothing else.
|
static |
Returns the callback type of the Expand callback.
The Expand callback is invoked when the splitter gadget is used to expand a collapsed section.
IlvGraphicCallback IlvSplitterGadget::getCollapseCallback | ( | ) | const |
Returns a pointer to the first unnamed callback in the Collapse callback list.
The Collapse callback is invoked when the splitter gadget is used to resize a section to a size smaller than its limit.
setCollapseCallback()
. IlvDirection IlvSplitterGadget::getDirection | ( | ) | const |
Returns the direction of the splitter gadget.
IlvVertical
and IlvHorizontal
. IlvGraphicCallback IlvSplitterGadget::getExpandCallback | ( | ) | const |
Returns a pointer to the first unnamed callback in the Expand callback list.
The Expand callback is invoked when the splitter gadget is used to expand a collapsed section.
setExpandCallback()
. IlvPos IlvSplitterGadget::getMousePos | ( | ) | const |
Returns the last mouse position registered by the interactor.
setMousePos()
. IlBoolean IlvSplitterGadget::isCollapsed | ( | ) | const |
Indicates whether the splitter gadget is collapsed.
If this method returns IlTrue
, the Collapse callback is never invoked. If it returns IlFalse
the Expand callback function is never invoked.
setCollapsed()
.
|
virtual |
Moves the associated guide to the specified position.
Is called automatically when the user drags the splitter gadget. If you want to call this member function in other situations, you must first invoke the IlvSplitterGadget::setMousePos()
member function by passing the same value as argument. If the section limit is reached and the IlvSplitterGadget::isCollapsed()
method returns IlFalse
, this member function invokes the Collapse callback. If the collapsed section is expanded and the IlvSplitterGadget::isCollapsed()
method returns IlTrue
, it calls the Expand callback. see ExpandCallbackType
, CollapseCallbackType
, isCollapsed()
.
position | The new position of the guide associated with this splitter gadget. |
setMousePos()
, isCollapsed()
. void IlvSplitterGadget::setCollapseCallback | ( | IlvGraphicCallback | callback, |
IlAny | arg | ||
) |
Sets a Collapse callback.
Removes all the existing Collapse callbacks before adding callback to the Collapse callback list. The callback function, when invoked, receives the user parameter arg. The Collapse callback is invoked when the splitter gadget is used to resize a section to a size smaller than its limit.
callback | A pointer to the new callback. |
arg | The callback argument. |
void IlvSplitterGadget::setCollapsed | ( | IlBoolean | collapsed | ) |
Specifies whether the splitter gadget should be collapsed.
collapsed | A Boolean value specifying whether the splitter gadget should be collapsed. |
isCollapsed()
. void IlvSplitterGadget::setExpandCallback | ( | IlvGraphicCallback | callback, |
IlAny | arg | ||
) |
Sets an Expand callback.
Removes all the existing Expand callbacks before adding callback to the Expand callback list. The callback function, when invoked, receives the user parameter arg. The Expand callback is invoked when the splitter gadget is used to expand a collapsed section.
callback | A pointer to the new callback. |
arg | The callback argument. |
void IlvSplitterGadget::setMousePos | ( | IlvPos | pos | ) |
Memorizes the position of the mouse when the splitter gadget is being dragged.
Allows the dragging of the splitter to be processed as if the mouse was doing it. See moveGuide()
.
pos | The new last mouse position. |
moveGuide()
.