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. More... | |
virtual IlvGadgetItem * | applyToItems (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 IlvGadgetItem * | createItem (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... | |
IlvTreeGadgetItem * | getFirstSelectedItem () const |
Retrieves the first selected item. More... | |
IlUInt | getItemsCount () const |
Returns the number of items in the tree. More... | |
virtual IlvTreeGadgetItem * | getRoot () 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... | |
IlvGadgetItem * | getCallbackItem () const |
Returns the item that triggered a callback. More... | |
IlvGadgetItem * | getDragDropTarget () const |
Returns the target item of a drag-and-drop operation. More... | |
IlvGraphic * | getDraggedImage () const |
Returns the graphic object used to draw the ghost image during a drag-and-drop operation. More... | |
IlvGadgetItem * | getDraggedItem () const |
Returns the item that is being dragged during a drag-and-drop operation. More... | |
IlvGadgetItem * | getEditedItem () const |
Returns the item that is being edited. More... | |
virtual const IlvPalette * | getHighlightTextPalette () const |
Returns the highlight palette used to draw the label of highlighted items. More... | |
virtual const IlvPalette * | getInsensitivePalette () const =0 |
Returns the palette used to draw an item that is not sensitive. More... | |
virtual IlvGadgetItem * | getItemByName (const char *name) const |
Returns the item whose name is specified. More... | |
virtual const IlvPalette * | getNormalTextPalette () const =0 |
Returns the default palette used to draw an item. More... | |
virtual const IlvPalette * | getOpaquePalette () const |
Returns the opaque palette used to draw opaque items. More... | |
virtual const IlvPalette * | getSelectionPalette () const =0 |
Returns the selection palette used to draw selected items. More... | |
virtual const IlvPalette * | getSelectionTextPalette () const =0 |
Returns the selection palette used to draw the label of selected items. More... | |
IlvGadgetItem * | getToolTipItem () 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 IlSymbol * | AbortDragItemCallbackType () |
Returns the callback type of the Abort Drag callback. More... | |
static IlSymbol * | AbortEditItemCallbackType () |
Returns the callback type of the Abort Edit callback. More... | |
static IlSymbol * | ActivateCallbackType () |
Returns the callback type of the Activate callback. More... | |
static IlSymbol * | DragItemCallbackType () |
Returns the callback type of the Drag Item callback. More... | |
static IlSymbol * | EndDragItemCallbackType () |
Returns the callback type of the End Drag callback. More... | |
static IlSymbol * | EndEditItemCallbackType () |
Returns the callback type of the End Edit callback. More... | |
static IlSymbol * | StartDragItemCallbackType () |
Returns the callback type of the Start Drag callback. More... | |
static IlSymbol * | StartEditItemCallbackType () |
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... | |
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. |
|
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
, recomputeAllItems()
, getItemByName()
. Reimplemented from IlvGadgetItemHolder.
|
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 |
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 | Specifies 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. |
0
, only the second parameter is used. Reimplemented from IlvGadgetItemHolder.
Reimplemented in IlvFileChooserTree, and IlvTreeGadget.
void IlvTreeGadgetItemHolder::deSelectAll | ( | ) |
Deselects all the selected items.
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. IlUInt IlvTreeGadgetItemHolder::getItemsCount | ( | ) | const |
Returns the number of items in the tree.
addItem
, removeItem
, detachItem
, getVisibleItemsCount
.
|
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.
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 |
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.