From 6cde8749c3cde48661fc390794d5d488812ed305 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 29 Apr 2025 09:43:32 +0200 Subject: app-win: add missing API --- include/adwaitamm/applicationwindow.hpp | 25 +++++++++ src/applicationwindow.cpp | 97 ++++++++++++++++++++++++++++++++- 2 files changed, 119 insertions(+), 3 deletions(-) diff --git a/include/adwaitamm/applicationwindow.hpp b/include/adwaitamm/applicationwindow.hpp index bef520d..fa41469 100644 --- a/include/adwaitamm/applicationwindow.hpp +++ b/include/adwaitamm/applicationwindow.hpp @@ -7,15 +7,21 @@ #ifndef LIBADWAITAMM_APPLICATION_WINDOW_HPP #define LIBADWAITAMM_APPLICATION_WINDOW_HPP +#include "adwaitamm/breakpoint.hpp" +#include "adwaitamm/dialog.hpp" #include "helpers/gobj_mixin.hpp" #include #include +#include #include #include +#include + #include #include +#include #include @@ -46,6 +52,25 @@ namespace Adwaita auto static get_type() -> GType; auto static get_base_type() -> GType; + auto add_breakpoint(Glib::RefPtr const & breakpoint) -> void; + + auto get_adaptive_preview() const -> bool; + auto get_content() const -> Gtk::Widget *; + auto get_current_breakpoint() const -> Glib::RefPtr; + auto get_dialogs() const -> Glib::RefPtr; + auto get_visible_dialog() const -> Dialog *; + + auto set_adaptive_preview(bool value) -> void; + auto set_content(Gtk::Widget & value) -> void; + + auto property_adaptive_preview() -> Glib::PropertyProxy; + auto property_adaptive_preview() const -> Glib::PropertyProxy_ReadOnly; + auto property_content() -> Glib::PropertyProxy; + auto property_content() const -> Glib::PropertyProxy_ReadOnly; + auto property_current_breakpoint() const -> Glib::PropertyProxy_ReadOnly>; + auto property_dialogs() const -> Glib::PropertyProxy_ReadOnly>; + auto property_visible_dialog() const -> Glib::PropertyProxy_ReadOnly; + protected: friend ApplicationWindow_Class; diff --git a/src/applicationwindow.cpp b/src/applicationwindow.cpp index 1de245f..45e8129 100644 --- a/src/applicationwindow.cpp +++ b/src/applicationwindow.cpp @@ -6,15 +6,21 @@ #include "adwaitamm/applicationwindow.hpp" +#include "adwaitamm/breakpoint.hpp" +#include "adwaitamm/dialog.hpp" #include "adwaitamm/private/applicationwindow_p.hpp" #include #include +#include #include #include +#include + #include #include +#include #include #include @@ -24,8 +30,24 @@ namespace Adwaita namespace { auto constinit _class = ApplicationWindow_Class{}; + + namespace property_name + { + auto constexpr adaptive_preview = "adaptive-preview"; + auto constexpr content = "content"; + auto constexpr current_breakpoint = "current-breakpoint"; + auto constexpr dialogs = "dialogs"; + auto constexpr visible_dialog = "visible-dialog"; + + } // namespace property_name } // namespace + ApplicationWindow::ApplicationWindow(Glib::RefPtr const & app) + : Glib::ObjectBase{nullptr} + , Gtk::ApplicationWindow{GTK_APPLICATION_WINDOW(adw_application_window_new(unwrap(app)))} + { + } + auto ApplicationWindow::get_type() -> GType { return _class.init().get_type(); @@ -36,10 +58,79 @@ namespace Adwaita return adw_application_window_get_type(); } - ApplicationWindow::ApplicationWindow(Glib::RefPtr const & app) - : Glib::ObjectBase{nullptr} - , Gtk::ApplicationWindow{GTK_APPLICATION_WINDOW(adw_application_window_new(unwrap(app)))} + auto ApplicationWindow::add_breakpoint(Glib::RefPtr const & breakpoint) -> void + { + return adw_application_window_add_breakpoint(unwrap(this), unwrap(breakpoint)); + } + + auto ApplicationWindow::get_adaptive_preview() const -> bool + { + return adw_application_window_get_adaptive_preview(const_cast(unwrap(this))); + } + + auto ApplicationWindow::get_content() const -> Gtk::Widget * + { + return Glib::wrap(adw_application_window_get_content(const_cast(unwrap(this)))); + } + + auto ApplicationWindow::get_current_breakpoint() const -> Glib::RefPtr + { + return Glib::wrap(adw_application_window_get_current_breakpoint(const_cast(unwrap(this)))); + } + + auto ApplicationWindow::get_dialogs() const -> Glib::RefPtr + { + return Glib::wrap(adw_application_window_get_dialogs(const_cast(unwrap(this)))); + } + + auto ApplicationWindow::get_visible_dialog() const -> Dialog * + { + return Glib::wrap(adw_application_window_get_visible_dialog(const_cast(unwrap(this)))); + } + + auto ApplicationWindow::set_adaptive_preview(bool value) -> void + { + return adw_application_window_set_adaptive_preview(unwrap(this), value); + } + + auto ApplicationWindow::set_content(Gtk::Widget & value) -> void + { + return adw_application_window_set_content(unwrap(this), unwrap(&value)); + } + + auto ApplicationWindow::property_adaptive_preview() -> Glib::PropertyProxy + { + return {this, property_name::adaptive_preview}; + } + + auto ApplicationWindow::property_adaptive_preview() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::adaptive_preview}; + } + + auto ApplicationWindow::property_content() -> Glib::PropertyProxy + { + return {this, property_name::content}; + } + + auto ApplicationWindow::property_content() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::content}; + } + + auto ApplicationWindow::property_current_breakpoint() const -> Glib::PropertyProxy_ReadOnly> + { + return {this, property_name::current_breakpoint}; + } + + auto ApplicationWindow::property_dialogs() const -> Glib::PropertyProxy_ReadOnly> + { + return {this, property_name::dialogs}; + } + + auto ApplicationWindow::property_visible_dialog() const -> Glib::PropertyProxy_ReadOnly { + return {this, property_name::visible_dialog}; } ApplicationWindow::ApplicationWindow(Glib::ConstructParams const & params) -- cgit v1.2.3