FlightGear next
FileDialog.hxx
Go to the documentation of this file.
1// FileDialog.hxx - abstract inteface for a file open/save dialog
2
3#ifndef FG_GUI_FILE_DIALOG_HXX
4#define FG_GUI_FILE_DIALOG_HXX 1
5
6#include <memory> // for std::unique_ptr
7
8#include <simgear/misc/strutils.hxx> // for string_list
9#include <simgear/misc/sg_path.hxx>
10
11#include <simgear/nasal/cppbind/NasalCallContext.hxx>
12
13// forward decls
14class SGPropertyNode;
15
17{
18public:
24
25 std::string getTitle() const
26 { return _title; }
27
28 void setTitle(const std::string& aTitle);
29
30 std::string getButton() const
31 { return _buttonText; }
32
33 void setButton(const std::string& aText);
34
35 SGPath getDirectory() const
36 { return _initialPath; }
37
38 void setDirectory(const SGPath& aPath);
39
42
43 void setFilterPatterns(const string_list& patterns);
44
46 std::string getPlaceholder() const
47 { return _placeholder; }
48
49 void setPlaceholderName(const std::string& aName);
50
51 bool showHidden() const
52 { return _showHidden; }
53 void setShowHidden(bool show);
54
58 virtual ~FGFileDialog ();
59
60 virtual void exec() = 0;
61 virtual void close() = 0;
62
64 {
65 public:
66 virtual ~Callback() { }
67 virtual void onFileDialogDone(FGFileDialog* ins, const SGPath& result) = 0;
68 };
69
70 virtual void setCallback(Callback* aCB);
71
72 void setCallbackFromNasal(const nasal::CallContext& ctx);
73protected:
75
77 std::string _title, _buttonText;
80 std::string _placeholder;
82 std::unique_ptr<Callback> _callback;
83};
84
85#endif // FG_GUI_FILE_DIALOG_HXX
virtual void onFileDialogDone(FGFileDialog *ins, const SGPath &result)=0
SGPath _initialPath
std::string getTitle() const
string_list _filterPatterns
void setDirectory(const SGPath &aPath)
void setButton(const std::string &aText)
void setPlaceholderName(const std::string &aName)
FGFileDialog(Usage use)
virtual void close()=0
virtual void exec()=0
void setShowHidden(bool show)
void setTitle(const std::string &aTitle)
string_list filterPatterns() const
bool showHidden() const
std::string _buttonText
const Usage _usage
std::string getButton() const
void setCallbackFromNasal(const nasal::CallContext &ctx)
SGPath getDirectory() const
std::string _placeholder
std::string getPlaceholder() const
for saving
std::unique_ptr< Callback > _callback
std::string _title
virtual ~FGFileDialog()
Destructor.
virtual void setCallback(Callback *aCB)
void setFilterPatterns(const string_list &patterns)
std::vector< std::string > string_list
Definition globals.hxx:36