summaryrefslogtreecommitdiff
path: root/src/gui/window.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-30 14:33:28 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2006-07-30 14:33:28 +0000
commitaff167beefadc32add4b44626cc2f1cbef800c7b (patch)
tree43796105cc107ec55742e88562e064d8031d3b23 /src/gui/window.cpp
parent18b73fdadd715d356416a95c31a25b3293fa2596 (diff)
downloadmana-aff167beefadc32add4b44626cc2f1cbef800c7b.tar.gz
mana-aff167beefadc32add4b44626cc2f1cbef800c7b.tar.bz2
mana-aff167beefadc32add4b44626cc2f1cbef800c7b.tar.xz
mana-aff167beefadc32add4b44626cc2f1cbef800c7b.zip
Updated TMW to be compatible with Guichan 0.5.0 (merged from guichan-0.5.0
branch).
Diffstat (limited to 'src/gui/window.cpp')
-rw-r--r--src/gui/window.cpp34
1 files changed, 12 insertions, 22 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index 974a1d73..9a07111f 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -105,7 +105,7 @@ Window::Window(const std::string& caption, bool modal, Window *parent):
// Add chrome
mChrome = new GCContainer();
mChrome->setOpaque(false);
- setContent(mChrome);
+ gcn::Window::add(mChrome);
// Add this window to the window container
windowContainer->add(this);
@@ -180,7 +180,7 @@ void Window::draw(gcn::Graphics* graphics)
graphics->drawText(getCaption(), 7, 5, gcn::Graphics::LEFT);
}
- drawContent(graphics);
+ drawChildren(graphics);
}
void Window::setContentWidth(int width)
@@ -195,7 +195,7 @@ void Window::setContentHeight(int height)
resizeToContent();
}
-void Window::setLocationRelativeTo(gcn::Widget* widget)
+void Window::setLocationRelativeTo(gcn::Widget *widget)
{
int wx, wy;
int x, y;
@@ -267,7 +267,7 @@ void Window::mousePress(int x, int y, int button)
// border, and is a candidate for a resize.
if (isResizable() && button == 1 &&
getGripDimension().isPointInRect(x, y) &&
- !getContentDimension().isPointInRect(x, y) &&
+ !getChildrenArea().isPointInRect(x, y) &&
hasMouse() &&
!(mMouseDrag && y > (int)getPadding()))
{
@@ -374,11 +374,8 @@ void Window::mouseMotion(int x, int y)
// Set the new window and content dimensions
setDimension(newDim);
-
- if (mContent != NULL && mMouseResize)
- {
- mContent->setDimension(getContentDimension());
- }
+ const gcn::Rectangle area = getChildrenArea();
+ mChrome->setSize(area.width, area.height);
}
}
@@ -406,18 +403,16 @@ Window::loadWindowState()
{
const std::string &name = mWindowName;
- setPosition((int)config.getValue(name + "WinX", getX()),
- (int)config.getValue(name + "WinY", getY()));
+ setPosition((int) config.getValue(name + "WinX", getX()),
+ (int) config.getValue(name + "WinY", getY()));
if (mResizable)
{
- setWidth((int)config.getValue(name + "WinWidth", getWidth()));
- setHeight((int)config.getValue(name + "WinHeight", getHeight()));
+ setSize((int) config.getValue(name + "WinWidth", getWidth()),
+ (int) config.getValue(name + "WinHeight", getHeight()));
- if (mContent != NULL)
- {
- mContent->setDimension(getContentDimension());
- }
+ const gcn::Rectangle area = getChildrenArea();
+ mChrome->setSize(area.width, area.height);
}
}
@@ -437,9 +432,4 @@ void Window::resetToDefaultSize()
{
setPosition(mDefaultX, mDefaultY);
setContentSize(mDefaultWidth, mDefaultHeight);
-
- if (mContent != NULL)
- {
- mContent->setDimension(getContentDimension());
- }
}