aboutsummaryrefslogtreecommitdiff
path: root/include/turns/adw/toast.hpp
blob: 83242c7c0df63f446b3a9af74c96a74128d22906 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef TURNS_ADW_TOAST_HPP
#define TURNS_ADW_TOAST_HPP

#include "turns/adw/helpers/gobj_mixin.hpp"
#include "turns/adw/helpers/properties.hpp"

#include <glibmm/object.h>
#include <glibmm/refptr.h>
#include <glibmm/ustring.h>
#include <glibmm/variant.h>

#include <gtkmm/widget.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;

    explicit Toast(Glib::ustring const & title);
    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 get_type() -> GType;
    auto static get_base_type() -> GType;

    auto dismiss() -> void;

    auto property_action_name(this auto && self);
    auto property_action_target(this auto && self);
    auto property_button_label(this auto && self);
    auto property_custom_title(this auto && self);
    auto property_priority(this auto && self);
    auto property_timeout(this auto && self);
    auto property_title(this auto && self);
    auto property_use_markup(this auto && self);

  protected:
    explicit Toast(Glib::ConstructParams const & params);
    explicit Toast(BaseObjectType * gobj);
  };

  auto Toast::property_action_name(this auto && self)
  {
    return helpers::make_property_proxy<Glib::ustring>(self, "action-name");
  }

  auto Toast::property_action_target(this auto && self)
  {
    return helpers::make_property_proxy<Glib::VariantBase>(self, "action-target");
  }

  auto Toast::property_button_label(this auto && self)
  {
    return helpers::make_property_proxy<Glib::ustring>(self, "button-label");
  }

  auto Toast::property_custom_title(this auto && self)
  {
    return helpers::make_property_proxy<Gtk::Widget *>(self, "custom-title");
  }

  auto Toast::property_priority(this auto && self)
  {
    return helpers::make_property_proxy<Priority>(self, "priority");
  }

  auto Toast::property_timeout(this auto && self)
  {
    return helpers::make_property_proxy<unsigned>(self, "timeout");
  }

  auto Toast::property_title(this auto && self)
  {
    return helpers::make_property_proxy<Glib::ustring>(self, "title");
  }

  auto Toast::property_use_markup(this auto && self)
  {
    return helpers::make_property_proxy<bool>(self, "use-markup");
  }

}  // namespace turns::adw

namespace Glib
{
  auto wrap(AdwToast * object, bool copy = false) -> Glib::RefPtr<turns::adw::Toast>;
}  // namespace Glib

#endif