/
ifilechooser.h
70 lines (56 loc) · 1.65 KB
/
ifilechooser.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#pragma once
#include <memory>
#include <string>
class wxWindow;
namespace ui
{
/**
* The FileChooser class can be used to query a path from the user.
* Use the GlobalDialogManager module to acquire a new instance of this class.
*/
class IFileChooser
{
public:
virtual ~IFileChooser() {}
// Lets the dialog start at a certain path
virtual void setCurrentPath(const std::string& path) = 0;
// Pre-fills the currently selected file
virtual void setCurrentFile(const std::string& file) = 0;
/**
* Returns the selected filename (default extension
* will be added if appropriate).
*/
virtual std::string getSelectedFileName() = 0;
/**
* greebo: Displays the dialog and enters the main loop.
* Returns the filename or "" if the user hit cancel.
*
* The returned file name is normalised using the os::standardPath() method.
*/
virtual std::string display() = 0;
};
typedef std::shared_ptr<IFileChooser> IFileChooserPtr;
/**
* The DirChooser class can be used to query a directory from the user.
* Use the GlobalDialogManager module to acquire a new instance of this class.
*/
class IDirChooser
{
public:
virtual ~IDirChooser() {}
// Lets the dialog start at a certain path
virtual void setCurrentPath(const std::string& path) = 0;
/**
* Returns the selected folder name.
*/
virtual std::string getSelectedFolderName() = 0;
/**
* greebo: Displays the dialog and enters the main loop.
* Returns the filename or "" if the user hit cancel.
*
* The returned file name is normalised using the os::standardPath() method.
*/
virtual std::string display() = 0;
};
typedef std::shared_ptr<IDirChooser> IDirChooserPtr;
} // namespace ui