Item holder class. More...
#include <ilviews/gadgets/itemgdt.h>
Public Member Functions | |
virtual void | addLabel (const char *label, IlAny data=0) |
Adds an item with a label to the holder list. More... | |
virtual IlvGadgetItem * | applyToItems (IlvApplyGadgetItem, IlAny) |
Applies the specified function to all the items of the holder. More... | |
virtual int | compareItems (const char *string1, const char *string2, IlAny value1, IlAny value2) |
Compares a pair of items. More... | |
virtual void | deSelectAll () |
Deselects all the items. More... | |
virtual void | empty ()=0 |
Empties the list. More... | |
IlUShort | getCardinal () const |
Returns the number of items stored in this holder. More... | |
IlShort | getFirstSelectedItem () const |
Returns the index of the first selected item. More... | |
IlShort | getIndex (const IlvGadgetItem *item, IlUShort start=0, IlUShort stop=(IlUShort) -1) const |
Returns the index of the specified item in the holder list. More... | |
IlvGadgetItem * | getItem (IlUShort index) const |
Returns an item from its position in the holder. More... | |
IlAny | getItemData (IlUShort index) const |
Returns an item user data. More... | |
IlvGadgetItem *const * | getItems (IlUShort &count) const |
Returns the array of all the items. More... | |
const char * | getLabel (IlUShort index) const |
Returns the indicated label of the list. More... | |
const char *const * | getLabels (IlUShort &count) const |
Returns an array of all the items labels. More... | |
IlShort | getPosition (const char *label, IlUShort start=0) const |
Returns the position of an item using its label. More... | |
virtual const char * | getSelection () const |
Returns the first selected item label. More... | |
IlUShort const * | getSelectionIndices (IlUShort &count) const |
Returns an array containing the indexes of the selected item. More... | |
const char *const * | getSelections (IlUShort &count) const |
Returns an array of the selected items. More... | |
IlAny const * | getUserDataArray (IlUShort &count) const |
Returns an array of all the user data for the items. More... | |
IlUShort | insertBitmap (IlvBitmap *bitmap, IlShort pos=-1) |
Inserts an item with a bitmap at the given position in the holder list. More... | |
IlUShort | insertGraphic (IlvGraphic *graphic, IlShort pos=-1) |
Inserts an item with a graphic as picture at a given position in the holder list. More... | |
IlUShort | insertItem (IlvGadgetItem *item, IlShort index=-1) |
Inserts an item at a given position in the holder's list. More... | |
virtual void | insertLabel (IlUShort pos, const char *label, IlAny data=0) |
Inserts an item with a label at a given position in the holder list. More... | |
IlBoolean | isSelected (IlUShort index) const |
Specifies whether the item whose position is specified is selected. More... | |
void | removeItem (IlUShort index, IlBoolean destroy=IlTrue) |
Removes an item from the holder. More... | |
void | removeLabel (IlUShort index) |
Removes and destroys an item. More... | |
void | setItemData (IlUShort index, IlAny itemData) |
Sets an item user data. More... | |
virtual void | setItems (IlvGadgetItem *const *items, IlUShort count) |
Replaces the entire list of items. More... | |
void | setLabel (IlUShort index, const char *label, IlBoolean copy) |
Modifies the label of an item. More... | |
virtual void | setLabels (const char *const *labels, IlAny const *itemData, IlUShort count, IlBoolean copy=IlTrue) |
Replaces the entire list of items. More... | |
virtual void | setLabels (const char *const *labels, IlUShort count, IlBoolean copy=IlTrue) |
Replaces the entire list of items. More... | |
virtual void | sort (IlvListCompareFunction func=0) |
Sorts the items. More... | |
Public Member Functions inherited from IlvGadgetItemHolder | |
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... | |
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... | |
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: ilvgadgt
IlvListGadgetItemHolder
is a specific IlvGadgetItemHolder
class that manages a list of items.
IlvAbstractMenu
, IlvGadgetItem
, IlvStringList
, IlvComboBox
, IlvOptionMenu
.
|
virtual |
Adds an item with a label to the holder list.
The item is created by calling the member function IlvGadgetItemHolder::createItem()
.
label | The item label. The string is copied internally. |
data | The item client data. |
insertItem()
, insertLabel()
, insertItem()
, insertGraphic()
, insertBitmap()
, setItems()
.
|
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.
string1 | The label of the first item. |
string2 | The label of the second item. |
value1 | The client data of the first item. |
value2 | The client data of the second item. |
sort()
.
|
virtual |
|
pure virtual |
Empties the list.
setItems()
, removeItem()
. Implemented in IlvToolBar, IlvStringList, IlvOptionMenu, IlvPopupMenu, IlvComboBox, and IlvAbstractMenu.
IlUShort IlvListGadgetItemHolder::getCardinal | ( | ) | const |
Returns the number of items stored in this holder.
insertItem()
, removeItem()
, setItems()
. IlShort IlvListGadgetItemHolder::getFirstSelectedItem | ( | ) | const |
Returns the index of the first selected item.
-1
if no item is selected. isSelected()
, IlvGadgetItem::isSelected()
. IlShort IlvListGadgetItemHolder::getIndex | ( | const IlvGadgetItem * | item, |
IlUShort | start = 0 , |
||
IlUShort | stop = (IlUShort) -1 |
||
) | const |
Returns the index of the specified item in the holder list.
-1
if the item is not in the holder list. item | The item to be retrieved. |
start | The index where to begin the search. |
stop | The index where to stop the search. The search doesn't includes the item of index stop. |
getItem()
. IlvGadgetItem* IlvListGadgetItemHolder::getItem | ( | IlUShort | index | ) | const |
Returns an item from its position in the holder.
index | The item position. |
0
if index is not valid. getIndex()
. Returns an item user data.
index | The item index. |
0
if there is none. setItemData()
, IlvGadgetItem::setClientData()
. IlvGadgetItem* const* IlvListGadgetItemHolder::getItems | ( | IlUShort & | count | ) | const |
Returns the array of all the items.
count | The number of items in the returned array. |
setItems()
, getItem()
, getIndex()
. const char* IlvListGadgetItemHolder::getLabel | ( | IlUShort | index | ) | const |
Returns the indicated label of the list.
index | The item index. |
0
is returned. const char* const* IlvListGadgetItemHolder::getLabels | ( | IlUShort & | count | ) | const |
Returns an array of all the items labels.
count | The number of elements of the returned array. |
setLabels()
, setItems()
. Returns the position of an item using its label.
label | The label of the searched item. |
start | The index where to begin the search. |
-1
if the label cannot be found.
|
virtual |
Returns the first selected item label.
getSelections()
, getSelectionIndices()
, isSelected()
. Reimplemented in IlvComboBox.
Returns an array containing the indexes of the selected item.
count | The number of elements in the returned array. |
getSelections()
, getFirstSelectedItem()
, isSelected()
. const char* const* IlvListGadgetItemHolder::getSelections | ( | IlUShort & | count | ) | const |
Returns an array of the selected items.
count | The number of elements in the returned array. |
Returns an array of all the user data for the items.
count | The number of elements in the returned array. |
0
. The user must not modify or delete the returned array. setItemData()
, getItemData()
. Inserts an item with a bitmap at the given position in the holder list.
The specified bitmap is locked. The item is created by calling the member function IlvGadgetItemHolder::createItem()
.
bitmap | The item picture. |
pos | The item position. If pos is -1 , the item is appended to the holder list. |
insertItem()
, insertGraphic()
, insertLabel()
, setItems()
. IlUShort IlvListGadgetItemHolder::insertGraphic | ( | IlvGraphic * | graphic, |
IlShort | pos = -1 |
||
) |
Inserts an item with a graphic as picture at a given position in the holder list.
The item is created by calling the member function IlvGadgetItemHolder::createItem()
.
graphic | The item picture. |
pos | The item position. If pos is -1 , the item is appended to the holder list. |
insertItem()
, insertBitmap()
, insertLabel()
, setItems()
. IlUShort IlvListGadgetItemHolder::insertItem | ( | IlvGadgetItem * | item, |
IlShort | index = -1 |
||
) |
Inserts an item at a given position in the holder's list.
item | The item. |
index | The item position. If index is -1 , the item is appended to the holder list. |
insertBitmap()
, insertGraphic()
, InsertLabel()
, setItems()
.
|
virtual |
Inserts an item with a label at a given position in the holder list.
The item is created by calling the member function IlvGadgetItemHolder::createItem()
.
pos | The item's position. |
label | The item label. |
data | The item client data. |
addLabel()
, insertItem()
, insertGraphic()
, insertBitmap()
, setItems()
. Specifies whether the item whose position is specified is selected.
index | The item index. |
IlTrue
if indexth item is selected. IlvGadgetItem::isSelected()
. Removes an item from the holder.
index | The item position. |
destroy | Specifies whether the item should be destroyed. |
insertItem()
. void IlvListGadgetItemHolder::removeLabel | ( | IlUShort | index | ) |
Removes and destroys an item.
index | The item position. |
removeItem()
, insertItem()
. Sets an item user data.
index | The item index. |
itemData | The item data. |
getItemData()
, IlvGadgetItem::getClientData()
.
|
virtual |
Replaces the entire list of items.
Sets the items of the holder to items, which must be an array of count IlvGadgetItem
objects. Items are not copied, but the deletion of the array items is the responsibility of the caller.
items | The new items. |
count | The number of items in items. |
getItems()
, insertItem()
, removeItem()
. Reimplemented in IlvStringList, IlvAbstractMenu, and IlvComboBox.
Modifies the label of an item.
index | The item index. |
label | The new item label. |
copy | Specifies whether the label should be copied. If the value is IlTrue then the string is copied. In any case the internal string will be deleted when this IlvGadgetItem is destroyed. |
getLabel()
.
|
virtual |
Replaces the entire list of items.
Replaces the entire internal list of items to match the count labels provided in the parameter labels. Each item created is associated with its data read from the itemData array.
labels | The new items labels. |
itemData | The data associated with the items. |
count | The number of elements in the labels and itemData arrays. |
copy | Specifies whether the label should be copied. If the value is IlTrue then the string is copied. In any case the internal string will be deleted when this IlvGadgetItem is destroyed. |
getLabels()
, setItems()
.
|
virtual |
Replaces the entire list of items.
Replaces the entire internal list of items to match the count labels provided in the parameter labels.
labels | The new items labels. |
count | The number of elements in the labels. |
copy | Specifies whether the label should be copied. If the value is IlTrue then the string is copied. In any case the internal string will be deleted when this IlvGadgetItem is destroyed. |
getLabels()
, setItems()
.
|
virtual |
Sorts the items.
Runs the sorting algorithm on all the items. If you provide a sorting function in the form of an IlvListCompareFunction
, this function is called to compare each item pair. If you do not provide a sorting function, a default comparison function is used.
func | A sorting function. |
IlvListCompareFunction
, compareItems()
. Reimplemented in IlvStringList.