1 // FileDialog.hxx - abstract inteface for a file open/save dialog
3 #ifndef FG_GUI_FILE_DIALOG_HXX
4 #define FG_GUI_FILE_DIALOG_HXX 1
6 #include <memory> // for std::auto_ptr
8 #include <simgear/misc/strutils.hxx> // for string_list
9 #include <simgear/misc/sg_path.hxx>
11 #include <simgear/nasal/cppbind/Ghost.hxx>
25 std::string getButton() const
26 { return _buttonText; }
28 void setButton(const std::string& aText);
30 SGPath getDirectory() const
31 { return _initialPath; }
33 void setDirectory(const SGPath& aPath);
35 string_list filterPatterns() const
36 { return _filterPatterns; }
38 void setFilterPatterns(const string_list& patterns);
41 std::string getPlaceholder() const
42 { return _placeholder; }
44 void setPlaceholderName(const std::string& aName);
46 bool showHidden() const
47 { return _showHidden; }
48 void setShowHidden(bool show);
53 virtual ~FGFileDialog ();
55 virtual void exec() = 0;
60 virtual ~Callback() { }
61 virtual void onFileDialogDone(FGFileDialog* ins, const SGPath& result) = 0;
64 virtual void setCallback(Callback* aCB);
66 naRef openFromNasal(const nasal::CallContext& ctx);
67 naRef setCallbackFromNasal(const nasal::CallContext& ctx);
69 FGFileDialog(const std::string& aTitle, Usage use);
72 std::string _title, _buttonText;
74 string_list _filterPatterns;
75 std::string _placeholder;
77 std::auto_ptr<Callback> _callback;
80 #endif // FG_GUI_FILE_DIALOG_HXX