summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-21 10:41:36 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2007-10-21 10:41:36 +0000
commit5020ea5c875a1f8d8c6468f40f0e1f9b4c482045 (patch)
treea7419c862b7781c81b47a5e7dc0a3f23a83fec81
parent1f6ef95ca6bc8972d16b5b3c97e4fe4797fdf97d (diff)
downloadmana-client-5020ea5c875a1f8d8c6468f40f0e1f9b4c482045.tar.gz
mana-client-5020ea5c875a1f8d8c6468f40f0e1f9b4c482045.tar.bz2
mana-client-5020ea5c875a1f8d8c6468f40f0e1f9b4c482045.tar.xz
mana-client-5020ea5c875a1f8d8c6468f40f0e1f9b4c482045.zip
Added automatic layout reflowing on window resize.
-rw-r--r--ChangeLog2
-rw-r--r--src/gui/window.cpp11
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 477995bf..27190a63 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,7 +2,7 @@
* src/gui/window.cpp, src/gui/window.h: Removed redundant resizable
flag. Factored moving/resizing code, so that events are fired only
- once per size change.
+ once per size change. Added automatic layout reflowing on resize.
* src/gui/widgets/layout.cpp: Allowed for decreasing sizes in layout.
2007-10-20 Guillaume Melquiond <guillaume.melquiond@gmail.com>
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 48fe3bfb..bf5f03db 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -229,6 +229,13 @@ void Window::setSize(int width, int height)
height - mGrip->getHeight() - area.y);
}
+ if (mLayout)
+ {
+ mLayout->setWidth(width - 2 * getPadding());
+ mLayout->setHeight(height - getPadding() - getTitleBarHeight());
+ mLayout->reflow();
+ }
+
fireWindowEvent(WindowEvent(this, WindowEvent::WINDOW_RESIZED));
}
@@ -615,5 +622,9 @@ void Window::reflowLayout()
{
if (!mLayout) return;
mLayout->reflow();
+ Layout *tmp = mLayout;
+ // Hide it so that the incoming resize does not reflow the layout again.
+ mLayout = NULL;
resizeToContent();
+ mLayout = tmp;
}