Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/gadgets/menu.h>
Public Member Functions | |
IlvPopupMenu (IlvDisplay *display, IlUShort count, IlvMenuItem *items, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvPopupMenu (IlvDisplay *display, IlUShort count=0, const char *const *labels=0, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
void | addOpenMenuCallback (IlSymbol *callbackName, IlAny arg) |
Adds a named Open Menu callback. | |
void | addOpenMenuCallback (IlvGraphicCallback callback, IlAny arg) |
Adds a Open Menu callback. | |
void | addOpenMenuCallback (IlSymbol *callbackName) |
Adds a named Open Menu callback. | |
void | addOpenMenuCallback (IlvGraphicCallback callback) |
Adds an Open Menu callback. | |
IlBoolean | autoLabelAlignment () const |
Indicates whether the automatic label alignment mode is on. | |
void | autoLabelAlignment (IlBoolean value, IlBoolean redraw=IlTrue) |
Specifies whether the automatic label alignment mode should be used. | |
virtual void | doIt () |
Is called when the user selects an item from a standalone pop-up menu. | |
virtual void | drawGadgetItem (const IlvGadgetItem *, IlvPort *, const IlvRect &, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Draws a specific gadget item. | |
virtual void | empty () |
Empties the list. | |
IlShort | get (const IlvPoint &point, IlvView *parent=0) |
Displays the menu at the specified location and waits until a selection is made. | |
virtual IlvPalette * | getHighlightTextPalette () const |
Returns the highlight palette used to draw the label of highlighted items. | |
virtual IlvDim | getLabelOffset () const |
Returns the offset applied to each item label. | |
IlvGraphicCallback | getOpenMenuCallback () const |
Returns a pointer to the first unnamed callback in the Open Menu callback list. | |
IlSymbol * | getOpenMenuCallbackName () const |
Returns the name of the first named callback in the Open Menu callback list. | |
IlvContainer * | getTopView () const |
Returns a pointer to the container associated with the pop-up menu. | |
IlBoolean | hasToolTips () const |
Indicates whether the pop-up menu displays tooltips. | |
virtual void | hide () |
Hides the pop-up menu. | |
IlBoolean | isDoubleBuffering () const |
Tests the double buffering setting. | |
virtual IlBoolean | isGrabbed () const |
Returns IlTrue if the pop-up menu is visible and grabbed. | |
IlBoolean | isVisible () const |
Indicates whether the pop-up menu is visible. | |
virtual void | itemBBox (IlUShort item, IlvRect &rect, const IlvTransformer *t=0) const |
Returns the bounding box of a menu item in the menu. | |
virtual void | recomputeAllItems () |
Recomputes the size of all the items managed by the holder. | |
virtual void | select (IlUShort pos) |
Is called when an item has been selected. | |
virtual void | setDoubleBuffering (IlBoolean value) |
Sets double buffering. | |
void | setLabelOffset (IlvDim offset, IlBoolean redraw=IlTrue) |
Sets the label offset of the pop-up menu. | |
void | setOpenMenuCallback (IlSymbol *callbackName, IlAny arg) |
Sets a named Open Menu callback. | |
void | setOpenMenuCallback (IlvGraphicCallback callback, IlAny arg) |
Sets an Open Menu callback. | |
void | setOpenMenuCallback (IlSymbol *callbackName) |
Sets a named Open Menu callback. | |
void | setOpenMenuCallback (IlvGraphicCallback callback) |
Sets an Open Menu callback. | |
virtual void | show (const IlvPoint &point, IlBoolean grab=IlTrue, IlvView *parent=0) |
Displays the menu at the specified location. | |
virtual void | unSelect (IlUShort pos) |
Is called when an item has been deselected. | |
void | useToolTips (IlBoolean value) |
Specifies whether the pop-up menu should display tooltips. | |
Static Public Member Functions | |
static IlBoolean | AreToolTipsEnabled () |
Indicates whether pop-up menus should display tooltips. | |
static void | EnableToolTips (IlBoolean value=IlTrue) |
Specifies whether pop-up menus should display tooltips. | |
static IlSymbol * | OpenMenuCallbackSymbol () |
Returns the symbol of the Open Menu callback list. | |
Friends | |
class | IlvDefaultPopupMenuLFHandler |
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
.
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. |
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. |
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. |
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 | ) |
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. |
static IlBoolean IlvPopupMenu::AreToolTipsEnabled | ( | ) | [static] |
Indicates whether pop-up menus should display tooltips.
IlTrue
if tooltips are allowed for pop-up menus, IlFalse
otherwise. 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. 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 | A Boolean value specifying whether the automatic alignment mode should be used. | |
redraw | A Boolean value specifying whether the pop-up menu should be redrawn. |
virtual void IlvPopupMenu::doIt | ( | ) | [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 void IlvPopupMenu::drawGadgetItem | ( | const IlvGadgetItem * | item, | |
IlvPort * | port, | |||
const IlvRect & | rect, | |||
const IlvTransformer * | t = 0 , |
|||
const IlvRegion * | clip = 0 | |||
) | const [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 void IlvPopupMenu::empty | ( | ) | [virtual] |
static void IlvPopupMenu::EnableToolTips | ( | IlBoolean | value = IlTrue |
) | [static] |
Specifies whether pop-up menus should display tooltips.
Use this setting to enable or disable tooltips at the class level.
value | A Boolean value specifying 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. |
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 IlvPalette* IlvPopupMenu::getHighlightTextPalette | ( | ) | const [virtual] |
Returns the highlight palette used to draw the label of highlighted items.
Reimplemented from IlvGadgetItemHolder.
virtual IlvDim IlvPopupMenu::getLabelOffset | ( | ) | const [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.
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
. IlBoolean IlvPopupMenu::hasToolTips | ( | ) | const [virtual] |
Indicates whether the pop-up menu displays tooltips.
IlTrue
if the pop-up menu handles tooltips and IlFalse
if it does not. 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 actually using double buffering. virtual IlBoolean IlvPopupMenu::isGrabbed | ( | ) | const [virtual] |
Returns IlTrue
if the pop-up menu is visible and grabbed.
IlTrue
if the pop-up menu is visible and grabbed. Implements IlvAbstractMenu.
IlBoolean IlvPopupMenu::isVisible | ( | ) | const |
virtual void IlvPopupMenu::itemBBox | ( | IlUShort | index, | |
IlvRect & | bbox, | |||
const IlvTransformer * | t = 0 | |||
) | 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 IlSymbol* IlvPopupMenu::OpenMenuCallbackSymbol | ( | ) | [static] |
Returns the symbol of the Open Menu callback list.
virtual void IlvPopupMenu::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.
IlvGadgetItem::recomputeSize
, applyToItems
. Reimplemented from IlvAbstractMenu.
virtual void IlvPopupMenu::select | ( | IlUShort | pos | ) | [virtual] |
Is called when an item has been selected.
pos | The index of the selected item. |
Reimplemented from IlvAbstractMenu.
virtual void IlvPopupMenu::setDoubleBuffering | ( | IlBoolean | value | ) | [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 | A Boolean value indicating if the container associated with the pop-up menu should use double buffering (IlTrue ) or not (IlFalse ). |
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 | A Boolean value specifying whether the pop-up menu should be redrawn. |
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. |
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. |
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 | ) |
Sets an Open Menu callback.
Removes all the existing Open Menu callbacks before adding callback to the Open Menu callback list. A Open Menu callback is An Open Menu callback is invoked before the pop-up menu is displayed.
callback | A pointer to the new callback. |
virtual void IlvPopupMenu::show | ( | const IlvPoint & | point, | |
IlBoolean | grab = IlTrue , |
|||
IlvView * | parent = 0 | |||
) | [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 | A Boolean value specifying whether the events occurring to 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 void IlvPopupMenu::unSelect | ( | IlUShort | pos | ) | [virtual] |
Is called when an item has been deselected.
pos | The index of the unselected item. |
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 | A Boolean value specifying whether the pop-up menu should display tooltips (IlTrue ) or not (IlFalse ). |
© Copyright 2012, 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.