Homepage Demos Overview Downloads Tutorials 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)
 Called when the control is activated (or the control system is reactivating).
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
std::string getRoot () const
 returns root
void setPath (const std::string &path)
 sets paths
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

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*


Constructor & Destructor Documentation

FileBrowserControl::FileBrowserControl  )  [inline]
 

Definition at line 15 of file FileBrowserControl.h.

FileBrowserControl::FileBrowserControl const std::string &  nm,
const std::string &  desc,
const std::string &  path
[inline]
 

constructor pass name and root path

Definition at line 17 of file FileBrowserControl.h.


Member Function Documentation

ControlBase * FileBrowserControl::activate MotionManager::MC_ID  display,
Socket gui
[virtual]
 

Called when the control is activated (or the control system is reactivating).

Takes the id number of a LedMC which the control should use, maintained by Controller. Controls share the display which is passed, and may use the socket gui to communicate with the GUI controller, if it is connected.

Returns:
a ControlBase pointer. Return:
  • this if the control should stay active (if it's not a one-shot command)
  • NULL to return to parent
  • other address to spawn a child control

Reimplemented from ControlBase.

Definition at line 7 of file FileBrowserControl.cc.

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 12 of file FileBrowserControl.cc.

bool FileBrowserControl::getRecurse  )  const [inline]
 

returns recurse

Definition at line 28 of file FileBrowserControl.h.

std::string FileBrowserControl::getRoot  )  const [inline]
 

returns root

Definition at line 31 of file FileBrowserControl.h.

void FileBrowserControl::init std::string  path  )  [inline, protected]
 

sets a junk menu item to mark this as having submenus, and sets root to path

Definition at line 57 of file FileBrowserControl.h.

Referenced by FileBrowserControl().

std::string FileBrowserControl::makePath const std::string &  filename  )  [protected]
 

returns the path from root as a string, appends filename

Definition at line 72 of file FileBrowserControl.cc.

std::string FileBrowserControl::makePath  )  [protected]
 

returns the path from root as a string, with no trailing '/'

Definition at line 62 of file FileBrowserControl.cc.

Referenced by doSelect(), makePath(), and rebuildmenu().

bool FileBrowserControl::match const std::string &  file,
const std::string &  filt
[static, protected]
 

returns true if file matches filt

Definition at line 79 of file FileBrowserControl.cc.

Referenced by rebuildmenu().

void FileBrowserControl::rebuildmenu  )  [protected]
 

rescans current directory and builds menus

Definition at line 104 of file FileBrowserControl.cc.

Referenced by activate(), doSelect(), and takeInput().

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 DumpFileControl, FileInputControl, LoadCalibration, LoadPostureControl, LoadWalkControl, PlaySoundControl, and RunSequenceControl< SequenceSize >.

Definition at line 42 of file FileBrowserControl.h.

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

void FileBrowserControl::setFilter const std::string &  filt  )  [inline]
 

sets filter; remember can only use one wildcard, e.g. *.ext or filename.ext or filename*

Definition at line 35 of file FileBrowserControl.h.

Referenced by LoadCalibration::LoadCalibration(), LoadPostureControl::LoadPostureControl(), LoadWalkControl::LoadWalkControl(), PlaySoundControl::PlaySoundControl(), PostureEditor::PostureEditor(), RunSequenceControl< SequenceSize >::RunSequenceControl(), and WaypointWalkControl::WaypointWalkControl().

void FileBrowserControl::setPath const std::string &  path  ) 
 

sets paths

Definition at line 53 of file FileBrowserControl.cc.

void FileBrowserControl::setRecurse bool  r  )  [inline]
 

sets recurse

Definition at line 27 of file FileBrowserControl.h.

void FileBrowserControl::setRoot const std::string &  path  ) 
 

sets root

Definition at line 45 of file FileBrowserControl.cc.

Referenced by init().

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 39 of file FileBrowserControl.cc.


Member Data Documentation

std::string FileBrowserControl::filter [protected]
 

default "*", only display matching files; only can use one wildcard, e.g. *.ext or filename.ext or filename*

Definition at line 63 of file FileBrowserControl.h.

Referenced by FileBrowserControl(), rebuildmenu(), and setFilter().

std::vector<std::string> FileBrowserControl::paths [protected]
 

list of directories from root

Definition at line 61 of file FileBrowserControl.h.

Referenced by doSelect(), FileBrowserControl(), makePath(), rebuildmenu(), setPath(), and setRoot().

bool FileBrowserControl::recurse [protected]
 

if true (default), will show directories; if false, subdirectories are hidden

Definition at line 59 of file FileBrowserControl.h.

Referenced by FileBrowserControl(), and setRecurse().

std::string FileBrowserControl::root [protected]
 

the path to browse, default "/"

Definition at line 60 of file FileBrowserControl.h.

Referenced by FileBrowserControl(), and setRoot().


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

Tekkotsu v2.2.1
Generated Tue Nov 23 16:37:46 2004 by Doxygen 1.3.9.1