// Generated by gmmproc 2.82.0 -- DO NOT MODIFY! #ifndef _GTKMM_FILEDIALOG_H #define _GTKMM_FILEDIALOG_H #include #include #include /* Copyright (C) 2022 The gtkmm Development Team * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see . */ #include #include #include #include #include #include #include #ifndef DOXYGEN_SHOULD_SKIP_THIS #endif /* DOXYGEN_SHOULD_SKIP_THIS */ #ifndef DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { class GTKMM_API FileDialog_Class; } // namespace Gtk #endif //DOXYGEN_SHOULD_SKIP_THIS namespace Gtk { class Window; /** 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(). * * @ingroup Dialogs * @newin{4,10} */ class GTKMM_API FileDialog : public Glib::Object { #ifndef DOXYGEN_SHOULD_SKIP_THIS public: using CppObjectType = FileDialog; using CppClassType = FileDialog_Class; using BaseObjectType = GtkFileDialog; using BaseClassType = GtkFileDialogClass; // noncopyable FileDialog(const FileDialog&) = delete; FileDialog& operator=(const FileDialog&) = delete; private: friend class FileDialog_Class; static CppClassType filedialog_class_; protected: explicit FileDialog(const Glib::ConstructParams& construct_params); explicit FileDialog(GtkFileDialog* castitem); #endif /* DOXYGEN_SHOULD_SKIP_THIS */ public: FileDialog(FileDialog&& src) noexcept; FileDialog& operator=(FileDialog&& src) noexcept; ~FileDialog() noexcept override; /** Get the GType for this class, for use with the underlying GObject type system. */ static GType get_type() G_GNUC_CONST; #ifndef DOXYGEN_SHOULD_SKIP_THIS static GType get_base_type() G_GNUC_CONST; #endif ///Provides access to the underlying C GObject. GtkFileDialog* gobj() { return reinterpret_cast(gobject_); } ///Provides access to the underlying C GObject. const GtkFileDialog* gobj() const { return reinterpret_cast(gobject_); } ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. GtkFileDialog* gobj_copy(); private: protected: FileDialog(); public: static Glib::RefPtr create(); /** Returns the title that will be shown on the * file chooser dialog. * * @newin{4,10} * * @return The title. */ Glib::ustring get_title() const; /** Sets the title that will be shown on the * file chooser dialog. * * @newin{4,10} * * @param title The new title. */ void set_title(const Glib::ustring& title); /** Returns whether the file chooser dialog * blocks interaction with the parent window * while it is presented. * * @newin{4,10} * * @return true if the file chooser dialog is modal. */ bool get_modal() const; /** Sets whether the file chooser dialog * blocks interaction with the parent window * while it is presented. * * @newin{4,10} * * @param modal The new value. */ void set_modal(bool modal = true); /** Gets the filters that will be offered to the user * in the file chooser dialog. * * @newin{4,10} * * @return The filters, as * a `Gio::ListModel` of `Gtk::FileFilters`. */ Glib::RefPtr get_filters(); /** Gets the filters that will be offered to the user * in the file chooser dialog. * * @newin{4,10} * * @return The filters, as * a `Gio::ListModel` of `Gtk::FileFilters`. */ Glib::RefPtr get_filters() const; /** Sets the filters that will be offered to the user * in the file chooser dialog. * * @newin{4,10} * * @param filters A `Gio::ListModel` of `Gtk::FileFilters`. */ void set_filters(const Glib::RefPtr& filters); /** Gets the filter that will be selected by default * in the file chooser dialog. * * @newin{4,10} * * @return The current filter. */ Glib::RefPtr get_default_filter(); /** Gets the filter that will be selected by default * in the file chooser dialog. * * @newin{4,10} * * @return The current filter. */ Glib::RefPtr get_default_filter() const; /** Sets the filter that will be selected by default * in the file chooser dialog. * * If set to nullptr, the first item in property_filters() * will be used as the default filter. If that list is empty, the dialog * will be unfiltered. * * @newin{4,10} * * @param filter A `Gtk::FileFilter`. */ void set_default_filter(const Glib::RefPtr& filter); /** Gets the folder that will be set as the * initial folder in the file chooser dialog. * * @newin{4,10} * * @return The folder. */ Glib::RefPtr get_initial_folder(); /** Gets the folder that will be set as the * initial folder in the file chooser dialog. * * @newin{4,10} * * @return The folder. */ Glib::RefPtr get_initial_folder() const; /** Sets the folder that will be set as the * initial folder in the file chooser dialog. * * @newin{4,10} * * @param folder A `Gio::File`. */ void set_initial_folder(const Glib::RefPtr& folder); /** Gets the name for the file that should be initially set. * * @newin{4,10} * * @return The name. */ std::string get_initial_name() const; /** Sets the name for the file that should be initially set. * For saving dialogs, this will usually be pre-entered into the name field. * * If a file with this name already exists in the directory set via * property_initial_folder(), the dialog should preselect it. * * @newin{4,10} * * @param name A UTF8 string. */ void set_initial_name(const std::string& name); /** Gets the file that will be initially selected in * the file chooser dialog. * * @newin{4,10} * * @return The file. */ Glib::RefPtr get_initial_file(); /** Gets the file that will be initially selected in * the file chooser dialog. * * @newin{4,10} * * @return The file. */ Glib::RefPtr get_initial_file() const; /** Sets the file that will be initially selected in * the file chooser dialog. * * This function is a shortcut for calling both * set_initial_folder() and * set_initial_name() with the directory and * name of @a file respectively. * * @newin{4,10} * * @param file A `Gio::File`. */ void set_initial_file(const Glib::RefPtr& file); /** Retrieves the text used by the dialog on its accept button. * * @newin{4,10} * * @return The label shown on the file chooser's accept button. */ Glib::ustring get_accept_label() const; /** Sets the label shown on the file chooser's accept button. * * Leaving the accept label unset or setting it as nullptr will fall back to * a default label, depending on what API is used to launch the file dialog. * * @newin{4,10} * * @param accept_label The new accept label. */ void set_accept_label(const Glib::ustring& accept_label); /** This function initiates a file selection operation by * presenting a file chooser dialog to the user. * * The @a slot will be called when the dialog is dismissed. * * @newin{4,10} * * @param parent The parent `Gtk::Window`. * @param cancellable A `Cancellable` to cancel the operation. * @param slot A callback to call when the * operation is complete. */ void open(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /// A open() convenience overload. void open(const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /** Finishes the open() call and * returns the resulting file. * * @newin{4,10} * * @param result A `Gio::AsyncResult`. * @return The file that was selected. * Otherwise, nullptr is returned and @a error is set. * * @throws Gtk::DialogError */ Glib::RefPtr open_finish(const Glib::RefPtr& result); /** This function initiates a directory selection operation by * presenting a file chooser dialog to the user. * * If you pass @a initial_folder, the file chooser will initially be * opened in the parent directory of that folder, otherwise, it * will be in the directory property_initial_folder(). * * The @a slot will be called when the dialog is dismissed. * * @newin{4,10} * * @param parent The parent `Gtk::Window`. * @param cancellable A `Cancellable` to cancel the operation. * @param slot A callback to call when the * operation is complete. */ void select_folder(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /// A select_folder() convenience overload. void select_folder(const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /** Finishes the select_folder() call and * returns the resulting file. * * @newin{4,10} * * @param result A `Gio::AsyncResult`. * @return The file that was selected. * Otherwise, nullptr is returned and @a error is set. * * @throws Gtk::DialogError */ Glib::RefPtr select_folder_finish(const Glib::RefPtr& result); /** This function initiates a file save operation by * presenting a file chooser dialog to the user. * * The @a slot will be called when the dialog is dismissed. * * @newin{4,10} * * @param parent The parent `Gtk::Window`. * @param cancellable A `Cancellable` to cancel the operation. * @param slot A callback to call when the * operation is complete. */ void save(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /// A save() convenience overload. void save(const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /** Finishes the save() call and * returns the resulting file. * * @newin{4,10} * * @param result A `Gio::AsyncResult`. * @return The file that was selected. * Otherwise, nullptr is returned and @a error is set. * * @throws Gtk::DialogError */ Glib::RefPtr save_finish(const Glib::RefPtr& result); /** 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_initial_folder(). * * The @a slot will be called when the dialog is dismissed. * * @newin{4,10} * * @param parent The parent `Gtk::Window`. * @param cancellable A `Cancellable` to cancel the operation. * @param slot A callback to call when the * operation is complete. */ void open_multiple(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /// A open_multiple() convenience overload. void open_multiple(const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /** Finishes the open_multiple() call and * returns the resulting files in a std::vector. * * @newin{4,10} * * @param result A `Gio::AsyncResult`. * @return The files that were selected, as a vector of `Gio::File`s. * Otherwise, an exception is thrown. * * @throws Gtk::DialogError */ std::vector> open_multiple_finish(const Glib::RefPtr& result); /** 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_initial_folder(). * * The @a slot will be called when the dialog is dismissed. * * @newin{4,10} * * @param parent The parent `Gtk::Window`. * @param cancellable A `Cancellable` to cancel the operation. * @param slot A callback to call when the * operation is complete. */ void select_multiple_folders(Window& parent, const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /// A select_multiple_folders() convenience overload. void select_multiple_folders(const Gio::SlotAsyncReady& slot, const Glib::RefPtr& cancellable = {}); /** Finishes the select_multiple_folders() * call and returns the resulting files in a std::vector. * * @newin{4,10} * * @param result A Gio::AsyncResult. * @return The files that were selected, as a vector of `Gio::File`s. * Otherwise, an exception is thrown. * * @throws Gtk::DialogError */ std::vector> select_multiple_folders_finish(const Glib::RefPtr& result); /** A title that may be shown on the file chooser dialog. * * @newin{4,10} * * Default value: "" * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< Glib::ustring > property_title() ; /** A title that may be shown on the file chooser dialog. * * @newin{4,10} * * Default value: "" * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::ustring > property_title() const; /** Whether the file chooser dialog is modal. * * @newin{4,10} * * Default value: true * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< bool > property_modal() ; /** Whether the file chooser dialog is modal. * * @newin{4,10} * * Default value: true * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< bool > property_modal() const; /** The list of filters. * * See property_default_filter() about how those two properties interact. * * @newin{4,10} * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< Glib::RefPtr > property_filters() ; /** The list of filters. * * See property_default_filter() about how those two properties interact. * * @newin{4,10} * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_filters() const; /** The default filter, that is, the filter that is initially * active in the file chooser dialog. * * If the default filter is nullptr, the first filter of property_filters() * is used as the default filter. If that property contains no filter, the dialog will * be unfiltered. * * If property_filters() is not nullptr, the default filter should be part * of the list. If it is not, the dialog may choose to not make it available. * * @newin{4,10} * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< Glib::RefPtr > property_default_filter() ; /** The default filter, that is, the filter that is initially * active in the file chooser dialog. * * If the default filter is nullptr, the first filter of property_filters() * is used as the default filter. If that property contains no filter, the dialog will * be unfiltered. * * If property_filters() is not nullptr, the default filter should be part * of the list. If it is not, the dialog may choose to not make it available. * * @newin{4,10} * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_default_filter() const; /** The initial file, that is, the file that is initially selected * in the file chooser dialog * * This is a utility property that sets both property_initial_folder() and * property_initial_name(). * * @newin{4,10} * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< Glib::RefPtr > property_initial_file() ; /** The initial file, that is, the file that is initially selected * in the file chooser dialog * * This is a utility property that sets both property_initial_folder() and * property_initial_name(). * * @newin{4,10} * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_initial_file() const; /** The initial folder, that is, the directory that is initially * opened in the file chooser dialog * * @newin{4,10} * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< Glib::RefPtr > property_initial_folder() ; /** The initial folder, that is, the directory that is initially * opened in the file chooser dialog * * @newin{4,10} * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::RefPtr > property_initial_folder() const; /** The initial name, that is, the filename that is initially * selected in the file chooser dialog. * * @newin{4,10} * * Default value: "" * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< std::string > property_initial_name() ; /** The initial name, that is, the filename that is initially * selected in the file chooser dialog. * * @newin{4,10} * * Default value: "" * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< std::string > property_initial_name() const; /** Label for the file chooser's accept button. * * @newin{4,10} * * Default value: "" * * @return A PropertyProxy that allows you to get or set the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy< Glib::ustring > property_accept_label() ; /** Label for the file chooser's accept button. * * @newin{4,10} * * Default value: "" * * @return A PropertyProxy_ReadOnly that allows you to get the value of the property, * or receive notification when the value of the property changes. */ Glib::PropertyProxy_ReadOnly< Glib::ustring > property_accept_label() const; public: public: //C++ methods used to invoke GTK+ virtual functions: protected: //GTK+ Virtual Functions (override these to change behaviour): //Default Signal Handlers:: }; } // namespace Gtk namespace Glib { /** A Glib::wrap() method for this object. * * @param object The C instance. * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref. * @result A C++ instance that wraps this C instance. * * @relates Gtk::FileDialog */ GTKMM_API Glib::RefPtr wrap(GtkFileDialog* object, bool take_copy = false); } #endif /* _GTKMM_FILEDIALOG_H */