Class definition of the fileselector

Author: martijn, bastiaan, jrvosse Warning: This fileselector may change your applications current working directory!

  #include <hush/bool.h> 
  #include <widgets/widgets.h> // We need al lot of widgets 
  class fileselector: public frame {
    public:
      // Typical hush stuff:
      char* type() const { return "fileselector"; }
      fileselector(const char *p, const char* options="", 
                                          int istop=true);  // make widget
      fileselector(const widget* w, const char *p, 
                  const char* options="", int istop=true);  // make widget
      fileselector();             // make handler for tcl command "filechooser"
      virtual ~fileselector();            // destruct C++ object (not window!)
      virtual int operator()();           // handle events
      // Typical fileselector stuff:
      virtual void mask(const char *m);   // set filename mask (default "*")
      virtual const char* mask() const;   // get    ,,      ,,
      virtual int dirpath(const char* path); // set current dir path
      virtual const char* dirpath() const ;  // get current dir
      virtual void rescan();              // rescan & display current dir
      virtual const char* get();          // get (and wait for) filename
                                          // returns 0 on cancel
    protected:    // Derived classes can redefine these: 
      virtual widget* create(int argc, char* argv[]);     // create new widget
      virtual void build_gui(widget* top, const char* opts =""); // set up GUI
      virtual void bindings();                            // install bindings
      virtual void options(const char* opts);             // process options
      virtual int usage(const char* msg) const;           // print usage
      
    private:      // I hate to have this private stuff in my header files:
      listbox *_listbox;
      button  *_okbutton,  *_cancelbutton;
      entry   *_fileentry, *_maskentry, *_pathentry;
      char    _filename[100], _pathname[100], _mask[100];
  };