Homepage Demos Overview Downloads Tutorials Reference
Credits

StringInputControl.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_StringInputControl_h_
00003 #define INCLUDED_StringInputControl_h_
00004 
00005 #include "ControlBase.h"
00006 #include "Motion/PostureEngine.h"
00007 #include <string>
00008 
00009 //! Upon activation, prompts the user for a string and stores it
00010 class StringInputControl : public ControlBase {
00011 public:
00012   //! Constructor
00013   StringInputControl(const std::string& n, const std::string& prompt) : ControlBase(n,prompt), lastInput(), userPrompt(prompt) {}
00014   //! Constructor
00015   StringInputControl(const std::string& n, const std::string& desc, const std::string& prompt) : ControlBase(n,desc), lastInput(), userPrompt(prompt) {}
00016 
00017   //  virtual ControlBase* activate(MotionManager::MC_ID disp_id, Socket* gui);
00018   
00019   virtual void refresh();
00020   
00021   virtual ControlBase* doReadStdIn(const std::string& prompt/*=std::string()*/);
00022   
00023   virtual ControlBase * takeInput(const std::string& msg) {
00024     lastInput=msg;
00025     return NULL;
00026   } 
00027   
00028   //! returns last call to takeInput()
00029   virtual std::string getLastInput() { return lastInput; }
00030 
00031   //! sets the prompt to give to the user
00032   virtual void setPrompt(const std::string& prompt) { userPrompt=prompt; }
00033 
00034 protected:
00035   std::string lastInput;  //!< stores the last input to takeInput()
00036   std::string userPrompt; //!< stores the prompt to send out
00037 };
00038 
00039 /*! @file
00040  * @brief Defines StringInputControl, which prompts for and stores a string from the user
00041  * @author ejt (Creator)
00042  *
00043  * $Author: ejt $
00044  * $Name: tekkotsu-2_0 $
00045  * $Revision: 1.4 $
00046  * $State: Rel $
00047  * $Date: 2003/09/25 15:26:11 $
00048  */
00049 
00050 #endif

Tekkotsu v2.0
Generated Wed Jan 21 03:20:30 2004 by Doxygen 1.3.4