Gtk-- Reference: Gtk::FileSelection

Class Index | Cross Index | Namespace Index

# Class Gtk::FileSelection

Prompt the user for a file or directory name.
Contained in: Gtk
Derived from: Gtk::Window
Derived by: none

#include <gtk--/fileselection.h>

### public function member index:
``explicit`` | `FileSelection` | `(`const` `nstring`& `title`=0)`;
``void`` | `complete` | `(`const` `string`& `pattern`)`;
``HBox`*` | `get_action_area` | `() `const``;
``Button`*` | `get_cancel_button` | `() `const``;
``string`` | `get_filename` | `() `const``;
``Button`*` | `get_ok_button` | `() `const``;
``Entry`*` | `get_selection_entry` | `() `const``;
``Label`*` | `get_selection_text` | `() `const``;
``GtkFileSelection`*` | `gtkobj` | `()`;
``const` `GtkFileSelection`*` | `gtkobj` | `() `const``;
``void`` | `hide_fileop_buttons` | `()`;
``static` `bool`` | `isA` | `(`Object`* `object`)`;
``void`` | `set_filename` | `(`const` `string`& `filename`)`;
``void`` | `show_fileop_buttons` | `()`;
``virtual`` | `~FileSelection` | `()`;

## Description:

`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.

The default filename can be set using `set_filename` and the selected filename retrieved using `get_filename`.

Use `complete` to display files that match a given pattern. This can be used for example, to show only *.txt files, or only files beginning with gtk*.

Simple file operations; create directory, delete file, and rename file, are available from buttons at the top of the dialog. These can be hidden using `hide_fileop_buttons` and shown again using `show_fileop_buttons`.

## Function Member Descriptions:

Gtk::FileSelection::FileSelection - Creates a new file selection dialog box.

``explicit`` `FileSelection``(`const` `nstring`& `title`=0)`;

> By default it will contain a `Gtk::CList` of the application's current working directory, and a file listing. Operation buttons that allow the user to create a directory, delete files and rename files, are also present.

> title: A message that will be placed in the file requestor's titlebar.

Gtk::FileSelection::get_action_area - Accessors

``HBox`*` `get_action_area``() `const``;
Gtk::FileSelection::get_filename - Retrieves the currently selected filename from the file selection dialog.

``string`` `get_filename``() `const``;

> If no file is selected then the selected directory path is returned.

> Returns: A string containing the selected file's full path.

Gtk::FileSelection::gtkobj - Returns the underlaying gtk+ object.

``GtkFileSelection`*` `gtkobj``()`;
Gtk::FileSelection::hide_fileop_buttons - Hides the file operation buttons that normally appear at the top of the dialog.

``void`` `hide_fileop_buttons``()`;

> Useful if you wish to create a custom file selector, based on `Gtk::FileSelection`.

Gtk::FileSelection::isA - Returns true if object is this type.

``static` `bool`` `isA``(`Object`* `object`)`;
Gtk::FileSelection::set_filename - Sets a default path for the file requestor.

``void`` `set_filename``(`const` `string`& `filename`)`;

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

> filename: A string to set as the default file name.

Gtk::FileSelection::show_fileop_buttons - Shows the file operation buttons, if they have previously been hidden.

``void`` `show_fileop_buttons``()`;

> The rest of the widgets in the dialog will be resized accordingly.