diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-04-03 18:41:43 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-04-03 18:41:43 +0200 |
| commit | ee599d7d62c16bb59603bedb62f03c01504a1893 (patch) | |
| tree | 8e371a4d211d56ea42b648c7cd1758568b27858b /adw/include/adwaitamm/toast.hpp | |
| parent | 6ff0bb23a71f334fe0ca86581cc86aaab2882003 (diff) | |
| download | turns-ee599d7d62c16bb59603bedb62f03c01504a1893.tar.xz turns-ee599d7d62c16bb59603bedb62f03c01504a1893.zip | |
adw: prepare files for extraction
Diffstat (limited to 'adw/include/adwaitamm/toast.hpp')
| -rw-r--r-- | adw/include/adwaitamm/toast.hpp | 111 |
1 files changed, 111 insertions, 0 deletions
diff --git a/adw/include/adwaitamm/toast.hpp b/adw/include/adwaitamm/toast.hpp new file mode 100644 index 0000000..88460f9 --- /dev/null +++ b/adw/include/adwaitamm/toast.hpp @@ -0,0 +1,111 @@ +#ifndef LIBADWAITAMM_TOAST_HPP +#define LIBADWAITAMM_TOAST_HPP + +#include "adwaitamm/helpers/gobj_mixin.hpp" +#include <sigc++/signal.h> + +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/propertyproxy.h> +#include <glibmm/refptr.h> +#include <glibmm/signalproxy.h> +#include <glibmm/ustring.h> +#include <glibmm/variant.h> + +#include <gtkmm/widget.h> + +#include <glib-object.h> + +#define _ADWAITA_INSIDE +#include <adw-toast.h> +#undef _ADWAITA_INSIDE + +using AdwToast = struct _AdwToast; + +namespace turns::adw +{ + struct Toast final : Glib::Object, + helpers::gobj_mixin<Toast, AdwToast> + { + struct Class : Glib::Class + { + using BaseClassParent = GObjectClass; + using BaseClassType = AdwToastClass; + using BaseObjectType = AdwToast; + using CppClassParent = struct Glib::Object_Class; + using CppObjectType = Toast; + + auto init() -> Glib::Class const &; + auto static class_init_function(void * gclass, void * data) -> void; + auto static wrap_new(GObject * object) -> Glib::ObjectBase *; + }; + + using BaseObjectType = Class::BaseObjectType; + using BaseClassType = Class::BaseClassType; + using CppObjectType = Class::CppObjectType; + using CppClassType = Class; + + enum class Priority + { + NORMAL, + HIGH, + }; + + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; + + Toast(Toast const & other) = delete; + Toast(Toast && other) noexcept = default; + + auto operator=(Toast const & other) noexcept -> Toast & = delete; + auto operator=(Toast && other) noexcept -> Toast & = default; + + auto static create(Glib::ustring const & title) -> Glib::RefPtr<Toast>; + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto dismiss() -> void; + auto get_action_name() const -> Glib::ustring; + auto get_action_target_value() const -> Glib::VariantBase; + auto get_button_label() const -> Glib::ustring; + auto get_custom_title() const -> Gtk::Widget *; + auto get_priority() const -> Priority; + auto get_timeout() const -> unsigned; + auto get_title() const -> Glib::ustring; + auto get_use_markup() const -> bool; + auto set_action_name(Glib::ustring value) -> void; + auto set_action_target_value(Glib::VariantBase const & value) -> void; + auto set_button_label(Glib::ustring value) -> void; + auto set_custom_title(Gtk::Widget * value) -> void; + auto set_detailed_action_name(Glib::ustring value) -> void; + auto set_priority(Priority value) -> void; + auto set_timeout(unsigned value) -> void; + auto set_title(Glib::ustring value) -> void; + auto set_use_markup(bool value) -> void; + + auto property_action_name() -> Glib::PropertyProxy<Glib::ustring>; + auto property_action_target() -> Glib::PropertyProxy<Glib::VariantBase>; + auto property_button_label() -> Glib::PropertyProxy<Glib::ustring>; + auto property_custom_title() -> Glib::PropertyProxy<Gtk::Widget *>; + auto property_priority() -> Glib::PropertyProxy<Priority>; + auto property_timeout() -> Glib::PropertyProxy<unsigned>; + auto property_title() -> Glib::PropertyProxy<Glib::ustring>; + auto property_use_markup() -> Glib::PropertyProxy<bool>; + + auto signal_button_clicked() -> Glib::SignalProxy<void()>; + auto signal_dismissed() -> Glib::SignalProxy<void()>; + + protected: + explicit Toast(Glib::ustring const & title); + explicit Toast(Glib::ConstructParams const & params); + explicit Toast(BaseObjectType * gobj); + }; + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwToast * object, bool copy = false) -> Glib::RefPtr<turns::adw::Toast>; +} // namespace Glib + +#endif
\ No newline at end of file |
