Main Page Widgets Namespaces Book

# Gtk::FileSelection Class Reference
[Dialogs]

Prompt the user for a file or directory name. More...

Inheritance diagram for Gtk::FileSelection:

[legend]
List of all members.

## Public Methods

virtual | ~FileSelection ()
GtkFileSelection* | gobj ()
const GtkFileSelection* | gobj () const
| FileSelection ()
| FileSelection (const Glib::ustring& title)
void | set_filename (const std::string& filename)
| Sets a default path for the file requestor.
std::string | get_filename () const
| This function returns the selected filename in the on-disk encoding (see Glib::filename_from_utf8()), which may or may not be the same as that used by GTK+ (UTF-8).
void | complete (const Glib::ustring& pattern)
void | show_fileop_buttons ()
void | hide_fileop_buttons ()
Glib::ArrayHandle<std::string> | get_selections () const
| Retrieves the list of file selections the user has made in the dialog box.
void | set_select_multiple (bool select_multiple=true)
| Sets whether the user is allowed to select multiple files in the file list.
bool | get_select_multiple () const
| Determines whether or not the user is allowed to select multiple files in the file list.
TreeView* | get_dir_list ()
const TreeView* | get_dir_list () const
TreeView* | get_file_list ()
const TreeView* | get_file_list () const
Entry* | get_selection_entry ()
const Entry* | get_selection_entry () const
Label* | get_selection_text ()
const Label* | get_selection_text () const
VBox* | get_main_vbox ()
const VBox* | get_main_vbox () const
Button* | get_ok_button ()
const Button* | get_ok_button () const
Button* | get_cancel_button ()
const Button* | get_cancel_button () const
Button* | get_help_button ()
const Button* | get_help_button () const
HButtonBox* | get_button_area ()
const HButtonBox* | get_button_area () const
HBox* | get_action_area ()
const HBox* | get_action_area () const
Glib::PropertyProxy<bool> | property_show_fileops ()
Glib::PropertyProxy<std::string> | property_filename ()
Glib::PropertyProxy<bool> | property_select_multiple ()

## Related Functions

(Note that these are not member functions.)
Gtk::FileSelection* | wrap (GtkFileSelection* object, bool take_copy=false)

## Detailed Description

Prompt the user for a file or directory name.

Gtk::FileSelection should be used to retrieve file or directory names from the user. It will create a new dialog window containing a directory list, and a file list corresponding to the current working directory. The filesystem can be navigated using the directory list or the drop-down history menu. Alternatively, the TAB key can be used to navigate using filename completion - common in text based editors such as emacs and jed.

## Constructor & Destructor Documentation

virtual Gtk::FileSelection::~FileSelection | ( |  | ) | `[virtual]`

Gtk::FileSelection::FileSelection | ( |  | ) |

Gtk::FileSelection::FileSelection | ( | const Glib::ustring& | title | ) | `[explicit]`

## Member Function Documentation

void Gtk::FileSelection::complete | ( | const Glib::ustring& | pattern | ) |

const HBox* Gtk::FileSelection::get_action_area | ( |  | ) |

| Reimplemented from Gtk::Dialog.

HBox* Gtk::FileSelection::get_action_area | ( |  | ) |

| Reimplemented from Gtk::Dialog.

const HButtonBox* Gtk::FileSelection::get_button_area | ( |  | ) |

HButtonBox* Gtk::FileSelection::get_button_area | ( |  | ) |

const Button* Gtk::FileSelection::get_cancel_button | ( |  | ) |

Button* Gtk::FileSelection::get_cancel_button | ( |  | ) |

const TreeView* Gtk::FileSelection::get_dir_list | ( |  | ) |

TreeView* Gtk::FileSelection::get_dir_list | ( |  | ) |

const TreeView* Gtk::FileSelection::get_file_list | ( |  | ) |

TreeView* Gtk::FileSelection::get_file_list | ( |  | ) |

std::string Gtk::FileSelection::get_filename | ( |  | ) |

This function returns the selected filename in the on-disk encoding (see Glib::filename_from_utf8()), which may or may not be the same as that used by GTK+ (UTF-8).

To convert to UTF-8, call Glib::filename_to_utf8(). The returned string points to a statically allocated buffer and should be copied if you plan to keep it around.

Returns:
  Currently-selected filename in locale's encoding.

const Button* Gtk::FileSelection::get_help_button | ( |  | ) |

Button* Gtk::FileSelection::get_help_button | ( |  | ) |

const VBox* Gtk::FileSelection::get_main_vbox | ( |  | ) |

VBox* Gtk::FileSelection::get_main_vbox | ( |  | ) |

const Button* Gtk::FileSelection::get_ok_button | ( |  | ) |

Button* Gtk::FileSelection::get_ok_button | ( |  | ) |

bool Gtk::FileSelection::get_select_multiple | ( |  | ) |

Determines whether or not the user is allowed to select multiple files in the file list.

See set_select_multiple().

Returns:
  `true` if the user is allowed to select multiple files in the file list.

const Entry* Gtk::FileSelection::get_selection_entry | ( |  | ) |

Entry* Gtk::FileSelection::get_selection_entry | ( |  | ) |

const Label* Gtk::FileSelection::get_selection_text | ( |  | ) |

Label* Gtk::FileSelection::get_selection_text | ( |  | ) |

Glib::ArrayHandle<std::string> Gtk::FileSelection::get_selections | ( |  | ) |

Retrieves the list of file selections the user has made in the dialog box.

This function is intended for use when the user can select multiple files in the file list. The first file in the list is equivalent to what get_filename() would return.

The filenames are in the encoding of g_filename_from_utf8, which may or may not be the same as that used by GTK+ (UTF-8). To convert to UTF-8, call Glib::filename_to_utf8() on each string.

Returns:
  A newly-allocated `0`-terminated array of strings. Use Glib::strfreev() to free it.

const GtkFileSelection* Gtk::FileSelection::gobj | ( |  | ) | const`[inline]`

| Reimplemented from Gtk::Dialog.

GtkFileSelection* Gtk::FileSelection::gobj | ( |  | ) | `[inline]`

| Reimplemented from Gtk::Dialog.

void Gtk::FileSelection::hide_fileop_buttons | ( |  | ) |

Glib::PropertyProxy<std::string> Gtk::FileSelection::property_filename | ( |  | ) |

Glib::PropertyProxy<bool> Gtk::FileSelection::property_select_multiple | ( |  | ) |

Glib::PropertyProxy<bool> Gtk::FileSelection::property_show_fileops | ( |  | ) |

void Gtk::FileSelection::set_filename | ( | const std::string& | filename | ) |

Sets a default path for the file requestor.

If filename includes a directory path, then the requestor will open with that path as its current working directory.

The encoding of filename is the on-disk encoding, which may not be UTF-8. See Glib::filename_from_utf8().

Parameters:

  filename | A string to set as the default file name.

void Gtk::FileSelection::set_select_multiple | ( | bool | select_multiple = true | ) |

Sets whether the user is allowed to select multiple files in the file list.

Use get_selections() to get the list of selected files.

Parameters:

  select_multiple | Whether or not the user is allowed to select multiple files in the file list.

void Gtk::FileSelection::show_fileop_buttons | ( |  | ) |

## Friends And Related Function Documentation

Gtk::FileSelection* wrap | ( | GtkFileSelection* | object,
|  | bool | take_copy = false
| ) | `[related]`

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

- fileselection.h