Call onResChange for every window

new-script-api
scrawl 7 years ago
parent 2b03bc0c56
commit c6c01870ec

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

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

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

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

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

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

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

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

Loading…
Cancel
Save