Views
Gadgets Package API Reference Guide
Product Documentation:
Views Documentation Home
List of all members | Public Member Functions | Friends
IlvTreeGadgetItemHolder Class Referenceabstract

Item holder class. More...

#include <ilviews/gadgets/tree.h>

Inheritance diagram for IlvTreeGadgetItemHolder:
IlvGadgetItemHolder IlvTreeGadget IlvFileChooserTree

Public Member Functions

void addItem (IlvTreeGadgetItem *parent, IlvTreeGadgetItem *item, IlInt index=-1)
 Adds the specified item to the tree hierarchy. More...
 
virtual IlvGadgetItemapplyToItems (IlvApplyGadgetItem f, IlAny arg)
 Applies the specified function to all the items of the holder. More...
 
virtual int compareItems (const IlvTreeGadgetItem *item1, const IlvTreeGadgetItem *item2) const
 Compares a pair of items. More...
 
virtual IlvGadgetItemcreateItem (const char *label, IlvGraphic *graphic=0, IlvBitmap *bitmap=0, IlvBitmap *selbitmap=0, IlBoolean copy=IlTrue) const
 Returns a new gadget item. More...
 
void deSelectAll ()
 Deselects all the selected items. More...
 
void detachItem (IlvTreeGadgetItem *item)
 Removes the specified item from the tree without destroying it. More...
 
IlvTreeGadgetItemgetFirstSelectedItem () const
 Retrieves the first selected item. More...
 
IlUInt getItemsCount () const
 Returns the number of items in the tree. More...
 
virtual IlvTreeGadgetItemgetRoot () const =0
 Returns the root item of the tree hierarchy. More...
 
IlUInt getVisibleItemsCount () const
 Returns the number of visible tree items. More...
 
void moveItem (IlvTreeGadgetItem *item, IlvTreeGadgetItem *parent, IlInt index=-1)
 Moves the specified item to a new parent. More...
 
void removeItem (IlvTreeGadgetItem *item)
 Removes the specified item from the tree. More...
 
virtual void sort (IlvTreeGadgetItem *item=0, IlUInt levels=(IlUInt) -1, IlvTreeGadgetItemCompareFunction func=0)
 Sorts the children of the specified item. More...
 
- Public Member Functions inherited from IlvGadgetItemHolder
virtual void drawGadgetItem (const IlvGadgetItem *item, IlvPort *port, const IlvRect &rect, const IlvTransformer *t=0, const IlvRegion *clip=0) const
 Draws a specific gadget item. More...
 
IlvGadgetItemgetCallbackItem () const
 Returns the item that triggered a callback. More...
 
IlvGadgetItemgetDragDropTarget () const
 Returns the target item of a drag-and-drop operation. More...
 
IlvGraphicgetDraggedImage () const
 Returns the graphic object used to draw the ghost image during a drag-and-drop operation. More...
 
IlvGadgetItemgetDraggedItem () const
 Returns the item that is being dragged during a drag-and-drop operation. More...
 
IlvGadgetItemgetEditedItem () const
 Returns the item that is being edited. More...
 
virtual IlvPalettegetHighlightTextPalette () const
 Returns the highlight palette used to draw the label of highlighted items. More...
 
virtual IlvPalettegetInsensitivePalette () const =0
 Returns the palette used to draw an item that is not sensitive. More...
 
virtual IlvGadgetItemgetItemByName (const char *name) const
 Returns the item whose name is specified. More...
 
virtual IlvPalettegetNormalTextPalette () const =0
 Returns the default palette used to draw an item. More...
 
virtual IlvPalettegetOpaquePalette () const
 Returns the opaque palette used to draw opaque items. More...
 
virtual IlvPalettegetSelectionPalette () const =0
 Returns the selection palette used to draw selected items. More...
 
virtual IlvPalettegetSelectionTextPalette () const =0
 Returns the selection palette used to draw the label of selected items. More...
 
IlvGadgetItemgetToolTipItem () const
 Returns the item that is displaying a tooltip. More...
 
virtual void initReDrawItems ()
 Begins a redraw session. More...
 
virtual void recomputeAllItems ()
 Recomputes the size of all the items managed by the holder. More...
 
virtual void reDrawItems ()
 Ends a redraw session. More...
 
void setDragDropTarget (IlvGadgetItem *item)
 Sets the target item of a drag-and-drop operation. More...
 
void setDraggedImage (IlvGraphic *graphic)
 Sets the graphic object used to draw the ghost image during a drag-and-drop operation. More...
 
void setDraggedItem (IlvGadgetItem *item)
 Sets the dragged item. More...
 

Friends

class IlvTreeGadgetItem
 

Additional Inherited Members

- Static Public Member Functions inherited from IlvGadgetItemHolder
static IlSymbolAbortDragItemCallbackType ()
 Returns the callback type of the Abort Drag callback. More...
 
static IlSymbolAbortEditItemCallbackType ()
 Returns the callback type of the Abort Edit callback. More...
 
static IlSymbolActivateCallbackType ()
 Returns the callback type of the Activate callback. More...
 
static IlSymbolDragItemCallbackType ()
 Returns the callback type of the Drag Item callback. More...
 
static IlSymbolEndDragItemCallbackType ()
 Returns the callback type of the End Drag callback. More...
 
static IlSymbolEndEditItemCallbackType ()
 Returns the callback type of the End Edit callback. More...
 
static IlSymbolStartDragItemCallbackType ()
 Returns the callback type of the Start Drag callback. More...
 
static IlSymbolStartEditItemCallbackType ()
 Returns the callback type of the Start Edit callback. More...
 
- Protected Member Functions inherited from IlvGadgetItemHolder
virtual void abortDragItem ()
 Is called when a drag-and-drop operation is aborted. More...
 
virtual void abortEdit (IlvGadgetItem *item)
 Is called when the editing of the specified item is aborted. More...
 
virtual void drawDraggedImage (const IlvPoint &point, const IlvTransformer *t)
 Is called to draw the ghost image during a drag-and-drop operation. More...
 
virtual void endDragItem (const IlvPoint &point)
 Is called when a drag-and-drop operation is finished. More...
 
virtual void endEdit (IlvGadgetItem *item)
 Is called after an item has been edited. More...
 
virtual void itemActivated (IlvGadgetItem *item)
 Is called when an item is activated. More...
 
virtual void itemDeSelected (IlvGadgetItem *item)
 Is called when an item is deselected. More...
 
virtual void itemDragged (const IlvPoint &point)
 Is called each time the user moves the mouse during a drag-and-drop operation. More...
 
virtual void itemHighlighted (IlvGadgetItem *item)
 Is called when an item is highlighted or unhighlighted. More...
 
virtual void itemSelected (IlvGadgetItem *item)
 Is called when an item is selected. More...
 
virtual void startDragItem (IlvGadgetItem *item)
 Is called when a drag-and-drop operation begins. More...
 
virtual void startEdit (IlvGadgetItem *item)
 Is called when an item is edited. More...
 

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

◆ addItem()

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

Adds the specified item to the tree hierarchy.

Parameters
parentThe 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.
itemThe item to be added.
indexThe 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().

◆ applyToItems()

virtual IlvGadgetItem* IlvTreeGadgetItemHolder::applyToItems ( IlvApplyGadgetItem  func,
IlAny  arg 
)
virtual

Applies the specified function to all the items of the holder.

Parameters
funcThe function to be applied.
argThe argument that will be passed to the function func.
Returns
The item that stopped the operation.
See also
IlvApplyGadgetItem, recomputeAllItems(), getItemByName().

Reimplemented from IlvGadgetItemHolder.

◆ compareItems()

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
item1The first item.
item2The second item.
See also
sort().

◆ createItem()

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
labelThe item label.
graphicThe IlvGraphic object representing the picture associated with the item.
bitmapThe IlvBitmap object representing the picture associated with the item.
selbitmapThe IlvBitmap object representing the picture of the item when it is selected.
copySpecifies 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.
Note
If both the second and third parameters are not 0, only the second parameter is used.
Returns
The created gadget item.

Reimplemented from IlvGadgetItemHolder.

Reimplemented in IlvFileChooserTree, and IlvTreeGadget.

◆ deSelectAll()

void IlvTreeGadgetItemHolder::deSelectAll ( )

Deselects all the selected items.

See also
IlvGadgetItem::select(), IlvGadgetItem::deSelect().

◆ detachItem()

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
itemThe item to be removed.
See also
removeItem(), addItem().

◆ getFirstSelectedItem()

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().

◆ getItemsCount()

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.

◆ getRoot()

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.

◆ getVisibleItemsCount()

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().

◆ moveItem()

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
itemThe item to be moved.
parentThe new parent item for item.
indexThe index where item will be inserted in the child list of parent.
See also
removeItem(), addItem(), detachItem().

◆ removeItem()

void IlvTreeGadgetItemHolder::removeItem ( IlvTreeGadgetItem item)

Removes the specified item from the tree.

item and all its children are removed and deleted.

Parameters
itemThe item to be removed.
See also
detachItem().

◆ sort()

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
itemThe item whose children are going to be sorted.
levelsAn integer value specifying the depth of the sorting algorithm.
funcA sorting function.
See also
IlvTreeGadgetItem::sortChildren(), IlvTreeGadgetItemCompareFunction, compareItems().

Reimplemented in IlvTreeGadget.