Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

FileInputControl.h

Go to the documentation of this file.
00001 //-*-c++-*-
00002 #ifndef INCLUDED_FileInputControl_h_
00003 #define INCLUDED_FileInputControl_h_
00004 
00005 #include "FileBrowserControl.h"
00006 #include <string>
00007 
00008 //! Upon activation, allows user to browse files and select one; stores path in a string
00009 class FileInputControl : public FileBrowserControl {
00010  public:
00011   //! Constructor
00012   FileInputControl()
00013     : FileBrowserControl("Select file","Select a file","/ms"), file(NULL), myfile()
00014   {}
00015 
00016   //! Constructor
00017   FileInputControl(const std::string& nm, const std::string& desc, const std::string& path, std::string* store=NULL)
00018     : FileBrowserControl(nm,desc,path), file(store), myfile()
00019   {}
00020 
00021   //! returns the path to file last selected
00022   virtual const std::string& getLastInput() { return myfile; }
00023 
00024   //! clears the last input (i.e. so you can easily tell later if new input is entered)
00025   virtual void clearLastInput() { selectedFile(""); }
00026 
00027   //! pass pointer to an external string you wish to have set when a file is selected; NULL otherwise
00028   virtual void setStore(std::string* store) { file=store; }
00029   
00030 protected:
00031   virtual ControlBase* selectedFile(const std::string& f) {
00032     myfile=f;
00033     if(file!=NULL)
00034       *file=f;
00035     return NULL;
00036   }
00037 
00038   std::string* file;  //!< if we're supposed to store in an external string, this will point to it, otherwise NULL
00039   std::string myfile; //!< stores last file selected
00040 
00041 private:
00042   FileInputControl(const FileInputControl& ); //!< don't call
00043   FileInputControl& operator=(const FileInputControl& ); //!< don't call
00044 };
00045 
00046 /*! @file
00047  * @brief Defines FileInputControl, which allows the user to browse files and select one, which is then stored in a string
00048  * @author ejt (Creator)
00049  *
00050  * $Author: ejt $
00051  * $Name: tekkotsu-2_4_1 $
00052  * $Revision: 1.2 $
00053  * $State: Exp $
00054  * $Date: 2004/03/23 00:55:01 $
00055  */
00056 
00057 #endif

Tekkotsu v2.4.1
Generated Tue Aug 16 16:32:47 2005 by Doxygen 1.4.4