From 7fd9ca808c908c67d9bec2183034ad16ea86a912 Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 2 Apr 2020 21:09:06 +0800 Subject: ... --- src/ui/layout_control.cpp | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to 'src/ui/layout_control.cpp') diff --git a/src/ui/layout_control.cpp b/src/ui/layout_control.cpp index cb71da30..90a825ff 100644 --- a/src/ui/layout_control.cpp +++ b/src/ui/layout_control.cpp @@ -7,13 +7,14 @@ LayoutControl::~LayoutControl() { for (const auto child : children_) delete child; } -void LayoutControl::AddChild(Control* control, const int position) { - Expects(control->GetParent() == nullptr); // The control already has a parent. +void LayoutControl::AddChild(Control* control, const Index position) { + Expects(control->GetParent() == + nullptr); // The control already has a parent. Expects(!dynamic_cast(control)); // Can't add a window as child. - Expects(position >= 0 || - position <= - static_cast( - this->children_.size())); // The position is out of range. + Expects(position >= 0); + Expects(position <= + static_cast( + this->children_.size())); // The position is out of range. children_.insert(this->children_.cbegin() + position, control); @@ -23,11 +24,11 @@ void LayoutControl::AddChild(Control* control, const int position) { OnAddChild(control, position); } -void LayoutControl::RemoveChild(const int position) { - Expects(position >= 0 && - position < - static_cast( - this->children_.size())); // The position is out of range. +void LayoutControl::RemoveChild(const Index position) { + Expects(position >= 0); + Expects(position < + static_cast( + this->children_.size())); // The position is out of range. const auto i = children_.cbegin() + position; const auto child = *i; @@ -40,12 +41,12 @@ void LayoutControl::RemoveChild(const int position) { OnRemoveChild(child, position); } -void LayoutControl::OnAddChild(Control* child, int position) { +void LayoutControl::OnAddChild(Control* child, const Index position) { CRU_UNUSED(child) CRU_UNUSED(position) } -void LayoutControl::OnRemoveChild(Control* child, int position) { +void LayoutControl::OnRemoveChild(Control* child, const Index position) { CRU_UNUSED(child) CRU_UNUSED(position) } -- cgit v1.2.3