aboutsummaryrefslogtreecommitdiff
path: root/src/ui/window.cpp
diff options
context:
space:
mode:
authorYuqian Yang <crupest@outlook.com>2018-10-04 16:52:11 +0000
committerYuqian Yang <crupest@outlook.com>2018-10-04 16:52:11 +0000
commit7e870dd16e2f5b41fa6c6f687723aaa50c16274d (patch)
treebe2b26a42dc9fde97379f98f035113e08e0bc331 /src/ui/window.cpp
parent30ecda8bb354d5982978af97aa90b5f49d9ea195 (diff)
parentc5384d496e9ed429ca2baa3ca5e586ff255235eb (diff)
downloadcru-7e870dd16e2f5b41fa6c6f687723aaa50c16274d.tar.gz
cru-7e870dd16e2f5b41fa6c6f687723aaa50c16274d.tar.bz2
cru-7e870dd16e2f5b41fa6c6f687723aaa50c16274d.zip
Merge branch '12-layout' into 'master'
Resolve "Add padding, margin, border to Control." Closes #12 See merge request crupest/CruUI!12
Diffstat (limited to 'src/ui/window.cpp')
-rw-r--r--src/ui/window.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/ui/window.cpp b/src/ui/window.cpp
index 39528550..9edbd398 100644
--- a/src/ui/window.cpp
+++ b/src/ui/window.cpp
@@ -354,8 +354,8 @@ namespace cru
void Window::Relayout()
{
- OnMeasure(GetSize());
- OnLayout(Rect(Point::Zero(), GetSize()));
+ OnMeasureCore(GetSize());
+ OnLayoutCore(Rect(Point::Zero(), GetSize()));
}
void Window::RefreshControlList() {
@@ -462,7 +462,7 @@ namespace cru
return ::PeekMessageW(&msg, hwnd_, message, message, PM_NOREMOVE) != 0;
}
- Size Window::OnMeasure(const Size& available_size)
+ Size Window::OnMeasureContent(const Size& available_size)
{
ForeachChild([available_size](Control* control)
{
@@ -498,9 +498,10 @@ namespace cru
ValidateRect(hwnd_, nullptr);
}
- void Window::OnResizeInternal(int new_width, int new_height) {
+ void Window::OnResizeInternal(const int new_width, const int new_height) {
render_target_->ResizeBuffer(new_width, new_height);
- Relayout();
+ if (!(new_width == 0 && new_height == 0))
+ Relayout();
}
void Window::OnSetFocusInternal()