rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Gadgets Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvTreeGadgetItemHolder Class Reference

Item holder class. More...

#include <ilviews/gadgets/tree.h>

Inheritance diagram for IlvTreeGadgetItemHolder:
IlvGadgetItemHolder IlvTreeGadget IlvFileChooserTree

List of all members.

Public Member Functions

void addItem (IlvTreeGadgetItem *parent, IlvTreeGadgetItem *item, IlInt index=-1)
 Adds the specified item to the tree hierarchy.
virtual IlvGadgetItemapplyToItems (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 IlvGadgetItemcreateItem (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.
IlvTreeGadgetItemgetFirstSelectedItem () const
 Retrieves the first selected item.
IlUInt getItemsCount () const
 Returns the number of items in the tree.
virtual IlvTreeGadgetItemgetRoot () 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

Detailed Description

Item holder class.

Library: ilvadvgdt

IlvTreeGadgetItemHolder is a specialized IlvGadgetItemHolder class for managing a tree hierarchy of IlvTreeGadgetItem objects.

See also:
IlvTreeGadgetItem, IlvTreeGadget, IlvHierarchicalSheet.

Member Function Documentation

void IlvTreeGadgetItemHolder::addItem ( IlvTreeGadgetItem parent,
IlvTreeGadgetItem item,
IlInt  index = -1 
)

Adds the specified item to the tree hierarchy.

Parameters:
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.
See also:
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.

Parameters:
func The function to be applied.
arg The argument that will be passed to the function func.
Returns:
The item that stopped the operation. See IlvApplyGadgetItem for details.
See also:
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.

Parameters:
item1 The first item.
item2 The second item.
See also:
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.

Parameters:
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, then you must allocate some memory for the label because in any case the label characters are deleted from the memory by the IlvGadgetItem.
Warning:
[note] If both the second and third parameters are not null, only the second parameter is used.
Returns:
The created gadget item.

Reimplemented from IlvGadgetItemHolder.

Reimplemented in IlvFileChooserTree, and IlvTreeGadget.

void IlvTreeGadgetItemHolder::deSelectAll (  ) 

Deselects all the selected items.

See also:
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.

Parameters:
item The item to be removed.
See also:
removeItem, addItem.
IlvTreeGadgetItem* IlvTreeGadgetItemHolder::getFirstSelectedItem (  )  const

Retrieves the first selected item.

Returns:
The first selected item in the tree or 0 if there are no selected items.
See also:
IlvGadgetItem::select, IlvGadgetItem::deSelect.
IlUInt IlvTreeGadgetItemHolder::getItemsCount (  )  const

Returns the number of items in the tree.

Returns:
The number of items in the tree, excluding the root item.
See also:
addItem, removeItem, detachItem, getVisibleItemsCount.
virtual IlvTreeGadgetItem* IlvTreeGadgetItemHolder::getRoot (  )  const [pure virtual]

Returns the root item of the tree hierarchy.

Returns:
The root item of the tree hierarchy.
See also:
addItem, removeItem, detachItem.

Implemented in IlvTreeGadget.

IlUInt IlvTreeGadgetItemHolder::getVisibleItemsCount (  )  const

Returns the number of visible tree items.

Returns:
The number of visible tree items, meaning the number of items whose ancestors are expanded.
See also:
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.

Parameters:
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.
See also:
removeItem, addItem, detachItem.
void IlvTreeGadgetItemHolder::removeItem ( IlvTreeGadgetItem item  ) 

Removes the specified item from the tree.

item and all its children are removed and deleted.

Parameters:
item The item to be removed.
See also:
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.

Parameters:
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.
See also:
IlvTreeGadgetItem::sortChildren, IlvTreeGadgetItemCompareFunction, compareItems.

Reimplemented in IlvTreeGadget.

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© 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.