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