Woopsi 1.0 GUI Framework for Nintendo DS Homebrew

- Main Page
- Classes
- Files

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions | Protected Attributes

# WoopsiUI::FileListBox Class Reference

`#include <filelistbox.h>`

Inheritance diagram for WoopsiUI::FileListBox:

List of all members.

## Public Member Functions
| FileListBox (s16 x, s16 y, u16 width, u16 height, u32 flags, GadgetStyle *style=NULL)
virtual void | handleDoubleClickEvent (const GadgetEventArgs &e)
virtual void | handleValueChangeEvent (const GadgetEventArgs &e)
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 const s32 | getSelectedIndex () const
virtual const FileListBoxDataItem * | getSelectedOption () const
virtual void | setAllowMultipleSelections (const bool allowMultipleSelections)
virtual const FileListBoxDataItem * | getOption (const s32 index) const
virtual void | sort ()
virtual const s32 | getOptionCount () const
virtual void | setPath (const WoopsiString &path)
virtual void | appendPath (const WoopsiString &path)
virtual const FilePath * | getPath () const
## Protected Member Functions
virtual void | drawContents (GraphicsPort *port)
virtual void | onResize (u16 width, u16 height)
virtual | ~FileListBox ()
virtual void | readDirectory ()
| FileListBox (const FileListBox &fileListBox)
## Protected Attributes
ScrollingListBox * | _listbox
FilePath * | _path

## Detailed Description

Class providing a listbox listing files. Designed to allow users to select a file from the filesytem. When a file is selected the requester will automatically close.

To read the value of the selected option or options, you should listen for the value changed event. This will fire when the user double-clicks an option or clicks the OK button.

When using this class, ensure you call "fatInitDefault();" somewhere in your setup code.

## Constructor & Destructor Documentation

WoopsiUI::FileListBox::FileListBox | ( | s16 | x,
|  | s16 | y,
|  | u16 | width,
|  | u16 | height,
|  | u32 | flags,
|  | GadgetStyle * | style = `NULL`
| ) |  |

Constructor.

Parameters:

  x | The x co-ordinate of the listbox.
  y | The y co-ordinate of the listbox.
  width | The width of the listbox.
  height | The height of the listbox.
  flags | Standard flags.
  style | Optional gadget style.

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

Destructor.

WoopsiUI::FileListBox::FileListBox | ( | const FileListBox & | fileListBox | ) | `[inline, protected]`

Copy constructor is protected to prevent usage.

## Member Function Documentation

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

Add a new option to the gadget using default colours.

Parameters:

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

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

Add a new option to 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.

virtual void WoopsiUI::FileListBox::appendPath | ( | const WoopsiString & | path | ) | `[virtual]`

Append a new path component to the current path. Automatically inserts trailing slash.

virtual void WoopsiUI::FileListBox::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:

  port | The GraphicsPort to draw to.

See also:
  redraw()

Reimplemented from WoopsiUI::Gadget.

virtual const FileListBoxDataItem* WoopsiUI::FileListBox::getOption | ( | const s32 | index | ) | const`[inline, virtual]`

Get the specified option.

Returns:
  The specified option.

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

Get the total number of options.

Returns:
  The number of options.

virtual const FilePath* WoopsiUI::FileListBox::getPath | ( |  | ) | const`[virtual]`

Get the current path.

virtual const s32 WoopsiUI::FileListBox::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 FileListBoxDataItem* WoopsiUI::FileListBox::getSelectedOption | ( |  | ) | const`[inline, virtual]`

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

Returns:
  The selected option.

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

Handles events raised by its sub-gadgets.

Parameters:

  e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

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

Handles events raised by its sub-gadgets.

Parameters:

  e | Event arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

virtual void WoopsiUI::FileListBox::onResize | ( | u16 | width,
|  | u16 | height
| ) |  | `[protected, virtual]`

Resize the textbox to the new dimensions.

Parameters:

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

Reimplemented from WoopsiUI::Gadget.

virtual void WoopsiUI::FileListBox::readDirectory | ( |  | ) | `[protected, virtual]`

Populate list with directory data.

virtual void WoopsiUI::FileListBox::removeAllOptions | ( |  | ) | `[inline, virtual]`

Remove all options from the gadget.

virtual void WoopsiUI::FileListBox::removeOption | ( | const s32 | index | ) | `[inline, virtual]`

Remove an option from the gadget by its index.

Parameters:

  index | The index of the option to remove.

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

Sets whether multiple selections are possible or not.

Parameters:

  allowMultipleSelections | True to allow multiple selections.

virtual void WoopsiUI::FileListBox::setPath | ( | const WoopsiString & | path | ) | `[virtual]`

Set the displayed path.

Parameters:

  path | The new path.

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

Sort the options alphabetically by the text of the options.

## Member Data Documentation

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

Pointer to the list box

FilePath* WoopsiUI::FileListBox::_path`[protected]`

Path currently displayed

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

- filelistbox.h