| 1 |
/* Copyright (C) 2017 The gtkmm Development Team |
| 2 |
* |
| 3 |
* This library is free software; you can redistribute it and/or |
| 4 |
* modify it under the terms of the GNU Lesser General Public |
| 5 |
* License as published by the Free Software Foundation; either |
| 6 |
* version 2.1 of the License, or (at your option) any later version. |
| 7 |
* |
| 8 |
* This library is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
* Lesser General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU Lesser General Public |
| 14 |
* License along with this library. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
_CONFIGINCLUDE(gtkmmconfig.h) |
| 18 |
|
| 19 |
#include <glibmm/object.h> |
| 20 |
|
| 21 |
_DEFS(gtkmm,gtk) |
| 22 |
_PINCLUDE(glibmm/private/object_p.h) |
| 23 |
|
| 24 |
namespace Gtk |
| 25 |
{ |
| 26 |
class GTKMM_API Window; |
| 27 |
|
| 28 |
/** Integrate with native dialogs. |
| 29 |
* |
| 30 |
* Native dialogs are platform dialogs that don't use Gtk::Dialog or |
| 31 |
* Gtk::Window. They are used in order to integrate better with a |
| 32 |
* platform, by looking the same as other native applications and |
| 33 |
* supporting platform specific features. |
| 34 |
* |
| 35 |
* The Gtk::Dialog functions cannot be used on such objects, but we |
| 36 |
* need a similar API in order to drive them. The %NativeDialog |
| 37 |
* object is an API that allows you to do this. It allows you to set |
| 38 |
* various common properties on the dialog, as well as show and hide |
| 39 |
* it and get a response signal when the user finished with the dialog. |
| 40 |
* |
| 41 |
* There is also a run() helper that makes it easy |
| 42 |
* to run any native dialog in a modal way with a recursive mainloop, |
| 43 |
* similar to Dialog::run(). |
| 44 |
* |
| 45 |
* @see Gtk::FileChooserNative, Gtk::Dialog |
| 46 |
* @newin{3,24} |
| 47 |
*/ |
| 48 |
class GTKMM_API NativeDialog : public Glib::Object |
| 49 |
{ |
| 50 |
_CLASS_GOBJECT(NativeDialog, GtkNativeDialog, GTK_NATIVE_DIALOG, Glib::Object, GObject, , , GTKMM_API) |
| 51 |
_IGNORE(gtk_native_dialog_destroy) |
| 52 |
|
| 53 |
protected: |
| 54 |
/** There is no create() method that corresponds to this constructor, |
| 55 |
* because only derived classes shall be created. |
| 56 |
*/ |
| 57 |
_CTOR_DEFAULT |
| 58 |
|
| 59 |
public: |
| 60 |
// No create() because only derived classes shall be instantiated. |
| 61 |
|
| 62 |
_WRAP_METHOD(void show(), gtk_native_dialog_show, newin "3,24") |
| 63 |
_WRAP_METHOD(void hide(), gtk_native_dialog_hide, newin "3,24") |
| 64 |
_WRAP_METHOD(bool get_visible() const, gtk_native_dialog_get_visible, newin "3,24") |
| 65 |
_WRAP_METHOD(void set_modal(bool modal = true), gtk_native_dialog_set_modal, newin "3,24") |
| 66 |
_WRAP_METHOD(bool get_modal() const, gtk_native_dialog_get_modal, newin "3,24") |
| 67 |
_WRAP_METHOD(void set_title(const Glib::ustring& title), gtk_native_dialog_set_title, newin "3,24") |
| 68 |
_WRAP_METHOD(Glib::ustring get_title() const, gtk_native_dialog_get_title, newin "3,24") |
| 69 |
|
| 70 |
_WRAP_METHOD(void set_transient_for(Window& parent), gtk_native_dialog_set_transient_for, newin "3,24") |
| 71 |
|
| 72 |
/** Unsets the current transient window. |
| 73 |
* @see set_transient_for(). |
| 74 |
* @newin{3,24} |
| 75 |
*/ |
| 76 |
void unset_transient_for(); |
| 77 |
|
| 78 |
_WRAP_METHOD(Window* get_transient_for(), gtk_native_dialog_get_transient_for, newin "3,24") |
| 79 |
_WRAP_METHOD(const Window* get_transient_for() const, gtk_native_dialog_get_transient_for, constversion, newin "3,24") |
| 80 |
|
| 81 |
_WRAP_METHOD(int run(), gtk_native_dialog_run, newin "3,24") |
| 82 |
|
| 83 |
_WRAP_PROPERTY("title", Glib::ustring, newin "3,24") |
| 84 |
_WRAP_PROPERTY("modal", bool, newin "3,24") |
| 85 |
_WRAP_PROPERTY("visible", bool, newin "3,24") |
| 86 |
_WRAP_PROPERTY("transient_for", Window*, newin "3,24") |
| 87 |
|
| 88 |
_WRAP_SIGNAL(void response(int response_id), "response", newin "3,24") |
| 89 |
}; |
| 90 |
|
| 91 |
} // namespace Gtk |