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();
void onResChange(int, int) { center(); }
private:
std::string mSuggestedPotionName;

@ -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);

@ -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);

@ -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);

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

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

@ -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) {}
};

@ -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)

Loading…
Cancel
Save