1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-18 13:12:50 +00:00

Call onResChange for every window

This commit is contained in:
scrawl 2017-09-23 22:07:30 +02:00
parent 2b03bc0c56
commit c6c01870ec
8 changed files with 20 additions and 8 deletions

View File

@ -26,6 +26,8 @@ namespace MWGui
virtual void onOpen();
void onResChange(int, int) { center(); }
private:
std::string mSuggestedPotionName;

View File

@ -17,6 +17,8 @@ namespace MWGui
void setPtr(const MWWorld::Ptr& book);
void setInventoryAllowed(bool allowed);
void onResChange(int, int) { center(); }
protected:
void onNextPageButtonClicked (MyGUI::Widget* sender);
void onPrevPageButtonClicked (MyGUI::Widget* sender);

View File

@ -22,6 +22,8 @@ namespace MWGui
QuickKeysMenu();
~QuickKeysMenu();
void onResChange(int, int) { center(); }
void onItemButtonClicked(MyGUI::Widget* sender);
void onMagicButtonClicked(MyGUI::Widget* sender);
void onUnassignButtonClicked(MyGUI::Widget* sender);

View File

@ -20,6 +20,8 @@ namespace MWGui
void setPtr (const MWWorld::Ptr& scroll);
void setInventoryAllowed(bool allowed);
void onResChange(int, int) { center(); }
protected:
void onCloseButtonClicked (MyGUI::Widget* _sender);
void onTakeButtonClicked (MyGUI::Widget* _sender);

View File

@ -19,6 +19,8 @@ namespace MWGui
void updateControlsBox();
void onResChange(int, int) { center(); }
protected:
MyGUI::TabControl* mSettingsTab;
MyGUI::Button* mOkButton;

View File

@ -30,6 +30,8 @@ namespace MWGui
void onFrame(float dt) { checkReferenceAvailable(); }
void onResChange(int, int) { center(); }
protected:
MyGUI::Button* mCancelButton;
MyGUI::TextBox* mPlayerGold;

View File

@ -42,7 +42,11 @@ namespace MWGui
virtual void setVisible(bool visible);
/// Returns the visibility state of the window
bool isVisible();
void center();
/// Called when GUI viewport changes size
virtual void onResChange(int width, int height) {}
};

View File

@ -1128,14 +1128,10 @@ namespace MWGui
it->first->setSize(size);
}
mConsole->onResChange(x, y);
mMenu->onResChange(x, y);
mSettingsWindow->center();
mAlchemyWindow->center();
mScrollWindow->center();
mBookWindow->center();
mQuickKeysMenu->center();
mSpellBuyingWindow->center();
for (WindowBase* window : mWindows)
window->onResChange(x, y);
// TODO: check if any windows are now off-screen and move them back if so
}
void WindowManager::onCursorChange(const std::string &name)