phoenix::DialogWindow

DialogWindow contains a collection of static functions for common dialog operations.

struct DialogWindow {
  static string fileOpen(Window &parent, const string &path, const string&... filters);
  static string fileSave(Window &parent, const string &path, const string&... filters);
  static string folderSelect(Window &parent, const string &path);
};

static string DialogWindow::fileOpen(Window &parent, const string &path, const string&... filters);

Displays the native file chooser dialog in open-file mode.

parent can be used to make the dialog modal to a specific window that spawns the dialog. You may pass this argument as Window::None to specify no window.

path is the default folder to start in. Pass this an empty string if you do not care.

filters is an optional parameter. You may specify as many filters as you like, and the first one will be the default. Here are some examples:

DialogWindow::fileOpen(Window::None, "/home", "Text files (*.txt)", "All files (*)");
DialogWindow::fileOpen(Window::None, "/home");

If no filters are specified, "All files (*)" is automatically added.

static string DialogWindow::fileSave(Window &parent, const string &path, const string&... filters);

The same as DialogWindow::fileOpen(), only this displays the save dialog instead. Depending on the OS, this dialog may prompt the user with an overwrite dialog before selecting a file that already exists.

string DialogWindow::folderSelect(Window &parent, const string &path);

Similar to DialogWindow::fileOpen(), only this does not take filters, and is used to select folders. On some platforms, such as Windows, this dialog looks substantially different than the file selection dialog.