diff options
Diffstat (limited to 'adw/src')
| -rw-r--r-- | adw/src/actionrow.cpp | 102 | ||||
| -rw-r--r-- | adw/src/application.cpp | 6 | ||||
| -rw-r--r-- | adw/src/applicationwindow.cpp | 83 | ||||
| -rw-r--r-- | adw/src/dialog.cpp | 14 | ||||
| -rw-r--r-- | adw/src/preferencesdialog.cpp | 12 | ||||
| -rw-r--r-- | adw/src/preferencespage.cpp | 17 | ||||
| -rw-r--r-- | adw/src/preferencesrow.cpp | 19 | ||||
| -rw-r--r-- | adw/src/switchrow.cpp | 13 | ||||
| -rw-r--r-- | adw/src/toast.cpp | 10 | ||||
| -rw-r--r-- | adw/src/toastoverlay.cpp | 13 | ||||
| -rw-r--r-- | adw/src/wrap_init.cpp | 3 |
11 files changed, 230 insertions, 62 deletions
diff --git a/adw/src/actionrow.cpp b/adw/src/actionrow.cpp index f45f7a3..e8cfc7d 100644 --- a/adw/src/actionrow.cpp +++ b/adw/src/actionrow.cpp @@ -1,10 +1,12 @@ #include "turns/adw/actionrow.hpp" +#include "turns/adw/helpers/properties.hpp" #include "turns/adw/preferencesrow.hpp" #include <glibmm/class.h> #include <glibmm/object.h> #include <glibmm/objectbase.h> +#include <glibmm/propertyproxy.h> #include <glibmm/refptr.h> #include <glibmm/ustring.h> #include <glibmm/utility.h> @@ -12,10 +14,13 @@ #include <gtkmm/init.h> #include <gtkmm/listboxrow.h> +#include <gtkmm/object.h> #include <gtkmm/private/widget_p.h> +#include <gtkmm/widget.h> #include <adwaita.h> #include <glib-object.h> +#include <glib.h> #include <gtk/gtk.h> namespace turns::adw @@ -29,7 +34,7 @@ namespace turns::adw { if (!gtype_) { - class_init_func_ = &ActionRow::Class::class_init_function; + class_init_func_ = &class_init_function; register_derived_type(adw_action_row_get_type()); } return *this; @@ -37,13 +42,13 @@ namespace turns::adw auto ActionRow::Class::class_init_function(void * gclass, void * data) -> void { - auto const klass = static_cast<AdwActionRowClass *>(gclass); - PreferencesRow::Class::class_init_function(klass, data); + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); } auto ActionRow::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new ActionRow(ADW_ACTION_ROW(object)); + return Gtk::manage(new ActionRow(ADW_ACTION_ROW(object))); } auto ActionRow::get_type() -> GType @@ -62,6 +67,16 @@ namespace turns::adw { } + ActionRow::ActionRow(Glib::ConstructParams const & params) + : adw::PreferencesRow{params} + { + } + + ActionRow::ActionRow(BaseObjectType * gobj) + : adw::PreferencesRow(ADW_PREFERENCES_ROW(gobj)) + { + } + auto ActionRow::add_prefix(Gtk::Widget & widget) -> ActionRow & { adw_action_row_add_prefix(Glib::unwrap(this), Glib::unwrap(&widget)); @@ -80,6 +95,69 @@ namespace turns::adw return *this; } + auto ActionRow::get_activatable_widget() const noexcept -> Glib::RefPtr<Gtk::Widget> + { + return Glib::make_refptr_for_instance(Glib::wrap(adw_action_row_get_activatable_widget(const_cast<BaseObjectType *>(Glib::unwrap(this))))); + } + + auto ActionRow::get_icon_name() const -> Glib::ustring + { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdeprecated-declarations" + return adw_action_row_get_icon_name(const_cast<BaseObjectType *>(Glib::unwrap(this))); +#pragma GCC diagnostic pop + } + + auto ActionRow::get_subtitle() const -> Glib::ustring + { + return adw_action_row_get_subtitle(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto ActionRow::get_subtitle_lines() const noexcept -> int + { + return adw_action_row_get_subtitle_lines(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto ActionRow::get_subtitle_selectable() const noexcept -> bool + { + return adw_action_row_get_subtitle_selectable(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto ActionRow::get_title_lines() const noexcept -> int + { + return adw_action_row_get_title_lines(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto ActionRow::property_activatable_widget() noexcept -> Glib::PropertyProxy<Gtk::Widget *> + { + return helpers::make_property_proxy<Gtk::Widget *>(*this, "activatable-widget"); + } + + auto ActionRow::property_icon_name() noexcept -> Glib::PropertyProxy<Glib::ustring> + { + return helpers::make_property_proxy<Glib::ustring>(*this, "icon-name"); + } + + auto ActionRow::property_subtitle() noexcept -> Glib::PropertyProxy<Glib::ustring> + { + return helpers::make_property_proxy<Glib::ustring>(*this, "subtitle"); + } + + auto ActionRow::property_subtitle_lines() noexcept -> Glib::PropertyProxy<int> + { + return helpers::make_property_proxy<int>(*this, "subtitle-lines"); + } + + auto ActionRow::property_subtitle_selectable() noexcept -> Glib::PropertyProxy<bool> + { + return helpers::make_property_proxy<bool>(*this, "subtitle-selectable"); + } + + auto ActionRow::property_title_lines() noexcept -> Glib::PropertyProxy<int> + { + return helpers::make_property_proxy<int>(*this, "title-lines"); + } + auto ActionRow::set_activatable_widget(Gtk::Widget & widget) noexcept -> CppObjectType & { adw_action_row_set_activatable_widget(Glib::unwrap(this), Glib::unwrap(&widget)); @@ -109,7 +187,7 @@ namespace turns::adw auto ActionRow::set_subtitle_selectable(bool subtitle_selectable) noexcept -> CppObjectType & { - adw_action_row_set_subtitle_selectable(Glib::unwrap(this), subtitle_selectable); + adw_action_row_set_subtitle_selectable(Glib::unwrap(this), static_cast<gboolean>(subtitle_selectable)); return *this; } @@ -119,24 +197,12 @@ namespace turns::adw return *this; } - ActionRow::ActionRow(Glib::ConstructParams const & params) - : adw::PreferencesRow{params} - { - } - - ActionRow::ActionRow(BaseObjectType * gobj) - : Glib::ObjectBase{nullptr} - , adw::PreferencesRow(ADW_PREFERENCES_ROW(gobj)) - { - } - } // namespace turns::adw namespace Glib { auto wrap(AdwActionRow * object, bool copy) -> Glib::RefPtr<turns::adw::ActionRow> { - return Glib::make_refptr_for_instance<turns::adw::ActionRow>( - dynamic_cast<turns::adw::ActionRow *>(Glib::wrap_auto(G_OBJECT(object), copy))); + return Glib::make_refptr_for_instance(dynamic_cast<turns::adw::ActionRow *>(Glib::wrap_auto(G_OBJECT(object), copy))); } } // namespace Glib
\ No newline at end of file diff --git a/adw/src/application.cpp b/adw/src/application.cpp index 1fe47c3..05bc07a 100644 --- a/adw/src/application.cpp +++ b/adw/src/application.cpp @@ -77,8 +77,7 @@ namespace turns::adw } Application::Application(AdwApplication * gobj) - : Glib::ObjectBase{nullptr} - , Gtk::Application((GtkApplication *)gobj) + : Gtk::Application((GtkApplication *)gobj) { } @@ -94,7 +93,6 @@ namespace Glib { auto wrap(AdwApplication * object, bool copy) -> Glib::RefPtr<turns::adw::Application> { - return Glib::make_refptr_for_instance<turns::adw::Application>( - dynamic_cast<turns::adw::Application *>(Glib::wrap_auto(G_OBJECT(object), copy))); + return Glib::make_refptr_for_instance(dynamic_cast<turns::adw::Application *>(Glib::wrap_auto(G_OBJECT(object), copy))); } } // namespace Glib
\ No newline at end of file diff --git a/adw/src/applicationwindow.cpp b/adw/src/applicationwindow.cpp new file mode 100644 index 0000000..af21a5e --- /dev/null +++ b/adw/src/applicationwindow.cpp @@ -0,0 +1,83 @@ +#include "turns/adw/applicationwindow.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/application.h> +#include <gtkmm/applicationwindow.h> +#include <gtkmm/init.h> +#include <gtkmm/object.h> +#include <gtkmm/private/applicationwindow_p.h> + +#include <adwaita.h> +#include <glib-object.h> +#include <gtk/gtk.h> + +namespace turns::adw +{ + namespace + { + auto constinit _class = ApplicationWindow::Class{}; + } // namespace + + auto ApplicationWindow::Class::init() -> Glib::Class const & + { + if (!gtype_) + { + class_init_func_ = &class_init_function; + register_derived_type(adw_application_window_get_type()); + } + return *this; + } + + auto ApplicationWindow::Class::class_init_function(void * gclass, void * data) -> void + { + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); + } + + auto ApplicationWindow::Class::wrap_new(GObject * object) -> Glib::ObjectBase * + { + return new ApplicationWindow(ADW_APPLICATION_WINDOW(object)); + } + + auto ApplicationWindow::get_type() -> GType + { + return _class.init().get_type(); + } + + auto ApplicationWindow::get_base_type() -> GType + { + return adw_application_window_get_type(); + } + + ApplicationWindow::ApplicationWindow(Gtk::Application & app) + : Glib::ObjectBase{nullptr} + , Gtk::ApplicationWindow{Glib::ConstructParams{_class.init(), "app", &app, nullptr}} + { + } + + ApplicationWindow::ApplicationWindow(Glib::ConstructParams const & params) + : Gtk::ApplicationWindow{params} + { + } + + ApplicationWindow::ApplicationWindow(BaseObjectType * gobj) + : Gtk::ApplicationWindow(GTK_APPLICATION_WINDOW(gobj)) + { + } + +} // namespace turns::adw + +namespace Glib +{ + auto wrap(AdwApplicationWindow * object, bool copy) -> turns::adw::ApplicationWindow * + { + return dynamic_cast<turns::adw::ApplicationWindow *>(Glib::wrap_auto(G_OBJECT(object), copy)); + } +} // namespace Glib
\ No newline at end of file diff --git a/adw/src/dialog.cpp b/adw/src/dialog.cpp index 3fe9752..c6d5e2b 100644 --- a/adw/src/dialog.cpp +++ b/adw/src/dialog.cpp @@ -8,6 +8,7 @@ #include <glibmm/wrap.h> #include <gtkmm/init.h> +#include <gtkmm/object.h> #include <gtkmm/private/widget_p.h> #include <gtkmm/widget.h> @@ -27,7 +28,7 @@ namespace turns::adw { if (!gtype_) { - class_init_func_ = &Dialog::Class::class_init_function; + class_init_func_ = &class_init_function; register_derived_type(adw_dialog_get_type()); } return *this; @@ -35,13 +36,13 @@ namespace turns::adw auto Dialog::Class::class_init_function(void * gclass, void * data) -> void { - auto const klass = static_cast<AdwDialogClass *>(gclass); - Gtk::Widget_Class::class_init_function(klass, data); + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); } auto Dialog::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new Dialog(ADW_DIALOG(object)); + return Gtk::manage(new Dialog(ADW_DIALOG(object))); } auto Dialog::get_type() -> GType @@ -60,8 +61,7 @@ namespace turns::adw } Dialog::Dialog(AdwDialog * gobj) - : Glib::ObjectBase{nullptr} - , Gtk::Widget(GTK_WIDGET(gobj)) + : Gtk::Widget(GTK_WIDGET(gobj)) { } @@ -82,6 +82,6 @@ namespace Glib { auto wrap(AdwDialog * object, bool copy) -> Glib::RefPtr<turns::adw::Dialog> { - return Glib::make_refptr_for_instance<turns::adw::Dialog>(dynamic_cast<turns::adw::Dialog *>(Glib::wrap_auto(G_OBJECT(object), copy))); + return Glib::make_refptr_for_instance(dynamic_cast<turns::adw::Dialog *>(Glib::wrap_auto(G_OBJECT(object), copy))); } } // namespace Glib
\ No newline at end of file diff --git a/adw/src/preferencesdialog.cpp b/adw/src/preferencesdialog.cpp index b18c0e6..10419fe 100644 --- a/adw/src/preferencesdialog.cpp +++ b/adw/src/preferencesdialog.cpp @@ -12,6 +12,7 @@ #include <glibmm/wrap.h> #include <gtkmm/init.h> +#include <gtkmm/object.h> #include <gtkmm/private/widget_p.h> #include <gtkmm/widget.h> @@ -30,7 +31,7 @@ namespace turns::adw { if (!gtype_) { - class_init_func_ = &PreferencesDialog::Class::class_init_function; + class_init_func_ = &class_init_function; register_derived_type(adw_preferences_dialog_get_type()); } return *this; @@ -38,13 +39,13 @@ namespace turns::adw auto PreferencesDialog::Class::class_init_function(void * gclass, void * data) -> void { - auto const klass = static_cast<AdwPreferencesDialogClass *>(gclass); - Gtk::Widget_Class::class_init_function(klass, data); + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); } auto PreferencesDialog::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new PreferencesDialog(ADW_PREFERENCES_DIALOG(object)); + return Gtk::manage(new PreferencesDialog(ADW_PREFERENCES_DIALOG(object))); } auto PreferencesDialog::get_type() -> GType @@ -63,8 +64,7 @@ namespace turns::adw } PreferencesDialog::PreferencesDialog(AdwPreferencesDialog * gobj) - : Glib::ObjectBase{nullptr} - , adw::Dialog(ADW_DIALOG(gobj)) + : adw::Dialog(ADW_DIALOG(gobj)) { } diff --git a/adw/src/preferencespage.cpp b/adw/src/preferencespage.cpp index 475f591..8467e29 100644 --- a/adw/src/preferencespage.cpp +++ b/adw/src/preferencespage.cpp @@ -9,6 +9,7 @@ #include <glibmm/wrap.h> #include <gtkmm/init.h> +#include <gtkmm/object.h> #include <gtkmm/private/widget_p.h> #include <gtkmm/widget.h> @@ -21,13 +22,13 @@ namespace turns::adw namespace { auto constinit _class = PreferencesPage::Class{}; - } + } // namespace auto PreferencesPage::Class::init() -> Glib::Class const & { if (!gtype_) { - class_init_func_ = &PreferencesPage::Class::class_init_function; + class_init_func_ = &class_init_function; register_derived_type(adw_preferences_page_get_type()); } return *this; @@ -35,13 +36,13 @@ namespace turns::adw auto PreferencesPage::Class::class_init_function(void * gclass, void * data) -> void { - auto const klass = static_cast<AdwPreferencesPageClass *>(gclass); - Gtk::Widget_Class::class_init_function(klass, data); + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); } auto PreferencesPage::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new PreferencesPage(ADW_PREFERENCES_PAGE(object)); + return Gtk::manage(new PreferencesPage(ADW_PREFERENCES_PAGE(object))); } auto PreferencesPage::get_type() -> GType @@ -60,8 +61,7 @@ namespace turns::adw } PreferencesPage::PreferencesPage(AdwPreferencesPage * gobj) - : Glib::ObjectBase{nullptr} - , Gtk::Widget(GTK_WIDGET(gobj)) + : Gtk::Widget(GTK_WIDGET(gobj)) { } @@ -77,7 +77,6 @@ namespace Glib { auto wrap(AdwPreferencesPage * object, bool copy) -> Glib::RefPtr<turns::adw::PreferencesPage> { - return Glib::make_refptr_for_instance<turns::adw::PreferencesPage>( - dynamic_cast<turns::adw::PreferencesPage *>(Glib::wrap_auto(G_OBJECT(object), copy))); + return Glib::make_refptr_for_instance(dynamic_cast<turns::adw::PreferencesPage *>(Glib::wrap_auto(G_OBJECT(object), copy))); } } // namespace Glib
\ No newline at end of file diff --git a/adw/src/preferencesrow.cpp b/adw/src/preferencesrow.cpp index ef9b281..039da96 100644 --- a/adw/src/preferencesrow.cpp +++ b/adw/src/preferencesrow.cpp @@ -10,7 +10,8 @@ #include <gtkmm/init.h> #include <gtkmm/listboxrow.h> -#include <gtkmm/private/widget_p.h> +#include <gtkmm/object.h> +#include <gtkmm/private/listboxrow_p.h> #include <adwaita.h> #include <glib-object.h> @@ -21,13 +22,13 @@ namespace turns::adw namespace { auto constinit _class = PreferencesRow::Class{}; - } + } // namespace auto PreferencesRow::Class::init() -> Glib::Class const & { if (!gtype_) { - class_init_func_ = &PreferencesRow::Class::class_init_function; + class_init_func_ = &class_init_function; register_derived_type(adw_preferences_row_get_type()); } return *this; @@ -35,13 +36,13 @@ namespace turns::adw auto PreferencesRow::Class::class_init_function(void * gclass, void * data) -> void { - auto const klass = static_cast<AdwPreferencesRowClass *>(gclass); - Gtk::Widget_Class::class_init_function(klass, data); + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); } auto PreferencesRow::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new PreferencesRow(ADW_PREFERENCES_ROW(object)); + return Gtk::manage(new PreferencesRow(ADW_PREFERENCES_ROW(object))); } auto PreferencesRow::get_type() -> GType @@ -90,8 +91,7 @@ namespace turns::adw } PreferencesRow::PreferencesRow(BaseObjectType * gobj) - : Glib::ObjectBase{nullptr} - , Gtk::ListBoxRow(GTK_LIST_BOX_ROW(gobj)) + : Gtk::ListBoxRow(GTK_LIST_BOX_ROW(gobj)) { } @@ -101,7 +101,6 @@ namespace Glib { auto wrap(AdwPreferencesRow * object, bool copy) -> Glib::RefPtr<turns::adw::PreferencesRow> { - return Glib::make_refptr_for_instance<turns::adw::PreferencesRow>( - dynamic_cast<turns::adw::PreferencesRow *>(Glib::wrap_auto(G_OBJECT(object), copy))); + return Glib::make_refptr_for_instance(dynamic_cast<turns::adw::PreferencesRow *>(Glib::wrap_auto(G_OBJECT(object), copy))); } } // namespace Glib
\ No newline at end of file diff --git a/adw/src/switchrow.cpp b/adw/src/switchrow.cpp index 8e9508d..3bd4a89 100644 --- a/adw/src/switchrow.cpp +++ b/adw/src/switchrow.cpp @@ -7,6 +7,7 @@ #include <glibmm/objectbase.h> #include <glibmm/refptr.h> #include <glibmm/wrap.h> +#include <gtkmm/object.h> #include <adwaita.h> #include <gio/gio.h> @@ -23,14 +24,21 @@ namespace turns::adw { if (!gtype_) { + class_init_func_ = &class_init_function; gtype_ = adw_switch_row_get_type(); } return *this; } + auto SwitchRow::Class::class_init_function(void * gclass, void * data) -> void + { + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); + } + auto SwitchRow::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new SwitchRow(ADW_SWITCH_ROW(object)); + return Gtk::manage(new SwitchRow(ADW_SWITCH_ROW(object))); } SwitchRow::SwitchRow() @@ -55,8 +63,7 @@ namespace turns::adw } SwitchRow::SwitchRow(BaseObjectType * gobj) - : Glib::ObjectBase{nullptr} - , adw::ActionRow(ADW_ACTION_ROW(gobj)) + : adw::ActionRow(ADW_ACTION_ROW(gobj)) { } diff --git a/adw/src/toast.cpp b/adw/src/toast.cpp index a173532..c830496 100644 --- a/adw/src/toast.cpp +++ b/adw/src/toast.cpp @@ -30,11 +30,18 @@ namespace turns::adw { if (!gtype_) { + class_init_func_ = &class_init_function; gtype_ = adw_toast_get_type(); } return *this; } + auto Toast::Class::class_init_function(void * gclass, void * data) -> void + { + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); + } + auto Toast::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { return new Toast(ADW_TOAST(object)); @@ -67,8 +74,7 @@ namespace turns::adw } Toast::Toast(BaseObjectType * gobj) - : Glib::ObjectBase{nullptr} - , Glib::Object((GObject *)gobj) + : Glib::Object((GObject *)gobj) { } diff --git a/adw/src/toastoverlay.cpp b/adw/src/toastoverlay.cpp index 27e0824..d785e60 100644 --- a/adw/src/toastoverlay.cpp +++ b/adw/src/toastoverlay.cpp @@ -11,6 +11,7 @@ #include <glibmm/utility.h> #include <glibmm/variant.h> +#include <gtkmm/private/widget_p.h> #include <gtkmm/widget.h> #include <adwaita.h> @@ -28,14 +29,21 @@ namespace turns::adw { if (!gtype_) { + class_init_func_ = &class_init_function; gtype_ = adw_toast_overlay_get_type(); } return *this; } + auto ToastOverlay::Class::class_init_function(void * gclass, void * data) -> void + { + auto const klass = static_cast<BaseClassType *>(gclass); + CppClassParent::class_init_function(klass, data); + } + auto ToastOverlay::Class::wrap_new(GObject * object) -> Glib::ObjectBase * { - return new ToastOverlay(ADW_TOAST_OVERLAY(object)); + return Gtk::manage(new ToastOverlay(ADW_TOAST_OVERLAY(object))); } auto ToastOverlay::get_type() -> GType @@ -59,8 +67,7 @@ namespace turns::adw } ToastOverlay::ToastOverlay(BaseObjectType * gobj) - : Glib::ObjectBase{nullptr} - , Gtk::Widget((GtkWidget *)gobj) + : Gtk::Widget((GtkWidget *)gobj) { } diff --git a/adw/src/wrap_init.cpp b/adw/src/wrap_init.cpp index f77dacd..16f87c3 100644 --- a/adw/src/wrap_init.cpp +++ b/adw/src/wrap_init.cpp @@ -2,6 +2,7 @@ #include "turns/adw/actionrow.hpp" #include "turns/adw/application.hpp" +#include "turns/adw/applicationwindow.hpp" #include "turns/adw/dialog.hpp" #include "turns/adw/preferencesdialog.hpp" #include "turns/adw/preferencespage.hpp" @@ -26,6 +27,7 @@ namespace turns::adw WRAP_CLASS(ActionRow, action_row); WRAP_CLASS(Application, application); + WRAP_CLASS(ApplicationWindow, application_window); WRAP_CLASS(Dialog, dialog); WRAP_CLASS(Toast, toast); WRAP_CLASS(PreferencesDialog, preferences_dialog); @@ -36,6 +38,7 @@ namespace turns::adw ENSURE_TYPE(ActionRow); ENSURE_TYPE(Application); + ENSURE_TYPE(ApplicationWindow); ENSURE_TYPE(Dialog); ENSURE_TYPE(Toast); ENSURE_TYPE(PreferencesDialog); |
