Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/gadgets/menu.h>
Public Member Functions | |
IlvPopupMenu (IlvDisplay *display, IlUShort count=0, const char *const *labels=0, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
IlvPopupMenu (IlvDisplay *display, IlUShort count, IlvMenuItem *items, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. More... | |
void | addOpenMenuCallback (IlvGraphicCallback callback) |
Adds an Open Menu callback. More... | |
void | addOpenMenuCallback (IlSymbol *callbackName) |
Adds a named Open Menu callback. More... | |
void | addOpenMenuCallback (IlvGraphicCallback callback, IlAny arg) |
Adds a Open Menu callback. More... | |
void | addOpenMenuCallback (IlSymbol *callbackName, IlAny arg) |
Adds a named Open Menu callback. More... | |
void | autoLabelAlignment (IlBoolean value, IlBoolean redraw=IlTrue) |
Specifies whether the automatic label alignment mode should be used. More... | |
IlBoolean | autoLabelAlignment () const |
Indicates whether the automatic label alignment mode is on. More... | |
virtual void | doIt () |
Is called when the user selects an item from a standalone pop-up menu. More... | |
virtual void | drawGadgetItem (const IlvGadgetItem *, IlvPort *, const IlvRect &, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws a specific gadget item. More... | |
virtual void | empty () |
Empties the list. More... | |
IlShort | get (const IlvPoint &point, IlvView *parent=0) |
Displays the menu at the specified location and waits until a selection is made. More... | |
virtual IlvPalette * | getHighlightTextPalette () const |
Returns the highlight palette used to draw the label of highlighted items. More... | |
virtual IlvDim | getLabelOffset () const |
Returns the offset applied to each item label. More... | |
IlvGraphicCallback | getOpenMenuCallback () const |
Returns a pointer to the first unnamed callback in the Open Menu callback list. More... | |
IlSymbol * | getOpenMenuCallbackName () const |
Returns the name of the first named callback in the Open Menu callback list. More... | |
IlvContainer * | getTopView () const |
Returns a pointer to the container associated with the pop-up menu. More... | |
IlBoolean | hasToolTips () const |
Indicates whether the pop-up menu displays tooltips. More... | |
virtual void | hide () |
Hides the pop-up menu. More... | |
IlBoolean | isDoubleBuffering () const |
Tests the double buffering setting. More... | |
virtual IlBoolean | isGrabbed () const |
Checks if the pop-up menu is visible and grabbed. More... | |
IlBoolean | isVisible () const |
Indicates whether the pop-up menu is visible. More... | |
virtual void | itemBBox (IlUShort item, IlvRect &rect, const IlvTransformer *t=0) const |
Returns the bounding box of a menu item in the menu. 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 void | setDoubleBuffering (IlBoolean value) |
Sets double buffering. More... | |
void | setLabelOffset (IlvDim offset, IlBoolean redraw=IlTrue) |
Sets the label offset of the pop-up menu. More... | |
void | setOpenMenuCallback (IlvGraphicCallback callback) |
Sets an Open Menu callback. More... | |
void | setOpenMenuCallback (IlSymbol *callbackName) |
Sets a named Open Menu callback. More... | |
void | setOpenMenuCallback (IlvGraphicCallback callback, IlAny arg) |
Sets an Open Menu callback. More... | |
void | setOpenMenuCallback (IlSymbol *callbackName, IlAny arg) |
Sets a named Open Menu callback. More... | |
virtual void | show (const IlvPoint &point, IlBoolean grab=IlTrue, IlvView *parent=0) |
Displays the menu at the specified location. More... | |
virtual void | unSelect (IlUShort pos) |
Is called when an item has been deselected. More... | |
void | useToolTips (IlBoolean value) |
Specifies whether the pop-up menu should display tooltips. More... | |
Public Member Functions inherited from IlvAbstractMenu | |
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 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 IlShort | pointToPosition (const IlvPoint &point, const IlvTransformer *t=0) const |
Returns the index of the menu item located at the indicated position. 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... | |
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 | |
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... | |
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 IlBoolean | AreToolTipsEnabled () |
Indicates whether pop-up menus should display tooltips. More... | |
static void | EnableToolTips (IlBoolean value=IlTrue) |
Specifies whether pop-up menus should display tooltips. More... | |
static IlSymbol * | OpenMenuCallbackSymbol () |
Returns the symbol of the Open Menu callback list. More... | |
Static Public Member Functions inherited from IlvAbstractMenu | |
static IlSymbol * | HighlightCBSymbol () |
Returns the callback type for the Highlight callback. More... | |
Friends | |
class | IlvDefaultPopupMenuLFHandler |
Additional Inherited Members | |
Protected Member Functions inherited from IlvAbstractMenu | |
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
The IlvPopupMenu
class handles a list of menu entries laid out vertically. These menu entries, called menu items, are instances of the IlvMenuItem
class, which can store a label, a bitmap, or a graphic object of the class IlvGraphic
.
A pop-up menu can be used as a submenu or as a standalone menu by calling the member functions IlvPopupMenu::show()
or IlvPopupMenu::get()
.
- IlvPopupMenu -
A pop-up menu can be torn off and put into a floating window. A tear-off pop-up menu can be detached by selecting the dashed line appearing across its top border. The first item of a tear-off pop-up menu must be of the type IlvTearOffItem
.
IlvAbstractBar
, IlvMenuItem
, IlvOptionMenu
, IlvComboBox
.This class support the following CSS properties:
Graphic property | CSS propery | Type |
---|---|---|
Background color | background-color | Color |
Text color | color | Color |
IlvPopupMenu::IlvPopupMenu | ( | IlvDisplay * | display, |
IlUShort | count = 0 , |
||
const char *const * | labels = 0 , |
||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
IlvPalette * | palette = 0 |
||
) |
Constructor.
Initializes a new instance of the IlvPopupMenu
class.
display | The connection to the display. |
count | The number of elements in the labels array. |
labels | An array of item labels. |
thickness | The thickness of the menu. |
palette | The palette used to draw the menu. |
IlvPopupMenu::IlvPopupMenu | ( | IlvDisplay * | display, |
IlUShort | count, | ||
IlvMenuItem * | items, | ||
IlUShort | thickness = IlvDefaultGadgetThickness , |
||
IlvPalette * | palette = 0 |
||
) |
Constructor.
Initializes a new instance of the IlvPopupMenu
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 menu items. |
thickness | The thickness of the menu. |
palette | The palette used to draw the menu. |
void IlvPopupMenu::addOpenMenuCallback | ( | IlvGraphicCallback | callback | ) |
Adds an Open Menu callback.
Adds callback to the Open Menu callback list. An Open Menu callback is invoked before the pop-up menu is displayed.
callback | A pointer to the new callback. |
setOpenMenuCallback()
, getOpenMenuCallback()
. void IlvPopupMenu::addOpenMenuCallback | ( | IlSymbol * | callbackName | ) |
Adds a named Open Menu callback.
Adds callbackName to the Open Menu callback list. gadget has the keyboard focus. An Open Menu callback is invoked before the pop-up menu is displayed.
callbackName | The name of the new callback. |
void IlvPopupMenu::addOpenMenuCallback | ( | IlvGraphicCallback | callback, |
IlAny | arg | ||
) |
Adds a Open Menu callback.
Adds callback to the Open Menu callback list. The callback function, when invoked, receives the user parameter arg.
An Open Menu callback is invoked before the pop-up menu is displayed.
callback | A pointer to the new callback. |
arg | The callback argument. |
setOpenMenuCallback()
, getOpenMenuCallback()
. Adds a named Open Menu callback.
Adds callbackName to the Open Menu callback list. The callback function, when invoked, receives the user parameter arg.
An Open Menu callback is invoked before the pop-up menu is displayed.
callbackName | The name of the new callback. |
arg | The callback argument. |
|
static |
Indicates whether pop-up menus should display tooltips.
IlTrue
if tooltips are allowed for pop-up menus, IlFalse
otherwise. hasToolTips()
, EnableToolTips()
. Specifies whether the automatic label alignment mode should be used.
When the automatic label alignment mode is enabled (the default), a label offset is automatically computed to ensure that all the item pictures are visible and all the item labels are aligned.
value | Specifies whether the automatic alignment mode should be used. |
redraw | Specifies whether the pop-up menu should be redrawn. |
setLabelOffset
, autoLabelAlignment()
. IlBoolean IlvPopupMenu::autoLabelAlignment | ( | ) | const |
Indicates whether the automatic label alignment mode is on.
IlTrue
if the automatic label alignment mode is on and IlFalse
otherwise.
|
virtual |
Is called when the user selects an item from a standalone pop-up menu.
The default implementation calls the IlvGadgetItem::activate()
method of the selected menu item, which causes the item callback to be invoked. The method does nothing if no item is selected.
|
virtual |
Draws a specific gadget item.
Redraws item in port at the location specified by rect using the clipping area clip. This method simply calls IlvGadgetItem::draw()
using the item instance.
item | The item to be redrawn. |
port | The destination drawing port. |
rect | The bounding box of the item. |
t | The transformer used to draw the item. Not used. |
clip | The clipping area. |
IlvGadgetItem::draw()
. Reimplemented from IlvGadgetItemHolder.
|
virtual |
Specifies whether pop-up menus should display tooltips.
Use this setting to enable or disable tooltips at the class level.
value | Specifies whether pop-up menus of the application should display tooltips (IlTrue ) or not (IlFalse ). If value is IlTrue , then each instance of pop-up menu will choose whether to display tooltips or not by using the value set by IlvPopupMenu::useToolTips() . If value is IlFalse , tooltips are disabled for all the pop-up menus of the application. |
useToolTips()
, AreToolTipsEnabled()
. Displays the menu at the specified location and waits until a selection is made.
Calls IlvPopupMenu::show()
, enters a modal loop, and waits until the pop-up menu is hidden.
point | The location where the menu is displayed. |
parent | The parent view for which the menu container is transient. For details on transient windows, see the IlvView constructors. |
-1
if there is no selected item.
|
virtual |
Returns the highlight palette used to draw the label of highlighted items.
Reimplemented from IlvGadgetItemHolder.
|
virtual |
Returns the offset applied to each item label.
0
if no offset has been defined. Reimplemented from IlvListGadgetItemHolder.
IlvGraphicCallback IlvPopupMenu::getOpenMenuCallback | ( | ) | const |
Returns a pointer to the first unnamed callback in the Open Menu callback list.
setOpenMenuCallback()
, addOpenMenuCallback()
. IlSymbol* IlvPopupMenu::getOpenMenuCallbackName | ( | ) | const |
Returns the name of the first named callback in the Open Menu callback list.
setOpenMenuCallbackName()
, getOpenMenuCallback()
. IlvContainer* IlvPopupMenu::getTopView | ( | ) | const |
Returns a pointer to the container associated with the pop-up menu.
When a pop-up menu is shown using IlvPopupMenu::show()
or IlvPopupMenu::get()
, an instance of the IlvContainer
class is created to display the pop-up menu.
0
.
|
virtual |
Indicates whether the pop-up menu displays tooltips.
IlTrue
if the pop-up menu handles tooltips and IlFalse
if it does not. useToolTips()
, EnableToolTips()
. Reimplemented from IlvGadgetItemHolder.
IlBoolean IlvPopupMenu::isDoubleBuffering | ( | ) | const |
Tests the double buffering setting.
IlTrue
) or not (IlFalse
) the container associated with the pop-up menu is using double buffering.
|
virtual |
Checks if the pop-up menu is visible and grabbed.
IlTrue
if the pop-up menu is visible and grabbed and IlFalse
otherwise. Implements IlvAbstractMenu.
IlBoolean IlvPopupMenu::isVisible | ( | ) | const |
|
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. |
Implements IlvAbstractMenu.
|
static |
Returns the symbol of the Open Menu callback list.
setOpenMenuCallback()
, IlvGraphic::setCallback()
.
|
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 IlvAbstractMenu.
|
virtual |
Is called when an item has been selected.
pos | The index of the selected item. |
unSelect()
. Reimplemented from IlvAbstractMenu.
|
virtual |
Sets double buffering.
Use this member function to indicate whether or not the container associated with the pop-up menu should use double buffering.
value | Specifies whether the container associated with the pop-up menu should use double buffering (IlTrue ) or not (IlFalse ). |
getTopView()
. Sets the label offset of the pop-up menu.
When a label offset is defined, all the item labels are aligned using this offset. Calling this method disables the automatic alignment mode.
offset | The new label offset. |
redraw | Specifies whether the pop-up menu should be redrawn. |
void IlvPopupMenu::setOpenMenuCallback | ( | IlvGraphicCallback | callback | ) |
Sets an Open Menu callback.
Removes all the existing Open Menu callbacks before adding callback to the Open Menu callback list.
An Open Menu callback is invoked before the pop-up menu is displayed.
callback | A pointer to the new callback. |
OpenMenu()
, addOpenMenuCallback()
, getOpenMenuCallback()
. void IlvPopupMenu::setOpenMenuCallback | ( | IlSymbol * | callbackName | ) |
Sets a named Open Menu callback.
Removes all the existing Open Menu callbacks before adding callbackName to the Open Menu callback list.
An Open Menu callback is invoked before the pop-up menu is displayed.
callbackName | The name of the new callback. |
void IlvPopupMenu::setOpenMenuCallback | ( | IlvGraphicCallback | callback, |
IlAny | arg | ||
) |
Sets an Open Menu callback.
Removes all the existing Open Menu callbacks before adding callback to the Open Menu callback list. The callback function, when invoked, receives the user parameter arg.
An Open Menu callback is invoked before the pop-up menu is displayed.
callback | A pointer to the new callback. |
arg | The callback argument. |
addOpenMenuCallback()
, getOpenMenuCallback()
. Sets a named Open Menu callback.
Removes all the existing Open Menu callbacks before adding callbackName to the Open Menu callback list. The callback function, when invoked, receives the user parameter arg.
An Open Menu callback is invoked before the pop-up menu is displayed.
callbackName | The name of the new callback. |
arg | The callback argument. |
|
virtual |
Displays the menu at the specified location.
Creates and displays an IlvContainer
object that contains the pop-up menu.
point | The location where the menu is displayed. |
grab | Specifies whether the events occurring in the menu container should be grabbed. |
parent | The parent view for which the menu container is transient. For details on transient windows, see the IlvView constructors. |
|
virtual |
Is called when an item has been deselected.
pos | The index of the unselected item. |
select()
. Reimplemented from IlvAbstractMenu.
void IlvPopupMenu::useToolTips | ( | IlBoolean | value | ) |
Specifies whether the pop-up menu should display tooltips.
The tooltips associated with menu items are displayed when the mouse remains over the items for a short period of time. For details on how to set tooltips to menu items, see IlvMenuItem::setToolTip()
.
value | Specifies whether the pop-up menu should display tooltips (IlTrue ) or not (IlFalse ). |
hasToolTips()
, IlvMenuItem::setToolTip()
. © 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.