#include <DesktopFileDialog.h>
|
| | DesktropFileDialog ()=default |
| |
| virtual void | OpenFile (const std::string &title, const std::string &defaultPathOrFile, const std::vector< std::string > &filters, const std::string &filterDescription, bool allowMultiple) override |
| |
| virtual void | SaveFile (const std::string &title, const std::string &defaultPathOrFile, const std::vector< std::string > &filters, const std::string &filterDescription) override |
| |
| virtual void | SelectFolder (const std::string &title, const std::string &defaultPath) override |
| |
| | FileDialogImpl ()=default |
| |
| virtual | ~FileDialogImpl ()=default |
| |
| virtual bool | DisplayAndGetResult (std::string &outPath) |
| |
| bool | HasResult () |
| |
| std::string | ConsumeResult () |
| |
Definition at line 8 of file DesktopFileDialog.h.
◆ DesktropFileDialog()
| Elevate::DesktropFileDialog::DesktropFileDialog |
( |
| ) |
|
|
default |
◆ OpenFile()
| void Elevate::DesktropFileDialog::OpenFile |
( |
const std::string & |
title, |
|
|
const std::string & |
defaultPathOrFile, |
|
|
const std::vector< std::string > & |
filters, |
|
|
const std::string & |
filterDescription, |
|
|
bool |
allowMultiple |
|
) |
| |
|
overridevirtual |
Implements Elevate::FileDialogImpl.
Definition at line 19 of file DesktopFileDialog.cpp.
20 {
21 std::vector<const char*> filterPtrs = ConvertFilters(filters);
22
23 const char* result = tinyfd_openFileDialog(
24 title.empty() ? nullptr : title.c_str(),
25 defaultPathOrFile.empty() ? nullptr : defaultPathOrFile.c_str(),
26 static_cast<int>(filterPtrs.size()),
27 filterPtrs.empty() ? nullptr : filterPtrs.data(),
28 filterDescription.empty() ? nullptr : filterDescription.c_str(),
29 allowMultiple ? 1 : 0
30 );
31
32 if (result == nullptr)
33 {
34 result = "";
35 }
37 }
void SetResult(const std::string &result)
◆ SaveFile()
| void Elevate::DesktropFileDialog::SaveFile |
( |
const std::string & |
title, |
|
|
const std::string & |
defaultPathOrFile, |
|
|
const std::vector< std::string > & |
filters, |
|
|
const std::string & |
filterDescription |
|
) |
| |
|
overridevirtual |
Implements Elevate::FileDialogImpl.
Definition at line 39 of file DesktopFileDialog.cpp.
40 {
41 std::vector<const char*> filterPtrs = ConvertFilters(filters);
42
43 const char* result = tinyfd_saveFileDialog(
44 title.empty() ? nullptr : title.c_str(),
45 defaultPathOrFile.empty() ? nullptr : defaultPathOrFile.c_str(),
46 static_cast<int>(filterPtrs.size()),
47 filterPtrs.empty() ? nullptr : filterPtrs.data(),
48 filterDescription.empty() ? nullptr : filterDescription.c_str()
49 );
50
51 if (result == nullptr)
52 {
53 result = "";
54 }
56 }
◆ SelectFolder()
| void Elevate::DesktropFileDialog::SelectFolder |
( |
const std::string & |
title, |
|
|
const std::string & |
defaultPath |
|
) |
| |
|
overridevirtual |
Implements Elevate::FileDialogImpl.
Definition at line 58 of file DesktopFileDialog.cpp.
59 {
60 const char* result = tinyfd_selectFolderDialog(
61 title.empty() ? nullptr : title.c_str(),
62 defaultPath.empty() ? nullptr : defaultPath.c_str()
63 );
64
65 if (result == nullptr)
66 {
67 result = "";
68 }
70 }
The documentation for this class was generated from the following files: