diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-04-28 08:24:15 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-04-28 09:39:16 +0200 |
| commit | 33d8a352eca90a530d560175f5406a5bde5e2861 (patch) | |
| tree | e34244ae066b8b1d206a78b8862415d41b4ef548 /adw/include | |
| parent | 663ec6def00cb498eb12de363ddb721828ab8175 (diff) | |
| download | turns-33d8a352eca90a530d560175f5406a5bde5e2861.tar.xz turns-33d8a352eca90a530d560175f5406a5bde5e2861.zip | |
adw: add missing Dialog functions
Diffstat (limited to 'adw/include')
| -rw-r--r-- | adw/include/adwaitamm/dialog.hpp | 65 | ||||
| -rw-r--r-- | adw/include/adwaitamm/enums.hpp | 8 | ||||
| -rw-r--r-- | adw/include/adwaitamm/private/dialog_p.hpp | 4 |
3 files changed, 70 insertions, 7 deletions
diff --git a/adw/include/adwaitamm/dialog.hpp b/adw/include/adwaitamm/dialog.hpp index de6af0c..82e1cd1 100644 --- a/adw/include/adwaitamm/dialog.hpp +++ b/adw/include/adwaitamm/dialog.hpp @@ -8,10 +8,13 @@ #define LIBADWAITAMM_DIALOG_HPP #include "adwaitamm/breakpoint.hpp" +#include "adwaitamm/enums.hpp" #include "helpers/gobj_mixin.hpp" #include <glibmm/object.h> +#include <glibmm/propertyproxy.h> #include <glibmm/refptr.h> +#include <glibmm/signalproxy.h> #include <glibmm/ustring.h> #include <gtkmm/shortcutmanager.h> @@ -38,6 +41,7 @@ namespace Adwaita using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; +#pragma mark - Special Member Functions explicit Dialog(); Dialog(Dialog const & other) = delete; Dialog(Dialog && other) noexcept = default; @@ -45,25 +49,72 @@ namespace Adwaita auto operator=(Dialog const & other) noexcept -> Dialog & = delete; auto operator=(Dialog && other) noexcept -> Dialog & = default; +#pragma mark - GObject Support auto static get_type() -> GType; auto static get_base_type() -> GType; +#pragma mark - Functions auto add_breakpoint(Glib::RefPtr<Breakpoint> const & breakpoint) -> void; auto close() -> void; auto force_close() -> void; - auto get_can_close() const -> bool; - auto get_child() const -> Gtk::Widget *; - auto get_content_height() const -> int; - auto get_content_width() const -> int; - auto get_current_breakpoint() const -> Glib::RefPtr<Breakpoint>; - auto get_default_widget() const -> Gtk::Widget *; - auto get_focus() const -> Gtk::Widget *; auto present(Gtk::Widget * parent) -> void; + +#pragma mark - Getters + [[nodiscard]] auto get_can_close() const -> bool; + [[nodiscard]] auto get_child() const -> Gtk::Widget *; + [[nodiscard]] auto get_content_height() const -> int; + [[nodiscard]] auto get_content_width() const -> int; + [[nodiscard]] auto get_current_breakpoint() const -> Glib::RefPtr<Breakpoint>; + [[nodiscard]] auto get_default_widget() const -> Gtk::Widget *; + [[nodiscard]] auto get_focus() const -> Gtk::Widget *; + [[nodiscard]] auto get_follows_content_size() const -> bool; + [[nodiscard]] auto get_presentation_mode() const -> PresentationMode; + [[nodiscard]] auto get_title() const -> Glib::ustring; + +#pragma mark - Setters + auto set_can_close(bool value) -> void; + auto set_child(Gtk::Widget & value) -> void; + auto set_content_height(int value) -> void; + auto set_content_width(int value) -> void; + auto set_default_widget(Gtk::Widget & value) -> void; + auto set_focus(Gtk::Widget & value) -> void; + auto set_follows_content_size(bool value) -> void; + auto set_presentation_mode(PresentationMode value) -> void; auto set_title(Glib::ustring const & str) -> void; +#pragma mark - Properties + [[nodiscard]] auto property_can_close() -> Glib::PropertyProxy<bool>; + [[nodiscard]] auto property_can_close() const -> Glib::PropertyProxy_ReadOnly<bool>; + [[nodiscard]] auto property_child() -> Glib::PropertyProxy<Gtk::Widget *>; + [[nodiscard]] auto property_child() const -> Glib::PropertyProxy_ReadOnly<Gtk::Widget *>; + [[nodiscard]] auto property_content_height() -> Glib::PropertyProxy<int>; + [[nodiscard]] auto property_content_height() const -> Glib::PropertyProxy_ReadOnly<int>; + [[nodiscard]] auto property_content_width() -> Glib::PropertyProxy<int>; + [[nodiscard]] auto property_content_width() const -> Glib::PropertyProxy_ReadOnly<int>; + [[nodiscard]] auto property_current_breakpoint() const -> Glib::PropertyProxy_ReadOnly<Glib::RefPtr<Breakpoint>>; + [[nodiscard]] auto property_default_widget() -> Glib::PropertyProxy<Gtk::Widget *>; + [[nodiscard]] auto property_default_widget() const -> Glib::PropertyProxy_ReadOnly<Gtk::Widget *>; + [[nodiscard]] auto property_focus_widget() -> Glib::PropertyProxy<Gtk::Widget *>; + [[nodiscard]] auto property_focus_widget() const -> Glib::PropertyProxy_ReadOnly<Gtk::Widget *>; + [[nodiscard]] auto property_follows_content_size() -> Glib::PropertyProxy<bool>; + [[nodiscard]] auto property_follows_content_size() const -> Glib::PropertyProxy_ReadOnly<bool>; + [[nodiscard]] auto property_presentation_mode() -> Glib::PropertyProxy<PresentationMode>; + [[nodiscard]] auto property_presentation_mode() const -> Glib::PropertyProxy_ReadOnly<PresentationMode>; + [[nodiscard]] auto property_title() -> Glib::PropertyProxy<Glib::ustring>; + [[nodiscard]] auto property_title() const -> Glib::PropertyProxy_ReadOnly<Glib::ustring>; + +#pragma mark - Signals + [[nodiscard]] auto signal_close_attempt() -> Glib::SignalProxy<void()>; + [[nodiscard]] auto signal_closed() -> Glib::SignalProxy<void()>; + protected: friend Dialog_Class; +#pragma mark - Default Signal Handlers + auto virtual on_close_attempt() -> void; + auto virtual on_closed() -> void; + +#pragma mark - Internal Constructors explicit Dialog(Glib::ConstructParams const & params); explicit Dialog(BaseObjectType * gobj); }; diff --git a/adw/include/adwaitamm/enums.hpp b/adw/include/adwaitamm/enums.hpp index 8cae39d..0d09833 100644 --- a/adw/include/adwaitamm/enums.hpp +++ b/adw/include/adwaitamm/enums.hpp @@ -43,6 +43,13 @@ namespace Adwaita MaxHeight, }; + enum struct PresentationMode + { + Auto, + Floating, + BottomSheet, + }; + enum struct RatioType { MinAspectRatio, @@ -78,6 +85,7 @@ namespace Glib VALUE_SPECIALIZATION(AccentColor); VALUE_SPECIALIZATION(ColorScheme); VALUE_SPECIALIZATION(LengthType); + VALUE_SPECIALIZATION(PresentationMode); VALUE_SPECIALIZATION(RatioType); VALUE_SPECIALIZATION(ResponseAppearance); VALUE_SPECIALIZATION(ToastPriority); diff --git a/adw/include/adwaitamm/private/dialog_p.hpp b/adw/include/adwaitamm/private/dialog_p.hpp index a8be388..814a44e 100644 --- a/adw/include/adwaitamm/private/dialog_p.hpp +++ b/adw/include/adwaitamm/private/dialog_p.hpp @@ -29,6 +29,10 @@ namespace Adwaita 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 |
