Rogue Wave Views 5.6 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Menu item class. More...
#include <ilviews/gadgets/amenu.h>
Public Member Functions | |
IlvMenuItem () | |
Constructor. | |
IlvMenuItem (IlvGraphic *graphic) | |
Constructor. | |
IlvMenuItem (IlvBitmap *bitmap) | |
Constructor. | |
IlvMenuItem (const char *label) | |
Constructor. | |
virtual void | deSelect () |
Deselects the item. | |
void | detachMenu (IlBoolean destroy=IlFalse) |
Suppresses the IlvPopupMenu associated with the menu item. | |
virtual void | drawLabel (IlvPort *dst, IlvPalette *palette, const IlvRect &rect, const IlvTransformer *t=0, const IlvRegion *clip=0) const |
Is called to draw the item label. | |
IlUShort | getAcceleratorKey () const |
Returns the accelerator key of the menu item. | |
IlUShort | getAcceleratorModifiers () const |
Returns the combination of modifiers used with the menu item accelerator. | |
const char * | getAcceleratorText () const |
Returns the text describing the accelerator. This text appears to the right of the menu item. | |
virtual IlUInt | getBitmapMask () const |
Returns the bitmap mask of the item. | |
IlvGraphicCallback | getCallback () const |
Returns a pointer to the item callback. | |
IlSymbol * | getCallbackName () const |
Returns the symbol that represents the name of the item callback. | |
virtual IlvBitmap * | getCurrentBitmap () const |
Returns the bitmap that is currently displayed by the item. | |
virtual IlvPalette * | getInsensitivePalette () const |
Returns the palette used to draw a nonsensitive item. | |
IlvPopupMenu * | getMenu () const |
Returns the IlvPopupMenu displayed by the menu item. | |
virtual const char * | getMessage () const |
Returns the message of the item. | |
const char * | getToolTip () const |
Returns the message used in the tooltip associated with the menu item. | |
IlvMenuItemType | getType () const |
Returns the type of the menu item. | |
IlBoolean | isChecked () const |
Specifies whether the menu item is checked. | |
IlBoolean | isRadioToggle () const |
Returns the radio state of the menu item. | |
IlBoolean | isReadOnly () const |
Indicates whether the menu item is read-only. | |
virtual IlBoolean | isSelectable () const |
Indicates whether the item can be selected. | |
IlBoolean | isTearOff () const |
Indicates whether the menu item is a tear-off item. | |
IlBoolean | isToggle () const |
Indicates whether the menu item is a toggle item. | |
virtual void | select () |
Selects the item. | |
void | setAcceleratorKey (IlUShort key) |
Sets the accelerator key of the menu item. | |
void | setAcceleratorModifiers (IlUShort modifiers) |
Sets the combination of modifiers used with the menu item accelerator. | |
void | setAcceleratorText (const char *text) |
Sets the text describing the accelerator. This text appears to the right of the menu item. | |
void | setCallback (IlvGraphicCallback callback) |
Sets the item callback. | |
void | setCallbackName (IlSymbol *callbackName) |
Sets the name of the item callback. | |
void | setChecked (IlBoolean value) |
Specifies whether the menu item should be checked. | |
void | setMenu (IlvPopupMenu *menu, IlBoolean copy=IlTrue) |
Sets the IlvPopupMenu displayed by the menu item. | |
void | setRadioToggle (IlBoolean value) |
Sets the radio state of the menu item. | |
void | setReadOnly (IlBoolean value) |
Specifies whether the menu item should be read-only. | |
void | setTearOff (IlBoolean value=IlTrue) |
Specifies whether the menu item should be a tear-off item. | |
void | setToggle (IlBoolean value) |
Specifies whether the menu item should be a toggle item. | |
void | setToolTip (const char *tooltip) |
Sets the message displayed by the tooltip associated with the menu item. | |
virtual void | sizes (IlvPalette *pal, IlvDim &width, IlvDim &height, IlBoolean margin=IlTrue) const |
Returns the size of the menu item. | |
Static Public Member Functions | |
static IlSymbol * | CheckedBitmapSymbol () |
Returns the symbol of the checked bitmap. | |
Protected Member Functions | |
virtual void | computeSize (IlUShort &, IlUShort &) const |
Computes the item size. | |
Friends | |
class | IlvAbstractMenu |
class | IlvPopupMenu |
Menu item class.
Library: ilvgadgt
The class IlvMenuItem
implements the items appearing in pop-up menus (IlvPopupMenu
) or in menu bars (IlvMenuBar
, IlvToolBar
). A menu item can display a label, a bitmap, a graphic object and can be used as a separator.
IlvMenuItem::IlvMenuItem | ( | const char * | label | ) |
Constructor.
Initializes a new instance of the IlvMenuItem
class.
label | The label of the menu item. |
IlvMenuItem::IlvMenuItem | ( | IlvBitmap * | bitmap | ) |
Constructor.
Initializes a new instance of the IlvMenuItem
class.
bitmap | The bitmap displayed by the menu item. The bitmap provided is used as the sensitive bitmap of the menu item. For more details, see IlvGadget::setBitmap . The bitmap is locked. |
IlvMenuItem::IlvMenuItem | ( | IlvGraphic * | graphic | ) |
Constructor.
Initializes a new instance of the IlvMenuItem
class.
graphic | The graphic object displayed by the menu item. |
IlvMenuItem::IlvMenuItem | ( | ) |
Constructor.
Initializes a new instance of the IlvMenuItem
class. This constructor creates a menu item that serves as a separator.
static IlSymbol* IlvMenuItem::CheckedBitmapSymbol | ( | ) | [static] |
Returns the symbol of the checked bitmap.
virtual void IlvMenuItem::computeSize | ( | IlUShort & | width, | |
IlUShort & | height | |||
) | const [protected, virtual] |
Computes the item size.
Computes the size of the item using the member function IlvGadgetItem::computeRects
, which specifies the location of the label and picture parts. If you want to change the item size, you can override this member function in a subclass.
width | The returned item width. | |
height | The returned item height. |
Reimplemented from IlvGadgetItem.
virtual void IlvMenuItem::deSelect | ( | ) | [virtual] |
Deselects the item.
The default implementation deselects and redraws the item, then it calls the holder method IlvGadgetItemHolder::itemDeSelected
.
Reimplemented from IlvGadgetItem.
void IlvMenuItem::detachMenu | ( | IlBoolean | destroy = IlFalse |
) |
Suppresses the IlvPopupMenu
associated with the menu item.
destroy | A Boolean value specifying whether the suppressed pop-up menu should be destroyed. |
virtual void IlvMenuItem::drawLabel | ( | IlvPort * | dst, | |
IlvPalette * | palette, | |||
const IlvRect & | rect, | |||
const IlvTransformer * | t = 0 , |
|||
const IlvRegion * | clip = 0 | |||
) | const [virtual] |
Is called to draw the item label.
You can override this method to modify the way the item is drawn.
dst | The destination drawing port. | |
palette | The palette used to draw the item label. | |
rect | The rectangle where to the item label will be drawn. | |
t | The transformer used to draw the item label. | |
clip | The clipping area. |
Reimplemented from IlvGadgetItem.
IlUShort IlvMenuItem::getAcceleratorKey | ( | ) | const |
Returns the accelerator key of the menu item.
IlUShort IlvMenuItem::getAcceleratorModifiers | ( | ) | const |
Returns the combination of modifiers used with the menu item accelerator.
IlvCtrlModifier
or IlvShiftModifier
, that should be used in combination with the accelerator key to invoke the menu item callback (see IlvEvent::modifiers
). const char* IlvMenuItem::getAcceleratorText | ( | ) | const |
Returns the text describing the accelerator. This text appears to the right of the menu item.
IlvPopupMenu
. virtual IlUInt IlvMenuItem::getBitmapMask | ( | ) | const [virtual] |
Returns the bitmap mask of the item.
The bitmap mask lets you know which bitmap indexes the item is handling. If the ith bit of the return value is set, it means that the item uses the bitmap of index i
. You can get the associated symbol using the static member function GetItemBitmapSymbol
.
Reimplemented from IlvGadgetItem.
IlvGraphicCallback IlvMenuItem::getCallback | ( | ) | const |
Returns a pointer to the item callback.
0
if there is none. IlSymbol* IlvMenuItem::getCallbackName | ( | ) | const |
Returns the symbol that represents the name of the item callback.
0
if there is none. virtual IlvBitmap* IlvMenuItem::getCurrentBitmap | ( | ) | const [virtual] |
Returns the bitmap that is currently displayed by the item.
Reimplemented from IlvGadgetItem.
virtual IlvPalette* IlvMenuItem::getInsensitivePalette | ( | ) | const [virtual] |
Returns the palette used to draw a nonsensitive item.
By default, an item uses the palette of its holder. Therefore, this method simply calls IlvGadgetItemHolder::getInsensitivePalette
.
Reimplemented from IlvGadgetItem.
IlvPopupMenu* IlvMenuItem::getMenu | ( | ) | const |
Returns the IlvPopupMenu
displayed by the menu item.
0
if there is none. virtual const char* IlvMenuItem::getMessage | ( | ) | const [virtual] |
Returns the message of the item.
Reimplemented from IlvGadgetItem.
const char* IlvMenuItem::getToolTip | ( | ) | const |
Returns the message used in the tooltip associated with the menu item.
0
if there is none. IlvMenuItemType IlvMenuItem::getType | ( | ) | const |
Returns the type of the menu item.
IlvSeparatorItem
and IlvTearOffItem
. IlvMenuItemType
IlBoolean IlvMenuItem::isChecked | ( | ) | const |
Specifies whether the menu item is checked.
IlTrue
if the menu item is checked. In this case, if the menu item is part of an IlvPopupMenu
, a small check mark appears to the left side of the menu item. It returns IlFalse
if the menu item is not checked. IlBoolean IlvMenuItem::isRadioToggle | ( | ) | const |
Returns the radio state of the menu item.
IlTrue
if the menu item is radio. When an item is radio and is located in an IlvPopupMenu
, a radio toggle check mark appears next to it, whether the item is checked or not.IlBoolean IlvMenuItem::isReadOnly | ( | ) | const |
Indicates whether the menu item is read-only.
A menu entry can be read-only. A read-only menu item cannot be selected.
IlTrue
if the menu item is read-only and IlFalse
otherwise. virtual IlBoolean IlvMenuItem::isSelectable | ( | ) | const [virtual] |
Indicates whether the item can be selected.
Is called when an item is about to be selected. You can redefine this member function to filter item selection.
IlTrue
if the item can be selected, and IlFalse
otherwise. Reimplemented from IlvGadgetItem.
IlBoolean IlvMenuItem::isTearOff | ( | ) | const |
Indicates whether the menu item is a tear-off item.
IlTrue
if the menu item is a tear-off item. IlBoolean IlvMenuItem::isToggle | ( | ) | const |
Indicates whether the menu item is a toggle item.
IlTrue
if the menu item is a toggle item. In this case, a check mark appears next to the item whether it is checked or not. virtual void IlvMenuItem::select | ( | ) | [virtual] |
Selects the item.
The default implementation selects and redraws the item, then it calls the holder method IlvGadgetItemHolder::itemSelected
.
Reimplemented from IlvGadgetItem.
void IlvMenuItem::setAcceleratorKey | ( | IlUShort | key | ) |
Sets the accelerator key of the menu item.
Sets key as the accelerator key. Used in combination with the modifier keys, it provides a quick access to the callback attached to the menu item.
key | The new accelerator key. |
void IlvMenuItem::setAcceleratorModifiers | ( | IlUShort | modifiers | ) |
Sets the combination of modifiers used with the menu item accelerator.
Sets the combination of modifiers, such as IlvCtrlModifier
or IlvShiftModifier
), that is to be used in combination with the accelerator key to call the menu item callback (see IlvEvent::modifiers
).
modifiers | The new modifiers to be used with the accelerator. |
void IlvMenuItem::setAcceleratorText | ( | const char * | text | ) |
Sets the text describing the accelerator. This text appears to the right of the menu item.
Sets text as the text that appears in the menu item to describe the accelerator when the item is located in an IlvPopupMenu
.
text | The new text for the accelerator. |
void IlvMenuItem::setCallback | ( | IlvGraphicCallback | callback | ) |
Sets the item callback.
Sets the callback associated with the menu item to callback.
callback | A pointer to the new item callback. |
void IlvMenuItem::setCallbackName | ( | IlSymbol * | callbackName | ) |
Sets the name of the item callback.
Sets the name of the item callback to callbackName. The item callback is triggered when the item is activated.
callbackName | The name of the callback. |
void IlvMenuItem::setChecked | ( | IlBoolean | value | ) |
Specifies whether the menu item should be checked.
If the item has a sensitive bitmap, and if no checked bitmap has been provided, a default checked bitmap is automatically computed the first time the item is checked.
value | A Boolean value specifying whether the menu item should be checked. |
void IlvMenuItem::setMenu | ( | IlvPopupMenu * | menu, | |
IlBoolean | copy = IlTrue | |||
) |
Sets the IlvPopupMenu
displayed by the menu item.
Sets a submenu to this menu item. A small arrow is displayed on the right side of the entry when the item is located in an IlvPopupMenu
. If there was already a submenu, then it is deleted.
menu | The new submenu. | |
copy | A Boolean value specifying whether menu should be copied. |
void IlvMenuItem::setRadioToggle | ( | IlBoolean | value | ) |
Sets the radio state of the menu item.
Sets the menu item to be a radio toggle, if value is IlTrue
.
value | A Boolean specifying whether the menu item should be a radio item. |
void IlvMenuItem::setReadOnly | ( | IlBoolean | value | ) |
Specifies whether the menu item should be read-only.
Sets the menu item to the read-only mode. If value is IlTrue
, the menu item cannot be selected.
value | A Boolean value specifying whether the menu item should be read- only. |
void IlvMenuItem::setTearOff | ( | IlBoolean | value = IlTrue |
) |
Specifies whether the menu item should be a tear-off item.
A tear-off menu item is represented by a dashed line when it is located in an IlvPopupMenu
. When selected, a tear-off menu item creates a top window in which a copy of the pop-up menu that contains it is put.
value | A Boolean value specifying the tear-off state of the menu item. |
void IlvMenuItem::setToggle | ( | IlBoolean | value | ) |
Specifies whether the menu item should be a toggle item.
Sets the menu item to be a toggle item. A toggle item located in an IlvPopupMenu
has a check mark displayed next to it only when using the Motif look-and-feel.
If the toggle item is located in an IlvToolBar
, then the item has a toggle behavior.
value | A Boolean value specifying whether the menu item should be a toggle item. |
void IlvMenuItem::setToolTip | ( | const char * | tooltip | ) |
Sets the message displayed by the tooltip associated with the menu item.
Sets the message displayed by the tooltip associated with this menu item. Tooltips attached to menu items are only active when the items belong to an IlvToolBar
object.
tooltip | The message to be displayed by the tooltip. |
virtual void IlvMenuItem::sizes | ( | IlvPalette * | pal, | |
IlvDim & | width, | |||
IlvDim & | height, | |||
IlBoolean | margin = IlTrue | |||
) | const [virtual] |
Returns the size of the menu item.
Returns in width and height the size of the menu item.
pal | This parameter is not obsolete. | |
width | The width of the menu item. | |
height | The height of the menu item. |
© 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.