Rogue Wave Views 5.5.1 |
Rogue Wave Views |
Rogue Wave Views Documentation Home |
Gadget class. More...
#include <ilviews/gadgets/optmenu.h>
Public Member Functions | |
IlvOptionMenu (IlvDisplay *display, const IlvRect &rect, const char *const *labels=0, IlUShort count=0, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
IlvOptionMenu (IlvDisplay *display, const IlvPoint &point, const char *const *labels=0, IlUShort count=0, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0) | |
Constructor. | |
virtual IlvGadgetItem * | createItem (const char *label, IlvGraphic *g=0, IlvBitmap *bitmap=0, IlvBitmap *sbitmap=0, IlBoolean copy=IlTrue) const |
Returns a new gadget item. | |
virtual void | doIt () |
Is called when an item is selected in the option menu. | |
virtual void | empty () |
Empties the list. | |
const char * | getLabel (IlUShort pos) const |
Returns the i th label of the list. | |
const char * | getLabel () const |
Returns the label displayed in the option menu. | |
virtual IlvPalette * | getNormalTextPalette () const |
Returns the default palette used to draw an item. | |
virtual IlvPalette * | getOpaquePalette () const |
Returns the opaque palette used to draw opaque items. | |
IlvPopupMenu * | getSubMenu () const |
Returns a pointer to the menu object used by the option menu. | |
virtual void | recomputeAllItems () |
Recomputes the size of all the items managed by the holder. | |
void | setSelected (IlShort index, IlBoolean redraw=IlFalse) |
Sets the selected item of the option menu. | |
IlShort | whichSelected () const |
Returns the index of the selected item. | |
Friends | |
class | IlvDefaultOptionMenuLFHandler |
class | IlvOptionMenuWLFHandler |
Gadget class.
Library: ilvadvgdt
The IlvOptionMenu
class defines a drop-down list of items from which the user can choose.
- IlvOptionMenu -
IlvOptionMenu::IlvOptionMenu | ( | IlvDisplay * | display, | |
const IlvPoint & | point, | |||
const char *const * | labels = 0 , |
|||
IlUShort | count = 0 , |
|||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of the class IlvOptionMenu
. The size of the object is computed from the first label of the labels array. If you want to specify its size, use the other constructor. The labels are copied.
display | The connection to the display. | |
point | The position of the option menu. | |
labels | An array containing the predefined labels of the option menu. | |
count | The number of elements in the labels array. | |
thickness | The thickness of the option menu. | |
palette | The palette used by the option menu. |
IlvOptionMenu::IlvOptionMenu | ( | IlvDisplay * | display, | |
const IlvRect & | rect, | |||
const char *const * | labels = 0 , |
|||
IlUShort | count = 0 , |
|||
IlUShort | thickness = IlvDefaultGadgetThickness , |
|||
IlvPalette * | palette = 0 | |||
) |
Constructor.
Initializes a new instance of the class IlvOptionMenu
. The labels are copied.
display | The connection to the display. | |
rect | The size and position of the option menu. | |
labels | An array containing the predefined labels of the option menu. | |
count | The number of elements in the labels array. | |
thickness | The thickness of the option menu. | |
palette | The palette used by the option menu. |
virtual IlvGadgetItem* IlvOptionMenu::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.
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 | A Boolean value specifying whether a label should be copied. If the value is IlFalse |
[note] If both the second and third parameters are not null, only the second parameter is used.
The created gadget item.
Reimplemented from IlvGadgetItemHolder.
virtual void IlvOptionMenu::doIt | ( | ) | [virtual] |
Is called when an item is selected in the option menu.
Is called whether the selection changes or not. The default implementation calls the main callback of the option menu.
virtual void IlvOptionMenu::empty | ( | ) | [virtual] |
const char* IlvOptionMenu::getLabel | ( | IlUShort | index | ) | const |
Returns the i
th label of the list.
index | The item index. |
index
is not in the holder range, 0
is returned. Reimplemented from IlvListGadgetItemHolder.
const char* IlvOptionMenu::getLabel | ( | ) | const |
Returns the label displayed in the option menu.
0
. virtual IlvPalette* IlvOptionMenu::getNormalTextPalette | ( | ) | const [virtual] |
Returns the default palette used to draw an item.
Implements IlvGadgetItemHolder.
virtual IlvPalette* IlvOptionMenu::getOpaquePalette | ( | ) | const [virtual] |
Returns the opaque palette used to draw opaque items.
Reimplemented from IlvGadgetItemHolder.
IlvPopupMenu* IlvOptionMenu::getSubMenu | ( | ) | const |
Returns a pointer to the menu object used by the option menu.
IlvPopupMenu
class handles lists of items that can be selected. virtual void IlvOptionMenu::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 IlvGadgetItemHolder.
Sets the selected item of the option menu.
index | The index of the selected item. | |
redraw | A Boolean value specifying whether the object should be redrawn. |
IlShort IlvOptionMenu::whichSelected | ( | ) | const |
Returns the index of the selected item.
0
. If no item is selected, it returns -1
. © 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.