rwlogo
Rogue Wave Views 5.6

Rogue Wave Views
Gadgets Package API Reference Guide

Product Documentation:

Rogue Wave Views
Documentation Home

IlvComboBox Class Reference

Gadget class. More...

#include <ilviews/gadgets/combo.h>

Inheritance diagram for IlvComboBox:
IlvTextField IlvListGadgetItemHolder IlvGadget IlvGadgetItemHolder IlvSimpleGraphic IlvGraphic IlvScrolledComboBox

List of all members.

Public Member Functions

 IlvComboBox (IlvDisplay *display, const IlvRect &rect, const char *label, const char *const *labels=0, IlUShort count=0, IlUShort thickness=IlvDefaultGadgetThickness, IlvPalette *palette=0)
 Constructor.
 IlvComboBox (IlvDisplay *display, const IlvPoint &point, const char *label, 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 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 by the text field.
virtual IlvPalettegetNormalTextPalette () const
 Returns the default palette used to draw an item.
virtual IlvPalettegetOpaquePalette () const
 Returns the opaque palette used to draw opaque items.
const char * getSelection () const
 Returns the string displayed in the combo box.
IlvPopupMenugetSubMenu () const
 Returns a pointer to the pop-up menu attached to the combo box.
IlBoolean isEditable () const
 Indicates whether the text field can be edited.
virtual IlBoolean isListVisible () const
 Indicates whether the list of items of the combo box is visible.
void itemsBBox (IlvRect &labelRect, IlvRect &arrowRect, const IlvTransformer *t=0) const
 The bounding boxes of the main two components of the combo box.
virtual void labelChanged ()
 Is called by the interactor whenever the label of the text field changes.
virtual void setItems (IlvGadgetItem *const *items, IlUShort count)
 Replaces the entire list of items.
virtual void setLabel (const char *, IlBoolean redraw=IlFalse)
 Sets the label of the text field.
void setSelected (IlUShort i, IlBoolean redraw=IlTrue)
 Sets the selected item in the combo box.
IlShort whichSelected () const
 Returns the index of the selected item.

Static Public Member Functions

static IlSymbolOpenListSymbol ()
 Returns the symbol of the Open List callback.

Friends

class IlvComboBoxWLFHandler
class IlvDefaultComboBoxLFHandler

Detailed Description

Gadget class.

Library: ilvgadgt

The IlvComboBox class combines a text field (IlvTextField class) with a pop-up menu displaying a set of predefined entries from which the user can choose.

IlvComboBoxa.gif

- A Combo Box -

The user can enter a character string in the text field, or click on the arrow appearing on the right side of the field and select one of the choices from the menu that is displayed. You can access the pop-up menu attached to the combo box to modify its behavior.

See also:
IlvScrolledComboBox, IlvOptionMenu.

Constructor & Destructor Documentation

IlvComboBox::IlvComboBox ( IlvDisplay display,
const IlvPoint point,
const char *  label,
const char *const *  labels = 0,
IlUShort  count = 0,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

Initializes a new instance of the IlvComboBox class. The size of the combo box is computed from the label parameter. If you want to specify the size, use the other constructor.

Parameters:
display The connection to the display.
point The position of the combo box.
label The label of the combo box.
labels An array containing the predefined labels of the combo box.
count The number of elements in the labels array.
thickness The thickness of the combo box.
palette The palette used by the combo box.
IlvComboBox::IlvComboBox ( IlvDisplay display,
const IlvRect rect,
const char *  label,
const char *const *  labels = 0,
IlUShort  count = 0,
IlUShort  thickness = IlvDefaultGadgetThickness,
IlvPalette palette = 0 
)

Constructor.

n Initializes a new instance of the class IlvComboBox.

Parameters:
display The connection to the display.
rect The size and position of the combo box.
label The label of the combo box.
labels An array containing the predefined labels of the combo box.
count The number of elements in the labels array.
thickness The thickness of the combo box.
palette The palette used by the combo box.

Member Function Documentation

virtual IlvGadgetItem* IlvComboBox::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 IlvComboBox::empty (  )  [virtual]

Empties the list.

See also:
setItems, removeItem

Implements IlvListGadgetItemHolder.

const char* IlvComboBox::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* IlvComboBox::getLabel (  )  const

Returns the label displayed by the text field.

Returns:
The label displayed by the text field.
See also:
setLabel, setValue(IlInt, IlBoolean), setValue(IlFloat, const char*, IlBoolean)

Reimplemented from IlvTextField.

virtual IlvPalette* IlvComboBox::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* IlvComboBox::getOpaquePalette (  )  const [virtual]

Returns the opaque palette used to draw opaque items.

Returns:
The opaque palette used to draw opaque items.

Reimplemented from IlvGadgetItemHolder.

const char* IlvComboBox::getSelection (  )  const [virtual]

Returns the string displayed in the combo box.

Returns:
The string displayed in the combo box.

Reimplemented from IlvListGadgetItemHolder.

IlvPopupMenu* IlvComboBox::getSubMenu (  )  const

Returns a pointer to the pop-up menu attached to the combo box.

Returns:
A pointer to the pop-up menu attached to the combo box.
Warning:
[note] The IlvScrolledComboBox subclass has no associated submenu. Therefore, the IlvComboBox::getSubMenu member function always returns 0. To get the IlvStringList of an IlvScrolledComboBox object, use IlvScrolledComboBox::getStringList instead.
See also:
IlvScrolledComboBox::getStringList
IlBoolean IlvComboBox::isEditable (  )  const

Indicates whether the text field can be edited.

The contents of a noneditable text field can be copied and localized. See IlvTextField::getMessage.

Returns:
IlTrue if the text field can be edited and IlFalse otherwise.
See also:
setEditable, getMessage

Reimplemented from IlvTextField.

virtual IlBoolean IlvComboBox::isListVisible (  )  const [virtual]

Indicates whether the list of items of the combo box is visible.

Returns:
IlTrue if the list of items of the combo box is visible and IlFalse if it is not.
See also:
showList, hideList

Reimplemented in IlvScrolledComboBox.

void IlvComboBox::itemsBBox ( IlvRect labelRect,
IlvRect arrowRect,
const IlvTransformer t = 0 
) const

The bounding boxes of the main two components of the combo box.

Parameters:
labelRect The bounding box of the text field.
arrowRect The bounding box of the arrow.
t The transformer applied to the combo box.
See also:
virtual void IlvComboBox::labelChanged (  )  [virtual]

Is called by the interactor whenever the label of the text field changes.

The default implementation calls the Label Changed callback.

See also:
setChangeCallback

Reimplemented from IlvTextField.

static IlSymbol* IlvComboBox::OpenListSymbol (  )  [static]

Returns the symbol of the Open List callback.

The Open List callback is invoked when the user opens the combo box list.

Returns:
The symbol of the Open List callback.
See also:
IlvGraphic::setCallback
virtual void IlvComboBox::setItems ( IlvGadgetItem *const *  items,
IlUShort  count 
) [virtual]

Replaces the entire list of items.

Sets the items of the holder to items, which must be an array of count IlvGadgetItem objects. Items are not copied, but the deletion of the array items is the responsibility of the caller.

Parameters:
items The new items.
count The number of items in items.
See also:
getItems, insertItem, removeItem

Reimplemented from IlvListGadgetItemHolder.

virtual void IlvComboBox::setLabel ( const char *  label,
IlBoolean  redraw = IlFalse 
) [virtual]

Sets the label of the text field.

Parameters:
label The new label of the text field. The old label is deleted and the new one is copied.
redraw A Boolean value specifying whether the text field should be redrawn.
See also:
getLabel, getIntValue, getFloatValue

Reimplemented from IlvTextField.

void IlvComboBox::setSelected ( IlUShort  i,
IlBoolean  redraw = IlTrue 
)

Sets the selected item in the combo box.

Parameters:
index The index of the selected item.
redraw A Boolean value specifying whether the combo box should be redrawn.
See also:
whichSelected, getSelection
IlShort IlvComboBox::whichSelected (  )  const

Returns the index of the selected item.

Returns:
The index of the item in the combo box list that matches the combo box selection. If no match is found, it returns -1.
See also:
setSelected
 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.