FileDialog

Base class for file dialogs.

Header#include "nativeui/file_dialog.h"
Namespacenamespace nu
Typeclass (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

Return

bool

void SetTitle(const std::string& title)

Set the title of the dialog.

Parameters

void SetButtonLabel(const std::string& label)

Set the text of accept button.

Parameters

void SetFilename(const std::string& filename)

Set the filename to show in the dialog.

Parameters

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

void SetOptions(int options)

A bit array of options.

Available options can be found in FileDialog::Option.

Parameters

void SetFilters(const std::vector<FileDialog::Filter>& filters)

Set the file types that the dialog can open or save.

Parameters

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