diff options
| -rw-r--r-- | adw/include/turns/adw/breakpoint.hpp | 3 | ||||
| -rw-r--r-- | adw/include/turns/adw/dialog.hpp | 12 | ||||
| -rw-r--r-- | adw/include/turns/adw/helpers/gobj_mixin.hpp | 2 | ||||
| -rw-r--r-- | adw/src/breakpoint.cpp | 5 | ||||
| -rw-r--r-- | adw/src/dialog.cpp | 50 |
5 files changed, 63 insertions, 9 deletions
diff --git a/adw/include/turns/adw/breakpoint.hpp b/adw/include/turns/adw/breakpoint.hpp index b274bbb..e5dabe3 100644 --- a/adw/include/turns/adw/breakpoint.hpp +++ b/adw/include/turns/adw/breakpoint.hpp @@ -84,19 +84,20 @@ namespace turns::adw using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj; using helpers::gobj_mixin<CppObjectType, BaseObjectType>::gobj_copy; - explicit Breakpoint(BreakpointCondition & condition); Breakpoint(Breakpoint const & other) = delete; Breakpoint(Breakpoint && other) noexcept = default; auto operator=(Breakpoint const & other) noexcept -> Breakpoint & = delete; auto operator=(Breakpoint && other) noexcept -> Breakpoint & = default; + auto static create(BreakpointCondition & condition) -> Glib::RefPtr<Breakpoint>; auto static get_type() -> GType; auto static get_base_type() -> GType; auto property_condition() -> Glib::PropertyProxy<BreakpointCondition *>; protected: + explicit Breakpoint(BreakpointCondition & condition); explicit Breakpoint(Glib::ConstructParams const & params); explicit Breakpoint(BaseObjectType * gobj); }; diff --git a/adw/include/turns/adw/dialog.hpp b/adw/include/turns/adw/dialog.hpp index 316a218..3536dfa 100644 --- a/adw/include/turns/adw/dialog.hpp +++ b/adw/include/turns/adw/dialog.hpp @@ -55,8 +55,16 @@ namespace turns::adw auto static get_type() -> GType; auto static get_base_type() -> GType; - auto add_breakpoint(adw::Breakpoint && breakpoint) -> void; + 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; auto set_title(Glib::ustring const & str) -> void; @@ -68,7 +76,7 @@ namespace turns::adw namespace Glib { - auto wrap(AdwDialog * object, bool copy = false) -> Glib::RefPtr<turns::adw::Dialog>; + auto wrap(AdwDialog * object, bool copy = false) -> turns::adw::Dialog *; } // namespace Glib #endif
\ No newline at end of file diff --git a/adw/include/turns/adw/helpers/gobj_mixin.hpp b/adw/include/turns/adw/helpers/gobj_mixin.hpp index d9e5097..67600cf 100644 --- a/adw/include/turns/adw/helpers/gobj_mixin.hpp +++ b/adw/include/turns/adw/helpers/gobj_mixin.hpp @@ -28,7 +28,7 @@ namespace turns::adw::helpers using gobj_type = std::conditional_t<std::is_const_v<clean_type>, std::add_const_t<Glib::Object>, Glib::Object>; static_cast<gobj_type &&>(self).reference(); - return self.gobj(); + return const_cast<AdwType *>(self.gobj()); } }; diff --git a/adw/src/breakpoint.cpp b/adw/src/breakpoint.cpp index eb857ad..dd930a3 100644 --- a/adw/src/breakpoint.cpp +++ b/adw/src/breakpoint.cpp @@ -134,6 +134,11 @@ namespace turns::adw { } + auto Breakpoint::create(BreakpointCondition & condition) -> Glib::RefPtr<Breakpoint> + { + return Glib::make_refptr_for_instance(new Breakpoint(condition)); + } + auto Breakpoint::get_type() -> GType { return _class.init().get_type(); diff --git a/adw/src/dialog.cpp b/adw/src/dialog.cpp index 8047d65..868ad22 100644 --- a/adw/src/dialog.cpp +++ b/adw/src/dialog.cpp @@ -74,10 +74,10 @@ namespace turns::adw { } - auto Dialog::add_breakpoint(adw::Breakpoint && breakpoint) -> void + auto Dialog::add_breakpoint(Glib::RefPtr<Breakpoint> const & breakpoint) -> void { - breakpoint.reference(); - adw_dialog_add_breakpoint(Glib::unwrap(this), Glib::unwrap(&breakpoint)); + // Take a copy because the dialog will take ownership of the breakpoint. + adw_dialog_add_breakpoint(Glib::unwrap(this), Glib::unwrap_copy(breakpoint)); } auto Dialog::close() -> void @@ -85,6 +85,46 @@ namespace turns::adw adw_dialog_close(Glib::unwrap(this)); } + auto Dialog::force_close() -> void + { + adw_dialog_force_close(Glib::unwrap(this)); + } + + auto Dialog::get_can_close() const -> bool + { + return adw_dialog_get_can_close(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto Dialog::get_child() const -> Gtk::Widget * + { + return Glib::wrap(adw_dialog_get_child(const_cast<BaseObjectType *>(Glib::unwrap(this))), true); + } + + auto Dialog::get_content_height() const -> int + { + return adw_dialog_get_content_height(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto Dialog::get_content_width() const -> int + { + return adw_dialog_get_content_width(const_cast<BaseObjectType *>(Glib::unwrap(this))); + } + + auto Dialog::get_current_breakpoint() const -> Glib::RefPtr<Breakpoint> + { + return Glib::wrap(adw_dialog_get_current_breakpoint(const_cast<BaseObjectType *>(Glib::unwrap(this))), true); + } + + auto Dialog::get_default_widget() const -> Gtk::Widget * + { + return Glib::wrap(adw_dialog_get_default_widget(const_cast<BaseObjectType *>(Glib::unwrap(this)))); + } + + auto Dialog::get_focus() const -> Gtk::Widget * + { + return Glib::wrap(adw_dialog_get_focus(const_cast<BaseObjectType *>(Glib::unwrap(this)))); + } + auto Dialog::present(Gtk::Widget * parent) -> void { adw_dialog_present(Glib::unwrap(this), Glib::unwrap(parent)); @@ -99,8 +139,8 @@ namespace turns::adw namespace Glib { - auto wrap(AdwDialog * object, bool copy) -> Glib::RefPtr<turns::adw::Dialog> + auto wrap(AdwDialog * object, bool copy) -> turns::adw::Dialog * { - return Glib::make_refptr_for_instance(dynamic_cast<turns::adw::Dialog *>(Glib::wrap_auto(G_OBJECT(object), copy))); + return dynamic_cast<turns::adw::Dialog *>(Glib::wrap_auto(G_OBJECT(object), copy)); } } // namespace Glib
\ No newline at end of file |
