Homepage | Demos | Overview | Downloads | Dev. Resources | Reference | Credits |
StringInputControl.hGo 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 const std::string& getLastInput() { return lastInput; } 00030 00031 //! clears the last input (i.e. so you can easily tell later if new input is entered) 00032 virtual void clearLastInput() { takeInput(""); } 00033 00034 //! sets the prompt to give to the user 00035 virtual void setPrompt(const std::string& prompt) { userPrompt=prompt; } 00036 00037 protected: 00038 std::string lastInput; //!< stores the last input to takeInput() 00039 std::string userPrompt; //!< stores the prompt to send out 00040 }; 00041 00042 /*! @file 00043 * @brief Defines StringInputControl, which prompts for and stores a string from the user 00044 * @author ejt (Creator) 00045 * 00046 * $Author: ejt $ 00047 * $Name: tekkotsu-2_4_1 $ 00048 * $Revision: 1.5 $ 00049 * $State: Exp $ 00050 * $Date: 2004/03/23 00:55:01 $ 00051 */ 00052 00053 #endif |
Tekkotsu v2.4.1 |
Generated Tue Aug 16 16:32:49 2005 by Doxygen 1.4.4 |