rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Gadgets Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvOptionMenu Class Reference

Gadget class. More...

#include <ilviews/gadgets/optmenu.h>

Inheritance diagram for IlvOptionMenu:
IlvGadget IlvListGadgetItemHolder IlvSimpleGraphic IlvGadgetItemHolder IlvGraphic

List of all members.

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 IlvGadgetItemcreateItem (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 ith label of the list.
const char * getLabel () const
 Returns the label displayed in the option menu.
virtual IlvPalettegetNormalTextPalette () const
 Returns the default palette used to draw an item.
virtual IlvPalettegetOpaquePalette () const
 Returns the opaque palette used to draw opaque items.
IlvPopupMenugetSubMenu () 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

Detailed Description

Gadget class.

Library: ilvadvgdt

The IlvOptionMenu class defines a drop-down list of items from which the user can choose.

IlvOptionMenua.gif

- IlvOptionMenu -

See also:
IlvMenuItem, IlvPopupMenu, IlvComboBox

Constructor & Destructor Documentation

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.

Parameters:
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.

Parameters:
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.

Member Function Documentation

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.

Parameters:
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, then you must allocate some memory for the label because in any case the label characters are deleted from the memory by the IlvGadgetItem.
Warning:
[note] If both the second and third parameters are not null, only the second parameter is used.
Returns:
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]

Empties the list.

See also:
setItems, removeItem

Implements IlvListGadgetItemHolder.

const char* IlvOptionMenu::getLabel ( IlUShort  index  )  const

Returns the ith label of the list.

Parameters:
index The item index.
Returns:
The index th label of the list. The returned string should not be modified or deleted. If 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.

Returns:
The label displayed in the option menu. If the selected item has no label, it returns 0.
See also:
setSelected
virtual IlvPalette* IlvOptionMenu::getNormalTextPalette (  )  const [virtual]

Returns the default palette used to draw an item.

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.

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.

Returns:
A pointer to the menu object used by the option menu. The IlvPopupMenu class handles lists of items that can be selected.
See also:
IlvPopupMenu
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.

See also:
IlvGadgetItem::recomputeSize, applyToItems.

Reimplemented from IlvGadgetItemHolder.

void IlvOptionMenu::setSelected ( IlShort  index,
IlBoolean  redraw = IlFalse 
)

Sets the selected item of the option menu.

Parameters:
index The index of the selected item.
redraw A Boolean value specifying whether the object should be redrawn.
See also:
whichSelected, getLabel
IlShort IlvOptionMenu::whichSelected (  )  const

Returns the index of the selected item.

Returns:
The index of the selected item. The first item has an index of 0. If no item is selected, it returns -1.
See also:
setSelected, getLabel
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

© 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.