From 673e58ca36421bb560d4e04277b6b58ce6e0db6f Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Tue, 29 Apr 2025 12:30:21 +0200 Subject: adw: implement ToolbarView --- src/toolbarview.cpp | 253 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) create mode 100644 src/toolbarview.cpp (limited to 'src/toolbarview.cpp') diff --git a/src/toolbarview.cpp b/src/toolbarview.cpp new file mode 100644 index 0000000..b2a9de6 --- /dev/null +++ b/src/toolbarview.cpp @@ -0,0 +1,253 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#include "adwaitamm/toolbarview.hpp" + +#include "adwaitamm/enums.hpp" +#include "adwaitamm/private/toolbarview_p.hpp" + +#include +#include +#include +#include +#include + +#include + +#include +#include + +namespace Adwaita +{ + + namespace + { + auto constinit _class = ToolbarView_Class{}; + + namespace property_name + { + auto constexpr bottom_bar_height = "bottom-bar-height"; + auto constexpr bottom_bar_style = "bottom-bar-style"; + auto constexpr content = "content"; + auto constexpr extend_content_to_bottom_edge = "extend-content-to-bottom-edge"; + auto constexpr extend_content_to_top_edge = "extend-content-to-top-edge"; + auto constexpr reveal_bottom_bars = "reveal-bottom-bars"; + auto constexpr reveal_top_bars = "reveal-top-bars"; + auto constexpr top_bar_height = "top-bar-height"; + auto constexpr top_bar_style = "top-bar-style"; + } // namespace property_name + } // namespace + + ToolbarView::ToolbarView() + : Glib::ObjectBase{nullptr} + , Gtk::Widget{Glib::ConstructParams{_class.init()}} + { + } + + auto ToolbarView::get_type() -> GType + { + return _class.init().get_type(); + } + + auto ToolbarView::get_base_type() -> GType + { + return adw_toolbar_view_get_type(); + } + + ToolbarView::ToolbarView(Glib::ConstructParams const & params) + : Gtk::Widget{params} + { + } + + ToolbarView::ToolbarView(BaseObjectType * gobj) + : Gtk::Widget(GTK_WIDGET(gobj)) + { + } + + auto ToolbarView::add_bottom_bar(Gtk::Widget & widget) -> void + { + return adw_toolbar_view_add_bottom_bar(unwrap(this), unwrap(&widget)); + } + + auto ToolbarView::add_top_bar(Gtk::Widget & widget) -> void + { + return adw_toolbar_view_add_top_bar(unwrap(this), unwrap(&widget)); + } + + auto ToolbarView::remove(Gtk::Widget & widget) -> void + { + return adw_toolbar_view_remove(unwrap(this), unwrap(&widget)); + } + + auto ToolbarView::get_bottom_bar_height() const -> int + { + return adw_toolbar_view_get_bottom_bar_height(const_cast(unwrap(this))); + } + + auto ToolbarView::get_bottom_bar_style() const -> ToolbarStyle + { + return static_cast(adw_toolbar_view_get_bottom_bar_style(const_cast(unwrap(this)))); + } + + auto ToolbarView::get_content() const -> Gtk::Widget * + { + return Glib::wrap(adw_toolbar_view_get_content(const_cast(unwrap(this)))); + } + + auto ToolbarView::get_extend_content_to_bottom_edge() const -> bool + { + return adw_toolbar_view_get_extend_content_to_bottom_edge(const_cast(unwrap(this))); + } + + auto ToolbarView::get_extend_content_to_top_edge() const -> bool + { + return adw_toolbar_view_get_extend_content_to_top_edge(const_cast(unwrap(this))); + } + + auto ToolbarView::get_reveal_bottom_bars() const -> bool + { + return adw_toolbar_view_get_reveal_bottom_bars(const_cast(unwrap(this))); + } + + auto ToolbarView::get_reveal_top_bars() const -> bool + { + return adw_toolbar_view_get_reveal_top_bars(const_cast(unwrap(this))); + } + + auto ToolbarView::get_top_bar_height() const -> int + { + return adw_toolbar_view_get_top_bar_height(const_cast(unwrap(this))); + } + + auto ToolbarView::get_top_bar_style() const -> ToolbarStyle + { + return static_cast(adw_toolbar_view_get_top_bar_style(const_cast(unwrap(this)))); + } + + auto ToolbarView::set_bottom_bar_style(ToolbarStyle value) -> void + { + return adw_toolbar_view_set_bottom_bar_style(unwrap(this), static_cast(value)); + } + + auto ToolbarView::set_content(Gtk::Widget & value) -> void + { + return adw_toolbar_view_set_content(unwrap(this), unwrap(&value)); + } + + auto ToolbarView::set_extend_content_to_bottom_edge(bool value) -> void + { + return adw_toolbar_view_set_extend_content_to_bottom_edge(unwrap(this), value); + } + + auto ToolbarView::set_extend_content_to_top_edge(bool value) -> void + { + return adw_toolbar_view_set_extend_content_to_top_edge(unwrap(this), value); + } + + auto ToolbarView::set_reveal_bottom_bars(bool value) -> void + { + return adw_toolbar_view_set_reveal_bottom_bars(unwrap(this), value); + } + + auto ToolbarView::set_reveal_top_bars(bool value) -> void + { + return adw_toolbar_view_set_reveal_top_bars(unwrap(this), value); + } + + auto ToolbarView::set_top_bar_style(ToolbarStyle value) -> void + { + return adw_toolbar_view_set_top_bar_style(unwrap(this), static_cast(value)); + } + + auto ToolbarView::property_bottom_bar_height() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::bottom_bar_height}; + } + + auto ToolbarView::property_bottom_bar_style() -> Glib::PropertyProxy + { + return {this, property_name::bottom_bar_style}; + } + + auto ToolbarView::property_bottom_bar_style() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::bottom_bar_style}; + } + + auto ToolbarView::property_content() -> Glib::PropertyProxy + { + return {this, property_name::content}; + } + + auto ToolbarView::property_content() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::content}; + } + + auto ToolbarView::property_extend_content_to_bottom_edge() -> Glib::PropertyProxy + { + return {this, property_name::extend_content_to_bottom_edge}; + } + + auto ToolbarView::property_extend_content_to_bottom_edge() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::extend_content_to_bottom_edge}; + } + + auto ToolbarView::property_extend_content_to_top_edge() -> Glib::PropertyProxy + { + return {this, property_name::extend_content_to_top_edge}; + } + + auto ToolbarView::property_extend_content_to_top_edge() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::extend_content_to_top_edge}; + } + + auto ToolbarView::property_reveal_bottom_bars() -> Glib::PropertyProxy + { + return {this, property_name::reveal_bottom_bars}; + } + + auto ToolbarView::property_reveal_bottom_bars() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::reveal_bottom_bars}; + } + + auto ToolbarView::property_reveal_top_bars() -> Glib::PropertyProxy + { + return {this, property_name::reveal_top_bars}; + } + + auto ToolbarView::property_reveal_top_bars() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::reveal_top_bars}; + } + + auto ToolbarView::property_top_bar_height() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::top_bar_height}; + } + + auto ToolbarView::property_top_bar_style() -> Glib::PropertyProxy + { + return {this, property_name::top_bar_style}; + } + + auto ToolbarView::property_top_bar_style() const -> Glib::PropertyProxy_ReadOnly + { + return {this, property_name::top_bar_style}; + } + +} // namespace Adwaita + +namespace Glib +{ + auto wrap(AdwToolbarView * object, bool copy) -> Adwaita::ToolbarView * + { + return dynamic_cast(Glib::wrap_auto(G_OBJECT(object), copy)); + } +} // namespace Glib \ No newline at end of file -- cgit v1.2.3