diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-04-04 16:31:38 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-04-04 16:31:38 +0200 |
| commit | 67c561efbeaa26131258c41b208f1890cb4865c5 (patch) | |
| tree | 9fbb1be4094a05c371c5c6977dae733a6b4758fb /adw/include/adwaitamm | |
| parent | b6d9a37966e34db8b5217a7e5466b2660f43a4ba (diff) | |
| download | turns-67c561efbeaa26131258c41b208f1890cb4865c5.tar.xz turns-67c561efbeaa26131258c41b208f1890cb4865c5.zip | |
adw: implement required AlertDialog functions
Diffstat (limited to 'adw/include/adwaitamm')
| -rw-r--r-- | adw/include/adwaitamm/alertdialog.hpp | 20 | ||||
| -rw-r--r-- | adw/include/adwaitamm/helpers/async_callback.hpp | 15 |
2 files changed, 33 insertions, 2 deletions
diff --git a/adw/include/adwaitamm/alertdialog.hpp b/adw/include/adwaitamm/alertdialog.hpp index 9da8488..8608cc6 100644 --- a/adw/include/adwaitamm/alertdialog.hpp +++ b/adw/include/adwaitamm/alertdialog.hpp @@ -10,6 +10,9 @@ #include <glibmm/refptr.h> #include <glibmm/ustring.h> +#include <giomm/asyncresult.h> +#include <giomm/cancellable.h> + #include <gtkmm/widget.h> #include <glib-object.h> @@ -19,8 +22,6 @@ using AdwAlertDialogClass = struct _AdwAlertDialogClass; namespace Adwaita { - struct Dialog_Class; - struct AlertDialog : Dialog, helpers::gobj_mixin<AlertDialog, AdwAlertDialog> { @@ -37,6 +38,13 @@ namespace Adwaita auto static wrap_new(GObject * object) -> Glib::ObjectBase *; }; + enum struct ResponseAppearance : int + { + _default, + suggested, + destructive, + }; + using BaseObjectType = Class::BaseObjectType; using BaseClassType = Class::BaseClassType; using CppObjectType = Class::CppObjectType; @@ -52,9 +60,17 @@ namespace Adwaita auto operator=(AlertDialog const & other) noexcept -> AlertDialog & = delete; auto operator=(AlertDialog && other) noexcept -> AlertDialog & = default; + auto static create(Glib::ustring heading, Glib::ustring body) -> Glib::RefPtr<AlertDialog>; auto static get_type() -> GType; auto static get_base_type() -> GType; + auto add_response(Glib::ustring id, Glib::ustring label) -> void; + auto choose(Gtk::Widget & parent, Glib::RefPtr<Gio::Cancellable> const & cancellable, Gio::SlotAsyncReady const & slot) -> void; + auto choose_finish(Glib::RefPtr<Gio::AsyncResult> const & result) -> Glib::ustring; + auto set_close_response(Glib::ustring id) -> void; + auto set_default_response(Glib::ustring id) -> void; + auto set_response_appearance(Glib::ustring id, ResponseAppearance value) -> void; + protected: explicit AlertDialog(Glib::ConstructParams const & params); explicit AlertDialog(BaseObjectType * gobj); diff --git a/adw/include/adwaitamm/helpers/async_callback.hpp b/adw/include/adwaitamm/helpers/async_callback.hpp new file mode 100644 index 0000000..e352359 --- /dev/null +++ b/adw/include/adwaitamm/helpers/async_callback.hpp @@ -0,0 +1,15 @@ +#ifndef LIBADWAITAMM_HELPERS_ASYNC_CALLBACK_HPP +#define LIBADWAITAMM_HELPERS_ASYNC_CALLBACK_HPP + +#include <glibmm/object.h> + +#include <giomm/asyncresult.h> + +namespace Adwaita::helpers +{ + + auto async_callback(GObject *, GAsyncResult * result, void * data) noexcept -> void; + +} // namespace Adwaita::helpers + +#endif
\ No newline at end of file |
