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

Gadget class. More...

#include <ilviews/gadgets/amenu.h>

Inheritance diagram for IlvAbstractMenu:
IlvGadget IlvListGadgetItemHolder IlvSimpleGraphic IlvGadgetItemHolder IlvGraphic IlvStylable IlvValueInterface IlvAbstractBar IlvPopupMenu IlvMenuBar IlvToolBar IlvComboBox::PopupMenu IlvToolBarPath

Public Member Functions

void addHighlightCallback (const IlSymbol *callbackName, IlBoolean submenus=IlTrue)
 Adds a named "Highlight" callback to the menu. More...
 
void addHighlightCallback (IlvGraphicCallback callback, IlBoolean submenus=IlTrue)
 Adds a "Highlight" callback to the menu. More...
 
void addItem (const IlvMenuItem &item, IlShort index=-1)
 Inserts a copy of a menu item at the specified index. 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 items. More...
 
virtual void empty ()
 Empties the list. More...
 
IlvMenuItemgetItem (IlUShort index) const
 Returns the menu item at the specified index. More...
 
virtual IlvGadgetItemgetItemByName (const char *str) const
 Returns the item whose name is specified. More...
 
IlvMenuItem *const * getItems (IlUShort &count) const
 Returns an array of all the items in the menu. More...
 
virtual void getLabelOrientation (IlvOrientation &orientation, IlBoolean &flip) const
 Returns the default orientation of the labels associated with the menu items. More...
 
virtual IlvPosition getLabelPosition () const
 Returns the default position of the labels associated with the menu items, relative to their picture. More...
 
virtual const IlvPalettegetNormalTextPalette () const
 Returns the default palette used to draw an item. More...
 
virtual const IlvPalettegetOpaquePalette () const
 Returns the opaque palette used to draw opaque items. More...
 
IlvPopupMenugetSubMenu (IlUShort pos) const
 Returns the IlvPopupMenu associated with the menu item at the specified index. More...
 
IlUShort insertItem (IlUShort pos, const char *label, const IlvPopupMenu *menu=0, IlBoolean copy=IlTrue)
 Inserts a menu item that has a label. More...
 
IlUShort insertItem (IlvMenuItem *item, IlShort pos=-1)
 Inserts a menu item at the specified position. More...
 
virtual IlBoolean isSelectable (const IlvMenuItem *item) const
 Indicates whether the specified item can be selected. More...
 
virtual IlBoolean isShowingLabel () const
 Returns IlTrue if the labels associated with the menu items are displayed. More...
 
virtual IlBoolean isShowingPicture () const
 Indicates if the pictures associated with the menu items are displayed. More...
 
virtual void itemBBox (IlUShort index, IlvRect &bbox, const IlvTransformer *t=0) const =0
 Returns the bounding box of a menu item in the menu. More...
 
virtual IlShort pointToPosition (const IlvPoint &point, const IlvTransformer *t=0) const
 Returns the index of the menu item located at the indicated position. More...
 
virtual void recomputeAllItems ()
 Recomputes the size of all the items managed by the holder. More...
 
virtual void select (IlUShort pos)
 Is called when an item has been selected. More...
 
virtual IlShort selectNext ()
 Is called when the user tries to select the next menu item using the keyboard. More...
 
virtual IlShort selectPrevious ()
 Is called when the user tries to select the previous menu item using the keyboard. More...
 
void setHighlightCallback (const IlSymbol *callbackName, IlBoolean submenus=IlTrue)
 Sets a named "Highlight" callback to the menu. More...
 
void setHighlightCallback (IlvGraphicCallback callback, IlBoolean submenus=IlTrue)
 Sets a "Highlight" callback to the menu. More...
 
virtual void setItems (IlvGadgetItem *const *items, IlUShort count)
 Replaces the entire list of items. More...
 
void setItems (IlvMenuItem *const *items, IlUShort count)
 Replaces the entire list of items in the menu. More...
 
void setLabelOrientation (IlvOrientation orientation, IlBoolean flip=IlFalse, IlBoolean redraw=IlTrue)
 Sets the default orientation of the labels associated with the menu items. More...
 
void setLabelPosition (IlvPosition position, IlBoolean redraw=IlTrue)
 Sets the default position of the menu item labels, relative to their picture. More...
 
void setSubMenu (IlUShort pos, IlvPopupMenu *popup, IlBoolean copy=IlTrue)
 Sets the IlvPopupMenu associated with the menu item at the specified index. More...
 
void showLabel (IlBoolean value=IlTrue, IlBoolean redraw=IlTrue)
 Specifies whether the menu item labels should be shown or hidden. More...
 
void showPicture (IlBoolean value=IlTrue, IlBoolean redraw=IlTrue)
 Specifies whether the menu item pictures should be shown or hidden. More...
 
virtual void unSelect (IlUShort pos)
 Is called when an item has been deselected. More...
 
IlShort whichSelected () const
 Returns the index of the selected item. More...
 
- Public Member Functions inherited from IlvListGadgetItemHolder
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...
 
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...
 
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 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 const IlvPalettegetHighlightTextPalette () const
 Returns the highlight palette used to draw the label of highlighted items. More...
 
IlvGadgetItemgetToolTipItem () const
 Returns the item that is displaying a tooltip. More...
 
virtual void initReDrawItems ()
 Begins a redraw session. 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...
 

Static Public Member Functions

static IlSymbolHighlightCBSymbol ()
 Returns the callback type for the Highlight callback. More...
 
- 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

 IlvAbstractMenu (IlvDisplay *display, IlUShort count, IlvMenuItem *items, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
 IlvAbstractMenu (IlvDisplay *display, IlUShort count=0, const char *const *labels=0, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor. More...
 
virtual void itemActivated (IlvGadgetItem *)
 Is called when an item is activated. 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 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

Gadget class.

Library: ilvgadgt

This abstract class is used to facilitate the use of menu classes.

See also
IlvMenuBar, IlvToolBar, IlvMenuItem, IlvOptionMenu, IlvPopupMenu.

Accessors\nAccessors provide a scriptable and uniform way to inspect and modify an object by using its base class methods <tt>IlvValueInterface::queryValue()</tt>, <tt>IlvValueInterface::queryValues()</tt>, <tt>IlvValueInterface::changeValue()</tt>, <tt>IlvValueInterface::changeValues()</tt>.\n\n\nThis class inherits the accessors of its superclass \c IlvGadget and adds the following ones:

Data accessors

Name Type Equivalent methods
flipLabel Boolean getLabelOrientation(), setLabelOrientation()
itemsCount UInt getCardinal()
items GadgetItemArray getItems(), setItems()
menuItems MenuItemArray getItems(), setItems()
labelPosition Direction getLabelPosition(), setLabelPosition()
labelOrientation Direction getLabelOrientation(), setLabelOrientation()
selectedItemIndex Int whichSelected()
showLabel Boolean isShowingLabel(), showLabel()
showPicture Boolean isShowingPicture(), showPicture()
callbackItem Object getCallbackItem()

Method accessors

Name Return type Equivalent methods
getItem(UInt index) Object getItem(IlUShort index) const
removeItem(UInt index) Void removeItem(IlUShort index, IlBoolean)
addItem(Object item, Int index) Void addItem(const IlvMenuItem& item, IlShort index)
getLabel(UInt index) String getLabel(IlUShort index) const
setLabel(UInt index, String str) Void setLabel(IlUShort index, const char* str, IlBoolean)
getSubMenu(UInt index) Object getSubMenu(IlUShort index) const
setSubMenu(UInt index, Object menu) Void setSubMenu(IlUShort index, IlvPopupMenu* menu, IlBoolean)
getItemByName(String name) Object getItemByName(const char* name) const

Constructor & Destructor Documentation

◆ IlvAbstractMenu() [1/2]

IlvAbstractMenu::IlvAbstractMenu ( IlvDisplay display,
IlUShort  count = 0,
const char *const *  labels = 0,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)
protected

Constructor.

Initializes a new instance of the IlvAbstractMenu class.

Parameters
displayThe connection to the display.
countThe number of elements in the labels array.
labelsAn array of predefined labels.
thicknessThe thickness of the menu.
paletteThe palette used to draw the menu.

◆ IlvAbstractMenu() [2/2]

IlvAbstractMenu::IlvAbstractMenu ( IlvDisplay display,
IlUShort  count,
IlvMenuItem items,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)
protected

Constructor.

Initializes a new instance of the IlvAbstractMenu class. The items are copied by this constructor.

Parameters
displayThe connection to the display.
countThe number of elements in the items array.
itemsAn array of predefined items.
thicknessThe thickness of the menu.
paletteThe palette used to draw the menu.

Member Function Documentation

◆ addHighlightCallback() [1/2]

void IlvAbstractMenu::addHighlightCallback ( const IlSymbol callbackName,
IlBoolean  submenus = IlTrue 
)

Adds a named "Highlight" callback to the menu.

Adds the highlight callback specified by callbackName to the menu. If submenus is set to IlTrue, the same callback name is added to the submenus. When the callback is invoked, its IlAny parameter can be cast in a pointer to an IlShort. This IlShort indicates the position of the currently highlighted menu item or is set to -1 if no menu item is highlighted. See the example in the setHighlightCallback() method above. A "Highlight" callback is invoked when a menu item is highlighted.

Parameters
callbackNameThe name of the callback.
submenusSpecifies whether the callback should be propagated to the submenus.
See also
setHighlightCallback().

◆ addHighlightCallback() [2/2]

void IlvAbstractMenu::addHighlightCallback ( IlvGraphicCallback  callback,
IlBoolean  submenus = IlTrue 
)

Adds a "Highlight" callback to the menu.

Adds the "Highlight" callback specified by callback to the menu. If submenus is set to IlTrue, the same callback is added to the submenus. When the callback is invoked, its IlAny parameter can be cast in a pointer to an IlShort. This IlShort indicates the position of the currently highlighted menu item or is set to -1 if no menu item is highlighted. See the example in the setHighlightCallback() method above. A "Highlight" callback is invoked when an item of the menu is highlighted.

Parameters
callbackA pointer to the callback.
submenusSpecifies whether the callback should be propagated to the submenus.
See also
setHighlightCallback().

◆ addItem()

void IlvAbstractMenu::addItem ( const IlvMenuItem item,
IlShort  index = -1 
)

Inserts a copy of a menu item at the specified index.

Parameters
itemThe menu item to copy and add.
indexThe index where to add the item. If index is -1, the item is appended to the list.

◆ createItem()

virtual IlvGadgetItem* IlvAbstractMenu::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.

◆ deSelectAll()

void IlvAbstractMenu::deSelectAll ( )
virtual

Deselects all the items.

See also
IlvGadgetItem::deSelect().

Reimplemented from IlvListGadgetItemHolder.

◆ empty()

virtual void IlvAbstractMenu::empty ( )
virtual

Empties the list.

See also
setItems(), removeItem().

Implements IlvListGadgetItemHolder.

Reimplemented in IlvToolBar, and IlvPopupMenu.

◆ getItem()

IlvMenuItem* IlvAbstractMenu::getItem ( IlUShort  index) const

Returns the menu item at the specified index.

Parameters
indexThe index of the menu item.
Returns
The menu item at index index, or 0 if index is not valid (out of range).

◆ getItemByName()

virtual IlvGadgetItem* IlvAbstractMenu::getItemByName ( const char *  name) const
virtual

Returns the item whose name is specified.

Parameters
nameThe name of the item.
Returns
The item found or 0 if the specified item cannot be found.
See also
IlvGadgetItem::setName(), applyToItems().

Reimplemented from IlvGadgetItemHolder.

◆ getItems()

IlvMenuItem* const* IlvAbstractMenu::getItems ( IlUShort count) const

Returns an array of all the items in the menu.

Parameters
countThe number of items managed by this menu.
Returns
an array of all the items in the menu.
Note
The returned array should never be modified or deleted.
See also
setItems(), IlvListGadgetItemHolder::insertItem().

◆ getLabelOrientation()

virtual void IlvAbstractMenu::getLabelOrientation ( IlvOrientation &  orientation,
IlBoolean flip 
) const
virtual

Returns the default orientation of the labels associated with the menu items.

Parameters
orientationThe default orientation of the labels.
flipSpecifies whether the labels are flipped or not. For more information, see the setLabelOrientation() method.
Returns
The default orientation of the labels associated with the menu items.
See also
setLabelOrientation().

Reimplemented from IlvGadgetItemHolder.

◆ getLabelPosition()

virtual IlvPosition IlvAbstractMenu::getLabelPosition ( ) const
virtual

Returns the default position of the labels associated with the menu items, relative to their picture.

Returns
The default position of the labels associated with the menu items, relative to their picture.
See also
setLabelPosition().

Reimplemented from IlvGadgetItemHolder.

◆ getNormalTextPalette()

virtual const IlvPalette* IlvAbstractMenu::getNormalTextPalette ( ) const
virtual

Returns the default palette used to draw an item.

Returns
The default palette used to draw an item.

Implements IlvGadgetItemHolder.

Reimplemented in IlvComboBox::PopupMenu.

◆ getOpaquePalette()

virtual const IlvPalette* IlvAbstractMenu::getOpaquePalette ( ) const
virtual

Returns the opaque palette used to draw opaque items.

Returns
The opaque palette used to draw opaque items.

Reimplemented from IlvGadgetItemHolder.

Reimplemented in IlvComboBox::PopupMenu.

◆ getSubMenu()

IlvPopupMenu* IlvAbstractMenu::getSubMenu ( IlUShort  pos) const

Returns the IlvPopupMenu associated with the menu item at the specified index.

This method assumes that pos is a valid index.

Parameters
posA valid index.
Returns
The submenu associated with the menu item at pos. Returns 0 if the menu item has no submenu.
See also
getItem(), IlvMenuItem::getMenu()

◆ HighlightCBSymbol()

static IlSymbol* IlvAbstractMenu::HighlightCBSymbol ( )
static

Returns the callback type for the Highlight callback.

The Highlight callback is called when the highlighted item has changed.

See also
IlvGraphic::setCallback(const IlSymbol*, IlvGraphicCallback, IlAny), IlvGadgetItem::highlight().

◆ insertItem() [1/2]

IlUShort IlvAbstractMenu::insertItem ( IlUShort  pos,
const char *  label,
const IlvPopupMenu menu = 0,
IlBoolean  copy = IlTrue 
)

Inserts a menu item that has a label.

Creates a new menu item with the specified label, sets menu as the submenu of this new item, and adds the item to the menu at the position specified by pos. Note that the pop-up menu is always copied. The last parameter copy is not used and is kept only to allow compatibility with version 2.1.

Parameters
posThe position where the new item should be inserted.
labelThe label of the new menu item.
menuThe submenu associated with the new menu item.
copyNot used.
Returns
The real position of the menu item after it has been inserted in the menu.
See also
IlvMenuItem::setMenu(), IlvListGadgetItemHolder::insertLabel().

◆ insertItem() [2/2]

IlUShort IlvAbstractMenu::insertItem ( IlvMenuItem item,
IlShort  pos = -1 
)

Inserts a menu item at the specified position.

Inserts the menu item item at the position specified by pos.

Parameters
itemThe menu item to insert.
posThe position where the menu item should be inserted. If pos equals -1, the menu item is added at the last position.
Returns
The real position of the menu item after it has been inserted in the menu.
See also
IlvListGadgetItemHolder::insertItem().

◆ isSelectable()

virtual IlBoolean IlvAbstractMenu::isSelectable ( const IlvMenuItem item) const
virtual

Indicates whether the specified item can be selected.

Parameters
itemThe menu item.
Returns
IlTrue if item can be selected and IlFalse otherwise.
See also
IlvGadgetItem::isSelectable().

Reimplemented in IlvToolBar.

◆ isShowingLabel()

virtual IlBoolean IlvAbstractMenu::isShowingLabel ( ) const
virtual

Returns IlTrue if the labels associated with the menu items are displayed.

Returns
IlTrue if the labels associated with the menu items are displayed.
See also
showLabel(), isShowingPicture().

Reimplemented from IlvGadgetItemHolder.

◆ isShowingPicture()

virtual IlBoolean IlvAbstractMenu::isShowingPicture ( ) const
virtual

Indicates if the pictures associated with the menu items are displayed.

Returns
IlTrue if the pictures associated with the menu items are displayed and IlFalse if they are not.
See also
showPicture(), isShowingLabel().

Reimplemented from IlvGadgetItemHolder.

◆ itemActivated()

virtual void IlvAbstractMenu::itemActivated ( IlvGadgetItem item)
protectedvirtual

Is called when an item is activated.

The default implementation calls the Activate callback.

Parameters
itemThe activated gadget item.
See also
IlvGadgetItem::activate().

Reimplemented from IlvGadgetItemHolder.

◆ itemBBox()

virtual void IlvAbstractMenu::itemBBox ( IlUShort  index,
IlvRect bbox,
const IlvTransformer t = 0 
) const
pure virtual

Returns the bounding box of a menu item in the menu.

Uses bbox to return the bounding box of the item specified by index when the object is displayed with the transformer t.

Parameters
indexThe index of the item.
bboxThe returned menu item's bounding box.
tThe transformer used to compute the item's bounding box.

Implemented in IlvPopupMenu, and IlvAbstractBar.

◆ pointToPosition()

virtual IlShort IlvAbstractMenu::pointToPosition ( const IlvPoint point,
const IlvTransformer t = 0 
) const
virtual

Returns the index of the menu item located at the indicated position.

Returns the index of the menu item located at the position indicated by point when the object is displayed with the transformer t.

Parameters
pointThe point used to located the item.
tThe transformer used to compute the item bounding box.
Returns
The index of the item located at the position indicated by point. If there is no item, a negative value is returned.

◆ recomputeAllItems()

virtual void IlvAbstractMenu::recomputeAllItems ( )
virtual

Recomputes the size of all the items managed by the holder.

Calls the IlvGadgetItem::recomputeSize() member function for all the items managed by this holder.

See also
IlvGadgetItem::recomputeSize(), applyToItems().

Reimplemented from IlvGadgetItemHolder.

Reimplemented in IlvPopupMenu.

◆ select()

virtual void IlvAbstractMenu::select ( IlUShort  pos)
virtual

Is called when an item has been selected.

Parameters
posThe index of the selected item.
See also
unSelect().

Reimplemented in IlvPopupMenu, and IlvAbstractBar.

◆ selectNext()

virtual IlShort IlvAbstractMenu::selectNext ( )
virtual

Is called when the user tries to select the next menu item using the keyboard.

Returns
The next selected item.

◆ selectPrevious()

virtual IlShort IlvAbstractMenu::selectPrevious ( )
virtual

Is called when the user tries to select the previous menu item using the keyboard.

Returns
The previous selected item.

◆ setHighlightCallback() [1/2]

void IlvAbstractMenu::setHighlightCallback ( const IlSymbol callbackName,
IlBoolean  submenus = IlTrue 
)

Sets a named "Highlight" callback to the menu.

Removes all the highlight callbacks and associates the highlight callback specified by callbackName to the menu. If submenus is set to IlTrue, the same callback name is added to the submenus.

When the callback is invoked, its IlAny parameter can be cast in a pointer to an IlShort. This IlShort indicates the position of the currently highlighted menu item or is set to -1 if no menu item is highlighted. See the example in the setHighlightCallback() method above. A "Highlight" callback is invoked when an item of the menu is highlighted.

Parameters
callbackNameThe name of the callback.
submenusSpecifies whether the callback should be propagated to the submenus.
See also
addHighlightCallback().

◆ setHighlightCallback() [2/2]

void IlvAbstractMenu::setHighlightCallback ( IlvGraphicCallback  callback,
IlBoolean  submenus = IlTrue 
)

Sets a "Highlight" callback to the menu.

Removes all the highlight callbacks and associates the highlight callback specified by callback to the menu. If submenus is set to IlTrue, the same callback is added to the submenus.

When the callback is invoked, its IlAny parameter can be cast in a pointer to an IlShort. This IlShort indicates the position of the currently highlighted menu item or is set to -1 if no menu item is highlighted. For example:

void myHighlightCB(IlvGraphic* mygraphic, IlAny itemptr)
{
IlShort hilited_item = *(IlShort*) itemptr;
IlvAbstractMenu* mymenu= (IlvAbstractMenu*) mygraphic;
if (hilited_item != -1) {
IlvMenuItem* current_item =
mymenu->getItem((IlUShort)hilited_item);
...
}
}

A "Highlight" callback is invoked when a menu item is highlighted.

Parameters
callbackA pointer to the callback.
submenusSpecifies whether the callback should be propagated to the submenus.
See also
addHighlightCallback().

◆ setItems() [1/2]

virtual void IlvAbstractMenu::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 from IlvListGadgetItemHolder.

◆ setItems() [2/2]

void IlvAbstractMenu::setItems ( IlvMenuItem *const *  items,
IlUShort  count 
)

Replaces the entire list of items in the menu.

Sets the items of the menu 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().

◆ setLabelOrientation()

void IlvAbstractMenu::setLabelOrientation ( IlvOrientation  orientation,
IlBoolean  flip = IlFalse,
IlBoolean  redraw = IlTrue 
)

Sets the default orientation of the labels associated with the menu items.

When orientation is set to IlvHorizontal, labels are drawn from left to right.

When orientation is set to IlvVertical, labels are drawn from top to bottom if flip is IlFalse, or from bottom to top if flip is IlFalse.

Parameters
orientationThe new orientation of the labels.
flipSpecifies whether the labels are flipped or not.
redrawSpecifies whether the menu should be redrawn.
See also
getLabelOrientation().

◆ setLabelPosition()

void IlvAbstractMenu::setLabelPosition ( IlvPosition  position,
IlBoolean  redraw = IlTrue 
)

Sets the default position of the menu item labels, relative to their picture.

Sets the default position of the menu item labels to pos. This setting is used to compute the geometry of each menu item. For more information, see the member function IlvGadgetItem::setLabelPosition().

Parameters
positionThe new position of the items label, relative to their picture.
redrawSpecifies whether the menu should be redrawn.
See also
getLabelPosition().

◆ setSubMenu()

void IlvAbstractMenu::setSubMenu ( IlUShort  pos,
IlvPopupMenu popup,
IlBoolean  copy = IlTrue 
)

Sets the IlvPopupMenu associated with the menu item at the specified index.

Sets a popup menu at the menu item specified by the index pos. This method assumes that pos is a valid index.

Parameters
posA valid index.
popupThe popup menu to set on the menu item.
copyIlTrue if the menu should be copied.
See also
getItem(), IlvMenuItem::setMenu()

◆ showLabel()

void IlvAbstractMenu::showLabel ( IlBoolean  value = IlTrue,
IlBoolean  redraw = IlTrue 
)

Specifies whether the menu item labels should be shown or hidden.

Shows the labels associated with the menu items if value is set to IlTrue.

Parameters
valueSpecifies whether the menu item labels should be shown or hidden.
redrawSpecifies whether the menu should be redrawn.
See also
isShowingLabel(), showPicture().

◆ showPicture()

void IlvAbstractMenu::showPicture ( IlBoolean  value = IlTrue,
IlBoolean  redraw = IlTrue 
)

Specifies whether the menu item pictures should be shown or hidden.

Shows the pictures associated with the menu items if value is set to IlTrue.

Parameters
valueSpecifies whether the menu item pictures should be shown (IlTrue) or hidden (IlFalse).
redrawSpecifies whether the menu should be redrawn.
See also
isShowingPicture(), showLabel().

◆ unSelect()

virtual void IlvAbstractMenu::unSelect ( IlUShort  pos)
virtual

Is called when an item has been deselected.

Parameters
posThe index of the unselected item.
See also
select().

Reimplemented in IlvPopupMenu, and IlvAbstractBar.

◆ whichSelected()

IlShort IlvAbstractMenu::whichSelected ( ) const

Returns the index of the selected item.

Returns
The index of the selected item or -1 if no item is selected.
See also
IlvGadgetItem::select().
IlUShort
unsigned short IlUShort
IlvGraphic
IlvAbstractMenu
Gadget class.
Definition: amenu.h:1002
IlShort
short IlShort
IlvMenuItem
Menu item class.
Definition: amenu.h:98
IlvAbstractMenu::getItem
IlvMenuItem * getItem(IlUShort index) const
Returns the menu item at the specified index.
Definition: amenu.h:1456
IlAny
void * IlAny