Rogue Wave Views
Gadgets Package API Reference Guide
Product Documentation:

Rogue Wave Views
Documentation Home
List of all members | Public Member Functions
IlvListGadgetItemHolder Class Referenceabstract

Item holder class. More...

#include <ilviews/gadgets/itemgdt.h>

Inheritance diagram for IlvListGadgetItemHolder:
IlvGadgetItemHolder IlvAbstractMenu IlvComboBox IlvOptionMenu IlvStringList IlvAbstractBar IlvPopupMenu IlvScrolledComboBox IlvMenuBar IlvToolBar IlvComboBox::PopupMenu IlvToolBarPath

Public Member Functions

virtual void addLabel (const char *label, IlAny data=0)
 Adds an item with a label to the holder list. More...
 
virtual IlvGadgetItemapplyToItems (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...
 
IlvGadgetItemgetItem (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 IlvGadgetItemcreateItem (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...
 
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...
 

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: ilvgadgt

IlvListGadgetItemHolder is a specific IlvGadgetItemHolder class that manages a list of items.

See also
IlvAbstractMenu, IlvGadgetItem, IlvStringList, IlvComboBox, IlvOptionMenu.

Member Function Documentation

§ addLabel()

virtual void IlvListGadgetItemHolder::addLabel ( const char *  label,
IlAny  data = 0 
)
virtual

Adds an item with a label to the holder list.

The item is created by calling the member function IlvGadgetItemHolder::createItem().

Parameters
labelThe item label. The string is copied internally.
dataThe item client data.
See also
insertItem(), insertLabel(), insertItem(), insertGraphic(), insertBitmap(), setItems().

§ applyToItems()

virtual IlvGadgetItem* IlvListGadgetItemHolder::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 IlvListGadgetItemHolder::compareItems ( const char *  string1,
const char *  string2,
IlAny  value1,
IlAny  value2 
)
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
string1The label of the first item.
string2The label of the second item.
value1The client data of the first item.
value2The client data of the second item.
See also
sort().

§ deSelectAll()

virtual void IlvListGadgetItemHolder::deSelectAll ( )
virtual

Deselects all the items.

See also
IlvGadgetItem::deSelect().

Reimplemented in IlvAbstractMenu.

§ empty()

virtual void IlvListGadgetItemHolder::empty ( )
pure virtual

§ getCardinal()

IlUShort IlvListGadgetItemHolder::getCardinal ( ) const

Returns the number of items stored in this holder.

Returns
The number of items stored in this holder.
See also
insertItem(), removeItem(), setItems().

§ getFirstSelectedItem()

IlShort IlvListGadgetItemHolder::getFirstSelectedItem ( ) const

Returns the index of the first selected item.

Returns
The index of the first selected item. Returns -1 if no item is selected.
See also
isSelected(), IlvGadgetItem::isSelected().

§ getIndex()

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.

Returns
The index of item beginning the search from start. It returns -1 if the item is not in the holder list.
Parameters
itemThe item to be retrieved.
startThe index where to begin the search.
stopThe index where to stop the search. The search doesn't includes the item of index stop.
See also
getItem().

§ getItem()

IlvGadgetItem* IlvListGadgetItemHolder::getItem ( IlUShort  index) const

Returns an item from its position in the holder.

Parameters
indexThe item position.
Returns
The indexth item. Returns 0 if index is not valid.
See also
getIndex().

§ getItemData()

IlAny IlvListGadgetItemHolder::getItemData ( IlUShort  index) const

Returns an item user data.

Parameters
indexThe item index.
Returns
The index th item user data or 0 if there is none.
See also
setItemData(), IlvGadgetItem::setClientData().

§ getItems()

IlvGadgetItem* const* IlvListGadgetItemHolder::getItems ( IlUShort count) const

Returns the array of all the items.

Parameters
countThe number of items in the returned array.
Returns
The array of all the items.
Note
The returned array should never be modified or deleted.
See also
setItems(), getItem(), getIndex().

§ getLabel()

const char* IlvListGadgetItemHolder::getLabel ( IlUShort  index) const

Returns the indicated label of the list.

Parameters
indexThe item index.
Returns
The index th label of the list. The returned string should not be modified or deleted. If index is not in the holder range, 0 is returned.

§ getLabels()

const char* const* IlvListGadgetItemHolder::getLabels ( IlUShort count) const

Returns an array of all the items labels.

Parameters
countThe number of elements of the returned array.
Returns
An array of count strings that includes all the items stored in the object.
Note
The returned array is a static array, managed internally. Other Rogue Wave Views routines may overwrite this buffer so it should be copied in a safe place if it needs to be persistent.
See also
setLabels(), setItems().

§ getPosition()

IlShort IlvListGadgetItemHolder::getPosition ( const char *  label,
IlUShort  start = 0 
) const

Returns the position of an item using its label.

Parameters
labelThe label of the searched item.
startThe index where to begin the search.
Returns
The position of the item with the label label, beginning the search from start. Returns -1 if the label cannot be found.
See also
getIndex(), IlvListGadgetItemHolder::getItemByName().

§ getSelection()

virtual const char* IlvListGadgetItemHolder::getSelection ( ) const
virtual

Returns the first selected item label.

Returns
The first selected item label. The returned string should never be modified or deleted.
See also
getSelections(), getSelectionIndices(), isSelected().

Reimplemented in IlvComboBox.

§ getSelectionIndices()

IlUShort const* IlvListGadgetItemHolder::getSelectionIndices ( IlUShort count) const

Returns an array containing the indexes of the selected item.

Parameters
countThe number of elements in the returned array.
Returns
An array of count values that holds the indexes of a selected item. The total number of selected items (and therefore, of valid values in the returned array) is returned in the count parameter.
Note
The returned array is a static array, managed internally. Other Rogue Wave Views routines may overwrite this buffer so it should be copied in a safe place if it needs to be persistent.
See also
getSelections(), getFirstSelectedItem(), isSelected().

§ getSelections()

const char* const* IlvListGadgetItemHolder::getSelections ( IlUShort count) const

Returns an array of the selected items.

Parameters
countThe number of elements in the returned array.
Returns
An array of count strings that includes all the selected items.
Note
The returned array is a static array, managed internally. Other Rogue Wave Views routines may overwrite this buffer so it should be copied in a safe place if it needs to be persistent.
See also
getSelectionIndices(), getFirstSelectedItem(), isSelected().

§ getUserDataArray()

IlAny const* IlvListGadgetItemHolder::getUserDataArray ( IlUShort count) const

Returns an array of all the user data for the items.

Parameters
countThe number of elements in the returned array.
Returns
An array of all the user data for the items. On return, the count parameter is set to the total number of items in the list. If user data has never been set to an item, the return value is 0. The user must not modify or delete the returned array.
See also
setItemData(), getItemData().

§ insertBitmap()

IlUShort IlvListGadgetItemHolder::insertBitmap ( IlvBitmap bitmap,
IlShort  pos = -1 
)

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

Parameters
bitmapThe item picture.
posThe item position. If pos is -1, the item is appended to the holder list.
Returns
The real index where the item was inserted.
See also
insertItem(), insertGraphic(), insertLabel(), setItems().

§ insertGraphic()

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

Parameters
graphicThe item picture.
posThe item position. If pos is -1, the item is appended to the holder list.
Returns
The real index where the item was inserted.
See also
insertItem(), insertBitmap(), insertLabel(), setItems().

§ insertItem()

IlUShort IlvListGadgetItemHolder::insertItem ( IlvGadgetItem item,
IlShort  index = -1 
)

Inserts an item at a given position in the holder's list.

Parameters
itemThe item.
indexThe item position. If index is -1, the item is appended to the holder list.
See also
insertBitmap(), insertGraphic(), InsertLabel(), setItems().

§ insertLabel()

virtual void IlvListGadgetItemHolder::insertLabel ( IlUShort  pos,
const char *  label,
IlAny  data = 0 
)
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().

Parameters
posThe item's position.
labelThe item label.
dataThe item client data.
See also
addLabel(), insertItem(), insertGraphic(), insertBitmap(), setItems().

§ isSelected()

IlBoolean IlvListGadgetItemHolder::isSelected ( IlUShort  index) const

Specifies whether the item whose position is specified is selected.

Parameters
indexThe item index.
Returns
IlTrue if indexth item is selected.
See also
IlvGadgetItem::isSelected().

§ removeItem()

void IlvListGadgetItemHolder::removeItem ( IlUShort  index,
IlBoolean  destroy = IlTrue 
)

Removes an item from the holder.

Parameters
indexThe item position.
destroySpecifies whether the item should be destroyed.
See also
insertItem().

§ removeLabel()

void IlvListGadgetItemHolder::removeLabel ( IlUShort  index)

Removes and destroys an item.

Parameters
indexThe item position.
See also
removeItem(), insertItem().

§ setItemData()

void IlvListGadgetItemHolder::setItemData ( IlUShort  index,
IlAny  itemData 
)

Sets an item user data.

Parameters
indexThe item index.
itemDataThe item data.
See also
getItemData(), IlvGadgetItem::getClientData().

§ setItems()

virtual void IlvListGadgetItemHolder::setItems ( IlvGadgetItem *const *  items,
IlUShort  count 
)
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.

Parameters
itemsThe new items.
countThe number of items in items.
See also
getItems(), insertItem(), removeItem().

Reimplemented in IlvAbstractMenu, IlvComboBox, and IlvStringList.

§ setLabel()

void IlvListGadgetItemHolder::setLabel ( IlUShort  index,
const char *  label,
IlBoolean  copy 
)

Modifies the label of an item.

Parameters
indexThe item index.
labelThe new item label.
copySpecifies 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.
See also
getLabel().

§ setLabels() [1/2]

virtual void IlvListGadgetItemHolder::setLabels ( const char *const *  labels,
IlAny const *  itemData,
IlUShort  count,
IlBoolean  copy = IlTrue 
)
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.

Parameters
labelsThe new items labels.
itemDataThe data associated with the items.
countThe number of elements in the labels and itemData arrays.
copySpecifies 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.
See also
getLabels(), setItems().

§ setLabels() [2/2]

virtual void IlvListGadgetItemHolder::setLabels ( const char *const *  labels,
IlUShort  count,
IlBoolean  copy = IlTrue 
)
virtual

Replaces the entire list of items.

Replaces the entire internal list of items to match the count labels provided in the parameter labels.

Parameters
labelsThe new items labels.
countThe number of elements in the labels.
copySpecifies 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.
See also
getLabels(), setItems().

§ sort()

virtual void IlvListGadgetItemHolder::sort ( IlvListCompareFunction  func = 0)
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.

Parameters
funcA sorting function.
See also
IlvListCompareFunction, compareItems().

Reimplemented in IlvStringList.


© Copyright 2018, 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.