summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gui/window.cpp31
-rw-r--r--src/gui/window.h3
2 files changed, 17 insertions, 17 deletions
diff --git a/src/gui/window.cpp b/src/gui/window.cpp
index f1316b4c..bf1ec01c 100644
--- a/src/gui/window.cpp
+++ b/src/gui/window.cpp
@@ -220,51 +220,50 @@ void Window::setLocationRelativeTo(gcn::Widget *widget)
getY() + (wy + (widget->getHeight() - getHeight()) / 2 - y));
}
-void Window::setLocationRelativeTo(ImageRect::ImagePosition position)
+void Window::setLocationRelativeTo(ImageRect::ImagePosition position,
+ int offsetX, int offsetY)
{
- int x = 0, y = 0;
-
if (position == ImageRect::UPPER_LEFT)
{
}
else if (position == ImageRect::UPPER_CENTER)
{
- x = (windowContainer->getWidth() - getWidth()) / 2;
+ offsetX += (windowContainer->getWidth() - getWidth()) / 2;
}
else if (position == ImageRect::UPPER_RIGHT)
{
- x = windowContainer->getWidth() - getWidth();
+ offsetX += windowContainer->getWidth() - getWidth();
}
else if (position == ImageRect::LEFT)
{
- y = (windowContainer->getHeight() - getHeight()) / 2;
+ offsetY += (windowContainer->getHeight() - getHeight()) / 2;
}
else if (position == ImageRect::CENTER)
{
- x = (windowContainer->getWidth() - getWidth()) / 2;
- y = (windowContainer->getHeight() - getHeight()) / 2;
+ offsetX += (windowContainer->getWidth() - getWidth()) / 2;
+ offsetY += (windowContainer->getHeight() - getHeight()) / 2;
}
else if (position == ImageRect::RIGHT)
{
- x = windowContainer->getWidth() - getWidth();
- y = (windowContainer->getHeight() - getHeight()) / 2;
+ offsetX += windowContainer->getWidth() - getWidth();
+ offsetY += (windowContainer->getHeight() - getHeight()) / 2;
}
else if (position == ImageRect::LOWER_LEFT)
{
- y = windowContainer->getHeight() - getHeight();
+ offsetY += windowContainer->getHeight() - getHeight();
}
else if (position == ImageRect::LOWER_CENTER)
{
- x = (windowContainer->getWidth() - getWidth()) / 2;
- y = windowContainer->getHeight() - getHeight();
+ offsetX += (windowContainer->getWidth() - getWidth()) / 2;
+ offsetY += windowContainer->getHeight() - getHeight();
}
else if (position == ImageRect::LOWER_RIGHT)
{
- x = windowContainer->getWidth() - getWidth();
- y = windowContainer->getHeight() - getHeight();
+ offsetX += windowContainer->getWidth() - getWidth();
+ offsetY += windowContainer->getHeight() - getHeight();
}
- setPosition(x, y);
+ setPosition(offsetX, offsetY);
}
void Window::setMinWidth(unsigned int width)
diff --git a/src/gui/window.h b/src/gui/window.h
index c24bde76..4fc6c862 100644
--- a/src/gui/window.h
+++ b/src/gui/window.h
@@ -92,7 +92,8 @@ class Window : public gcn::Window, gcn::WidgetListener
/**
* Sets the location relative to the given enumerated position.
*/
- void setLocationRelativeTo(ImageRect::ImagePosition position);
+ void setLocationRelativeTo(ImageRect::ImagePosition position,
+ int offsetX = 0, int offsetY = 0);
/**
* Sets whether or not the window can be resized.