Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

FileBrowserControl Class Reference

#include <FileBrowserControl.h>

Inheritance diagram for FileBrowserControl:

Inheritance graph
[legend]
List of all members.

Detailed Description

Displays the contents of a directory in a control menu, probably useful as a baseclass for other controls.

Causes the selectedFile() function to be called on the root FileBrowserControl with the selected file

Definition at line 11 of file FileBrowserControl.h.

Public Member Functions

Constructors/Destructors
constructor

 FileBrowserControl ()
 FileBrowserControl (const std::string &nm, const std::string &desc, const std::string &path)
 constructor pass name and root path
ControlBase Inheritance
virtual ControlBaseactivate (MotionManager::MC_ID display, Socket *gui)
virtual ControlBasedoSelect ()
 when the user has trigger an "open selection" - default is to return the hilighted control*/
virtual ControlBasetakeInput (const std::string &msg)
 called when the user has supplied a text string (may or may not have been prompted by doReadStdIn()! May not even be active yet - the user can direct the same input to a set of hilighted menus)
Accessors
void setRecurse (bool r)
 sets recurse
bool getRecurse () const
 returns recurse
void setRoot (const std::string &path)
 sets root, clears paths
std::string getRoot () const
 returns root
void appendPath (const std::string &path)
 adds entries to paths (location relative to root)
void setFilter (const std::string &filt)
 sets filter; remember can only use one wildcard, e.g. *.ext or filename.ext or filename*

Protected Member Functions

virtual ControlBaseselectedFile (const std::string &)
 the big money function - by default calls the parent if it exists, otherwise nothing
std::string makePath ()
 returns the path from root as a string, with no trailing '/'
std::string makePath (const std::string &filename)
 returns the path from root as a string, appends filename
void rebuildmenu ()
 rescans current directory and builds menus
void init (std::string path)
 sets a junk menu item to mark this as having submenus, and sets root to path

Static Protected Member Functions

static bool match (const std::string &file, const std::string &filt)
 returns true if file matches filt

Protected Attributes

bool recurse
 if true (default), will show directories; if false, subdirectories are hidden
std::string root
 the path to browse, default "/"
std::vector< std::string > paths
 list of directories from root
std::string filter
 default "*", only display matching files; only can use one wildcard, e.g. *.ext or filename.ext or filename*


Member Function Documentation

ControlBase * FileBrowserControl::doSelect (  )  [virtual]

when the user has trigger an "open selection" - default is to return the hilighted control*/

The value which is returned is then activate()ed and pushed on the Controller's stack

Reimplemented from ControlBase.

Definition at line 16 of file FileBrowserControl.cc.

virtual ControlBase* FileBrowserControl::selectedFile ( const std::string &   )  [inline, protected, virtual]

the big money function - by default calls the parent if it exists, otherwise nothing

returning NULL means deactivate, this (default) to stay put, or a different Control if you want a submenu

Reimplemented in ConfigurationEditor::LoadSettings, ConfigurationEditor::SaveSettings, DumpFileControl, FileInputControl, LoadCalibration, LoadPostureControl, LoadWalkControl, PlaySoundControl, and RunSequenceControl< SequenceSize >.

Definition at line 42 of file FileBrowserControl.h.

Referenced by doSelect(), and LoadCalibration::selectedFile().

ControlBase * FileBrowserControl::takeInput ( const std::string &  msg  )  [virtual]

called when the user has supplied a text string (may or may not have been prompted by doReadStdIn()! May not even be active yet - the user can direct the same input to a set of hilighted menus)

The value which is returned is then activate()ed and pushed on the Controller's stack

Reimplemented from ControlBase.

Definition at line 43 of file FileBrowserControl.cc.

Referenced by TorqueCalibrate::init().


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

Tekkotsu v3.0
Generated Fri May 11 20:08:09 2007 by Doxygen 1.4.7