aboutsummaryrefslogtreecommitdiff
path: root/src/ui/layout_control.cpp
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-04-02 21:09:06 +0800
committercrupest <crupest@outlook.com>2020-04-02 21:09:06 +0800
commit7fd9ca808c908c67d9bec2183034ad16ea86a912 (patch)
treedd4287e511404aa2da07ea078b4bc2c76d4874fc /src/ui/layout_control.cpp
parent381d0831f72dc52831bbfb66d9e7db10a86760e5 (diff)
downloadcru-7fd9ca808c908c67d9bec2183034ad16ea86a912.tar.gz
cru-7fd9ca808c908c67d9bec2183034ad16ea86a912.tar.bz2
cru-7fd9ca808c908c67d9bec2183034ad16ea86a912.zip
...
Diffstat (limited to 'src/ui/layout_control.cpp')
-rw-r--r--src/ui/layout_control.cpp27
1 files changed, 14 insertions, 13 deletions
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<Window*>(control)); // Can't add a window as child.
- Expects(position >= 0 ||
- position <=
- static_cast<int>(
- this->children_.size())); // The position is out of range.
+ Expects(position >= 0);
+ Expects(position <=
+ static_cast<Index>(
+ 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<int>(
- this->children_.size())); // The position is out of range.
+void LayoutControl::RemoveChild(const Index position) {
+ Expects(position >= 0);
+ Expects(position <
+ static_cast<Index>(
+ 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)
}