clan::OpenFileDialog Class Reference - ClanLib SDK
Description: clan::OpenFileDialog Class Reference

Public Member Functions | List of all members
clan::OpenFileDialog Class Reference

Displays the system open file dialog. More...

`#include <open_file_dialog.h>`

## Public Member Functions
| OpenFileDialog (View *owner)
| Constructs an open file dialog.
void | add_filter (const std::string &filter_description, const std::string &filter_extension, bool is_default=false)
| Add a filter that determines what types of files are displayed.
void | clear_filters ()
| Clears all filters.
std::string | filename () const
| Get the full path of the file selected.
std::vector< std::string > | filenames () const
| Gets an array that contains one file name for each selected file.
void | set_filename (const std::string &filename)
| Sets a string containing the full path of the file selected.
void | set_filter_index (int filter_index)
| Sets a default filter, on a 0-based index.
void | set_initial_directory (const std::string &path)
| Sets the initial directory that is displayed.
void | set_multi_select (bool multiselect)
| Sets if multiple files can be selected or not.
void | set_title (const std::string &title)
| Sets the text that appears in the title bar.
bool | show ()
| Shows the file dialog.

## Detailed Description

Displays the system open file dialog.

## Constructor & Destructor Documentation

## ◆ OpenFileDialog()

clan::OpenFileDialog::OpenFileDialog | ( | View * | owner | ) |

Constructs an open file dialog.

## Member Function Documentation

## ◆ add_filter()

void clan::OpenFileDialog::add_filter | ( | const std::string & | filter_description,
|  | const std::string & | filter_extension,
|  | bool | is_default = false )

Add a filter that determines what types of files are displayed.

## ◆ clear_filters()

void clan::OpenFileDialog::clear_filters | ( |  | ) |

Clears all filters.

## ◆ filename()

std::string clan::OpenFileDialog::filename | ( |  | ) | const

Get the full path of the file selected.

If multiple files are selected, this returns the first file.

Referenced by set_filename().

## ◆ filenames()

std::vector< std::string > clan::OpenFileDialog::filenames | ( |  | ) | const

Gets an array that contains one file name for each selected file.

## ◆ set_filename()

void clan::OpenFileDialog::set_filename | ( | const std::string & | filename | ) |

Sets a string containing the full path of the file selected.

References filename().

## ◆ set_filter_index()

void clan::OpenFileDialog::set_filter_index | ( | int | filter_index | ) |

Sets a default filter, on a 0-based index.

## ◆ set_initial_directory()

void clan::OpenFileDialog::set_initial_directory | ( | const std::string & | path | ) |

Sets the initial directory that is displayed.

References clan::path.

## ◆ set_multi_select()

void clan::OpenFileDialog::set_multi_select | ( | bool | multiselect | ) |

Sets if multiple files can be selected or not.

Parameters

  multiselect | = When true, multiple items can be selected.

## ◆ set_title()

void clan::OpenFileDialog::set_title | ( | const std::string & | title | ) |

Sets the text that appears in the title bar.

## ◆ show()

bool clan::OpenFileDialog::show | ( |  | ) |

Shows the file dialog.

Returns
  true if the user clicks the OK button of the dialog that is displayed, false otherwise.

The documentation for this class was generated from the following file:

- open_file_dialog.h