gtkmm
4.9.1
|
A Gtk::FileDialog object collects the arguments that are needed to present a file chooser dialog to the user, such as a title for the dialog and whether it should be modal. More...
#include <gtkmm/filedialog.h>
Public Member Functions | |
FileDialog (FileDialog && src) noexcept | |
FileDialog & | operator= (FileDialog && src) noexcept |
~FileDialog () noexcept override | |
GtkFileDialog * | gobj () |
Provides access to the underlying C GObject. More... | |
const GtkFileDialog * | gobj () const |
Provides access to the underlying C GObject. More... | |
GtkFileDialog * | gobj_copy () |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. More... | |
Glib::ustring | get_title () const |
Returns the title that will be shown on the file chooser dialog. More... | |
void | set_title (const Glib::ustring & title) |
Sets the title that will be shown on the file chooser dialog. More... | |
bool | get_modal () const |
Returns whether the file chooser dialog blocks interaction with the parent window while it is presented. More... | |
void | set_modal (bool modal=true) |
Sets whether the file chooser dialog blocks interaction with the parent window while it is presented. More... | |
Glib::RefPtr< Gio::ListModel > | get_filters () |
Gets the filters that will be offered to the user in the file chooser dialog. More... | |
Glib::RefPtr< const Gio::ListModel > | get_filters () const |
Gets the filters that will be offered to the user in the file chooser dialog. More... | |
void | set_filters (const Glib::RefPtr< Gio::ListModel > & filters) |
Sets the filters that will be offered to the user in the file chooser dialog. More... | |
Glib::RefPtr< FileFilter > | get_current_filter () |
Gets the filter that will be selected by default in the file chooser dialog. More... | |
Glib::RefPtr< const FileFilter > | get_current_filter () const |
Gets the filter that will be selected by default in the file chooser dialog. More... | |
void | set_current_filter (const Glib::RefPtr< FileFilter > & filter) |
Sets the filters that will be selected by default in the file chooser dialog. More... | |
Glib::RefPtr< Gio::ListModel > | get_shortcut_folders () |
Gets the shortcut folders that will be available to the user in the file chooser dialog. More... | |
Glib::RefPtr< const Gio::ListModel > | get_shortcut_folders () const |
Gets the shortcut folders that will be available to the user in the file chooser dialog. More... | |
void | set_shortcut_folders (const Glib::RefPtr< Gio::ListModel > & shortcut_folders) |
Sets the shortcut folders that will be available to the user in the file chooser dialog. More... | |
Glib::RefPtr< Gio::File > | get_current_folder () |
Gets the folder that will be set as the initial folder in the file chooser dialog. More... | |
Glib::RefPtr< const Gio::File > | get_current_folder () const |
Gets the folder that will be set as the initial folder in the file chooser dialog. More... | |
void | set_current_folder (const Glib::RefPtr< Gio::File > & folder) |
Sets the folder that will be set as the initial folder in the file chooser dialog, unless overridden by parameters of the async call. More... | |
void | open (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & current_file={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
This function initiates a file selection operation by presenting a file chooser dialog to the user. More... | |
void | open (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & current_file={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
A open() convenience overload. More... | |
Glib::RefPtr< Gio::File > | open_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const |
Finishes the open() call and returns the resulting file. More... | |
void | select_folder (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & current_folder={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
This function initiates a directory selection operation by presenting a file chooser dialog to the user. More... | |
void | select_folder (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & current_folder={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
A select_folder() convenience overload. More... | |
Glib::RefPtr< Gio::File > | select_folder_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const |
Finishes the select_folder() call and returns the resulting file. More... | |
void | save (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & current_file={}, const std::string & current_name={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
This function initiates a file save operation by presenting a file chooser dialog to the user. More... | |
void | save (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::File > & current_file={}, const std::string & current_name={}, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
A save() convenience overload. More... | |
Glib::RefPtr< Gio::File > | save_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const |
Finishes the save() call and returns the resulting file. More... | |
void | open_multiple (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
This function initiates a multi-file selection operation by presenting a file chooser dialog to the user. More... | |
void | open_multiple (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
A open_multiple() convenience overload. More... | |
Glib::RefPtr< Gio::ListModel > | open_multiple_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const |
Finishes the open() call and returns the resulting files in a Gio::ListModel . More... | |
void | select_multiple_folders (Window & parent, const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
This function initiates a multi-directory selection operation by presenting a file chooser dialog to the user. More... | |
void | select_multiple_folders (const Gio::SlotAsyncReady & slot, const Glib::RefPtr< Gio::Cancellable > & cancellable={}) const |
A select_multiple_folders() convenience overload. More... | |
Glib::RefPtr< Gio::ListModel > | select_multiple_folders_finish (const Glib::RefPtr< Gio::AsyncResult > & result) const |
Finishes the select_multiple_folders() call and returns the resulting files in a Gio::ListModel . More... | |
Glib::PropertyProxy< Glib::ustring > | property_title () |
A title that may be shown on the file chooser dialog. More... | |
Glib::PropertyProxy_ReadOnly< Glib::ustring > | property_title () const |
A title that may be shown on the file chooser dialog. More... | |
Glib::PropertyProxy< bool > | property_modal () |
Whether the file chooser dialog is modal. More... | |
Glib::PropertyProxy_ReadOnly< bool > | property_modal () const |
Whether the file chooser dialog is modal. More... | |
Glib::PropertyProxy< Glib::RefPtr< Gio::ListModel > > | property_filters () |
The list of filters. More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::ListModel > > | property_filters () const |
The list of filters. More... | |
Glib::PropertyProxy< Glib::RefPtr< Gio::ListModel > > | property_shortcut_folders () |
The list of shortcut folders. More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::ListModel > > | property_shortcut_folders () const |
The list of shortcut folders. More... | |
Glib::PropertyProxy< Glib::RefPtr< FileFilter > > | property_current_filter () |
The current filter, that is, the filter that is initially active in the file chooser dialog. More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< FileFilter > > | property_current_filter () const |
The current filter, that is, the filter that is initially active in the file chooser dialog. More... | |
Glib::PropertyProxy< Glib::RefPtr< Gio::File > > | property_current_folder () |
The current folder, that is, the directory that is initially opened in the file chooser dialog, unless overridden by parameters of the async call. More... | |
Glib::PropertyProxy_ReadOnly< Glib::RefPtr< Gio::File > > | property_current_folder () const |
The current folder, that is, the directory that is initially opened in the file chooser dialog, unless overridden by parameters of the async call. More... | |
![]() | |
Object (const Object &)=delete | |
Object & | operator= (const Object &)=delete |
Object (Object &&src) noexcept | |
Object & | operator= (Object &&src) noexcept |
void * | get_data (const QueryQuark &key) |
void | set_data (const Quark &key, void *data) |
void | set_data (const Quark &key, void *data, DestroyNotify notify) |
void | remove_data (const QueryQuark &quark) |
void * | steal_data (const QueryQuark &quark) |
Glib::RefPtr< Glib::Object > | wrap (GObject *object, bool take_copy=false) |
![]() | |
ObjectBase (const ObjectBase &)=delete | |
ObjectBase & | operator= (const ObjectBase &)=delete |
void | set_property_value (const Glib::ustring &property_name, const Glib::ValueBase &value) |
void | get_property_value (const Glib::ustring &property_name, Glib::ValueBase &value) const |
void | set_property (const Glib::ustring &property_name, const PropertyType &value) |
void | get_property (const Glib::ustring &property_name, PropertyType &value) const |
PropertyType | get_property (const Glib::ustring &property_name) const |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, const sigc::slot< void()> &slot) |
sigc::connection | connect_property_changed (const Glib::ustring &property_name, sigc::slot< void()> &&slot) |
void | freeze_notify () |
void | thaw_notify () |
virtual void | reference () const |
virtual void | unreference () const |
GObject * | gobj () |
const GObject * | gobj () const |
GObject * | gobj_copy () const |
![]() | |
trackable () noexcept | |
trackable (const trackable &src) noexcept | |
trackable (trackable &&src) noexcept | |
~trackable () | |
void | add_destroy_notify_callback (notifiable *data, func_destroy_notify func) const |
void | notify_callbacks () |
trackable & | operator= (const trackable &src) |
trackable & | operator= (trackable &&src) noexcept |
void | remove_destroy_notify_callback (notifiable *data) const |
Static Public Member Functions | |
static GType | get_type () |
Get the GType for this class, for use with the underlying GObject type system. More... | |
static Glib::RefPtr< FileDialog > | create () |
Protected Member Functions | |
FileDialog () | |
![]() | |
Object () | |
Object (const Glib::ConstructParams &construct_params) | |
Object (GObject *castitem) | |
~Object () noexcept override | |
![]() | |
ObjectBase () | |
ObjectBase (const char *custom_type_name) | |
ObjectBase (const std::type_info &custom_type_info) | |
ObjectBase (ObjectBase &&src) noexcept | |
ObjectBase & | operator= (ObjectBase &&src) noexcept |
virtual | ~ObjectBase () noexcept=0 |
void | initialize (GObject *castitem) |
void | initialize_move (GObject *castitem, Glib::ObjectBase *previous_wrapper) |
Related Functions | |
(Note that these are not member functions.) | |
Glib::RefPtr< Gtk::FileDialog > | wrap (GtkFileDialog * object, bool take_copy=false) |
A Glib::wrap() method for this object. More... | |
Additional Inherited Members | |
![]() | |
typedef void(*)(gpointer data | DestroyNotify) |
![]() | |
typedef internal::func_destroy_notify | func_destroy_notify |
![]() | |
typedef internal::func_destroy_notify | func_destroy_notify |
A Gtk::FileDialog object collects the arguments that are needed to present a file chooser dialog to the user, such as a title for the dialog and whether it should be modal.
The dialog is shown with open(), save(), etc. These APIs follow the GIO async pattern, and the result can be obtained by calling the corresponding finish function, for example open_finish().
|
noexcept |
|
overridenoexcept |
|
protected |
|
static |
Glib::RefPtr<FileFilter> Gtk::FileDialog::get_current_filter | ( | ) |
Gets the filter that will be selected by default in the file chooser dialog.
Glib::RefPtr<const FileFilter> Gtk::FileDialog::get_current_filter | ( | ) | const |
Gets the filter that will be selected by default in the file chooser dialog.
Glib::RefPtr<Gio::File> Gtk::FileDialog::get_current_folder | ( | ) |
Gets the folder that will be set as the initial folder in the file chooser dialog.
Glib::RefPtr<const Gio::File> Gtk::FileDialog::get_current_folder | ( | ) | const |
Gets the folder that will be set as the initial folder in the file chooser dialog.
Glib::RefPtr<Gio::ListModel> Gtk::FileDialog::get_filters | ( | ) |
Gets the filters that will be offered to the user in the file chooser dialog.
Gio::ListModel
of Gtk::FileFilters
. Glib::RefPtr<const Gio::ListModel> Gtk::FileDialog::get_filters | ( | ) | const |
Gets the filters that will be offered to the user in the file chooser dialog.
Gio::ListModel
of Gtk::FileFilters
. bool Gtk::FileDialog::get_modal | ( | ) | const |
Returns whether the file chooser dialog blocks interaction with the parent window while it is presented.
true
if the file chooser dialog is modal. Glib::RefPtr<Gio::ListModel> Gtk::FileDialog::get_shortcut_folders | ( | ) |
Gets the shortcut folders that will be available to the user in the file chooser dialog.
Gio::ListModel
of Files
. Glib::RefPtr<const Gio::ListModel> Gtk::FileDialog::get_shortcut_folders | ( | ) | const |
Gets the shortcut folders that will be available to the user in the file chooser dialog.
Gio::ListModel
of Files
. Glib::ustring Gtk::FileDialog::get_title | ( | ) | const |
Returns the title that will be shown on the file chooser dialog.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
GtkFileDialog* Gtk::FileDialog::gobj_copy | ( | ) |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
void Gtk::FileDialog::open | ( | const Gio::SlotAsyncReady & | slot, |
const Glib::RefPtr< Gio::File > & | current_file = {} , |
||
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
A open() convenience overload.
void Gtk::FileDialog::open | ( | Window & | parent, |
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::File > & | current_file = {} , |
||
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
This function initiates a file selection operation by presenting a file chooser dialog to the user.
If you pass current_file, the file chooser will initially be opened in the parent directory of that file, otherwise, it will be in the directory property_current_folder().
The slot will be called when the dialog is dismissed. It should call open_finish() to obtain the result.
parent | The parent Gtk::Window . |
current_file | The file to select initially. |
cancellable | A Cancellable to cancel the operation. |
slot | A callback to call when the operation is complete. |
Glib::RefPtr<Gio::File> Gtk::FileDialog::open_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) | const |
Finishes the open() call and returns the resulting file.
result | A Gio::AsyncResult . |
nullptr
is returned and error is set.Glib::Error |
void Gtk::FileDialog::open_multiple | ( | const Gio::SlotAsyncReady & | slot, |
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
A open_multiple() convenience overload.
void Gtk::FileDialog::open_multiple | ( | Window & | parent, |
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
This function initiates a multi-file selection operation by presenting a file chooser dialog to the user.
The file chooser will initially be opened in the directory property_current_folder().
The slot will be called when the dialog is dismissed. It should call open_multiple_finish() to obtain the result.
parent | The parent Gtk::Window . |
cancellable | A Cancellable to cancel the operation. |
slot | A callback to call when the operation is complete. |
Glib::RefPtr<Gio::ListModel> Gtk::FileDialog::open_multiple_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) | const |
Finishes the open() call and returns the resulting files in a Gio::ListModel
.
result | A Gio::AsyncResult . |
Gio::ListModel
of Files
. Otherwise, nullptr
is returned and error is set.Glib::Error |
|
noexcept |
Glib::PropertyProxy< Glib::RefPtr<FileFilter> > Gtk::FileDialog::property_current_filter | ( | ) |
The current filter, that is, the filter that is initially active in the file chooser dialog.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<FileFilter> > Gtk::FileDialog::property_current_filter | ( | ) | const |
The current filter, that is, the filter that is initially active in the file chooser dialog.
Glib::PropertyProxy< Glib::RefPtr<Gio::File> > Gtk::FileDialog::property_current_folder | ( | ) |
The current folder, that is, the directory that is initially opened in the file chooser dialog, unless overridden by parameters of the async call.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::File> > Gtk::FileDialog::property_current_folder | ( | ) | const |
The current folder, that is, the directory that is initially opened in the file chooser dialog, unless overridden by parameters of the async call.
Glib::PropertyProxy< Glib::RefPtr<Gio::ListModel> > Gtk::FileDialog::property_filters | ( | ) |
The list of filters.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::ListModel> > Gtk::FileDialog::property_filters | ( | ) | const |
The list of filters.
Glib::PropertyProxy< bool > Gtk::FileDialog::property_modal | ( | ) |
Whether the file chooser dialog is modal.
Default value: true
Glib::PropertyProxy_ReadOnly< bool > Gtk::FileDialog::property_modal | ( | ) | const |
Whether the file chooser dialog is modal.
Default value: true
Glib::PropertyProxy< Glib::RefPtr<Gio::ListModel> > Gtk::FileDialog::property_shortcut_folders | ( | ) |
The list of shortcut folders.
Glib::PropertyProxy_ReadOnly< Glib::RefPtr<Gio::ListModel> > Gtk::FileDialog::property_shortcut_folders | ( | ) | const |
The list of shortcut folders.
Glib::PropertyProxy< Glib::ustring > Gtk::FileDialog::property_title | ( | ) |
A title that may be shown on the file chooser dialog.
Default value: ""
Glib::PropertyProxy_ReadOnly< Glib::ustring > Gtk::FileDialog::property_title | ( | ) | const |
A title that may be shown on the file chooser dialog.
Default value: ""
void Gtk::FileDialog::save | ( | const Gio::SlotAsyncReady & | slot, |
const Glib::RefPtr< Gio::File > & | current_file = {} , |
||
const std::string & | current_name = {} , |
||
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
A save() convenience overload.
void Gtk::FileDialog::save | ( | Window & | parent, |
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::File > & | current_file = {} , |
||
const std::string & | current_name = {} , |
||
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
This function initiates a file save operation by presenting a file chooser dialog to the user.
You should pass either current_file if you have a file to save to, or current_name, if you are creating a new file.
If you pass current_file, the file chooser will initially be opened in the parent directory of that file, otherwise, it will be in the directory property_current_folder().
The slot will be called when the dialog is dismissed. It should call save_finish() to obtain the result.
parent | The parent Gtk::Window . |
current_file | The initial file. |
current_name | The initial filename to offer. |
cancellable | A Cancellable to cancel the operation. |
slot | A callback to call when the operation is complete. |
Glib::RefPtr<Gio::File> Gtk::FileDialog::save_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) | const |
Finishes the save() call and returns the resulting file.
result | A Gio::AsyncResult . |
nullptr
is returned and error is set.Glib::Error |
void Gtk::FileDialog::select_folder | ( | const Gio::SlotAsyncReady & | slot, |
const Glib::RefPtr< Gio::File > & | current_folder = {} , |
||
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
A select_folder() convenience overload.
void Gtk::FileDialog::select_folder | ( | Window & | parent, |
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::File > & | current_folder = {} , |
||
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
This function initiates a directory selection operation by presenting a file chooser dialog to the user.
If you pass current_folder, the file chooser will initially be opened in the parent directory of that folder, otherwise, it will be in the directory property_current_folder().
The slot will be called when the dialog is dismissed. It should call select_folder_finish() to obtain the result.
parent | The parent Gtk::Window . |
current_folder | The folder to select initially. |
cancellable | A Cancellable to cancel the operation. |
slot | A callback to call when the operation is complete. |
Glib::RefPtr<Gio::File> Gtk::FileDialog::select_folder_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) | const |
Finishes the select_folder() call and returns the resulting file.
result | A Gio::AsyncResult . |
nullptr
is returned and error is set.Glib::Error |
void Gtk::FileDialog::select_multiple_folders | ( | const Gio::SlotAsyncReady & | slot, |
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
A select_multiple_folders() convenience overload.
void Gtk::FileDialog::select_multiple_folders | ( | Window & | parent, |
const Gio::SlotAsyncReady & | slot, | ||
const Glib::RefPtr< Gio::Cancellable > & | cancellable = {} |
||
) | const |
This function initiates a multi-directory selection operation by presenting a file chooser dialog to the user.
The file chooser will initially be opened in the directory property_current_folder().
The slot will be called when the dialog is dismissed. It should call select_multiple_folders_finish() to obtain the result.
parent | The parent Gtk::Window . |
cancellable | A Cancellable to cancel the operation. |
slot | A callback to call when the operation is complete. |
Glib::RefPtr<Gio::ListModel> Gtk::FileDialog::select_multiple_folders_finish | ( | const Glib::RefPtr< Gio::AsyncResult > & | result | ) | const |
Finishes the select_multiple_folders() call and returns the resulting files in a Gio::ListModel
.
result | A Gio::AsyncResult . |
Gio::ListModel
of Files
. Otherwise, nullptr
is returned and error is set.Glib::Error |
void Gtk::FileDialog::set_current_filter | ( | const Glib::RefPtr< FileFilter > & | filter | ) |
Sets the filters that will be selected by default in the file chooser dialog.
filter | A Gtk::FileFilter . |
void Gtk::FileDialog::set_current_folder | ( | const Glib::RefPtr< Gio::File > & | folder | ) |
Sets the folder that will be set as the initial folder in the file chooser dialog, unless overridden by parameters of the async call.
folder | A Gio::File . |
void Gtk::FileDialog::set_filters | ( | const Glib::RefPtr< Gio::ListModel > & | filters | ) |
Sets the filters that will be offered to the user in the file chooser dialog.
filters | A Gio::ListModel of Gtk::FileFilters . |
void Gtk::FileDialog::set_modal | ( | bool | modal = true | ) |
Sets whether the file chooser dialog blocks interaction with the parent window while it is presented.
modal | The new value. |
void Gtk::FileDialog::set_shortcut_folders | ( | const Glib::RefPtr< Gio::ListModel > & | shortcut_folders | ) |
Sets the shortcut folders that will be available to the user in the file chooser dialog.
shortcut_folders | A Gio::ListModel of Files . |
void Gtk::FileDialog::set_title | ( | const Glib::ustring & | title | ) |
Sets the title that will be shown on the file chooser dialog.
title | The new title. |
|
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. |