# WoopsiUI::ScrollingListBox Class Reference

`#include <scrollinglistbox.h>`

Inheritance diagram for WoopsiUI::ScrollingListBox:

List of all members.

## Public Member Functions
| ScrollingListBox (s16 x, s16 y, u16 width, u16 height, FontBase *font=NULL)
virtual void | addOption (const char *text, const u32 value)
virtual void | addOption (const char *text, const u32 value, const u16 normalTextColour, const u16 normalBackColour, const u16 selectedTextColour, const u16 selectedBackColour)
virtual void | removeOption (const s32 index)
virtual void | removeAllOptions ()
virtual void | selectOption (const s32 index)
virtual void | deselectOption (const s32 index)
virtual void | selectAllOptions ()
virtual void | deselectAllOptions ()
virtual void | draw (Rect clipRect)
virtual const s32 | getSelectedIndex () const
virtual void | setSelectedIndex (const s32 index)
virtual const ListData::ListDataItem * | getSelectedOption () const
virtual void | setAllowMultipleSelections (const bool allowMultipleSelections)
virtual void | resizeCanvas ()
virtual const ListData::ListDataItem * | getOption (const s32 index) const
virtual void | sort ()
virtual const s32 | getOptionCount () const
virtual const u16 | getOptionHeight () const
virtual void | handleValueChangeEvent (const GadgetEventArgs &e)
virtual void | handleScrollEvent (const GadgetEventArgs &e)
virtual void | handleDoubleClickEvent (const GadgetEventArgs &e)
virtual bool | resize (u16 width, u16 height)
virtual void | setFont (FontBase *font)
void | setOutlineType (const OutlineType outline)
virtual void | setSortInsertedItems (const bool sortInsertedItems)
## Protected Member Functions
virtual | ~ScrollingListBox ()
| ScrollingListBox (const ScrollingListBox &scrollingListBox)
## Protected Attributes
ListBox * | _listbox
ScrollbarVertical * | _scrollbar
u8 | _scrollbarWidth

## Detailed Description

Gadget containing a ListBox and a vertical scrollbar. Exposed methods are more or less identical to the methods exposed by the ListBox to ensure that the two are interchangeable.

## Constructor & Destructor Documentation

ScrollingListBox::ScrollingListBox | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | FontBase * | font = `NULL` |
| ) |  |  |

Constructor.

Parameters:

  | x | The x co-ordinate of the gadget.
  | y | The y co-ordinate of the gadget.
  | width | The width of the gadget.
  | height | The height of the gadget.
  | font | The font to use with the listbox.

virtual WoopsiUI::ScrollingListBox::~ScrollingListBox | ( |  | ) | `[inline, protected, virtual]`

Destructor.

WoopsiUI::ScrollingListBox::ScrollingListBox | ( | const ScrollingListBox & | scrollingListBox | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

void ScrollingListBox::addOption | ( | const char * | text,
|  | const u32 | value,
|  | const u16 | normalTextColour,
|  | const u16 | normalBackColour,
|  | const u16 | selectedTextColour,
|  | const u16 | selectedBackColour |
| ) |  |  | `[virtual]`

Add a new option to the gadget. Does not redraw the gadget.

Parameters:

  | text | Text to show in the option.
  | value | The value of the option.
  | normalTextColour | Colour to draw the text with when not selected.
  | normalBackColour | Colour to draw the background with when not selected.
  | selectedTextColour | Colour to draw the text with when selected.
  | selectedBackColour | Colour to draw the background with when selected.

void ScrollingListBox::addOption | ( | const char * | text,
|  | const u32 | value |
| ) |  |  | `[virtual]`

Add a new option to the gadget using default colours. Does not redraw the gadget.

Parameters:

  | text | Text to show in the option.
  | value | The value of the option.

virtual void WoopsiUI::ScrollingListBox::deselectAllOptions | ( |  | ) | `[inline, virtual]`

Deselect all options. Redraws the gadget and raises a value changed event.

virtual void WoopsiUI::ScrollingListBox::deselectOption | ( | const s32 | index | ) | `[inline, virtual]`

Select an option by its index. Does not deselect any other selected options. Redraws the gadget and raises a value changed event.

Parameters:

  | index | The index of the option to select.

void ScrollingListBox::draw | ( | Rect | clipRect | ) | `[virtual]`

Draw the region of the menu within the clipping rect.

Parameters:

  | clipRect | The clipping rect to limit drawing to.

Reimplemented from WoopsiUI::Gadget.

virtual const ListData::ListDataItem* WoopsiUI::ScrollingListBox::getOption | ( | const s32 | index | ) | const`[inline, virtual]`

Get the selected index. Returns -1 if nothing is selected.

Returns:
  The selected index.

virtual const s32 WoopsiUI::ScrollingListBox::getOptionCount | ( |  | ) | const`[inline, virtual]`

Get the total number of options.

Returns:
  The number of options.

virtual const u16 WoopsiUI::ScrollingListBox::getOptionHeight | ( |  | ) | const`[inline, virtual]`

Get the height of a single option.

Returns:
  The height of an option.

virtual const s32 WoopsiUI::ScrollingListBox::getSelectedIndex | ( |  | ) | const`[inline, virtual]`

Get the selected index. Returns -1 if nothing is selected. If more than one option is selected, the index of the first selected option is returned.

Returns:
  The selected index.

virtual const ListData::ListDataItem* WoopsiUI::ScrollingListBox::getSelectedOption | ( |  | ) | const`[inline, virtual]`

Get the selected option. Returns NULL if nothing is selected.

Returns:
  The selected option.

void ScrollingListBox::handleDoubleClickEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  | e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

void ScrollingListBox::handleScrollEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  | e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

void ScrollingListBox::handleValueChangeEvent | ( | const GadgetEventArgs & | e | ) | `[virtual]`

Handles events raised by its sub-gadgets.

Parameters:

  | e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

void ScrollingListBox::removeAllOptions | ( |  | ) | `[virtual]`

Remove all options from the gadget. Does not redraw the gadget.

void ScrollingListBox::removeOption | ( | const s32 | index | ) | `[virtual]`

Remove an option from the gadget by its index. Does not redraw the gadget.

Parameters:

  | index | The index of the option to remove.

bool ScrollingListBox::resize | ( | u16 | width,
|  | u16 | height |
| ) |  |  | `[virtual]`

Resize the textbox to the new dimensions.

Parameters:

  | width | The new width.
  | height | The new height.

Returns:
  True if the resize was successful.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::ScrollingListBox::resizeCanvas | ( |  | ) | `[inline, virtual]`

Resize the scrolling canvas to encompass all options. Does not redraw the gadget.

virtual void WoopsiUI::ScrollingListBox::selectAllOptions | ( |  | ) | `[inline, virtual]`

Select all options. Does nothing if the listbox does not allow multiple selections. Redraws the gadget and raises a value changed event.

virtual void WoopsiUI::ScrollingListBox::selectOption | ( | const s32 | index | ) | `[inline, virtual]`

Select an option by its index. Does not deselect any other selected options. Redraws the gadget and raises a value changed event.

Parameters:

  | index | The index of the option to select.

virtual void WoopsiUI::ScrollingListBox::setAllowMultipleSelections | ( | const bool | allowMultipleSelections | ) | `[inline, virtual]`

Sets whether multiple selections are possible or not. Does not redraw the gadget.

Parameters:

  | allowMultipleSelections | True to allow multiple selections.

void ScrollingListBox::setFont | ( | FontBase * | font | ) | `[virtual]`

Set the font used in the textbox.

Parameters:

  | font | Pointer to the new font.

Reimplemented from WoopsiUI::Gadget.

void WoopsiUI::ScrollingListBox::setOutlineType | ( | const OutlineType | outline | ) | `[inline]`

Sets the outline type of the list box.

Parameters:

  | outline | The outline type.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::ScrollingListBox::setSelectedIndex | ( | const s32 | index | ) | `[inline, virtual]`

Sets the selected index. Specify -1 to select nothing. Resets any other selected items to deselected. Redraws the gadget and raises a value changed event.

Parameters:

  | index | The selected index.

virtual void WoopsiUI::ScrollingListBox::setSortInsertedItems | ( | const bool | sortInsertedItems | ) | `[inline, virtual]`

Sets whether or not items added to the list are automatically sorted on insert or not.

Parameters:

  | sortInsertedItems | True to enable sort on insertion.

virtual void WoopsiUI::ScrollingListBox::sort | ( |  | ) | `[inline, virtual]`

Sort the options alphabetically by the text of the options.

## Member Data Documentation

ListBox* WoopsiUI::ScrollingListBox::_listbox`[protected]`

Pointer to the list box

ScrollbarVertical* WoopsiUI::ScrollingListBox::_scrollbar`[protected]`

Pointer to the scrollbar

u8 WoopsiUI::ScrollingListBox::_scrollbarWidth`[protected]`

Width of the scrollbar

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

- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/scrollinglistbox.h
- C:/Documents and Settings/Administrator/Desktop/woopsi-src-0.39/Woopsi/woopsi/scrollinglistbox.cpp

All Classes Functions Variables Enumerations Enumerator