summaryrefslogtreecommitdiff
path: root/src/gui/window.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/window.cpp')
-rw-r--r--src/gui/window.cpp30
1 files changed, 11 insertions, 19 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 68b79367..7629e2e7 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -22,6 +22,7 @@
*/
#include <algorithm>
+#include <cassert>
#include <climits>
#include <guichan/exception.hpp>
@@ -234,9 +235,8 @@ void Window::setSize(int width, int height)
if (mLayout)
{
- mLayout->setWidth(width - 2 * getPadding());
- mLayout->setHeight(height - getPadding() - getTitleBarHeight());
- int w, h;
+ int w = width - 2 * getPadding(),
+ h = height - getPadding() - getTitleBarHeight();
mLayout->reflow(w, h);
}
@@ -520,7 +520,6 @@ void Window::mouseDragged(gcn::MouseEvent &event)
// Set the new window and content dimensions
setDimension(newDim);
- updateContentSize();
}
}
@@ -555,7 +554,6 @@ void Window::resetToDefaultSize()
{
setPosition(mDefaultX, mDefaultY);
setContentSize(mDefaultWidth, mDefaultHeight);
- updateContentSize();
}
int Window::getResizeHandles(gcn::MouseEvent &event)
@@ -611,28 +609,22 @@ Layout &Window::getLayout()
return *mLayout;
}
-void Window::forgetLayout()
+LayoutCell &Window::place(int x, int y, gcn::Widget *wg, int w, int h)
{
- delete mLayout;
- mLayout = 0;
+ add(wg);
+ return getLayout().place(wg, x, y, w, h);
}
-Cell &Window::place(int x, int y, gcn::Widget *wg, int w, int h)
+ContainerPlacer Window::getPlacer(int x, int y)
{
- add(wg);
- return getLayout().place(wg, x, y, w, h);
+ return ContainerPlacer(this, &getLayout().at(x, y));
}
-void Window::reflowLayout()
+void Window::reflowLayout(int w, int h)
{
- if (!mLayout) return;
- int w, h;
+ assert(mLayout);
mLayout->reflow(w, h);
- w += mLayout->getX();
- h += mLayout->getY();
- Layout *tmp = mLayout;
- // Hide it so that the incoming resize does not reflow the layout again.
+ delete mLayout;
mLayout = NULL;
setContentSize(w, h);
- mLayout = tmp;
}