Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/gadgets/amenu.h>
Public Member Functions | |
void | addHighlightCallback (IlvGraphicCallback callback, IlBoolean submenus=IlTrue) |
Adds a "Highlight" callback to the menu. More... | |
void | addHighlightCallback (const IlSymbol *callbackName, IlBoolean submenus=IlTrue) |
Adds a named "Highlight" callback to the menu. 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 items. More... | |
virtual void | empty () |
Empties the list. More... | |
virtual IlvGadgetItem * | getItemByName (const char *) 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 IlvPalette * | getNormalTextPalette () const |
Returns the default palette used to draw an item. More... | |
virtual IlvPalette * | getOpaquePalette () const |
Returns the opaque palette used to draw opaque items. More... | |
IlUShort | insertItem (IlvMenuItem *item, IlShort pos=-1) |
Inserts a menu item at the specified position. More... | |
IlUShort | insertItem (IlUShort pos, const char *label, const IlvPopupMenu *menu=0, IlBoolean copy=IlTrue) |
Inserts a menu item that has a label. 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 (IlvGraphicCallback callback, IlBoolean submenus=IlTrue) |
Sets a "Highlight" callback to the menu. More... | |
void | setHighlightCallback (const IlSymbol *callbackName, IlBoolean submenus=IlTrue) |
Sets a named "Highlight" callback to the menu. More... | |
void | setItems (IlvMenuItem *const *items, IlUShort count) |
Replaces the entire list of items in the menu. More... | |
virtual void | setItems (IlvGadgetItem *const *items, IlUShort count) |
Replaces the entire list of items. 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 | 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 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... | |
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... | |
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... | |
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 IlvPalette * | getHighlightTextPalette () const |
Returns the highlight palette used to draw the label of highlighted items. More... | |
IlvGadgetItem * | getToolTipItem () 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 IlSymbol * | HighlightCBSymbol () |
Returns the callback type for the Highlight callback. More... | |
Protected Member Functions | |
IlvAbstractMenu (IlvDisplay *display, IlUShort count=0, const char *const *labels=0, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
IlvAbstractMenu (IlvDisplay *display, IlUShort count, IlvMenuItem *items, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
virtual void | itemActivated (IlvGadgetItem *) |
Is called when an item is activated. More... | |
Gadget class.
Library: ilvgadgt
This abstract class is used to facilitate the use of menu classes.
IlvMenuBar
, IlvToolBar
, IlvMenuItem
, IlvOptionMenu
, IlvPopupMenu
.
|
protected |
Constructor.
Initializes a new instance of the IlvAbstractMenu
class.
display | The connection to the display. |
count | The number of elements in the labels array. |
labels | An array of predefined labels. |
thickness | The thickness of the menu. |
palette | The palette used to draw the menu. |
|
protected |
Constructor.
Initializes a new instance of the IlvAbstractMenu
class. The items are copied by this constructor.
display | The connection to the display. |
count | The number of elements in the items array. |
items | An array of predefined items. |
thickness | The thickness of the menu. |
palette | The palette used to draw the menu. |
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.
callback | A pointer to the callback. |
submenus | Specifies whether the callback should be propagated to the submenus. |
setHighlightCallback()
. 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.
callbackName | The name of the callback. |
submenus | Specifies whether the callback should be propagated to the submenus. |
setHighlightCallback()
.
|
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.
|
virtual |
Deselects all the items.
IlvGadgetItem::deSelect()
. Reimplemented from IlvListGadgetItemHolder.
|
virtual |
Empties the list.
setItems()
, removeItem()
. Implements IlvListGadgetItemHolder.
Reimplemented in IlvPopupMenu, and IlvToolBar.
|
virtual |
Returns the item whose name is specified.
name | The name of the item. |
0
if the specified item cannot be found. IlvGadgetItem::setName()
, applyToItems()
. Reimplemented from IlvGadgetItemHolder.
IlvMenuItem* const* IlvAbstractMenu::getItems | ( | IlUShort & | count | ) | const |
Returns an array of all the items in the menu.
count | The number of items managed by this menu. |
|
virtual |
Returns the default orientation of the labels associated with the menu items.
orientation | The default orientation of the labels. |
flip | Specifies whether the labels are flipped or not. For more information, see the setLabelOrientation() method. |
setLabelOrientation()
. Reimplemented from IlvGadgetItemHolder.
|
virtual |
Returns the default position of the labels associated with the menu items, relative to their picture.
setLabelPosition()
. Reimplemented from IlvGadgetItemHolder.
|
virtual |
Returns the default palette used to draw an item.
Implements IlvGadgetItemHolder.
|
virtual |
Returns the opaque palette used to draw opaque items.
Reimplemented from IlvGadgetItemHolder.
|
static |
Returns the callback type for the Highlight callback.
The Highlight callback is called when the highlighted item has changed.
IlvGraphic::setCallback()
, IlvGadgetItem::highlight()
. 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.
item | The menu item to insert. |
pos | The position where the menu item should be inserted. If pos equals -1 , the menu item is added at the last position. |
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.
pos | The position where the new item should be inserted. |
label | The label of the new menu item. |
menu | The submenu associated with the new menu item. |
copy | Not used. |
IlvGadgetItem::setMenu()
, IlvListGadgetItemHolder::insertLabel()
.
|
virtual |
Indicates whether the specified item can be selected.
item | The menu item. |
IlTrue
if item can be selected and IlFalse
otherwise. IlvGadgetItem::isSelectable()
. Reimplemented in IlvToolBar.
|
virtual |
Returns IlTrue
if the labels associated with the menu items are displayed.
IlTrue
if the labels associated with the menu items are displayed. showLabel()
, isShowingPicture()
. Reimplemented from IlvGadgetItemHolder.
|
virtual |
Indicates if the pictures associated with the menu items are displayed.
IlTrue
if the pictures associated with the menu items are displayed and IlFalse
if they are not. showPicture()
, isShowingLabel()
. Reimplemented from IlvGadgetItemHolder.
|
protectedvirtual |
Is called when an item is activated.
The default implementation calls the Activate callback.
item | The activated gadget item. |
IlvGadgetItem::activate()
. Reimplemented from IlvGadgetItemHolder.
|
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.
index | The index of the item. |
bbox | The returned menu item's bounding box. |
t | The transformer used to compute the item's bounding box. |
Implemented in IlvPopupMenu, and IlvAbstractBar.
|
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.
point | The point used to located the item. |
t | The transformer used to compute the item bounding box. |
|
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.
IlvGadgetItem::recomputeSize()
, applyToItems()
. Reimplemented from IlvGadgetItemHolder.
Reimplemented in IlvPopupMenu.
|
virtual |
Is called when an item has been selected.
pos | The index of the selected item. |
unSelect()
. Reimplemented in IlvPopupMenu, and IlvAbstractBar.
|
virtual |
Is called when the user tries to select the next menu item using the keyboard.
|
virtual |
Is called when the user tries to select the previous menu item using the keyboard.
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:
A "Highlight" callback is invoked when a menu item is highlighted.
callback | A pointer to the callback. |
submenus | Specifies whether the callback should be propagated to the submenus. |
addHighlightCallback()
. 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.
callbackName | The name of the callback. |
submenus | Specifies whether the callback should be propagated to the submenus. |
addHighlightCallback()
. 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.
items | The new items. |
count | The number of items in items. |
getItems()
, insertItem()
, removeItem()
.
|
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 from IlvListGadgetItemHolder.
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
.
orientation | The new orientation of the labels. |
flip | Specifies whether the labels are flipped or not. |
redraw | Specifies whether the menu should be redrawn. |
getLabelOrientation()
. 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()
.
position | The new position of the items label, relative to their picture. |
redraw | Specifies whether the menu should be redrawn. |
getLabelPosition()
. 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
.
value | Specifies whether the menu item labels should be shown or hidden. |
redraw | Specifies whether the menu should be redrawn. |
isShowingLabel()
, showPicture()
. 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
.
value | Specifies whether the menu item pictures should be shown (IlTrue ) or hidden (IlFalse ). |
redraw | Specifies whether the menu should be redrawn. |
isShowingPicture()
, showLabel()
.
|
virtual |
Is called when an item has been deselected.
pos | The index of the unselected item. |
select()
. Reimplemented in IlvPopupMenu, and IlvAbstractBar.
IlShort IlvAbstractMenu::whichSelected | ( | ) | const |
Returns the index of the selected item.
-1
if no item is selected. IlvGadgetItem::select()
. © Copyright 2015, 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.