Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Item holder class. More...
#include <ilviews/gadgets/tree.h>
Public Member Functions | |
void | addItem (IlvTreeGadgetItem *parent, IlvTreeGadgetItem *item, IlInt index=-1) |
Adds the specified item to the tree hierarchy. | |
virtual IlvGadgetItem * | applyToItems (IlvApplyGadgetItem f, IlAny arg) |
Applies the specified function to all the items of the holder. | |
virtual int | compareItems (const IlvTreeGadgetItem *item1, const IlvTreeGadgetItem *item2) const |
Compares a pair of items. | |
virtual IlvGadgetItem * | createItem (const char *label, IlvGraphic *graphic=0, IlvBitmap *bitmap=0, IlvBitmap *selbitmap=0, IlBoolean copy=IlTrue) const |
Returns a new gadget item. | |
void | deSelectAll () |
Deselects all the selected items. | |
void | detachItem (IlvTreeGadgetItem *item) |
Removes the specified item from the tree without destroying it. | |
IlvTreeGadgetItem * | getFirstSelectedItem () const |
Retrieves the first selected item. | |
IlUInt | getItemsCount () const |
Returns the number of items in the tree. | |
virtual IlvTreeGadgetItem * | getRoot () const =0 |
Returns the root item of the tree hierarchy. | |
IlUInt | getVisibleItemsCount () const |
Returns the number of visible tree items. | |
void | moveItem (IlvTreeGadgetItem *item, IlvTreeGadgetItem *parent, IlInt index=-1) |
Moves the specified item to a new parent. | |
void | removeItem (IlvTreeGadgetItem *item) |
Removes the specified item from the tree. | |
virtual void | sort (IlvTreeGadgetItem *item=0, IlUInt levels=(IlUInt)-1, IlvTreeGadgetItemCompareFunction func=0) |
Sorts the children of the specified item. | |
Friends | |
class | IlvTreeGadgetItem |
Item holder class.
Library: ilvadvgdt
IlvTreeGadgetItemHolder
is a specialized IlvGadgetItemHolder
class for managing a tree hierarchy of IlvTreeGadgetItem
objects.
IlvTreeGadgetItem
, IlvTreeGadget
, IlvHierarchicalSheet
. void IlvTreeGadgetItemHolder::addItem | ( | IlvTreeGadgetItem * | parent, | |
IlvTreeGadgetItem * | item, | |||
IlInt | index = -1 | |||
) |
Adds the specified item to the tree hierarchy.
parent | The parent item to which the new item will be attached. If parent is 0 , item is added to the root item of the tree hierarchy. | |
item | The item to be added. | |
index | The position where item will be added. If index is -1 , item is added at the end of the parent child list. |
IlvTreeGadgetItem::insertChild
, removeItem
, detachItem
. Reimplemented in IlvTreeGadget.
virtual IlvGadgetItem* IlvTreeGadgetItemHolder::applyToItems | ( | IlvApplyGadgetItem | func, | |
IlAny | arg | |||
) | [virtual] |
Applies the specified function to all the items of the holder.
func | The function to be applied. | |
arg | The argument that will be passed to the function func. |
IlvApplyGadgetItem
for details. IlvApplyGadgetItem
, recomputeAllItems
, getItemByName
. Reimplemented from IlvGadgetItemHolder.
virtual int IlvTreeGadgetItemHolder::compareItems | ( | const IlvTreeGadgetItem * | item1, | |
const IlvTreeGadgetItem * | item2 | |||
) | const [virtual] |
Compares a pair of items.
If no sorting function is provided, this method is called to compare each item pair. This function simply returns the result of strcmp
on the two item labels.
item1 | The first item. | |
item2 | The second item. |
sort
. virtual IlvGadgetItem* IlvTreeGadgetItemHolder::createItem | ( | const char * | label, | |
IlvGraphic * | graphic = 0 , |
|||
IlvBitmap * | bitmap = 0 , |
|||
IlvBitmap * | selbitmap = 0 , |
|||
IlBoolean | copy = IlTrue | |||
) | const [virtual] |
Returns a new gadget item.
You can override this member function in a subclass to create your own items.
label | The item label. | |
graphic | The IlvGraphic object representing the picture associated with the item. | |
bitmap | The IlvBitmap object representing the picture associated with the item. | |
selbitmap | The IlvBitmap object representing the picture of the item when it is selected. | |
copy | A Boolean value specifying whether a label should be copied. If the value is IlFalse |
[note] If both the second and third parameters are not null, only the second parameter is used.
The created gadget item.
Reimplemented from IlvGadgetItemHolder.
Reimplemented in IlvFileChooserTree, and IlvTreeGadget.
void IlvTreeGadgetItemHolder::deSelectAll | ( | ) |
Deselects all the selected items.
IlvGadgetItem::select
, IlvGadgetItem::deSelect
. void IlvTreeGadgetItemHolder::detachItem | ( | IlvTreeGadgetItem * | item | ) |
Removes the specified item from the tree without destroying it.
item and all its children are removed but not deleted.
item | The item to be removed. |
removeItem
, addItem
. IlvTreeGadgetItem* IlvTreeGadgetItemHolder::getFirstSelectedItem | ( | ) | const |
Retrieves the first selected item.
0
if there are no selected items. IlvGadgetItem::select
, IlvGadgetItem::deSelect
. IlUInt IlvTreeGadgetItemHolder::getItemsCount | ( | ) | const |
Returns the number of items in the tree.
addItem
, removeItem
, detachItem
, getVisibleItemsCount
. virtual IlvTreeGadgetItem* IlvTreeGadgetItemHolder::getRoot | ( | ) | const [pure virtual] |
Returns the root item of the tree hierarchy.
addItem
, removeItem
, detachItem
. Implemented in IlvTreeGadget.
IlUInt IlvTreeGadgetItemHolder::getVisibleItemsCount | ( | ) | const |
Returns the number of visible tree items.
IlvTreeGadgetItem::isVisible
, getItemsCount
. void IlvTreeGadgetItemHolder::moveItem | ( | IlvTreeGadgetItem * | item, | |
IlvTreeGadgetItem * | parent, | |||
IlInt | index = -1 | |||
) |
Moves the specified item to a new parent.
Removes item from the tree hierarchy and adds it as a child of parent at the index specified by index.
item | The item to be moved. | |
parent | The new parent item for item. | |
index | The index where item will be inserted in the child list of parent. |
removeItem
, addItem
, detachItem
. void IlvTreeGadgetItemHolder::removeItem | ( | IlvTreeGadgetItem * | item | ) |
Removes the specified item from the tree.
item and all its children are removed and deleted.
item | The item to be removed. |
detachItem
. virtual void IlvTreeGadgetItemHolder::sort | ( | IlvTreeGadgetItem * | item = 0 , |
|
IlUInt | levels = (IlUInt)-1 , |
|||
IlvTreeGadgetItemCompareFunction | func = 0 | |||
) | [virtual] |
Sorts the children of the specified item.
Runs the sorting algorithm on all the children of 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.
item | The item whose children are going to be sorted. | |
levels | An integer value specifying the depth of the sorting algorithm. | |
func | A sorting function. |
Reimplemented in IlvTreeGadget.
© 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.