diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2024-08-17 21:01:51 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2024-08-17 21:01:51 +0200 |
| commit | 33e61b16363a67a989acce1d3ca375637316b1df (patch) | |
| tree | 56c140aba25e6cb677e2ed0b7f6bed4ba8b5cb40 /adw/src | |
| parent | 3b807ac5a02b9c778661c280a348f73d61c821ba (diff) | |
| download | turns-33e61b16363a67a989acce1d3ca375637316b1df.tar.xz turns-33e61b16363a67a989acce1d3ca375637316b1df.zip | |
app: add skip-defeated preference
Diffstat (limited to 'adw/src')
| -rw-r--r-- | adw/src/switchrow.cpp | 72 | ||||
| -rw-r--r-- | adw/src/wrap_init.cpp | 3 |
2 files changed, 75 insertions, 0 deletions
diff --git a/adw/src/switchrow.cpp b/adw/src/switchrow.cpp new file mode 100644 index 0000000..8e9508d --- /dev/null +++ b/adw/src/switchrow.cpp @@ -0,0 +1,72 @@ +#include "turns/adw/switchrow.hpp" + +#include "turns/adw/actionrow.hpp" + +#include <glibmm/class.h> +#include <glibmm/object.h> +#include <glibmm/objectbase.h> +#include <glibmm/refptr.h> +#include <glibmm/wrap.h> + +#include <adwaita.h> +#include <gio/gio.h> +#include <glib-object.h> + +namespace turns::adw +{ + namespace + { + auto constinit _class = SwitchRow::Class{}; + } // namespace + + auto SwitchRow::Class::init() -> Glib::Class const & + { + if (!gtype_) + { + gtype_ = adw_switch_row_get_type(); + } + return *this; + } + + auto SwitchRow::Class::wrap_new(GObject * object) -> Glib::ObjectBase * + { + return new SwitchRow(ADW_SWITCH_ROW(object)); + } + + SwitchRow::SwitchRow() + : Glib::ObjectBase{nullptr} + , adw::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) + : adw::ActionRow{params} + { + } + + SwitchRow::SwitchRow(BaseObjectType * gobj) + : Glib::ObjectBase{nullptr} + , adw::ActionRow(ADW_ACTION_ROW(gobj)) + { + } + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwSwitchRow * object, bool copy) -> Glib::RefPtr<turns::adw::SwitchRow> + { + return Glib::make_refptr_for_instance<turns::adw::SwitchRow>( + dynamic_cast<turns::adw::SwitchRow *>(Glib::wrap_auto(G_OBJECT(object), copy))); + } +} // namespace Glib
\ No newline at end of file diff --git a/adw/src/wrap_init.cpp b/adw/src/wrap_init.cpp index 6998f90..f77dacd 100644 --- a/adw/src/wrap_init.cpp +++ b/adw/src/wrap_init.cpp @@ -6,6 +6,7 @@ #include "turns/adw/preferencesdialog.hpp" #include "turns/adw/preferencespage.hpp" #include "turns/adw/preferencesrow.hpp" +#include "turns/adw/switchrow.hpp" #include "turns/adw/toast.hpp" #include "turns/adw/toastoverlay.hpp" @@ -30,6 +31,7 @@ namespace turns::adw WRAP_CLASS(PreferencesDialog, preferences_dialog); WRAP_CLASS(PreferencesPage, preferences_page); WRAP_CLASS(PreferencesRow, preferences_row); + WRAP_CLASS(SwitchRow, switch_row); WRAP_CLASS(ToastOverlay, toast_overlay); ENSURE_TYPE(ActionRow); @@ -39,6 +41,7 @@ namespace turns::adw ENSURE_TYPE(PreferencesDialog); ENSURE_TYPE(PreferencesPage); ENSURE_TYPE(PreferencesRow); + ENSURE_TYPE(SwitchRow); ENSURE_TYPE(ToastOverlay); } } // namespace turns::adw
\ No newline at end of file |
