FileDialog
Base class for file dialogs.
Header | #include "nativeui/file_dialog.h" |
Namespace | namespace nu |
Type | class (RefCounted) |
Methods
base::FilePath GetResult() const
Return the chosen item in dialog.
Return
base::FilePath
bool Run()
Show the dialog and wait for result, return true
if user has chosen
item(s).
Return
bool
bool RunForWindow(Window* window)
Show the dialog as a modal child of parent window
and wait for result,
return true
if user has chosen item(s).
Parameters
Window*
window
Return
bool
void SetTitle(const std::string& title)
Set the title of the dialog.
Parameters
const std::string&
title
void SetButtonLabel(const std::string& label)
Set the text of accept button.
Parameters
const std::string&
label
void SetFilename(const std::string& filename)
Set the filename to show in the dialog.
Parameters
const std::string&
filename
void SetFolder(const base::FilePath& folder)
Set a folder
that is always selected when the dialog is opened
On macOS file dialogs of sandboxed apps may silently ignore the folder selection, notwithstanding that the user may be able to subsequently navigate to the folder and the app successfully access files within the folder. The behavior depends on the app's entitlements and the particular folder specified.
Parameters
const base::FilePath&
folder
void SetOptions(int options)
A bit array of options
.
Available options can be found in FileDialog::Option
.
Parameters
int
options
void SetFilters(const std::vector<FileDialog::Filter>& filters)
Set the file types that the dialog can open or save.
Parameters
const std::vector<FileDialog::Filter>&
filters - An array ofFileDialog::Filter
objects.
std::vector<FileDialog::Filter> GetFilters() const
Return the filters previously set.
Return
std::vector<FileDialog::Filter>
NativeFileDialog GetNative() const
Return the native type wrapped by the dialog.
Return
NativeFileDialog