diff options
Diffstat (limited to 'src/gui')
27 files changed, 66 insertions, 60 deletions
diff --git a/src/gui/skin.cpp b/src/gui/skin.cpp index 602d7204e..2028cbfc0 100644 --- a/src/gui/skin.cpp +++ b/src/gui/skin.cpp @@ -26,6 +26,8 @@ #include "settings.h" +#include "enums/resources/imageposition.h" + #include "resources/image.h" #include "resources/imagerect.h" @@ -124,24 +126,26 @@ void Skin::updateAlpha(const float minimumOpacityAllowed) int Skin::getMinWidth() const { - if (!mBorder || !mBorder->grid[ImageRect::UPPER_LEFT] - || !mBorder->grid[ImageRect::UPPER_RIGHT]) + if (!mBorder || + !mBorder->grid[ImagePosition::UPPER_LEFT] || + !mBorder->grid[ImagePosition::UPPER_RIGHT]) { return 1; } - return mBorder->grid[ImageRect::UPPER_LEFT]->getWidth() + - mBorder->grid[ImageRect::UPPER_RIGHT]->getWidth(); + return mBorder->grid[ImagePosition::UPPER_LEFT]->getWidth() + + mBorder->grid[ImagePosition::UPPER_RIGHT]->getWidth(); } int Skin::getMinHeight() const { - if (!mBorder || !mBorder->grid[ImageRect::UPPER_LEFT] - || !mBorder->grid[ImageRect::LOWER_LEFT]) + if (!mBorder || + !mBorder->grid[ImagePosition::UPPER_LEFT] || + !mBorder->grid[ImagePosition::LOWER_LEFT]) { return 1; } - return mBorder->grid[ImageRect::UPPER_LEFT]->getHeight() + - mBorder->grid[ImageRect::LOWER_LEFT]->getHeight(); + return mBorder->grid[ImagePosition::UPPER_LEFT]->getHeight() + + mBorder->grid[ImagePosition::LOWER_LEFT]->getHeight(); } 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); /** diff --git a/src/gui/windows/bankwindow.cpp b/src/gui/windows/bankwindow.cpp index 09dbb7622..4e28b3b81 100644 --- a/src/gui/windows/bankwindow.cpp +++ b/src/gui/windows/bankwindow.cpp @@ -66,7 +66,7 @@ BankWindow::BankWindow() : placer(5, 2, mWithdrawButton, 5); setContentSize(300, 100); - setDefaultSize(300, 100, ImageRect::CENTER, 0, 0); + setDefaultSize(300, 100, ImagePosition::CENTER, 0, 0); center(); setDefaultSize(); diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index 6d89e67d7..41b6c9355 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -237,7 +237,7 @@ void BuyDialog::init() setStickyButtonLock(true); setMinWidth(260); setMinHeight(220); - setDefaultSize(260, 230, ImageRect::CENTER); + setDefaultSize(260, 230, ImagePosition::CENTER); // reset advance flag for personal shops and cash shop if (mAdvanced && diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp index 691996878..ce2a5a12f 100644 --- a/src/gui/windows/chatwindow.cpp +++ b/src/gui/windows/chatwindow.cpp @@ -136,15 +136,15 @@ ChatWindow::ChatWindow() : if (w < 100) w = 100; if (mainGraphics->getHeight() < 480) - setDefaultSize(w, 90, ImageRect::UPPER_LEFT, -110, -35); + setDefaultSize(w, 90, ImagePosition::UPPER_LEFT, -110, -35); else - setDefaultSize(w, 123, ImageRect::UPPER_LEFT, -110, -35); + setDefaultSize(w, 123, ImagePosition::UPPER_LEFT, -110, -35); #else if (mainGraphics->getWidth() < 600) w = mainGraphics->getWidth() - 10; if (w < 100) w = 100; - setDefaultSize(w, 123, ImageRect::LOWER_LEFT); + setDefaultSize(w, 123, ImagePosition::LOWER_LEFT); #endif setMinWidth(150); setMinHeight(90); diff --git a/src/gui/windows/debugwindow.cpp b/src/gui/windows/debugwindow.cpp index ce1bb5e35..6fdf78cd4 100644 --- a/src/gui/windows/debugwindow.cpp +++ b/src/gui/windows/debugwindow.cpp @@ -55,7 +55,7 @@ DebugWindow::DebugWindow() : setSaveVisible(true); setStickyButtonLock(true); - setDefaultSize(400, 300, ImageRect::CENTER); + setDefaultSize(400, 300, ImagePosition::CENTER); // TRANSLATORS: debug window tab mTabs->addTab(std::string(_("Map")), mMapWidget); diff --git a/src/gui/windows/didyouknowwindow.cpp b/src/gui/windows/didyouknowwindow.cpp index ce078f8dd..429cbaefb 100644 --- a/src/gui/windows/didyouknowwindow.cpp +++ b/src/gui/windows/didyouknowwindow.cpp @@ -74,7 +74,7 @@ DidYouKnowWindow::DidYouKnowWindow() : if (setupWindow) setupWindow->registerWindowForReset(this); - setDefaultSize(500, 400, ImageRect::CENTER); + setDefaultSize(500, 400, ImagePosition::CENTER); mBrowserBox->setOpaque(false); // TRANSLATORS: did you know window button diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 801c4f756..730acee2f 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -124,7 +124,7 @@ EditServerDialog::EditServerDialog(ServerDialog *const parent, setMinWidth(getWidth()); setMinHeight(getHeight()); - setDefaultSize(getWidth(), getHeight(), ImageRect::CENTER); + setDefaultSize(getWidth(), getHeight(), ImagePosition::CENTER); setResizable(false); addKeyListener(this); diff --git a/src/gui/windows/equipmentwindow.cpp b/src/gui/windows/equipmentwindow.cpp index c8a8da5ab..14fc93f40 100644 --- a/src/gui/windows/equipmentwindow.cpp +++ b/src/gui/windows/equipmentwindow.cpp @@ -811,7 +811,7 @@ void EquipmentWindow::recalcSize() mMaxY += mMinY; mTabs->setWidth(mMaxX); mMaxY += mUnequip->getHeight() - mYPadding; - setDefaultSize(mMaxX, mMaxY, ImageRect::CENTER); + setDefaultSize(mMaxX, mMaxY, ImagePosition::CENTER); } int EquipmentWindow::addPage(const std::string &name) diff --git a/src/gui/windows/helpwindow.cpp b/src/gui/windows/helpwindow.cpp index 0d65582a9..861357ea5 100644 --- a/src/gui/windows/helpwindow.cpp +++ b/src/gui/windows/helpwindow.cpp @@ -71,7 +71,7 @@ HelpWindow::HelpWindow() : if (setupWindow) setupWindow->registerWindowForReset(this); - setDefaultSize(500, 400, ImageRect::CENTER); + setDefaultSize(500, 400, ImagePosition::CENTER); mBrowserBox->setOpaque(false); diff --git a/src/gui/windows/inventorywindow.cpp b/src/gui/windows/inventorywindow.cpp index 71c09d723..b5a006604 100644 --- a/src/gui/windows/inventorywindow.cpp +++ b/src/gui/windows/inventorywindow.cpp @@ -163,9 +163,9 @@ InventoryWindow::InventoryWindow(Inventory *const inventory) : setStickyButtonLock(true); if (mainGraphics->mWidth > 600) - setDefaultSize(450, 310, ImageRect::CENTER); + setDefaultSize(450, 310, ImagePosition::CENTER); else - setDefaultSize(387, 307, ImageRect::CENTER); + setDefaultSize(387, 307, ImagePosition::CENTER); setMinWidth(310); setMinHeight(179); addKeyListener(this); diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp index aebe962cb..3a5c1ee93 100644 --- a/src/gui/windows/logindialog.cpp +++ b/src/gui/windows/logindialog.cpp @@ -178,9 +178,9 @@ void LoginDialog::postInit() setContentSize(310, 250); setContentSize(310, h); #ifdef ANDROID - setDefaultSize(310, h, ImageRect::UPPER_CENTER, 0, 0); + setDefaultSize(310, h, ImagePosition::UPPER_CENTER, 0, 0); #else - setDefaultSize(310, h, ImageRect::CENTER, 0, 0); + setDefaultSize(310, h, ImagePosition::CENTER, 0, 0); #endif center(); loadWindowState(); diff --git a/src/gui/windows/maileditwindow.cpp b/src/gui/windows/maileditwindow.cpp index 1030e41ae..a36ae23ef 100644 --- a/src/gui/windows/maileditwindow.cpp +++ b/src/gui/windows/maileditwindow.cpp @@ -80,7 +80,7 @@ MailEditWindow::MailEditWindow() : setStickyButtonLock(true); setVisible(Visible_true); - setDefaultSize(380, 200, ImageRect::CENTER); + setDefaultSize(380, 200, ImagePosition::CENTER); setMinWidth(200); setMinHeight(200); center(); diff --git a/src/gui/windows/mailviewwindow.cpp b/src/gui/windows/mailviewwindow.cpp index 5e2159f5f..cb10ca4c4 100644 --- a/src/gui/windows/mailviewwindow.cpp +++ b/src/gui/windows/mailviewwindow.cpp @@ -85,7 +85,7 @@ MailViewWindow::MailViewWindow(const MailMessage *const message) : setStickyButtonLock(true); setVisible(Visible_true); - setDefaultSize(380, 230, ImageRect::CENTER); + setDefaultSize(380, 230, ImagePosition::CENTER); setMinWidth(200); setMinHeight(100); center(); diff --git a/src/gui/windows/mailwindow.cpp b/src/gui/windows/mailwindow.cpp index dfb8f2c8c..6e1027f8d 100644 --- a/src/gui/windows/mailwindow.cpp +++ b/src/gui/windows/mailwindow.cpp @@ -79,7 +79,7 @@ MailWindow::MailWindow() : if (setupWindow) setupWindow->registerWindowForReset(this); - setDefaultSize(310, 180, ImageRect::CENTER); + setDefaultSize(310, 180, ImagePosition::CENTER); setMinWidth(310); setMinHeight(250); center(); diff --git a/src/gui/windows/npcdialog.cpp b/src/gui/windows/npcdialog.cpp index 28ede67e6..03420cda6 100644 --- a/src/gui/windows/npcdialog.cpp +++ b/src/gui/windows/npcdialog.cpp @@ -154,7 +154,7 @@ NpcDialog::NpcDialog(const BeingId npcId) : setMinWidth(200); setMinHeight(150); - setDefaultSize(300, 578, ImageRect::LOWER_LEFT); + setDefaultSize(300, 578, ImagePosition::LOWER_LEFT); mPlayerBox->setWidth(70); mPlayerBox->setHeight(100); diff --git a/src/gui/windows/questswindow.cpp b/src/gui/windows/questswindow.cpp index 8d4d1eebb..bf09506bf 100644 --- a/src/gui/windows/questswindow.cpp +++ b/src/gui/windows/questswindow.cpp @@ -94,7 +94,7 @@ QuestsWindow::QuestsWindow() : setStickyButtonLock(true); setSaveVisible(true); - setDefaultSize(400, 350, ImageRect::RIGHT); + setDefaultSize(400, 350, ImagePosition::RIGHT); setMinWidth(310); setMinHeight(220); diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp index e35c3c8de..5d6f112a9 100644 --- a/src/gui/windows/serverdialog.cpp +++ b/src/gui/windows/serverdialog.cpp @@ -179,7 +179,7 @@ ServerDialog::ServerDialog(ServerInfo *const serverInfo, setMinWidth(310); setMinHeight(220); - setDefaultSize(getWidth(), getHeight(), ImageRect::CENTER); + setDefaultSize(getWidth(), getHeight(), ImagePosition::CENTER); setResizable(true); addKeyListener(this); diff --git a/src/gui/windows/shopwindow.cpp b/src/gui/windows/shopwindow.cpp index 127f0fbcd..fd9a22996 100644 --- a/src/gui/windows/shopwindow.cpp +++ b/src/gui/windows/shopwindow.cpp @@ -153,9 +153,9 @@ ShopWindow::ShopWindow() : setMinWidth(300); setMinHeight(220); if (mainGraphics->mWidth > 600) - setDefaultSize(500, 300, ImageRect::CENTER); + setDefaultSize(500, 300, ImagePosition::CENTER); else - setDefaultSize(380, 300, ImageRect::CENTER); + setDefaultSize(380, 300, ImagePosition::CENTER); if (setupWindow) setupWindow->registerWindowForReset(this); diff --git a/src/gui/windows/shortcutwindow.cpp b/src/gui/windows/shortcutwindow.cpp index f463b5526..a186295ac 100644 --- a/src/gui/windows/shortcutwindow.cpp +++ b/src/gui/windows/shortcutwindow.cpp @@ -90,7 +90,7 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title, if (height == 0) height = bh * maxItems + border; - setDefaultSize(width, height, ImageRect::LOWER_RIGHT); + setDefaultSize(width, height, ImagePosition::LOWER_RIGHT); mBoxesWidth += bw + border; } @@ -133,7 +133,7 @@ ShortcutWindow::ShortcutWindow(const std::string &restrict title, setupWindow->registerWindowForReset(this); if (width && height) - setDefaultSize(width, height, ImageRect::LOWER_RIGHT); + setDefaultSize(width, height, ImagePosition::LOWER_RIGHT); setMinWidth(32); setMinHeight(32); diff --git a/src/gui/windows/textcommandeditor.cpp b/src/gui/windows/textcommandeditor.cpp index 605a9d1df..83e699c88 100644 --- a/src/gui/windows/textcommandeditor.cpp +++ b/src/gui/windows/textcommandeditor.cpp @@ -105,7 +105,7 @@ TextCommandEditor::TextCommandEditor(TextCommand *const command) : keyboard.setEnabled(false); setWindowName("TextCommandEditor"); - setDefaultSize(w, h, ImageRect::CENTER); + setDefaultSize(w, h, ImagePosition::CENTER); #ifdef TMWA_SUPPORT mIsMagic->setActionEventId("magic"); diff --git a/src/gui/windows/textselectdialog.cpp b/src/gui/windows/textselectdialog.cpp index 9db45d7c7..187716439 100644 --- a/src/gui/windows/textselectdialog.cpp +++ b/src/gui/windows/textselectdialog.cpp @@ -64,7 +64,7 @@ void TextSelectDialog::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/windows/tradewindow.cpp b/src/gui/windows/tradewindow.cpp index 68c779148..d7d094014 100644 --- a/src/gui/windows/tradewindow.cpp +++ b/src/gui/windows/tradewindow.cpp @@ -100,7 +100,7 @@ TradeWindow::TradeWindow() : setResizable(true); setCloseButton(true); setStickyButtonLock(true); - setDefaultSize(386, 180, ImageRect::CENTER); + setDefaultSize(386, 180, ImagePosition::CENTER); setMinWidth(310); setMinHeight(180); diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp index 9597de849..df2569f3e 100644 --- a/src/gui/windows/updaterwindow.cpp +++ b/src/gui/windows/updaterwindow.cpp @@ -210,7 +210,7 @@ UpdaterWindow::UpdaterWindow(const std::string &restrict updateHost, { setWindowName("UpdaterWindow"); setResizable(true); - setDefaultSize(450, 400, ImageRect::CENTER); + setDefaultSize(450, 400, ImagePosition::CENTER); setMinWidth(310); setMinHeight(220); diff --git a/src/gui/windows/whoisonline.cpp b/src/gui/windows/whoisonline.cpp index a23e24437..537fc2f74 100644 --- a/src/gui/windows/whoisonline.cpp +++ b/src/gui/windows/whoisonline.cpp @@ -126,7 +126,7 @@ void WhoIsOnline::postInit() Window::postInit(); const int h = 350; const int w = 200; - setDefaultSize(w, h, ImageRect::CENTER); + setDefaultSize(w, h, ImagePosition::CENTER); setVisible(Visible_false); setCloseButton(true); |