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

#include <libwoopsi/include/filelistbox.h>

Inheritance diagram for WoopsiUI::FileListBox:
WoopsiUI::Gadget WoopsiUI::GadgetEventHandler

List of all members.

Public Member Functions

 FileListBox (s16 x, s16 y, u16 width, u16 height, 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 FileListBoxDataItemgetSelectedOption () const
virtual void setAllowMultipleSelections (const bool allowMultipleSelections)
virtual const FileListBoxDataItemgetOption (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 FilePathgetPath () 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,
GadgetStyle style = NULL 
)

Constructor.

Parameters:
xThe x co-ordinate of the listbox.
yThe y co-ordinate of the listbox.
widthThe width of the listbox.
heightThe height of the listbox.
styleOptional 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:
textText to show in the option.
valueThe 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:
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.
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:
portThe 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:
eEvent arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

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

Handles events raised by its sub-gadgets.

Parameters:
eEvent arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

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

Resize the textbox to the new dimensions.

Parameters:
widthThe new width.
heightThe 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:
indexThe 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:
allowMultipleSelectionsTrue to allow multiple selections.
virtual void WoopsiUI::FileListBox::setPath ( const WoopsiString path) [virtual]

Set the displayed path.

Parameters:
pathThe new path.
virtual void WoopsiUI::FileListBox::sort ( ) [inline, virtual]

Sort the options alphabetically by the text of the options.


Member Data Documentation

Pointer to the list box

Path currently displayed


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