Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget Item class. More...
#include <ilviews/gadgets/tree.h>
Public Member Functions | |
IlvTreeGadgetItem (IlvBitmap *bitmap) | |
Constructor. | |
IlvTreeGadgetItem (IlvGraphic *graphic) | |
Constructor. | |
IlvTreeGadgetItem (const char *label, IlvGraphic *graphic, IlvPosition position=IlvRight, IlUShort spacing=4, IlBoolean copy=IlTrue) | |
Constructor. | |
IlvTreeGadgetItem (const char *label, IlvBitmap *bitmap=0, IlvPosition position=IlvRight, IlUShort spacing=4, IlBoolean copy=IlTrue) | |
Constructor. | |
IlvTreeGadgetItem * | applyToChildren (IlvApplyGadgetItem func, IlAny arg=0) const |
Applies the specified function to all the children of the tree gadget item. | |
virtual IlvGadgetItem * | copy () const |
Copies this object. | |
virtual void | deSelect () |
Deselects the item. | |
void | detach () |
Detaches the item from its parent. | |
virtual void | expand () |
Expands the item. | |
void | expandAll () |
Expands the item and all its children. | |
virtual IlUInt | getBitmapMask () const |
Returns the bitmap mask of the item. | |
IlUInt | getCardinal () const |
Returns the number of children of the tree gadget item. | |
virtual IlvBitmap * | getCurrentBitmap () const |
Returns the bitmap that is currently displayed by the item. | |
IlvTreeGadgetItem * | getFirstChild () const |
Returns the first child of the item. | |
IlvTreeGadgetItem * | getLastChild () const |
Returns the last child of the item. | |
IlvTreeGadgetItem * | getNextSibling () const |
Returns the next sibling of the item. | |
IlvTreeGadgetItem * | getParent () const |
Returns the parent of the item. | |
IlUInt | getPosition () const |
Returns the position of the item in its parent list. | |
IlvTreeGadgetItem * | getPrevSibling () const |
Returns the previous sibling of the item. | |
IlvTreeGadgetItemHolder * | getTreeHolder () const |
Returns a pointer to the item holder. | |
IlBoolean | hasChildren () const |
Indicates whether the item has children. | |
IlBoolean | hasUnknownChildCount () const |
Indicates that the number of children is not known. | |
IlBoolean | insertChild (IlvTreeGadgetItem *item, IlInt index=-1) |
Inserts the specified item in the list of children of this tree gadget item. | |
IlBoolean | isAncestorOf (IlvTreeGadgetItem *item) const |
Indicates whether the item is an ancestor of the specified item. | |
IlBoolean | isExpanded () const |
Indicates whether the item is expanded. | |
IlBoolean | isFirstChild () const |
Indicates whether the item is the first child in its parent list. | |
IlBoolean | isLastChild () const |
Indicates whether the item is the last child in its parent list. | |
IlBoolean | isVisible () const |
Indicates whether the item is visible. | |
IlvTreeGadgetItem * | lastVisible () const |
Returns the last visible children of the item. | |
IlvTreeGadgetItem * | nextSelected () const |
Returns the next selected item. | |
IlvTreeGadgetItem * | nextVisible () const |
Returns the next visible item. | |
IlvTreeGadgetItem * | previousVisible () const |
Returns the previous visible item. | |
virtual void | select () |
Selects the item. | |
void | setUnknownChildCount (IlBoolean value) |
Specifies whether the item should behave as if it had children. | |
virtual void | shrink () |
Shrinks the item. | |
void | sortChildren (IlUInt levels=(IlUInt)-1, IlvTreeGadgetItemCompareFunction func=0) |
Sorts the children of the tree gadget item. | |
virtual void | write (IlvOutputFile &) const |
Writes an object description to a file. | |
Static Public Member Functions | |
static IlSymbol * | ExpandedBitmapSymbol () |
Returns the symbol associated with the expanded bitmap. | |
static IlvGadgetItem * | readItem (IlvInputFile &, IlvDisplay *) |
Reads an object description from a file. | |
Protected Member Functions | |
virtual void | computeSize (IlUShort &, IlUShort &) const |
Computes the item size. | |
Friends | |
class | IlvTreeGadget |
class | IlvTreeGadgetItemHolder |
Gadget Item class.
Library: ilvadvgdt
This class represents an item of an IlvTreeGadgetItemHolder
. Each IlvTreeGadgetItem
has a certain number of children. An IlvTreeGadgetItem
may be expanded or not. When the item is expanded, its children are displayed, and if an expanded bitmap has been provided, it is used. This class is used by the both the IlvTreeGadget
and IlvHierarchicalSheet
classes.
Tree Gadget Items
IlvTreeGadgetItemHolder
, IlvTreeGadget
, IlvHierarchicalSheet
. IlvTreeGadgetItem::IlvTreeGadgetItem | ( | const char * | label, | |
IlvBitmap * | bitmap = 0 , |
|||
IlvPosition | position = IlvRight , |
|||
IlUShort | spacing = 4 , |
|||
IlBoolean | copy = IlTrue | |||
) |
Constructor.
Initializes a new instance of the IlvTreeGadgetItem
class. This constructor allows you to specify both a label and a bitmap, as well as their relative alignment and spacing. The bitmap is locked.
label | The item label. | |
bitmap | The item sensitive bitmap. | |
position | The label position relative to the picture. | |
spacing | The spacing between the label and the picture. | |
copy | A Boolean value specifying whether a label should be copied. If the value is IlFalse |
IlvTreeGadgetItem::IlvTreeGadgetItem | ( | const char * | label, | |
IlvGraphic * | graphic, | |||
IlvPosition | position = IlvRight , |
|||
IlUShort | spacing = 4 , |
|||
IlBoolean | copy = IlTrue | |||
) |
Constructor.
Initializes a new instance of the IlvTreeGadgetItem
class. This constructor allows you to specify both a label and a graphic, as well as their relative alignment and spacing.
label | The item label. | |
graphic | The item picture. | |
position | The label position relative to the picture. | |
spacing | The spacing between the label and the picture. | |
copy | A Boolean value specifying whether a label should be copied. If the value is IlFalse |
IlvTreeGadgetItem::IlvTreeGadgetItem | ( | IlvGraphic * | graphic | ) |
Constructor.
Initializes a new instance of the IlvTreeGadgetItem
class. This constructor allows you to create an item represented by a graphical object.
graphic | The item picture. |
IlvTreeGadgetItem::IlvTreeGadgetItem | ( | IlvBitmap * | bitmap | ) |
Constructor.
Initializes a new instance of the IlvTreeGadgetItem
class. This constructor allows you to create an item represented by a bitmap. The bitmap is locked.
bitmap | The item sensitive bitmap. |
IlvTreeGadgetItem* IlvTreeGadgetItem::applyToChildren | ( | IlvApplyGadgetItem | func, | |
IlAny | arg = 0 | |||
) | const |
Applies the specified function to all the children of the tree gadget item.
func | The function to be applied. | |
arg | The argument that will be passed to the function func . |
IlvApplyGadgetItem
virtual void IlvTreeGadgetItem::computeSize | ( | IlUShort & | width, | |
IlUShort & | height | |||
) | const [protected, virtual] |
Computes the item size.
Computes the size of the item using the member function IlvGadgetItem::computeRects
, which specifies the location of the label and picture parts. If you want to change the item size, you can override this member function in a subclass.
width | The returned item width. | |
height | The returned item height. |
Reimplemented from IlvGadgetItem.
virtual IlvGadgetItem* IlvTreeGadgetItem::copy | ( | ) | const [virtual] |
Copies this object.
Allocates and returns a copy of this object. The named properties attached to the gadget item are also copied.
IlvPredefinedGadgetItemIOMembers
. Reimplemented from IlvGadgetItem.
virtual void IlvTreeGadgetItem::deSelect | ( | ) | [virtual] |
Deselects the item.
The default implementation deselects and redraws the item, then it calls the holder method IlvGadgetItemHolder::itemDeSelected
.
Reimplemented from IlvGadgetItem.
void IlvTreeGadgetItem::detach | ( | ) |
virtual void IlvTreeGadgetItem::expand | ( | ) | [virtual] |
void IlvTreeGadgetItem::expandAll | ( | ) |
static IlSymbol* IlvTreeGadgetItem::ExpandedBitmapSymbol | ( | ) | [static] |
Returns the symbol associated with the expanded bitmap.
virtual IlUInt IlvTreeGadgetItem::getBitmapMask | ( | ) | const [virtual] |
Returns the bitmap mask of the item.
The bitmap mask lets you know which bitmap indexes the item is handling. If the ith bit of the return value is set, it means that the item uses the bitmap of index i
. You can get the associated symbol using the static member function GetItemBitmapSymbol
.
Reimplemented from IlvGadgetItem.
IlUInt IlvTreeGadgetItem::getCardinal | ( | ) | const |
Returns the number of children of the tree gadget item.
Searches the children of the tree gadget item recursively.
insertChild
. virtual IlvBitmap* IlvTreeGadgetItem::getCurrentBitmap | ( | ) | const [virtual] |
Returns the bitmap that is currently displayed by the item.
Reimplemented from IlvGadgetItem.
IlvTreeGadgetItem* IlvTreeGadgetItem::getFirstChild | ( | ) | const |
Returns the first child of the item.
0
if this item has no children. getLastChild
, getParent
. IlvTreeGadgetItem* IlvTreeGadgetItem::getLastChild | ( | ) | const |
Returns the last child of the item.
0
if this item has no children. getFirstChild
, getParent
. IlvTreeGadgetItem* IlvTreeGadgetItem::getNextSibling | ( | ) | const |
Returns the next sibling of the item.
0
if the item is the last child. getPrevSibling
, nextVisible
, nextSelected
, getParent
. IlvTreeGadgetItem* IlvTreeGadgetItem::getParent | ( | ) | const |
Returns the parent of the item.
0
if this item has no parent. insertChild
. IlUInt IlvTreeGadgetItem::getPosition | ( | ) | const |
Returns the position of the item in its parent list.
insertChild
. IlvTreeGadgetItem* IlvTreeGadgetItem::getPrevSibling | ( | ) | const |
Returns the previous sibling of the item.
0
if the item is the first child. getNextSibling
, previousVisible
, previousSelected
, getParent
. IlvTreeGadgetItemHolder* IlvTreeGadgetItem::getTreeHolder | ( | ) | const |
Returns a pointer to the item holder.
IlvTreeGadgetItemHolder
to which the item is connected, or 0
if there's none. IlBoolean IlvTreeGadgetItem::hasChildren | ( | ) | const |
Indicates whether the item has children.
IlTrue
if the item has children. Otherwise, returns IlFalse
. insertChild
, detach
. IlBoolean IlvTreeGadgetItem::hasUnknownChildCount | ( | ) | const |
Indicates that the number of children is not known.
IlTrue
if the number of children of the tree gadget item is not known. In this case, the tree gadget item behaves as if it had children even when it does not have any. This means that you can expand it. This feature is useful when you want to add items to the tree only if necessary, that is, when the user tries accessing these items by expanding their parent. IlBoolean IlvTreeGadgetItem::insertChild | ( | IlvTreeGadgetItem * | item, | |
IlInt | index = -1 | |||
) |
Inserts the specified item in the list of children of this tree gadget item.
item | The item to be inserted. | |
index | The position where item will be added in the list. |
detach
IlBoolean IlvTreeGadgetItem::isAncestorOf | ( | IlvTreeGadgetItem * | item | ) | const |
Indicates whether the item is an ancestor of the specified item.
item | The tree gadget item. |
IlTrue
if this tree gadget item is an ancestor of item. Otherwise, it returns IlFalse
. getParent
IlBoolean IlvTreeGadgetItem::isExpanded | ( | ) | const |
Indicates whether the item is expanded.
To expand or shrink a tree gadget item, you can use the IlvTreeGadgetItem::expand
and IlvTreeGadgetItem::shrink
member functions.
IlTrue
if the item is expanded. Otherwise, returns IlFalse
. IlBoolean IlvTreeGadgetItem::isFirstChild | ( | ) | const |
Indicates whether the item is the first child in its parent list.
IlTrue
if this item is the first child of its parent. Otherwise, it returns IlFalse
. getFirstChild
, isLastChild
. IlBoolean IlvTreeGadgetItem::isLastChild | ( | ) | const |
Indicates whether the item is the last child in its parent list.
IlTrue
if this item is the last child of its parent. Otherwise, it returns IlFalse
. getLastChild
, isFirstChild
. IlBoolean IlvTreeGadgetItem::isVisible | ( | ) | const |
IlvTreeGadgetItem* IlvTreeGadgetItem::lastVisible | ( | ) | const |
Returns the last visible children of the item.
isVisible
, nextVisible
, previousVisible
IlvTreeGadgetItem* IlvTreeGadgetItem::nextSelected | ( | ) | const |
Returns the next selected item.
0
if there is no selected item. isSelected
, IlvGadgetItem::select
IlvTreeGadgetItem* IlvTreeGadgetItem::nextVisible | ( | ) | const |
IlvTreeGadgetItem* IlvTreeGadgetItem::previousVisible | ( | ) | const |
Returns the previous visible item.
isVisible
, nextVisible
static IlvGadgetItem* IlvTreeGadgetItem::readItem | ( | IlvInputFile & | file, | |
IlvDisplay * | display | |||
) | [static] |
Reads an object description from a file.
Reads an object description from the file input. It reads the information that was saved by the member function write
to be able to create a new instance of this object. Usually, because of the availability of the constructor that expects an IlvInputFile
, readItem
should be equivalent to :
IlvGadgetItem* MyClass::readItem(IlvInputFile& file, IlvDisplay* display) { return new MyClass(file, display); }
file | The file to be read from. | |
display | The display used to create the object. |
readItem
method is not capitalized like other static methods so that it is consistent with the write
method. Reimplemented from IlvGadgetItem.
virtual void IlvTreeGadgetItem::select | ( | ) | [virtual] |
Selects the item.
The default implementation selects and redraws the item, then it calls the holder method IlvGadgetItemHolder::itemSelected
.
Reimplemented from IlvGadgetItem.
void IlvTreeGadgetItem::setUnknownChildCount | ( | IlBoolean | value | ) |
Specifies whether the item should behave as if it had children.
For details, see IlvTreeGadgetItem::hasUnknownChildCount
.
value | A Boolean value specifying whether the item knows the number of its children (IlTrue ) or not (IlFalse ). |
hasUnknownChildCount
. virtual void IlvTreeGadgetItem::shrink | ( | ) | [virtual] |
void IlvTreeGadgetItem::sortChildren | ( | IlUInt | levels = (IlUInt)-1 , |
|
IlvTreeGadgetItemCompareFunction | func = 0 | |||
) |
Sorts the children of the tree gadget item.
Runs the sorting algorithm on all the children of this item. If you provide a sorting function in the form of an IlvTreeGadgetItemCompareFunction
, this function is called to compare each item pair. If you do not provide a sorting function, a default comparison function is used that sort items in the ascendant order using their labels.
levels | An integer value specifying the depth of the sorting algorithm. | |
func | A sorting function. |
virtual void IlvTreeGadgetItem::write | ( | IlvOutputFile & | file | ) | const [virtual] |
Writes an object description to a file.
Writes out, in a file, the object description. This description contains all the information necessary to create an exact copy of this object by means of the member function readItem
.
file | The name of the file to be written to. |
Reimplemented from IlvGadgetItem.
© Copyright 2012, Rogue Wave Software, Inc. All Rights Reserved.
Rogue Wave is a registered trademark of Rogue Wave Software, Inc. in the United States and other countries. All other trademarks are the property of their respective owners.