![]() |
![]() |
In gtkmm, the main objects that implement this interface are FileChooserWidget and FileChooserDialog. You do not need to write an object that implements the FileChooser interface unless you are trying to adapt an existing file selector to expose a standard programming interface.
open(2)
or fopen(3)
, you may not be able to directly set it as the text of a Gtk::Label widget unless you convert it first to UTF-8, which all gtkmm widgets expect. You should use Glib::filename_to_utf8() to convert filenames into strings that can be passed to gtkmm widgets.
Public Member Functions | |
void | add_filter (const FileFilter& filter) |
Adds filter to the list of filters that the user can select between. | |
bool | add_shortcut_folder (const Glib::ustring& folder) |
Adds a folder to be displayed with the shortcut folders in a file chooser. | |
bool | add_shortcut_folder_uri (const Glib::ustring& uri) |
Adds a folder URI to be displayed with the shortcut folders in a file chooser. | |
FileChooserAction | get_action () const |
Gets the type of operation that the file chooser is performing; see set_action(). | |
Glib::ustring | get_current_folder () const |
Gets the current folder of chooser as a local filename. | |
Glib::ustring | get_current_folder_uri () const |
Gets the current folder of chooser as an URI. | |
bool | get_do_overwrite_confirmation () const |
Queries whether a file chooser is set to confirm for overwriting when the user types a file name that already exists. | |
const Gtk::Widget* | get_extra_widget () const |
Gets the current preview widget; see set_extra_widget(). | |
Gtk::Widget* | get_extra_widget () |
Gets the current preview widget; see set_extra_widget(). | |
Glib::ustring | get_filename () const |
Gets the filename for the currently selected file in the file selector. | |
Glib::SListHandle<Glib::ustring> | get_filenames () const |
Lists all the selected files and subfolders in the current folder of chooser . | |
const FileFilter* | get_filter () const |
Gets the current filter; see set_filter(). | |
FileFilter* | get_filter () |
Gets the current filter; see set_filter(). | |
bool | get_local_only () const |
Gets whether only local files can be selected in the file selector. | |
Glib::ustring | get_preview_filename () const |
Gets the filename that should be previewed in a custom preview widget. | |
Glib::ustring | get_preview_uri () const |
Gets the URI that should be previewed in a custom preview widget. | |
Gtk::Widget* | get_preview_widget () |
Gets the current preview widget; see set_preview_widget(). | |
const Gtk::Widget* | get_preview_widget () const |
Gets the current preview widget; see set_preview_widget(). | |
bool | get_preview_widget_active () const |
Gets whether the preview widget set by set_preview_widget() should be shown for the current filename. | |
bool | get_select_multiple () const |
Gets whether multiple files can be selected in the file selector. | |
bool | get_show_hidden () const |
Gets whether hidden files and folders are displayed in the file selector. | |
Glib::ustring | get_uri () const |
Gets the URI for the currently selected file in the file selector. | |
Glib::SListHandle<Glib::ustring> | get_uris () const |
Lists all the selected files and subfolders in the current folder of chooser . | |
bool | get_use_preview_label () const |
Gets whether a stock label should be drawn with the name of the previewed file. | |
const GtkFileChooser* | gobj () const |
Provides access to the underlying C GObject. | |
GtkFileChooser* | gobj () |
Provides access to the underlying C GObject. | |
Glib::SListHandle<const FileFilter*> | list_filters () const |
Lists the current set of user-selectable filters; see add_filter(), remove_filter(). | |
Glib::SListHandle<FileFilter*> | list_filters () |
Lists the current set of user-selectable filters; see add_filter(), remove_filter(). | |
Glib::SListHandle<Glib::ustring> | list_shortcut_folder_uris () const |
Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder_uri(). | |
Glib::SListHandle<Glib::ustring> | list_shortcut_folders () const |
Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder(). | |
Glib::PropertyProxy_ReadOnly< FileChooserAction > | property_action () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<FileChooserAction> | property_action () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< bool > | property_do_overwrite_confirmation () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<bool> | property_do_overwrite_confirmation () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< Widget* > | property_extra_widget () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<Widget*> | property_extra_widget () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< FileFilter* > | property_filter () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<FileFilter*> | property_filter () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< bool > | property_folder_mode () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<bool> | property_folder_mode () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< bool > | property_local_only () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<bool> | property_local_only () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< Widget* > | property_preview_widget () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<Widget*> | property_preview_widget () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< bool > | property_preview_widget_active () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<bool> | property_preview_widget_active () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< bool > | property_select_multiple () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<bool> | property_select_multiple () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< bool > | property_show_hidden () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<bool> | property_show_hidden () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy_ReadOnly< bool > | property_use_preview_label () const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
Glib::PropertyProxy<bool> | property_use_preview_label () |
You rarely need to use properties because there are get_ and set_ methods for almost all of them. | |
void | remove_filter (const FileFilter& filter) |
Removes filter from the list of filters that the user can select between. | |
bool | remove_shortcut_folder (const Glib::ustring& folder) |
Removes a folder from a file chooser's list of shortcut folders. | |
bool | remove_shortcut_folder_uri (const Glib::ustring& uri) |
Removes a folder URI from a file chooser's list of shortcut folders. | |
void | select_all () |
Selects all the files in the current folder of a file chooser. | |
bool | select_filename (const Glib::ustring& filename) |
Selects a filename. | |
bool | select_uri (const Glib::ustring& uri) |
Selects the file to by uri . | |
void | set_action (FileChooserAction action) |
Sets the type of operation that the chooser is performing; the user interface is adapted to suit the selected action. | |
bool | set_current_folder (const Glib::ustring& filename) |
Sets the current folder for chooser from a local filename. | |
bool | set_current_folder_uri (const Glib::ustring& uri) |
Sets the current folder for chooser from an URI. | |
void | set_current_name (const Glib::ustring& name) |
Sets the current name in the file selector, as if entered by the user. | |
void | set_do_overwrite_confirmation (bool do_overwrite_confirmation=true) |
Sets whether a file chooser in GTK_FILE_CHOOSER_ACTION_SAVE mode will present a confirmation dialog if the user types a file name that already exists. | |
void | set_extra_widget (Gtk::Widget& extra_widget) |
Sets an application-supplied widget to provide extra options to the user. | |
bool | set_filename (const Glib::ustring& filename) |
Sets filename as the current filename for the file chooser, by changing to the file's parent folder and actually selecting the file in list. | |
void | set_filter (const FileFilter& filter) |
Sets the current filter; only the files that pass the filter will be displayed. | |
void | set_local_only (bool local_only=true) |
Sets whether only local files can be selected in the file selector. | |
void | set_preview_widget (Gtk::Widget& preview_widget) |
Sets an application-supplied widget to use to display a custom preview of the currently selected file. | |
void | set_preview_widget_active (bool active=true) |
Sets whether the preview widget set by set_preview_widget() should be shown for the current filename. | |
void | set_select_multiple (bool select_multiple=true) |
Sets whether multiple files can be selected in the file selector. | |
void | set_show_hidden (bool show_hidden=true) |
Sets whether hidden files and folders are displayed in the file selector. | |
bool | set_uri (const Glib::ustring& uri) |
Sets the file referred to by uri as the current file for the file chooser, by changing to the URI's parent folder and actually selecting the URI in the list. | |
void | set_use_preview_label (bool use_label=true) |
Sets whether the file chooser should display a stock label with the name of the file that is being previewed; the default is true . | |
Glib::SignalProxy0<FileChooserConfirmation> | signal_confirm_overwrite () |
TODO. | |
Glib::SignalProxy0<void> | signal_current_folder_changed () |
This signal is emitted when the current folder in a FileChooser changes. | |
Glib::SignalProxy0<void> | signal_file_activated () |
This signal is emitted when the user "activates" a file in the file chooser. | |
Glib::SignalProxy0<void> | signal_selection_changed () |
This signal is emitted when there is a change in the set of selected files in a GtkFileChooser. | |
Glib::SignalProxy0<void> | signal_update_preview () |
This signal is emitted when the preview in a file chooser should be regenerated. | |
void | unselect_all () |
Unselects all the files in the current folder of a file chooser. | |
void | unselect_filename (const Glib::ustring& filename) |
Unselects a currently selected filename. | |
void | unselect_uri (const Glib::ustring& uri) |
Unselects the file referred to by uri . | |
virtual | ~FileChooser () |
Static Public Member Functions | |
static void | add_interface (GType gtype_implementer) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr<Gtk::FileChooser> | wrap (GtkFileChooser* object, bool take_copy=false) |
A Glib::wrap() method for this object. |
virtual Gtk::FileChooser::~FileChooser | ( | ) | [virtual] |
void Gtk::FileChooser::add_filter | ( | const FileFilter& | filter | ) |
Adds filter to the list of filters that the user can select between.
When a filter is selected, only files that are passed by that filter are displayed.
Note that the chooser takes ownership of the filter, so you have to ref and sink it if you want to keep a reference.
filter | A Gtk::FileFilter. |
static void Gtk::FileChooser::add_interface | ( | GType | gtype_implementer | ) | [static] |
bool Gtk::FileChooser::add_shortcut_folder | ( | const Glib::ustring & | folder | ) |
Adds a folder to be displayed with the shortcut folders in a file chooser.
Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a "/usr/share/mydrawprogram/Clipart" folder to the volume list.
folder | Filename of the folder to add. |
true
if the folder could be added successfully, false
otherwise. In the latter case, the error will be set as appropriate.bool Gtk::FileChooser::add_shortcut_folder_uri | ( | const Glib::ustring & | uri | ) |
Adds a folder URI to be displayed with the shortcut folders in a file chooser.
Note that shortcut folders do not get saved, as they are provided by the application. For example, you can use this to add a "file:///usr/share/mydrawprogram/Clipart" folder to the volume list.
uri | URI of the folder to add. |
true
if the folder could be added successfully, false
otherwise. In the latter case, the error will be set as appropriate.FileChooserAction Gtk::FileChooser::get_action | ( | ) | const |
Gets the type of operation that the file chooser is performing; see set_action().
Glib::ustring Gtk::FileChooser::get_current_folder | ( | ) | const |
Gets the current folder of chooser as a local filename.
See set_current_folder().
0
if the current path cannot be represented as a local filename. Free with Glib::free(). This function will also return 0
if the file chooser was unable to load the last folder that was requested from it; for example, as would be for calling set_current_folder() on a nonexistent folder.Glib::ustring Gtk::FileChooser::get_current_folder_uri | ( | ) | const |
Gets the current folder of chooser as an URI.
bool Gtk::FileChooser::get_do_overwrite_confirmation | ( | ) | const |
Queries whether a file chooser is set to confirm for overwriting when the user types a file name that already exists.
true
if the file chooser will present a confirmation dialog; false
otherwise.const Gtk::Widget* Gtk::FileChooser::get_extra_widget | ( | ) | const |
Gtk::Widget* Gtk::FileChooser::get_extra_widget | ( | ) |
Glib::ustring Gtk::FileChooser::get_filename | ( | ) | const |
Gets the filename for the currently selected file in the file selector.
If multiple files are selected, one of the filenames will be returned at random.
If the file chooser is in folder mode, this function returns the selected folder.
Glib::SListHandle<Glib::ustring> Gtk::FileChooser::get_filenames | ( | ) | const |
Lists all the selected files and subfolders in the current folder of chooser .
The returned names are full absolute paths. If files in the current folder cannot be represented as local filenames they will be ignored. (See get_uris())
const FileFilter* Gtk::FileChooser::get_filter | ( | ) | const |
FileFilter* Gtk::FileChooser::get_filter | ( | ) |
bool Gtk::FileChooser::get_local_only | ( | ) | const |
Gets whether only local files can be selected in the file selector.
See set_local_only()
true
if only local files can be selected.Glib::ustring Gtk::FileChooser::get_preview_filename | ( | ) | const |
Gets the filename that should be previewed in a custom preview widget.
See set_preview_widget().
Glib::ustring Gtk::FileChooser::get_preview_uri | ( | ) | const |
Gets the URI that should be previewed in a custom preview widget.
See set_preview_widget().
Gtk::Widget* Gtk::FileChooser::get_preview_widget | ( | ) |
const Gtk::Widget* Gtk::FileChooser::get_preview_widget | ( | ) | const |
bool Gtk::FileChooser::get_preview_widget_active | ( | ) | const |
Gets whether the preview widget set by set_preview_widget() should be shown for the current filename.
See set_preview_widget_active().
true
if the preview widget is active for the current filename.bool Gtk::FileChooser::get_select_multiple | ( | ) | const |
Gets whether multiple files can be selected in the file selector.
true
if multiple files can be selected.bool Gtk::FileChooser::get_show_hidden | ( | ) | const |
Gets whether hidden files and folders are displayed in the file selector.
See set_show_hidden().
true
if hidden files and folders are displayed.Glib::ustring Gtk::FileChooser::get_uri | ( | ) | const |
Gets the URI for the currently selected file in the file selector.
If multiple files are selected, one of the filenames will be returned at random.
If the file chooser is in folder mode, this function returns the selected folder.
Glib::SListHandle<Glib::ustring> Gtk::FileChooser::get_uris | ( | ) | const |
Lists all the selected files and subfolders in the current folder of chooser .
The returned names are full absolute URIs.
bool Gtk::FileChooser::get_use_preview_label | ( | ) | const |
Gets whether a stock label should be drawn with the name of the previewed file.
true
if the file chooser is set to display a label with the name of the previewed file, false
otherwise. const GtkFileChooser* Gtk::FileChooser::gobj | ( | ) | const [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::Interface.
Reimplemented in Gtk::FileChooserButton, Gtk::FileChooserDialog, and Gtk::FileChooserWidget.
GtkFileChooser* Gtk::FileChooser::gobj | ( | ) | [inline] |
Provides access to the underlying C GObject.
Reimplemented from Glib::Interface.
Reimplemented in Gtk::FileChooserButton, Gtk::FileChooserDialog, and Gtk::FileChooserWidget.
Glib::SListHandle<const FileFilter*> Gtk::FileChooser::list_filters | ( | ) | const |
Lists the current set of user-selectable filters; see add_filter(), remove_filter().
Glib::SListHandle<FileFilter*> Gtk::FileChooser::list_filters | ( | ) |
Lists the current set of user-selectable filters; see add_filter(), remove_filter().
Glib::SListHandle<Glib::ustring> Gtk::FileChooser::list_shortcut_folder_uris | ( | ) | const |
Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder_uri().
0
if there are no shortcut folders. Free the returned list with Glib::slist_free(), and the URIs with Glib::free().Glib::SListHandle<Glib::ustring> Gtk::FileChooser::list_shortcut_folders | ( | ) | const |
Queries the list of shortcut folders in the file chooser, as set by add_shortcut_folder().
Glib::PropertyProxy_ReadOnly<FileChooserAction> Gtk::FileChooser::property_action | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<FileChooserAction> Gtk::FileChooser::property_action | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<bool> Gtk::FileChooser::property_do_overwrite_confirmation | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> Gtk::FileChooser::property_do_overwrite_confirmation | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<Widget*> Gtk::FileChooser::property_extra_widget | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<Widget*> Gtk::FileChooser::property_extra_widget | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<FileFilter*> Gtk::FileChooser::property_filter | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<FileFilter*> Gtk::FileChooser::property_filter | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<bool> Gtk::FileChooser::property_folder_mode | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> Gtk::FileChooser::property_folder_mode | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<bool> Gtk::FileChooser::property_local_only | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> Gtk::FileChooser::property_local_only | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<Widget*> Gtk::FileChooser::property_preview_widget | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<Widget*> Gtk::FileChooser::property_preview_widget | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<bool> Gtk::FileChooser::property_preview_widget_active | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> Gtk::FileChooser::property_preview_widget_active | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<bool> Gtk::FileChooser::property_select_multiple | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> Gtk::FileChooser::property_select_multiple | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<bool> Gtk::FileChooser::property_show_hidden | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> Gtk::FileChooser::property_show_hidden | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy_ReadOnly<bool> Gtk::FileChooser::property_use_preview_label | ( | ) | const |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
Glib::PropertyProxy<bool> Gtk::FileChooser::property_use_preview_label | ( | ) |
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
void Gtk::FileChooser::remove_filter | ( | const FileFilter& | filter | ) |
Removes filter from the list of filters that the user can select between.
filter | A Gtk::FileFilter. |
bool Gtk::FileChooser::remove_shortcut_folder | ( | const Glib::ustring & | folder | ) |
Removes a folder from a file chooser's list of shortcut folders.
folder | Filename of the folder to remove. |
true
if the operation succeeds, false
otherwise. In the latter case, the error will be set as appropriate.
bool Gtk::FileChooser::remove_shortcut_folder_uri | ( | const Glib::ustring & | uri | ) |
Removes a folder URI from a file chooser's list of shortcut folders.
uri | URI of the folder to remove. |
true
if the operation succeeds, false
otherwise. In the latter case, the error will be set as appropriate.
void Gtk::FileChooser::select_all | ( | ) |
bool Gtk::FileChooser::select_filename | ( | const Glib::ustring & | filename | ) |
Selects a filename.
If the file name isn't in the current folder of chooser , then the current folder of chooser will be changed to the folder containing filename .
filename | The filename to select. |
true
if both the folder could be changed and the file was selected successfully, false
otherwise.bool Gtk::FileChooser::select_uri | ( | const Glib::ustring & | uri | ) |
Selects the file to by uri .
If the URI doesn't refer to a file in the current folder of chooser , then the current folder of chooser will be changed to the folder containing filename .
uri | The URI to select. |
true
if both the folder could be changed and the URI was selected successfully, false
otherwise.void Gtk::FileChooser::set_action | ( | FileChooserAction | action | ) |
Sets the type of operation that the chooser is performing; the user interface is adapted to suit the selected action.
For example, an option to create a new folder might be shown if the action is Gtk::FILE_CHOOSER_ACTION_SAVE but not if the action is Gtk::FILE_CHOOSER_ACTION_OPEN.
action | The action that the file selector is performing. |
bool Gtk::FileChooser::set_current_folder | ( | const Glib::ustring & | filename | ) |
Sets the current folder for chooser from a local filename.
The user will be shown the full contents of the current folder, plus user interface elements for navigating to other folders.
filename | The full path of the new current folder. |
true
if the folder could be changed successfully, false
otherwise.bool Gtk::FileChooser::set_current_folder_uri | ( | const Glib::ustring & | uri | ) |
Sets the current folder for chooser from an URI.
The user will be shown the full contents of the current folder, plus user interface elements for navigating to other folders.
uri | The URI for the new current folder. |
true
if the folder could be changed successfully, false
otherwise.void Gtk::FileChooser::set_current_name | ( | const Glib::ustring & | name | ) |
Sets the current name in the file selector, as if entered by the user.
Note that the name passed in here is a UTF-8 string rather than a filename. This function is meant for such uses as a suggested name in a "Save As..." dialog.
If you want to preselect a particular existing file, you should use set_filename() or set_uri() instead. Please see the documentation for those functions for an example of using set_current_name() as well.
name | The filename to use, as a UTF-8 string. |
void Gtk::FileChooser::set_do_overwrite_confirmation | ( | bool | do_overwrite_confirmation = true |
) |
Sets whether a file chooser in GTK_FILE_CHOOSER_ACTION_SAVE mode will present a confirmation dialog if the user types a file name that already exists.
This is false
by default.
Regardless of this setting, the chooser will emit the "confirm-overwrite" signal when appropriate.
If all you need is the stock confirmation dialog, set this property to true
. You can override the way confirmation is done by actually handling the "confirm-overwrite" signal; please refer to its documentation for the details.
do_overwrite_confirmation | Whether to confirm overwriting in save mode. |
void Gtk::FileChooser::set_extra_widget | ( | Gtk::Widget& | extra_widget | ) |
Sets an application-supplied widget to provide extra options to the user.
extra_widget | Widget for extra options. |
bool Gtk::FileChooser::set_filename | ( | const Glib::ustring & | filename | ) |
Sets filename as the current filename for the file chooser, by changing to the file's parent folder and actually selecting the file in list.
If the chooser is in Gtk::FILE_CHOOSER_ACTION_SAVE mode, the file's base name will also appear in the dialog's file name entry.
If the file name isn't in the current folder of chooser , then the current folder of chooser will be changed to the folder containing filename . This is equivalent to a sequence of unselect_all() followed by select_filename().
Note that the file must exist, or nothing will be done except for the directory change.
If you are implementing a <guimenuitem>File/Save As...</guimenuitem> dialog, you should use this function if you already have a file name to which the user may save; for example, when the user opens an existing file and then does <guimenuitem>File/Save As...</guimenuitem> on it. If you don't have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:
if (document_is_new) { /<!-- -->* the user just created a new document *<!-- -->/ gtk_file_chooser_set_current_folder (chooser, default_folder_for_saving); gtk_file_chooser_set_current_name (chooser, "Untitled document"); } else { /<!-- -->* the user edited an existing document *<!-- -->/ gtk_file_chooser_set_filename (chooser, existing_filename); }
filename | The filename to set as current. |
true
if both the folder could be changed and the file was selected successfully, false
otherwise.void Gtk::FileChooser::set_filter | ( | const FileFilter& | filter | ) |
Sets the current filter; only the files that pass the filter will be displayed.
If the user-selectable list of filters is non-empty, then the filter should be one of the filters in that list. Setting the current filter when the list of filters is empty is useful if you want to restrict the displayed set of files without letting the user change it.
filter | A Gtk::FileFilter. |
void Gtk::FileChooser::set_local_only | ( | bool | local_only = true |
) |
Sets whether only local files can be selected in the file selector.
If local_only is true
(the default), then the selected file are files are guaranteed to be accessible through the operating systems native file file system and therefore the application only needs to worry about the filename functions in Gtk::FileChooser, like get_filename(), rather than the URI functions like get_uri(),
local_only | true if only local files can be selected. |
void Gtk::FileChooser::set_preview_widget | ( | Gtk::Widget& | preview_widget | ) |
Sets an application-supplied widget to use to display a custom preview of the currently selected file.
To implement a preview, after setting the preview widget, you connect to the update-preview signal, and call get_preview_filename() or get_preview_uri() on each change. If you can display a preview of the new file, update your widget and set the preview active using set_preview_widget_active(). Otherwise, set the preview inactive.
When there is no application-supplied preview widget, or the application-supplied preview widget is not active, the file chooser may display an internally generated preview of the current file or it may display no preview at all.
preview_widget | Widget for displaying preview. |
void Gtk::FileChooser::set_preview_widget_active | ( | bool | active = true |
) |
Sets whether the preview widget set by set_preview_widget() should be shown for the current filename.
When active is set to false, the file chooser may display an internally generated preview of the current file or it may display no preview at all. See set_preview_widget() for more details.
active | Whether to display the user-specified preview widget. |
void Gtk::FileChooser::set_select_multiple | ( | bool | select_multiple = true |
) |
Sets whether multiple files can be selected in the file selector.
This is only relevant if the action is set to be GTK_FILE_CHOOSER_ACTION_OPEN or GTK_FILE_CHOOSER_ACTION_SAVE. It cannot be set with either of the folder actions.
select_multiple | true if multiple files can be selected. |
void Gtk::FileChooser::set_show_hidden | ( | bool | show_hidden = true |
) |
Sets whether hidden files and folders are displayed in the file selector.
show_hidden | true if hidden files and folders should be displayed. |
bool Gtk::FileChooser::set_uri | ( | const Glib::ustring & | uri | ) |
Sets the file referred to by uri as the current file for the file chooser, by changing to the URI's parent folder and actually selecting the URI in the list.
If the chooser is Gtk::FILE_CHOOSER_ACTION_SAVE mode, the URI's base name will also appear in the dialog's file name entry.
If the URI isn't in the current folder of chooser , then the current folder of chooser will be changed to the folder containing uri . This is equivalent to a sequence of unselect_all() followed by select_uri().
Note that the URI must exist, or nothing will be done except for the directory change. If you are implementing a <guimenuitem>File/Save As...</guimenuitem> dialog, you should use this function if you already have a file name to which the user may save; for example, when the user opens an existing file and then does <guimenuitem>File/Save As...</guimenuitem> on it. If you don't have a file name already — for example, if the user just created a new file and is saving it for the first time, do not call this function. Instead, use something similar to this:
if (document_is_new) { /<!-- -->* the user just created a new document *<!-- -->/ gtk_file_chooser_set_current_folder_uri (chooser, default_folder_for_saving); gtk_file_chooser_set_current_name (chooser, "Untitled document"); } else { /<!-- -->* the user edited an existing document *<!-- -->/ gtk_file_chooser_set_uri (chooser, existing_uri); }
uri | The URI to set as current. |
true
if both the folder could be changed and the URI was selected successfully, false
otherwise.void Gtk::FileChooser::set_use_preview_label | ( | bool | use_label = true |
) |
Sets whether the file chooser should display a stock label with the name of the file that is being previewed; the default is true
.
Applications that want to draw the whole preview area themselves should set this to false
and display the name themselves in their preview widget.
See also: set_preview_widget()
use_label | Whether to display a stock label with the name of the previewed file. |
Glib::SignalProxy0<FileChooserConfirmation> Gtk::FileChooser::signal_confirm_overwrite | ( | ) |
TODO.
FileChooserConfirmation on_my_confirm_overwrite()
Glib::SignalProxy0< void > Gtk::FileChooser::signal_current_folder_changed | ( | ) |
This signal is emitted when the current folder in a FileChooser changes.
This can happen due to the user performing some action that changes folders, such as selecting a bookmark or visiting a folder on the file list. It can also happen as a result of calling a function to explicitly change the current folder in a file chooser.
Normally you do not need to connect to this signal, unless you need to keep track of which folder a file chooser is showing.
void on_my_current_folder_changed()
Glib::SignalProxy0< void > Gtk::FileChooser::signal_file_activated | ( | ) |
This signal is emitted when the user "activates" a file in the file chooser.
This can happen by double-clicking on a file in the file list, or by pressing <keycap>Enter</keycap>.
Normally you do not need to connect to this signal. It is used internally by FileChooserDialog to know when to activate the default button in the dialog.
void on_my_file_activated()
Glib::SignalProxy0< void > Gtk::FileChooser::signal_selection_changed | ( | ) |
This signal is emitted when there is a change in the set of selected files in a GtkFileChooser.
This can happen when the user modifies the selection with the mouse or the keyboard, or when explicitly calling functions to change the selection.
Normally you do not need to connect to this signal, as it is easier to wait for the file chooser to finish running, and then to get the list of selected files using the functions mentioned below.
void on_my_selection_changed()
Glib::SignalProxy0< void > Gtk::FileChooser::signal_update_preview | ( | ) |
This signal is emitted when the preview in a file chooser should be regenerated.
For example, this can happen when the currently selected file changes. You should use this signal if you want your file chooser to have a preview widget.
Once you have installed a preview widget with set_preview_widget(), you should update it when this signal is emitted. You can use the functions get_preview_filename() or get_preview_uri() to get the name of the file to preview. Your widget may not be able to preview all kinds of files; your signal handler must call set_preview_wiget_active() to inform the file chooser about whether the preview was generated successfully or not.
void on_my_update_preview()
void Gtk::FileChooser::unselect_all | ( | ) |
void Gtk::FileChooser::unselect_filename | ( | const Glib::ustring & | filename | ) |
Unselects a currently selected filename.
If the filename is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.
filename | The filename to unselect. |
void Gtk::FileChooser::unselect_uri | ( | const Glib::ustring & | uri | ) |
Unselects the file referred to by uri .
If the file is not in the current directory, does not exist, or is otherwise not currently selected, does nothing.
uri | The URI to unselect. |
Glib::RefPtr<Gtk::FileChooser> wrap | ( | GtkFileChooser * | object, | |
bool | take_copy = false | |||
) | [related] |
A Glib::wrap() method for this object.
object | The C instance. | |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |