diff options
Diffstat (limited to 'adw/include')
| -rw-r--r-- | adw/include/adwaitamm/private/spinrow_p.hpp | 35 | ||||
| -rw-r--r-- | adw/include/adwaitamm/spinrow.hpp | 117 |
2 files changed, 152 insertions, 0 deletions
diff --git a/adw/include/adwaitamm/private/spinrow_p.hpp b/adw/include/adwaitamm/private/spinrow_p.hpp new file mode 100644 index 0000000..f99c28d --- /dev/null +++ b/adw/include/adwaitamm/private/spinrow_p.hpp @@ -0,0 +1,35 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef LIBADWAITAMM_PRIVATE_SPIN_ROW_P_HPP +#define LIBADWAITAMM_PRIVATE_SPIN_ROW_P_HPP + +#include "adwaitamm/private/actionrow_p.hpp" + +#include <glibmm/class.h> +#include <glibmm/objectbase.h> + +#define _ADWAITA_INSIDE +#include <adw-spin-row.h> +#undef _ADWAITA_INSIDE + +namespace Adwaita +{ + struct SpinRow_Class : Glib::Class + { + using BaseClassParent = AdwActionRowClass; + using BaseClassType = AdwSpinRowClass; + using BaseObjectType = AdwSpinRow; + using CppClassParent = ActionRow_Class; + using CppObjectType = struct SpinRow; + + auto init() -> Glib::Class const &; + auto static class_init_function(void * gclass, void * data) -> void; + auto static wrap_new(GObject * object) -> Glib::ObjectBase *; + }; +} // namespace Adwaita + +#endif
\ No newline at end of file diff --git a/adw/include/adwaitamm/spinrow.hpp b/adw/include/adwaitamm/spinrow.hpp new file mode 100644 index 0000000..f5e02b6 --- /dev/null +++ b/adw/include/adwaitamm/spinrow.hpp @@ -0,0 +1,117 @@ +/** + * @author Felix Morgner (felix.morgner@gmail.com) + * @copyright Copyright (c) 2025 + * SPDX-License-Identifier: LGPL-2.1-or-later + */ + +#ifndef LIBADWAITAMM_SPIN_ROW_HPP +#define LIBADWAITAMM_SPIN_ROW_HPP + +#include "adwaitamm/actionrow.hpp" +#include "adwaitamm/helpers/gobj_mixin.hpp" + +#include <glibmm/object.h> +#include <glibmm/propertyproxy.h> +#include <glibmm/refptr.h> +#include <glibmm/signalproxy.h> + +#include <gtkmm/adjustment.h> +#include <gtkmm/spinbutton.h> + +#include <glib-object.h> + +#define _ADWAITA_INSIDE +#include <adw-spin-row.h> +#undef _ADWAITA_INSIDE + +using AdwSpinRow = struct _AdwSpinRow; + +namespace Adwaita +{ + struct SpinRow final : ActionRow, + helpers::gobj_mixin<SpinRow, AdwSpinRow> + { + using BaseObjectType = AdwSpinRow; + using BaseClassType = AdwSpinRowClass; + using CppObjectType = struct SpinRow; + using CppClassType = struct SpinRow_Class; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; + using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; + +#pragma mark - Special Member Functions + SpinRow(Gtk::Adjustment & adjustment, double climb_rate, unsigned int digits); + SpinRow(double min, double max, double step); + SpinRow(SpinRow const & other) = delete; + SpinRow(SpinRow && other) noexcept = default; + + auto operator=(SpinRow const & other) noexcept -> SpinRow & = delete; + auto operator=(SpinRow && other) noexcept -> SpinRow & = default; + +#pragma mark - GObject Support + auto static get_type() -> GType; + auto static get_base_type() -> GType; + +#pragma mark - Functions + auto configure(Gtk::Adjustment & adjustment, double climb_rate, unsigned int digits) -> void; + auto update() -> void; + +#pragma mark - Getters + [[nodiscard]] auto get_adjustment() const -> Glib::RefPtr<Gtk::Adjustment>; + [[nodiscard]] auto get_climb_rate() const -> double; + [[nodiscard]] auto get_digits() const -> unsigned int; + [[nodiscard]] auto get_numeric() const -> bool; + [[nodiscard]] auto get_snap_to_ticks() const -> bool; + [[nodiscard]] auto get_update_policy() const -> Gtk::SpinButton::UpdatePolicy; + [[nodiscard]] auto get_value() const -> double; + [[nodiscard]] auto get_wrap() const -> bool; + +#pragma mark - Setters + auto set_adjustment(Gtk::Adjustment & value) -> void; + auto set_climb_rate(double value) -> void; + auto set_digits(unsigned int value) -> void; + auto set_numeric(bool value) -> void; + auto set_range(double min, double max) -> void; + auto set_snap_to_ticks(bool value) -> void; + auto set_update_policy(Gtk::SpinButton::UpdatePolicy value) -> void; + auto set_value(double value) -> void; + auto set_wrap(bool value) -> void; + +#pragma mark - Properties + [[nodiscard]] auto property_adjustment() -> Glib::PropertyProxy<Glib::RefPtr<Gtk::Adjustment>>; + [[nodiscard]] auto property_adjustment() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Gtk::Adjustment>>; + [[nodiscard]] auto property_climb_rate() -> Glib::PropertyProxy<double>; + [[nodiscard]] auto property_climb_rate() const -> Glib::PropertyProxy_ReadOnly<double>; + [[nodiscard]] auto property_digits() -> Glib::PropertyProxy<unsigned int>; + [[nodiscard]] auto property_digits() const -> Glib::PropertyProxy_ReadOnly<unsigned int>; + [[nodiscard]] auto property_numeric() -> Glib::PropertyProxy<bool>; + [[nodiscard]] auto property_numeric() const -> Glib::PropertyProxy_ReadOnly<bool>; + [[nodiscard]] auto property_snap_to_ticks() -> Glib::PropertyProxy<bool>; + [[nodiscard]] auto property_snap_to_ticks() const -> Glib::PropertyProxy_ReadOnly<bool>; + [[nodiscard]] auto property_update_policy() -> Glib::PropertyProxy<Gtk::SpinButton::UpdatePolicy>; + [[nodiscard]] auto property_update_policy() const -> Glib::PropertyProxy_ReadOnly<Gtk::SpinButton::UpdatePolicy>; + [[nodiscard]] auto property_value() -> Glib::PropertyProxy<double>; + [[nodiscard]] auto property_value() const -> Glib::PropertyProxy_ReadOnly<double>; + [[nodiscard]] auto property_wrap() -> Glib::PropertyProxy<bool>; + [[nodiscard]] auto property_wrap() const -> Glib::PropertyProxy_ReadOnly<bool>; + +#pragma mark - Signals + auto signal_input() -> Glib::SignalProxy<int(double &)>; + auto signal_output() -> Glib::SignalProxy<bool()>; + auto signal_wrapped() -> Glib::SignalProxy<void()>; + + protected: + friend SpinRow_Class; + +#pragma mark - Internal Constructors + explicit SpinRow(Glib::ConstructParams const & params); + explicit SpinRow(BaseObjectType * gobj); + }; + +} // namespace Adwaita + +namespace Glib +{ + auto wrap(AdwSpinRow * object, bool copy = false) -> Adwaita::SpinRow *; +} // namespace Glib + +#endif
\ No newline at end of file |
