diff options
Diffstat (limited to 'src/gui/widgets')
-rw-r--r-- | src/gui/widgets/selldialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/window.cpp | 40 | ||||
-rw-r--r-- | src/gui/widgets/window.h | 6 |
3 files changed, 25 insertions, 23 deletions
diff --git a/src/gui/widgets/selldialog.cpp b/src/gui/widgets/selldialog.cpp index 2e6e20b86..8e66a4737 100644 --- a/src/gui/widgets/selldialog.cpp +++ b/src/gui/widgets/selldialog.cpp @@ -82,7 +82,7 @@ void SellDialog::postInit() setStickyButtonLock(true); setMinWidth(260); setMinHeight(220); - setDefaultSize(260, 230, ImageRect::CENTER); + setDefaultSize(260, 230, ImagePosition::CENTER); if (setupWindow) setupWindow->registerWindowForReset(this); diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 6223a3d33..17f9bcc70 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -516,44 +516,44 @@ void Window::setLocationHorisontallyRelativeTo(const Widget *const widget) - mDimension.width) / 2 - x), 0); } -void Window::setLocationRelativeTo(const ImageRect::ImagePosition &position, +void Window::setLocationRelativeTo(const ImagePosition::Type &position, int offsetX, int offsetY) { - if (position == ImageRect::UPPER_LEFT) + if (position == ImagePosition::UPPER_LEFT) { } - else if (position == ImageRect::UPPER_CENTER) + else if (position == ImagePosition::UPPER_CENTER) { offsetX += (mainGraphics->mWidth - mDimension.width) / 2; } - else if (position == ImageRect::UPPER_RIGHT) + else if (position == ImagePosition::UPPER_RIGHT) { offsetX += mainGraphics->mWidth - mDimension.width; } - else if (position == ImageRect::LEFT) + else if (position == ImagePosition::LEFT) { offsetY += (mainGraphics->mHeight - mDimension.height) / 2; } - else if (position == ImageRect::CENTER) + else if (position == ImagePosition::CENTER) { offsetX += (mainGraphics->mWidth - mDimension.width) / 2; offsetY += (mainGraphics->mHeight - mDimension.height) / 2; } - else if (position == ImageRect::RIGHT) + else if (position == ImagePosition::RIGHT) { offsetX += mainGraphics->mWidth - mDimension.width; offsetY += (mainGraphics->mHeight - mDimension.height) / 2; } - else if (position == ImageRect::LOWER_LEFT) + else if (position == ImagePosition::LOWER_LEFT) { offsetY += mainGraphics->mHeight - mDimension.height; } - else if (position == ImageRect::LOWER_CENTER) + else if (position == ImagePosition::LOWER_CENTER) { offsetX += (mainGraphics->mWidth - mDimension.width) / 2; offsetY += mainGraphics->mHeight - mDimension.height; } - else if (position == ImageRect::LOWER_RIGHT) + else if (position == ImagePosition::LOWER_RIGHT) { offsetX += mainGraphics->mWidth - mDimension.width; offsetY += mainGraphics->mHeight - mDimension.height; @@ -1175,47 +1175,47 @@ void Window::setDefaultSize() } void Window::setDefaultSize(const int defaultWidth, const int defaultHeight, - const ImageRect::ImagePosition &position, + const ImagePosition::Type &position, const int offsetX, const int offsetY) { int x = 0; int y = 0; - if (position == ImageRect::UPPER_LEFT) + if (position == ImagePosition::UPPER_LEFT) { } - else if (position == ImageRect::UPPER_CENTER) + else if (position == ImagePosition::UPPER_CENTER) { x = (mainGraphics->mWidth - defaultWidth) / 2; } - else if (position == ImageRect::UPPER_RIGHT) + else if (position == ImagePosition::UPPER_RIGHT) { x = mainGraphics->mWidth - defaultWidth; } - else if (position == ImageRect::LEFT) + else if (position == ImagePosition::LEFT) { y = (mainGraphics->mHeight - defaultHeight) / 2; } - else if (position == ImageRect::CENTER) + else if (position == ImagePosition::CENTER) { x = (mainGraphics->mWidth - defaultWidth) / 2; y = (mainGraphics->mHeight - defaultHeight) / 2; } - else if (position == ImageRect::RIGHT) + else if (position == ImagePosition::RIGHT) { x = mainGraphics->mWidth - defaultWidth; y = (mainGraphics->mHeight - defaultHeight) / 2; } - else if (position == ImageRect::LOWER_LEFT) + else if (position == ImagePosition::LOWER_LEFT) { y = mainGraphics->mHeight - defaultHeight; } - else if (position == ImageRect::LOWER_CENTER) + else if (position == ImagePosition::LOWER_CENTER) { x = (mainGraphics->mWidth - defaultWidth) / 2; y = mainGraphics->mHeight - defaultHeight; } - else if (position == ImageRect::LOWER_RIGHT) + else if (position == ImagePosition::LOWER_RIGHT) { x = mainGraphics->mWidth - defaultWidth; y = mainGraphics->mHeight - defaultHeight; diff --git a/src/gui/widgets/window.h b/src/gui/widgets/window.h index ec0ce8b43..0e6e9c026 100644 --- a/src/gui/widgets/window.h +++ b/src/gui/widgets/window.h @@ -68,6 +68,8 @@ #include "enums/simpletypes/modal.h" +#include "enums/resources/imageposition.h" + #include "listeners/mouselistener.h" #include "listeners/widgetlistener.h" @@ -151,7 +153,7 @@ class Window notfinal : public BasicContainer2, /** * Sets the location relative to the given enumerated position. */ - void setLocationRelativeTo(const ImageRect::ImagePosition &position, + void setLocationRelativeTo(const ImagePosition::Type &position, int offsetX = 0, int offsetY = 0); /** @@ -391,7 +393,7 @@ class Window notfinal : public BasicContainer2, * on a relative enumerated position, rather than a coordinate position. */ void setDefaultSize(const int defaultWidth, const int defaultHeight, - const ImageRect::ImagePosition &position, + const ImagePosition::Type &position, const int offsetx = 0, const int offsetY = 0); /** |