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

#include <libwoopsi/include/filerequester.h>

Inheritance diagram for WoopsiUI::FileRequester:
WoopsiUI::AmigaWindow WoopsiUI::Window WoopsiUI::GadgetEventHandler WoopsiUI::Gadget

List of all members.

Public Member Functions

 FileRequester (s16 x, s16 y, u16 width, u16 height, const WoopsiString &title, const WoopsiString &path, GadgetStyle *style=NULL)
virtual void handleReleaseEvent (const GadgetEventArgs &e)
virtual void handleActionEvent (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 char *path)
virtual void appendPath (const char *path)
virtual const FilePathgetPath () const
virtual const WoopsiStringgetTextBoxFileName () const

Protected Member Functions

virtual void onResize (u16 width, u16 height)
virtual ~FileRequester ()
 FileRequester (const FileRequester &fileRequester)

Protected Attributes

Button_okButton
Button_cancelButton
FileListBox_listbox
TextBox_fileNameTextBox

Detailed Description

Class providing a window containing a file listbox, an OK button and a Cancel button.

Designed to allow users selection 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.

To add this class to a project:

Note that including libfat increases the ROM size by ~100K. Also note that in the SDL build of Woopsi, the FileRequester shows dummy folders and files. As file I/O is not standard in C, creating a working, cross-platform FileRequester for SDL is a more troublesome task than it really justifies. The dummy data allows for the SDL UI to be tested away from the DS, which is all it is really intended to do.


Constructor & Destructor Documentation

WoopsiUI::FileRequester::FileRequester ( s16  x,
s16  y,
u16  width,
u16  height,
const WoopsiString title,
const WoopsiString path,
GadgetStyle style = NULL 
)

Constructor.

Parameters:
xThe x co-ordinate of the window.
yThe y co-ordinate of the window.
widthThe width of the window.
heightThe height of the window.
titleThe title of the window.
pathThe initial path that the requester will show.
styleOptional gadget style.
virtual WoopsiUI::FileRequester::~FileRequester ( ) [inline, protected, virtual]

Destructor.

WoopsiUI::FileRequester::FileRequester ( const FileRequester fileRequester) [inline, protected]

Copy constructor is protected to prevent usage.


Member Function Documentation

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

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

Parameters:
textText to show in the option.
valueThe value of the option.
virtual void WoopsiUI::FileRequester::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. Does not redraw 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::FileRequester::appendPath ( const char *  path) [virtual]

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

virtual const FileListBoxDataItem* WoopsiUI::FileRequester::getOption ( const s32  index) const [inline, virtual]

Get the specified option.

Returns:
The specified option.
virtual const s32 WoopsiUI::FileRequester::getOptionCount ( ) const [inline, virtual]

Get the total number of options.

Returns:
The number of options.
virtual const FilePath* WoopsiUI::FileRequester::getPath ( ) const [virtual]

Get the current path.

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

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

Returns:
The selected option.
virtual const WoopsiString& WoopsiUI::FileRequester::getTextBoxFileName ( ) const [virtual]

Get the filename contained in the filename textbox.

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

Handles events raised by its sub-gadgets.

Parameters:
eEvent arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

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

Handles events raised by its sub-gadgets.

Parameters:
eEvent arguments.

Reimplemented from WoopsiUI::AmigaWindow.

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

Handles events raised by its sub-gadgets.

Parameters:
eEvent arguments.

Reimplemented from WoopsiUI::GadgetEventHandler.

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

Resize the textbox to the new dimensions.

Parameters:
widthThe new width.
heightThe new height.

Reimplemented from WoopsiUI::AmigaWindow.

virtual void WoopsiUI::FileRequester::removeAllOptions ( ) [inline, virtual]

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

virtual void WoopsiUI::FileRequester::removeOption ( const s32  index) [inline, virtual]

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

Parameters:
indexThe index of the option to remove.
virtual void WoopsiUI::FileRequester::setAllowMultipleSelections ( const bool  allowMultipleSelections) [inline, virtual]

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

Parameters:
allowMultipleSelectionsTrue to allow multiple selections.
virtual void WoopsiUI::FileRequester::setPath ( const char *  path) [virtual]

Set the displayed path.

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

Sort the options alphabetically by the text of the options.


Member Data Documentation

Pointer to the cancel button

Pointer to the file name textbox

Pointer to the list box

Pointer to the OK button


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