From fa581d0ed3dbeca2463358be8c4db9534c310154 Mon Sep 17 00:00:00 2001 From: lisyarus Date: Mon, 7 Feb 2022 21:13:41 +0300 Subject: [PATCH] Make ui::grid_layout::get return shared_ptr --- libs/ui/include/psemek/ui/grid_layout.hpp | 2 +- libs/ui/source/grid_layout.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/libs/ui/include/psemek/ui/grid_layout.hpp b/libs/ui/include/psemek/ui/grid_layout.hpp index ec5b9f57..fa3a43d7 100644 --- a/libs/ui/include/psemek/ui/grid_layout.hpp +++ b/libs/ui/include/psemek/ui/grid_layout.hpp @@ -28,7 +28,7 @@ namespace psemek::ui virtual void set_row_weight(std::size_t i, float w); virtual void set_column_weight(std::size_t i, float w); - virtual element * get(std::size_t i, std::size_t j) const; + virtual std::shared_ptr get(std::size_t i, std::size_t j) const; virtual std::shared_ptr set(std::size_t i, std::size_t j, std::shared_ptr c); virtual std::shared_ptr remove(std::size_t i, std::size_t j); diff --git a/libs/ui/source/grid_layout.cpp b/libs/ui/source/grid_layout.cpp index 1097a346..5033e9c5 100644 --- a/libs/ui/source/grid_layout.cpp +++ b/libs/ui/source/grid_layout.cpp @@ -32,7 +32,7 @@ namespace psemek::ui { for (std::size_t i = 0; i < row_count(); ++i) for (std::size_t j = 0; j < column_count(); ++j) - if (get(i, j) == c) return true; + if (get(i, j).get() == c) return true; return false; } @@ -42,7 +42,7 @@ namespace psemek::ui { for (std::size_t j = 0; j < column_count(); ++j) { - if (get(i, j) == c) + if (get(i, j).get() == c) { return remove(i, j); } @@ -100,9 +100,9 @@ namespace psemek::ui post_reshape(); } - element * grid_layout::get(std::size_t i, std::size_t j) const + std::shared_ptr grid_layout::get(std::size_t i, std::size_t j) const { - return children_(i, j).get(); + return children_(i, j); } std::shared_ptr grid_layout::set(std::size_t i, std::size_t j, std::shared_ptr c)