Homepage Demos Overview Downloads Tutorials 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   const std::string& getLastInput() { return myfile; }
00023 
00024   //! pass pointer to an external string you wish to have set when a file is selected; NULL otherwise
00025   void setStore(std::string* store) { file=store; }
00026   
00027 protected:
00028   virtual ControlBase* selectedFile(const std::string& f) {
00029     myfile=f;
00030     if(file!=NULL)
00031       *file=f;
00032     return NULL;
00033   }
00034 
00035   std::string* file;  //!< if we're supposed to store in an external string, this will point to it, otherwise NULL
00036   std::string myfile; //!< stores last file selected
00037 
00038 private:
00039   FileInputControl(const FileInputControl& ); //!< don't call
00040   FileInputControl& operator=(const FileInputControl& ); //!< don't call
00041 };
00042 
00043 /*! @file
00044  * @brief Defines FileInputControl, which allows the user to browse files and select one, which is then stored in a string
00045  * @author ejt (Creator)
00046  *
00047  * $Author: ejt $
00048  * $Name: tekkotsu-2_0 $
00049  * $Revision: 1.1 $
00050  * $State: Exp $
00051  * $Date: 2004/01/08 22:39:54 $
00052  */
00053 
00054 #endif

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