diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-04-28 14:01:30 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-04-28 14:01:30 +0200 |
| commit | 29eb802f09da07421099238eceaee9e3b1d61ff2 (patch) | |
| tree | d07784be13475237d58f65033959c1e27e6245c0 /adw/src/toast.cpp | |
| parent | dff2f80ddc8f742b8181409d6feeca33e856112e (diff) | |
| download | turns-29eb802f09da07421099238eceaee9e3b1d61ff2.tar.xz turns-29eb802f09da07421099238eceaee9e3b1d61ff2.zip | |
adw: extract libadwaitamm
Diffstat (limited to 'adw/src/toast.cpp')
| -rw-r--r-- | adw/src/toast.cpp | 262 |
1 files changed, 0 insertions, 262 deletions
diff --git a/adw/src/toast.cpp b/adw/src/toast.cpp deleted file mode 100644 index 0a95b09..0000000 --- a/adw/src/toast.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/** - * @author Felix Morgner (felix.morgner@gmail.com) - * @copyright Copyright (c) 2025 - * SPDX-License-Identifier: LGPL-2.1-or-later - */ - -#include "adwaitamm/toast.hpp" - -#include "adwaitamm/enums.hpp" -#include "adwaitamm/private/toast_p.hpp" - -#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/utility.h> -#include <glibmm/variant.h> -#include <glibmm/wrap.h> - -#include <gtkmm/widget.h> - -#include <glib-object.h> -#include <glib.h> - -namespace Adwaita -{ - namespace - { - auto constinit _class = Toast_Class{}; - - static const Glib::SignalProxyInfo Toast_signal_button_clicked_info = {"button-clicked", - (GCallback)&Glib::SignalProxyNormal::slot0_void_callback, - (GCallback)&Glib::SignalProxyNormal::slot0_void_callback}; - - static const Glib::SignalProxyInfo Toast_signal_dismissed_info = {"dismissed", - (GCallback)&Glib::SignalProxyNormal::slot0_void_callback, - (GCallback)&Glib::SignalProxyNormal::slot0_void_callback}; - - } // namespace - - Toast::Toast(Glib::ustring const & title) - : Glib::ObjectBase{nullptr} - , Glib::Object{Glib::ConstructParams{_class.init(), "title", Glib::c_str_or_nullptr(title), nullptr}} - { - } - - Toast::Toast(Glib::ConstructParams const & params) - : Glib::Object{params} - { - } - - Toast::Toast(BaseObjectType * gobj) - : Glib::Object((GObject *)gobj) - { - } - - auto Toast::create(Glib::ustring const & title) -> Glib::RefPtr<Toast> - { - return Glib::make_refptr_for_instance(new Toast{title}); - } - - auto Toast::get_type() -> GType - { - return _class.init().get_type(); - } - - auto Toast::get_base_type() -> GType - { - return adw_toast_get_type(); - } - - auto Toast::dismiss() -> void - { - return adw_toast_dismiss(gobj()); - } - - auto Toast::get_action_name() const -> Glib::ustring - { - return adw_toast_get_action_name(const_cast<BaseObjectType *>(Glib::unwrap(this))); - } - - auto Toast::get_action_target_value() const -> Glib::VariantBase - { - // Take a copy because the value is owned by the toast. - return Glib::wrap(adw_toast_get_action_target_value(const_cast<BaseObjectType *>(Glib::unwrap(this))), true); - } - - auto Toast::get_button_label() const -> Glib::ustring - { - return adw_toast_get_button_label(const_cast<BaseObjectType *>(Glib::unwrap(this))); - } - - auto Toast::get_custom_title() const -> Gtk::Widget * - { - return Glib::wrap(adw_toast_get_custom_title(const_cast<BaseObjectType *>(Glib::unwrap(this)))); - } - - auto Toast::get_priority() const -> ToastPriority - { - return static_cast<ToastPriority>(adw_toast_get_priority(const_cast<BaseObjectType *>(Glib::unwrap(this)))); - } - - auto Toast::get_timeout() const -> unsigned - { - return adw_toast_get_timeout(const_cast<BaseObjectType *>(Glib::unwrap(this))); - } - - auto Toast::get_title() const -> Glib::ustring - { - return adw_toast_get_title(const_cast<BaseObjectType *>(Glib::unwrap(this))); - } - - auto Toast::get_use_markup() const -> bool - { - return adw_toast_get_use_markup(const_cast<BaseObjectType *>(Glib::unwrap(this))); - } - - auto Toast::set_action_name(Glib::ustring value) -> void - { - adw_toast_set_action_name(Glib::unwrap(this), Glib::c_str_or_nullptr(value)); - } - - auto Toast::set_action_target_value(Glib::VariantBase const & value) -> void - { - adw_toast_set_action_target_value(Glib::unwrap(this), const_cast<GVariant *>(Glib::unwrap(&value))); - } - - auto Toast::set_button_label(Glib::ustring value) -> void - { - adw_toast_set_button_label(Glib::unwrap(this), Glib::c_str_or_nullptr(value)); - } - - auto Toast::set_custom_title(Gtk::Widget * value) -> void - { - adw_toast_set_custom_title(Glib::unwrap(this), Glib::unwrap(value)); - } - - auto Toast::set_detailed_action_name(Glib::ustring value) -> void - { - adw_toast_set_detailed_action_name(Glib::unwrap(this), Glib::c_str_or_nullptr(value)); - } - - auto Toast::set_priority(ToastPriority value) -> void - { - adw_toast_set_priority(Glib::unwrap(this), static_cast<AdwToastPriority>(value)); - } - - auto Toast::set_timeout(unsigned value) -> void - { - adw_toast_set_timeout(Glib::unwrap(this), value); - } - - auto Toast::set_title(Glib::ustring value) -> void - { - adw_toast_set_title(Glib::unwrap(this), Glib::c_str_or_nullptr(value)); - } - - auto Toast::set_use_markup(bool value) -> void - { - adw_toast_set_use_markup(Glib::unwrap(this), value); - } - - auto Toast::property_action_name() -> Glib::PropertyProxy<Glib::ustring> - { - return Glib::PropertyProxy<Glib::ustring>(this, "action-name"); - } - - auto Toast::property_action_name() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> - { - return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "action-name"); - } - - auto Toast::property_action_target() -> Glib::PropertyProxy<Glib::VariantBase> - { - return Glib::PropertyProxy<Glib::VariantBase>(this, "action-target"); - } - - auto Toast::property_action_target() const -> Glib::PropertyProxy_ReadOnly<Glib::VariantBase> - { - return Glib::PropertyProxy_ReadOnly<Glib::VariantBase>(this, "action-target"); - } - - auto Toast::property_button_label() -> Glib::PropertyProxy<Glib::ustring> - { - return Glib::PropertyProxy<Glib::ustring>(this, "button-label"); - } - - auto Toast::property_button_label() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> - { - return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "button-label"); - } - - auto Toast::property_custom_title() -> Glib::PropertyProxy<Gtk::Widget *> - { - return Glib::PropertyProxy<Gtk::Widget *>(this, "custom-title"); - } - - auto Toast::property_custom_title() const -> Glib::PropertyProxy_ReadOnly<Gtk::Widget *> - { - return Glib::PropertyProxy_ReadOnly<Gtk::Widget *>(this, "custom-title"); - } - - auto Toast::property_priority() -> Glib::PropertyProxy<ToastPriority> - { - return Glib::PropertyProxy<ToastPriority>(this, "priority"); - } - - auto Toast::property_priority() const -> Glib::PropertyProxy_ReadOnly<ToastPriority> - { - return Glib::PropertyProxy_ReadOnly<ToastPriority>(this, "priority"); - } - auto Toast::property_timeout() -> Glib::PropertyProxy<unsigned> - { - return Glib::PropertyProxy<unsigned>(this, "timeout"); - } - - auto Toast::property_timeout() const -> Glib::PropertyProxy_ReadOnly<unsigned> - { - return Glib::PropertyProxy_ReadOnly<unsigned>(this, "timeout"); - } - - auto Toast::property_title() -> Glib::PropertyProxy<Glib::ustring> - { - return Glib::PropertyProxy<Glib::ustring>(this, "title"); - } - - auto Toast::property_title() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring> - { - return Glib::PropertyProxy_ReadOnly<Glib::ustring>(this, "title"); - } - - auto Toast::property_use_markup() -> Glib::PropertyProxy<bool> - { - return Glib::PropertyProxy<bool>(this, "use-markup"); - } - - auto Toast::property_use_markup() const -> Glib::PropertyProxy_ReadOnly<bool> - { - return Glib::PropertyProxy_ReadOnly<bool>(this, "use-markup"); - } - - auto Toast::signal_button_clicked() -> Glib::SignalProxy<void()> - { - return Glib::SignalProxy<void()>{this, &Toast_signal_button_clicked_info}; - } - - auto Toast::signal_dismissed() -> Glib::SignalProxy<void()> - { - return Glib::SignalProxy<void()>{this, &Toast_signal_dismissed_info}; - } - -} // namespace Adwaita - -namespace Glib -{ - auto wrap(AdwToast * object, bool copy) -> Glib::RefPtr<Adwaita::Toast> - { - return Glib::make_refptr_for_instance<Adwaita::Toast>(dynamic_cast<Adwaita::Toast *>(Glib::wrap_auto(G_OBJECT(object), copy))); - } -} // namespace Glib
\ No newline at end of file |
