diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index cb163b648..f535c66c3 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -34,27 +34,28 @@ namespace MWGui : WindowPinnableBase("openmw_spell_window.layout") , NoDrop(drag, mMainWidget) , mSpellView(nullptr) - , mDeleteButton(nullptr) , mUpdateTimer(0.0f) { mSpellIcons = new SpellIcons(); + MyGUI::Widget* deleteButton; + getWidget(deleteButton, "DeleteSpellButton"); + getWidget(mSpellView, "SpellView"); getWidget(mEffectBox, "EffectsBox"); getWidget(mFilterEdit, "FilterEdit"); - getWidget(mDeleteButton, "DeleteSpellButton"); mFilterEdit->setUserString("IgnoreTabKey", "y"); mSpellView->eventSpellClicked += MyGUI::newDelegate(this, &SpellWindow::onModelIndexSelected); mFilterEdit->eventEditTextChange += MyGUI::newDelegate(this, &SpellWindow::onFilterChanged); - mDeleteButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellWindow::onDeleteClicked); + deleteButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellWindow::onDeleteClicked); setCoord(498, 300, 302, 300); - MyGUI::Window* t = mMainWidget->castType(); - t->eventWindowChangeCoord += MyGUI::newDelegate(this, &SpellWindow::onWindowResize); - onWindowResize(t); + // Adjust the spell filtering widget size because of MyGUI limitations. + int filterWidth = mSpellView->getSize().width - deleteButton->getSize().width - 3; + mFilterEdit->setSize(filterWidth, mFilterEdit->getSize().height); } SpellWindow::~SpellWindow() @@ -258,10 +259,4 @@ namespace MWGui else onSpellSelected(spell.mId); } - - void SpellWindow::onWindowResize(MyGUI::Window* window) { - MyGUI::IntSize sz = mFilterEdit->getSize(); - sz.width = window->getSize().width - mDeleteButton->getSize().width - 40; - mFilterEdit->setSize(sz); - } } diff --git a/apps/openmw/mwgui/spellwindow.hpp b/apps/openmw/mwgui/spellwindow.hpp index fed480b21..01a9c7392 100644 --- a/apps/openmw/mwgui/spellwindow.hpp +++ b/apps/openmw/mwgui/spellwindow.hpp @@ -36,7 +36,6 @@ namespace MWGui void onDeleteClicked(MyGUI::Widget *widget); void onDeleteSpellAccept(); void askDeleteSpell(const std::string& spellId); - void onWindowResize(MyGUI::Window* window); virtual void onPinToggled(); virtual void onTitleDoubleClicked(); @@ -45,7 +44,6 @@ namespace MWGui SpellView* mSpellView; SpellIcons* mSpellIcons; MyGUI::EditBox* mFilterEdit; - MyGUI::Button* mDeleteButton; private: float mUpdateTimer; diff --git a/files/mygui/openmw_spell_window.layout b/files/mygui/openmw_spell_window.layout index ffc7ab48f..9a6e39cd1 100644 --- a/files/mygui/openmw_spell_window.layout +++ b/files/mygui/openmw_spell_window.layout @@ -13,17 +13,17 @@ - + + - - + + - - - + +