summaryrefslogtreecommitdiff
path: root/adw/src/switchrow.cpp
blob: 010c133c7ea271baf305b5ed1153ddc7c4f8cd14 (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
#include "adwaitamm/switchrow.hpp"

#include "adwaitamm/actionrow.hpp"
#include "adwaitamm/private/switchrow_p.hpp"

#include <glibmm/class.h>
#include <glibmm/object.h>
#include <glibmm/objectbase.h>
#include <glibmm/propertyproxy.h>
#include <glibmm/refptr.h>
#include <glibmm/wrap.h>

#include <gtkmm/object.h>

#include <adwaita.h>
#include <gio/gio.h>
#include <glib-object.h>

namespace Adwaita
{
  namespace
  {
    auto constinit _class = SwitchRow_Class{};
  }  // namespace

  SwitchRow::SwitchRow()
      : Glib::ObjectBase{nullptr}
      , ActionRow{Glib::ConstructParams{_class.init()}}
  {
  }

  auto SwitchRow::get_type() -> GType
  {
    return _class.init().get_type();
  }

  auto SwitchRow::get_base_type() -> GType
  {
    return adw_switch_row_get_type();
  }

  SwitchRow::SwitchRow(Glib::ConstructParams const & params)
      : ActionRow{params}
  {
  }

  SwitchRow::SwitchRow(BaseObjectType * gobj)
      : ActionRow(ADW_ACTION_ROW(gobj))
  {
  }

  auto SwitchRow::get_active() const noexcept -> bool
  {
    return adw_switch_row_get_active(const_cast<BaseObjectType *>(unwrap(this)));
  }

  auto SwitchRow::set_active(bool value) noexcept -> void
  {
    adw_switch_row_set_active(unwrap(this), value);
  }

  auto SwitchRow::property_active() -> Glib::PropertyProxy<bool>
  {
    return Glib::PropertyProxy<bool>{this, "active"};
  }

  auto SwitchRow::property_active() const -> Glib::PropertyProxy_ReadOnly<bool>
  {
    return Glib::PropertyProxy_ReadOnly<bool>{this, "active"};
  }

}  // namespace Adwaita

namespace Glib
{
  auto wrap(AdwSwitchRow * object, bool copy) -> Adwaita::SwitchRow *
  {
    return dynamic_cast<Adwaita::SwitchRow *>(Glib::wrap_auto(G_OBJECT(object), copy));
  }
}  // namespace Glib