Woopsi 1.3
Nintendo DS Gui Framework
Public Member Functions | Protected Member Functions | Protected Attributes
WoopsiUI::ScrollingListBox Class Reference

#include <libwoopsi/include/scrollinglistbox.h>

Inheritance diagram for WoopsiUI::ScrollingListBox:
WoopsiUI::ListBoxBase WoopsiUI::Gadget WoopsiUI::GadgetEventHandler

List of all members.

Public Member Functions

 ScrollingListBox (s16 x, s16 y, u16 width, u16 height, GadgetStyle *style=NULL)
virtual void addOption (const WoopsiString &text, const u32 value)
virtual void addOption (ListBoxDataItem *option)
virtual void addOption (const WoopsiString &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 const s32 getSelectedIndex () const
virtual void setSelectedIndex (const s32 index)
virtual const ListBoxDataItemgetSelectedOption () const
virtual void setAllowMultipleSelections (const bool allowMultipleSelections)
virtual const bool allowsMultipleSelections () const
virtual void resizeCanvas ()
virtual const ListBoxDataItemgetOption (const s32 index)
virtual const ListBoxDataItemgetOption (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 handleActionEvent (const GadgetEventArgs &e)
virtual void handleScrollEvent (const GadgetEventArgs &e)
virtual void handleClickEvent (const GadgetEventArgs &e)
virtual void handleDoubleClickEvent (const GadgetEventArgs &e)
virtual void handleReleaseEvent (const GadgetEventArgs &e)
virtual void handleReleaseOutsideEvent (const GadgetEventArgs &e)
virtual void setFont (FontBase *font)
virtual void setSortInsertedItems (const bool sortInsertedItems)
virtual void getPreferredDimensions (Rect &rect) const

Protected Member Functions

void updateScrollbar ()
virtual void drawContents (GraphicsPort *port)
virtual void onResize (u16 width, u16 height)
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

WoopsiUI::ScrollingListBox::ScrollingListBox ( s16  x,
s16  y,
u16  width,
u16  height,
GadgetStyle style = NULL 
)

Constructor.

Parameters:
xThe x co-ordinate of the gadget.
yThe y co-ordinate of the gadget.
widthThe width of the gadget.
heightThe height of the gadget.
styleThe style that the gadget should use. If this is not specified, the gadget will use the values stored in the global defaultGadgetStyle object. The gadget will copy the properties of the style into its own internal style object.
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

virtual void WoopsiUI::ScrollingListBox::addOption ( const WoopsiString text,
const u32  value 
) [virtual]

Add a new option to the gadget using default colours.

Parameters:
textText to show in the option.
valueThe value of the option.

Implements WoopsiUI::ListBoxBase.

virtual void WoopsiUI::ScrollingListBox::addOption ( ListBoxDataItem option) [virtual]

Add an option to the gadget.

Parameters:
optionThe option to add.

Implements WoopsiUI::ListBoxBase.

virtual void WoopsiUI::ScrollingListBox::addOption ( const WoopsiString text,
const u32  value,
const u16  normalTextColour,
const u16  normalBackColour,
const u16  selectedTextColour,
const u16  selectedBackColour 
) [virtual]

Add a new option to the gadget.

Parameters:
textText to show in the option.
valueThe value of the option.
normalTextColourColour to draw the text with when not selected.
normalBackColourColour to draw the background with when not selected.
selectedTextColourColour to draw the text with when selected.
selectedBackColourColour to draw the background with when selected.

Implements WoopsiUI::ListBoxBase.

virtual const bool WoopsiUI::ScrollingListBox::allowsMultipleSelections ( ) const [inline, virtual]

Sets whether multiple selections are possible or not.

Returns:
True if multiple selections are allowed.

Implements WoopsiUI::ListBoxBase.

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

Deselect all options. Raises a value changed event.

Implements WoopsiUI::ListBoxBase.

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

Select an option by its index. Does not deselect any other selected options. Raises a value changed event.

Parameters:
indexThe index of the option to select.

Implements WoopsiUI::ListBoxBase.

virtual void WoopsiUI::ScrollingListBox::drawContents ( GraphicsPort port) [protected, virtual]

Draw the area of this gadget that falls within the clipping region. Called by the redraw() function to draw all visible regions.

Parameters:
portThe GraphicsPort to draw to.
See also:
redraw()

Reimplemented from WoopsiUI::Gadget.

virtual const ListBoxDataItem* WoopsiUI::ScrollingListBox::getOption ( const s32  index) [inline, virtual]

Get the specified option.

Returns:
The specified option.

Implements WoopsiUI::ListBoxBase.

virtual const ListBoxDataItem* 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.

Implements WoopsiUI::ListBoxBase.

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

Get the height of a single option.

Returns:
The height of an option.

Implements WoopsiUI::ListBoxBase.

virtual void WoopsiUI::ScrollingListBox::getPreferredDimensions ( Rect rect) const [virtual]

Insert the dimensions that this gadget wants to have into the rect passed in as a parameter. All co-ordinates are relative to the gadget's parent. Value is based on the length of the largest string in the set of options.

Parameters:
rectReference to a rect to populate with data.

Reimplemented from WoopsiUI::Gadget.

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.

Implements WoopsiUI::ListBoxBase.

virtual const ListBoxDataItem* WoopsiUI::ScrollingListBox::getSelectedOption ( ) const [inline, virtual]

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

Returns:
The selected option.

Implements WoopsiUI::ListBoxBase.

virtual void WoopsiUI::ScrollingListBox::handleActionEvent ( const GadgetEventArgs e) [virtual]

Handle a gadget action event.

Parameters:
eThe event data.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ScrollingListBox::handleClickEvent ( const GadgetEventArgs e) [virtual]

Handle a stylus click event.

Parameters:
eThe event data.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ScrollingListBox::handleDoubleClickEvent ( const GadgetEventArgs e) [virtual]

Handles events raised by its sub-gadgets.

Parameters:
eEvent arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ScrollingListBox::handleReleaseEvent ( const GadgetEventArgs e) [virtual]

Handle a stylus release event that occurred within the bounds of the source gadget.

Parameters:
eThe event data.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ScrollingListBox::handleReleaseOutsideEvent ( const GadgetEventArgs e) [virtual]

Handle a stylus release event that occurred outside the bounds of the source gadget.

Parameters:
eThe event data.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ScrollingListBox::handleScrollEvent ( const GadgetEventArgs e) [virtual]

Handles events raised by its sub-gadgets.

Parameters:
eEvent arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ScrollingListBox::handleValueChangeEvent ( const GadgetEventArgs e) [virtual]

Handles events raised by its sub-gadgets.

Parameters:
eEvent arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::ScrollingListBox::onResize ( u16  width,
u16  height 
) [protected, virtual]

Resize the listbox to the new dimensions.

Parameters:
widthThe new width.
heightThe new height.

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::ScrollingListBox::removeAllOptions ( ) [virtual]

Remove all options from the gadget.

Implements WoopsiUI::ListBoxBase.

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

Remove an option from the gadget by its index.

Parameters:
indexThe index of the option to remove.

Implements WoopsiUI::ListBoxBase.

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

Resize the scrolling canvas to encompass all options.

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

Select all options. Does nothing if the listbox does not allow multiple selections. Raises a value changed event.

Implements WoopsiUI::ListBoxBase.

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

Select an option by its index. Does not deselect any other selected options. Raises a value changed event.

Parameters:
indexThe index of the option to select.

Implements WoopsiUI::ListBoxBase.

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

Sets whether multiple selections are possible or not.

Parameters:
allowMultipleSelectionsTrue to allow multiple selections.

Implements WoopsiUI::ListBoxBase.

virtual void WoopsiUI::ScrollingListBox::setFont ( FontBase font) [virtual]

Set the font used in the textbox.

Parameters:
fontPointer to the new font.

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. Raises a value changed event.

Parameters:
indexThe selected index.

Implements WoopsiUI::ListBoxBase.

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:
sortInsertedItemsTrue to enable sort on insertion.

Implements WoopsiUI::ListBoxBase.

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

Sort the options alphabetically by the text of the options.

Implements WoopsiUI::ListBoxBase.

void WoopsiUI::ScrollingListBox::updateScrollbar ( ) [protected]

Updates all scrollbar properties; called when listbox changes.


Member Data Documentation

Pointer to the list box.

Pointer to the scrollbar.

Width of the scrollbar.


The documentation for this class was generated from the following file:
 All Classes Functions Variables Enumerations Enumerator