diff --git a/apps/openmw/mwgui/spellwindow.cpp b/apps/openmw/mwgui/spellwindow.cpp index 2b1056797..3ae681390 100644 --- a/apps/openmw/mwgui/spellwindow.cpp +++ b/apps/openmw/mwgui/spellwindow.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -33,22 +34,25 @@ namespace MWGui : WindowPinnableBase("openmw_spell_window.layout") , NoDrop(drag, mMainWidget) , mSpellView(nullptr) + , mDeleteButton(nullptr) , mUpdateTimer(0.0f) { mSpellIcons = new SpellIcons(); - MyGUI::Button *deleteSpellBtn = nullptr; - getWidget(mSpellView, "SpellView"); getWidget(mEffectBox, "EffectsBox"); getWidget(mFilterEdit, "FilterEdit"); - getWidget(deleteSpellBtn, "DeleteSpellButton"); + getWidget(mDeleteButton, "DeleteSpellButton"); mFilterEdit->setUserString("IgnoreTabKey", "y"); mSpellView->eventSpellClicked += MyGUI::newDelegate(this, &SpellWindow::onModelIndexSelected); mFilterEdit->eventEditTextChange += MyGUI::newDelegate(this, &SpellWindow::onFilterChanged); - deleteSpellBtn->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellWindow::onDeleteClicked); + mDeleteButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SpellWindow::onDeleteClicked); + + MyGUI::Window* t = mMainWidget->castType(); + t->eventWindowChangeCoord += MyGUI::newDelegate(this, &SpellWindow::onWindowResize); + onWindowResize(t); setCoord(498, 300, 302, 300); } @@ -254,4 +258,10 @@ 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 01a9c7392..fed480b21 100644 --- a/apps/openmw/mwgui/spellwindow.hpp +++ b/apps/openmw/mwgui/spellwindow.hpp @@ -36,6 +36,7 @@ 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(); @@ -44,6 +45,7 @@ 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 6a975008a..ffc7ab48f 100644 --- a/files/mygui/openmw_spell_window.layout +++ b/files/mygui/openmw_spell_window.layout @@ -15,8 +15,9 @@ - - + + +