rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Gadgets Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvTreeGadgetItem Class Reference

Gadget Item class. More...

#include <ilviews/gadgets/tree.h>

Inheritance diagram for IlvTreeGadgetItem:
IlvGadgetItem IlvTreePathGadgetItem

List of all members.

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.
IlvTreeGadgetItemapplyToChildren (IlvApplyGadgetItem func, IlAny arg=0) const
 Applies the specified function to all the children of the tree gadget item.
virtual IlvGadgetItemcopy () 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 IlvBitmapgetCurrentBitmap () const
 Returns the bitmap that is currently displayed by the item.
IlvTreeGadgetItemgetFirstChild () const
 Returns the first child of the item.
IlvTreeGadgetItemgetLastChild () const
 Returns the last child of the item.
IlvTreeGadgetItemgetNextSibling () const
 Returns the next sibling of the item.
IlvTreeGadgetItemgetParent () const
 Returns the parent of the item.
IlUInt getPosition () const
 Returns the position of the item in its parent list.
IlvTreeGadgetItemgetPrevSibling () const
 Returns the previous sibling of the item.
IlvTreeGadgetItemHoldergetTreeHolder () 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.
IlvTreeGadgetItemlastVisible () const
 Returns the last visible children of the item.
IlvTreeGadgetItemnextSelected () const
 Returns the next selected item.
IlvTreeGadgetItemnextVisible () const
 Returns the next visible item.
IlvTreeGadgetItempreviousVisible () 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 IlSymbolExpandedBitmapSymbol ()
 Returns the symbol associated with the expanded bitmap.
static IlvGadgetItemreadItem (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

Detailed Description

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.

IlvTreeGadgetItema.gif

Tree Gadget Items

See also:
IlvTreeGadgetItemHolder, IlvTreeGadget, IlvHierarchicalSheet.

Constructor & Destructor Documentation

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.

Parameters:
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, then you must allocate some memory for the label because in any case the label characters are deleted from the memory by the IlvTreeGadgetItem.
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.

Parameters:
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, then you must allocate some memory for the label because in any case the label characters are deleted from the memory by the IlvTreeGadgetItem.
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.

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

Parameters:
bitmap The item sensitive bitmap.

Member Function Documentation

IlvTreeGadgetItem* IlvTreeGadgetItem::applyToChildren ( IlvApplyGadgetItem  func,
IlAny  arg = 0 
) const

Applies the specified function to all the children of the tree gadget item.

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

Parameters:
width The returned item width.
height The returned item height.
See also:
computeRects, recomputeSize, getWidth, getHeight

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.

Returns:
A copy of the object.
See also:
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.

See also:
isSelected, select, SelectedBitmapSymbol

Reimplemented from IlvGadgetItem.

void IlvTreeGadgetItem::detach (  ) 

Detaches the item from its parent.

The item is not deleted.

See also:
insertChild
virtual void IlvTreeGadgetItem::expand (  )  [virtual]

Expands the item.

When an item is expanded, its children are visible.

See also:
isExpanded, shrink
void IlvTreeGadgetItem::expandAll (  ) 

Expands the item and all its children.

See also:
expand, shrink
static IlSymbol* IlvTreeGadgetItem::ExpandedBitmapSymbol (  )  [static]

Returns the symbol associated with the expanded bitmap.

Returns:
The symbol associated with the expanded bitmap.
See also:
IlvGadgetItem::GetItemBitmapIndex, IlvGadgetItem::AddItemBitmapSymbol, IlvGadgetItem::setBitmap, expand, shrink
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.

Returns:
The bitmap mask of the item.
See also:
GetItemBitmapSymbol, getBitmap(IlUShort)

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.

Returns:
The number of children of the tree gadget item. The returned value includes this item.
See also:
insertChild.
virtual IlvBitmap* IlvTreeGadgetItem::getCurrentBitmap (  )  const [virtual]

Returns the bitmap that is currently displayed by the item.

Returns:
The bitmap that is currently displayed, depending on the item state. If you want to display a specific bitmap, you can override this member function is a subclass.
See also:
getBitmap

Reimplemented from IlvGadgetItem.

IlvTreeGadgetItem* IlvTreeGadgetItem::getFirstChild (  )  const

Returns the first child of the item.

Returns:
The first child of this item, or 0 if this item has no children.
See also:
getLastChild, getParent.
IlvTreeGadgetItem* IlvTreeGadgetItem::getLastChild (  )  const

Returns the last child of the item.

Returns:
The last child of this item, or 0 if this item has no children.
See also:
getFirstChild, getParent.
IlvTreeGadgetItem* IlvTreeGadgetItem::getNextSibling (  )  const

Returns the next sibling of the item.

Returns:
The next sibling of this item, or 0 if the item is the last child.
See also:
getPrevSibling, nextVisible, nextSelected, getParent.
IlvTreeGadgetItem* IlvTreeGadgetItem::getParent (  )  const

Returns the parent of the item.

Returns:
The parent of this item, or 0 if this item has no parent.
See also:
insertChild.
IlUInt IlvTreeGadgetItem::getPosition (  )  const

Returns the position of the item in its parent list.

Returns:
Returns the position of the item in its parent list.
See also:
insertChild.
IlvTreeGadgetItem* IlvTreeGadgetItem::getPrevSibling (  )  const

Returns the previous sibling of the item.

Returns:
The previous sibling of this item, or 0 if the item is the first child.
See also:
getNextSibling, previousVisible, previousSelected, getParent.
IlvTreeGadgetItemHolder* IlvTreeGadgetItem::getTreeHolder (  )  const

Returns a pointer to the item holder.

Returns:
A pointer to the instance of IlvTreeGadgetItemHolder to which the item is connected, or 0 if there's none.
IlBoolean IlvTreeGadgetItem::hasChildren (  )  const

Indicates whether the item has children.

Returns:
IlTrue if the item has children. Otherwise, returns IlFalse.
See also:
insertChild, detach.
IlBoolean IlvTreeGadgetItem::hasUnknownChildCount (  )  const

Indicates that the number of children is not known.

Returns:
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.
See also:
expand, shrink.
IlBoolean IlvTreeGadgetItem::insertChild ( IlvTreeGadgetItem item,
IlInt  index = -1 
)

Inserts the specified item in the list of children of this tree gadget item.

Parameters:
item The item to be inserted.
index The position where item will be added in the list.
See also:
detach
IlBoolean IlvTreeGadgetItem::isAncestorOf ( IlvTreeGadgetItem item  )  const

Indicates whether the item is an ancestor of the specified item.

Parameters:
item The tree gadget item.
Returns:
IlTrue if this tree gadget item is an ancestor of item. Otherwise, it returns IlFalse.
See also:
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.

Returns:
IlTrue if the item is expanded. Otherwise, returns IlFalse.
See also:
expand, shrink.
IlBoolean IlvTreeGadgetItem::isFirstChild (  )  const

Indicates whether the item is the first child in its parent list.

Returns:
IlTrue if this item is the first child of its parent. Otherwise, it returns IlFalse.
See also:
getFirstChild, isLastChild.
IlBoolean IlvTreeGadgetItem::isLastChild (  )  const

Indicates whether the item is the last child in its parent list.

Returns:
IlTrue if this item is the last child of its parent. Otherwise, it returns IlFalse.
See also:
getLastChild, isFirstChild.
IlBoolean IlvTreeGadgetItem::isVisible (  )  const

Indicates whether the item is visible.

Warning:
[note] This method does not check that the item can be seen on the screen. It only checks that all its ancestors are expanded.
Returns:
IlTrue if this item is visible. The item is visible if all its ancestors are expanded.
See also:
expand, shrink.
IlvTreeGadgetItem* IlvTreeGadgetItem::lastVisible (  )  const

Returns the last visible children of the item.

Returns:
The last visible children of this item.
See also:
isVisible, nextVisible, previousVisible
IlvTreeGadgetItem* IlvTreeGadgetItem::nextSelected (  )  const

Returns the next selected item.

Returns:
The next selected item, or 0 if there is no selected item.
See also:
isSelected, IlvGadgetItem::select
IlvTreeGadgetItem* IlvTreeGadgetItem::nextVisible (  )  const

Returns the next visible item.

Returns:
The next visible item.
See also:
isVisible, previousVisible
IlvTreeGadgetItem* IlvTreeGadgetItem::previousVisible (  )  const

Returns the previous visible item.

Returns:
The previous visible item.
See also:
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);
 }
Parameters:
file The file to be read from.
display The display used to create the object.
See also:
DeclareGadgetItemInfoRO, DeclareGadgetItemInfo, IlvPredefinedGadgetItemIOMembers.
Warning:
[note] The 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.

See also:
isSelected, deSelect, SelectedBitmapSymbol

Reimplemented from IlvGadgetItem.

void IlvTreeGadgetItem::setUnknownChildCount ( IlBoolean  value  ) 

Specifies whether the item should behave as if it had children.

For details, see IlvTreeGadgetItem::hasUnknownChildCount.

Parameters:
value A Boolean value specifying whether the item knows the number of its children (IlTrue) or not (IlFalse).
See also:
hasUnknownChildCount.
virtual void IlvTreeGadgetItem::shrink (  )  [virtual]

Shrinks the item.

When an item is shrunk, its children are hidden.

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

Parameters:
levels An integer value specifying the depth of the sorting algorithm.
func A sorting function.
See also:
IlvTreeGadgetItemHolder::sort, IlvTreeGadgetItemCompareFunction.
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.

Parameters:
file The name of the file to be written to.
See also:
DeclareGadgetItemInfoRO, DeclareGadgetItemInfo, IlvPredefinedGadgetItemIOMembers.

Reimplemented from IlvGadgetItem.

 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.