- Main Page
- Classes
- Files
- Directories
- Related Pages

- Class List
- Class Hierarchy
- Class Members

# KrListBox Class Reference

A very simple listbox. More...

`#include <listbox.h>`

Inheritance diagram for KrListBox:

List of all members.

## Public Member Functions
| KrListBox (int width, int height, const KrScheme &scheme, bool drawBorder)
| Constructs a list box.
int | NumItems ()
| Return the number of items in the list box.
int | SelectedItem ()
| Return the index of the selected item.
std::string | SelectedItemText ()
| Return the text of the selected item.
int | AddTextChar (const std::string &text)
| Add an item. Returns the index of the item.
void | GetTextChar (int index, std::string *text)
| Query an item and write it to the "text" string.
void | MoveSelection (int delta)
| Move the selection, positive or negative, scrolling if necessary.
void | MoveUpOne ()
| Move the selection up one.
void | MoveDownOne ()
| Move the selection down one.
virtual bool | HandleWidgetEvent (KrWidget *source, const KrWidgetEvent &event)
| Handle widget events, return true if handled, false if not ours.

## Detailed Description

A very simple listbox.

Items can be added, but not removed. It can be scrolled, but through the method MoveSelection. Normally, you set up button to accomplish this. (The guitest demonstrates this.)

Events Sent

- SELECTION when an item in the listbox is selected.

## Constructor & Destructor Documentation

KrListBox::KrListBox | ( | int | width,
|  | int | height,
|  | const KrScheme & | scheme,
|  | bool | drawBorder |
| ) |  |  |

Constructs a list box.

Parameters:

  | width | Width in pixels of the list box.
  | height | Height in pixels of the list box.
  | scheme | The color palette and font to use to render the list box.
  | drawBorder | Whether or not a bevel should be drawn around the list box.

The documentation for this class was generated from the following file:

- listbox.h