diff options
Diffstat (limited to 'include/adwaitamm')
| -rw-r--r-- | include/adwaitamm/adwaitamm.hpp | 3 | ||||
| -rw-r--r-- | include/adwaitamm/enums.hpp | 7 | ||||
| -rw-r--r-- | include/adwaitamm/headerbar.hpp | 97 | ||||
| -rw-r--r-- | include/adwaitamm/private/headerbar_p.hpp | 39 |
4 files changed, 145 insertions, 1 deletions
diff --git a/include/adwaitamm/adwaitamm.hpp b/include/adwaitamm/adwaitamm.hpp index 1bee898..6f4e73a 100644 --- a/include/adwaitamm/adwaitamm.hpp +++ b/include/adwaitamm/adwaitamm.hpp @@ -11,6 +11,7 @@ #include <adwaitamm/dialog.hpp> // IWYU pragma: export #include <adwaitamm/entryrow.hpp> // IWYU pragma: export #include <adwaitamm/enums.hpp> // IWYU pragma: export +#include <adwaitamm/headerbar.hpp> // IWYU pragma: export #include <adwaitamm/preferencesdialog.hpp> // IWYU pragma: export #include <adwaitamm/preferencespage.hpp> // IWYU pragma: export #include <adwaitamm/preferencesrow.hpp> // IWYU pragma: export @@ -19,7 +20,7 @@ #include <adwaitamm/switchrow.hpp> // IWYU pragma: export #include <adwaitamm/toast.hpp> // IWYU pragma: export #include <adwaitamm/toastoverlay.hpp> // IWYU pragma: export -#include <adwaitamm/toolbarview.hpp> // IWYU pragma: export +#include <adwaitamm/toolbarview.hpp> // IWYU pragma: export #include <adwaitamm/windowtitle.hpp> // IWYU pragma: export #include <adwaitamm/wrap_init.hpp> // IWYU pragma: export diff --git a/include/adwaitamm/enums.hpp b/include/adwaitamm/enums.hpp index 159b20d..0809a49 100644 --- a/include/adwaitamm/enums.hpp +++ b/include/adwaitamm/enums.hpp @@ -26,6 +26,12 @@ namespace Adwaita Slate, }; + enum struct CenteringPolicy + { + Loose, + Strict, + }; + enum struct ColorScheme { Default, @@ -90,6 +96,7 @@ namespace Glib } VALUE_SPECIALIZATION(AccentColor); + VALUE_SPECIALIZATION(CenteringPolicy); VALUE_SPECIALIZATION(ColorScheme); VALUE_SPECIALIZATION(LengthType); VALUE_SPECIALIZATION(PresentationMode); diff --git a/include/adwaitamm/headerbar.hpp b/include/adwaitamm/headerbar.hpp new file mode 100644 index 0000000..338b189 --- /dev/null +++ b/include/adwaitamm/headerbar.hpp @@ -0,0 +1,97 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef LIBADWAITAMM_HEADER_BAR_HPP +#define LIBADWAITAMM_HEADER_BAR_HPP + +#include "adwaitamm/enums.hpp" +#include "helpers/gobj_mixin.hpp" + +#include <glibmm/object.h> +#include <glibmm/propertyproxy.h> +#include <glibmm/ustring.h> + +#include <gtkmm/widget.h> + +#include <glib-object.h> + +#define _ADWAITA_INSIDE +#include <adw-header-bar.h> +#undef _ADWAITA_INSIDE + +namespace Adwaita +{ + struct HeaderBar final : Gtk::Widget, + helpers::gobj_mixin<HeaderBar, AdwHeaderBar> + { + + using BaseObjectType = AdwHeaderBar; + using BaseClassType = AdwHeaderBarClass; + using CppObjectType = HeaderBar; + using CppClassType = struct HeaderBar_Class; + + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; + + HeaderBar(); + HeaderBar(HeaderBar const & other) = delete; + HeaderBar(HeaderBar && other) noexcept = default; + + auto operator=(HeaderBar const & other) noexcept -> HeaderBar & = delete; + auto operator=(HeaderBar && other) noexcept -> HeaderBar & = default; + + auto static get_type() -> GType; + auto static get_base_type() -> GType; + + auto pack_end(Gtk::Widget & widget) -> void; + auto pack_start(Gtk::Widget & widget) -> void; + auto remove(Gtk::Widget & widget) -> void; + + [[nodiscard]] auto get_centering_policy() -> CenteringPolicy; + [[nodiscard]] auto get_decoration_layout() -> Glib::ustring; + [[nodiscard]] auto get_show_back_button() -> bool; + [[nodiscard]] auto get_show_end_title_buttons() -> bool; + [[nodiscard]] auto get_show_start_title_buttons() -> bool; + [[nodiscard]] auto get_show_title() -> bool; + [[nodiscard]] auto get_title_widget() -> Gtk::Widget *; + + auto set_centering_policy(CenteringPolicy value) -> void; + auto set_decoration_layout(Glib::ustring const & value) -> void; + auto set_show_back_button(bool value) -> void; + auto set_show_end_title_buttons(bool value) -> void; + auto set_show_start_title_buttons(bool value) -> void; + auto set_show_title(bool value) -> void; + auto set_title_widget(Gtk::Widget & value) -> void; + + auto property_centering_policy() -> Glib::PropertyProxy<CenteringPolicy>; + auto property_centering_policy() const -> Glib::PropertyProxy_ReadOnly<CenteringPolicy>; + auto property_decoration_layout() -> Glib::PropertyProxy<Glib::ustring>; + auto property_decoration_layout() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring>; + auto property_show_back_button() -> Glib::PropertyProxy<bool>; + auto property_show_back_button() const -> Glib::PropertyProxy_ReadOnly<bool>; + auto property_show_end_title_buttons() -> Glib::PropertyProxy<bool>; + auto property_show_end_title_buttons() const -> Glib::PropertyProxy_ReadOnly<bool>; + auto property_show_start_title_buttons() -> Glib::PropertyProxy<bool>; + auto property_show_start_title_buttons() const -> Glib::PropertyProxy_ReadOnly<bool>; + auto property_show_title() -> Glib::PropertyProxy<bool>; + auto property_show_title() const -> Glib::PropertyProxy_ReadOnly<bool>; + auto property_title_widget() -> Glib::PropertyProxy<Gtk::Widget *>; + auto property_title_widget() const -> Glib::PropertyProxy_ReadOnly<Gtk::Widget *>; + + protected: + friend HeaderBar_Class; + + explicit HeaderBar(Glib::ConstructParams const & params); + explicit HeaderBar(BaseObjectType * gobj); + }; +} // namespace Adwaita + +namespace Glib +{ + auto wrap(AdwHeaderBar * object, bool copy = false) -> Adwaita::HeaderBar *; +} // namespace Glib + +#endif
\ No newline at end of file diff --git a/include/adwaitamm/private/headerbar_p.hpp b/include/adwaitamm/private/headerbar_p.hpp new file mode 100644 index 0000000..dac73ef --- /dev/null +++ b/include/adwaitamm/private/headerbar_p.hpp @@ -0,0 +1,39 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef LIBADWAITAMM_PRIVATE_HEADER_BAR_P_HPP +#define LIBADWAITAMM_PRIVATE_HEADER_BAR_P_HPP + +#include <glibmm/class.h> +#include <glibmm/objectbase.h> + +#include <gtkmm/widget.h> + +#define _ADWAITA_INSIDE +#include <adw-header-bar.h> +#undef _ADWAITA_INSIDE + +namespace Adwaita +{ + struct HeaderBar_Class : Glib::Class + { + using BaseClassParent = GtkWidgetClass; + using BaseClassType = AdwHeaderBarClass; + using BaseObjectType = AdwHeaderBar; + using CppClassParent = Gtk::Widget_Class; + using CppObjectType = struct HeaderBar; + + auto init() -> Glib::Class const &; + auto static class_init_function(void * gclass, void * data) -> void; + auto static wrap_new(GObject * object) -> Glib::ObjectBase *; + + protected: + auto static close_attempt(BaseObjectType * self) -> void; + auto static closed(BaseObjectType * self) -> void; + }; +} // namespace Adwaita + +#endif
\ No newline at end of file |
