summaryrefslogtreecommitdiff
path: root/adw/src/preferencesrow.cpp
blob: a6f53688c9f84e42719373620245e558ca1d46f3 (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
#include "turns/adw/preferencesrow.hpp"

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

#include <gtkmm/init.h>
#include <gtkmm/listboxrow.h>
#include <gtkmm/object.h>
#include <gtkmm/private/listboxrow_p.h>

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

namespace turns::adw
{
  namespace
  {
    auto constinit _class = PreferencesRow::Class{};
  }  // namespace

  auto PreferencesRow::Class::init() -> Glib::Class const &
  {
    if (!gtype_)
    {
      class_init_func_ = &class_init_function;
      register_derived_type(adw_preferences_row_get_type());
    }
    return *this;
  }

  auto PreferencesRow::Class::class_init_function(void * gclass, void * data) -> void
  {
    auto const klass = static_cast<BaseClassType *>(gclass);
    CppClassParent::class_init_function(klass, data);
  }

  auto PreferencesRow::Class::wrap_new(GObject * object) -> Glib::ObjectBase *
  {
    return Gtk::manage(new PreferencesRow(ADW_PREFERENCES_ROW(object)));
  }

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

  auto PreferencesRow::get_base_type() -> GType
  {
    return adw_preferences_row_get_type();
  }

  PreferencesRow::PreferencesRow()
      : Glib::ObjectBase{nullptr}
      , Gtk::ListBoxRow{Glib::ConstructParams{_class.init()}}
  {
  }

  auto PreferencesRow::set_title(Glib::ustring const & title) -> CppObjectType &
  {
    adw_preferences_row_set_title(Glib::unwrap(this), title.c_str());
    return *this;
  }

  auto PreferencesRow::set_title_selectable(bool selectable) noexcept -> CppObjectType &
  {
    adw_preferences_row_set_title_selectable(Glib::unwrap(this), selectable);
    return *this;
  }

  auto PreferencesRow::set_use_markup(bool use) noexcept -> CppObjectType &
  {
    adw_preferences_row_set_use_markup(Glib::unwrap(this), use);
    return *this;
  }

  auto PreferencesRow::set_use_underline(bool use) noexcept -> CppObjectType &
  {
    adw_preferences_row_set_use_underline(Glib::unwrap(this), use);
    return *this;
  }

  PreferencesRow::PreferencesRow(Glib::ConstructParams const & params)
      : Gtk::ListBoxRow{params}
  {
  }

  PreferencesRow::PreferencesRow(BaseObjectType * gobj)
      : Gtk::ListBoxRow(GTK_LIST_BOX_ROW(gobj))
  {
  }

}  // namespace turns::adw

namespace Glib
{
  auto wrap(AdwPreferencesRow * object, bool copy) -> turns::adw::PreferencesRow *
  {
    return dynamic_cast<turns::adw::PreferencesRow *>(Glib::wrap_auto(G_OBJECT(object), copy));
  }
}  // namespace Glib