mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 10:53:53 +00:00
spell window: don't manually recalculate edit box width every update
This commit is contained in:
parent
e1ce15efb5
commit
e057ea171f
3 changed files with 13 additions and 20 deletions
|
@ -34,27 +34,28 @@ namespace MWGui
|
||||||
: WindowPinnableBase("openmw_spell_window.layout")
|
: WindowPinnableBase("openmw_spell_window.layout")
|
||||||
, NoDrop(drag, mMainWidget)
|
, NoDrop(drag, mMainWidget)
|
||||||
, mSpellView(nullptr)
|
, mSpellView(nullptr)
|
||||||
, mDeleteButton(nullptr)
|
|
||||||
, mUpdateTimer(0.0f)
|
, mUpdateTimer(0.0f)
|
||||||
{
|
{
|
||||||
mSpellIcons = new SpellIcons();
|
mSpellIcons = new SpellIcons();
|
||||||
|
|
||||||
|
MyGUI::Widget* deleteButton;
|
||||||
|
getWidget(deleteButton, "DeleteSpellButton");
|
||||||
|
|
||||||
getWidget(mSpellView, "SpellView");
|
getWidget(mSpellView, "SpellView");
|
||||||
getWidget(mEffectBox, "EffectsBox");
|
getWidget(mEffectBox, "EffectsBox");
|
||||||
getWidget(mFilterEdit, "FilterEdit");
|
getWidget(mFilterEdit, "FilterEdit");
|
||||||
getWidget(mDeleteButton, "DeleteSpellButton");
|
|
||||||
|
|
||||||
mFilterEdit->setUserString("IgnoreTabKey", "y");
|
mFilterEdit->setUserString("IgnoreTabKey", "y");
|
||||||
|
|
||||||
mSpellView->eventSpellClicked += MyGUI::newDelegate(this, &SpellWindow::onModelIndexSelected);
|
mSpellView->eventSpellClicked += MyGUI::newDelegate(this, &SpellWindow::onModelIndexSelected);
|
||||||
mFilterEdit->eventEditTextChange += MyGUI::newDelegate(this, &SpellWindow::onFilterChanged);
|
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);
|
setCoord(498, 300, 302, 300);
|
||||||
|
|
||||||
MyGUI::Window* t = mMainWidget->castType<MyGUI::Window>();
|
// Adjust the spell filtering widget size because of MyGUI limitations.
|
||||||
t->eventWindowChangeCoord += MyGUI::newDelegate(this, &SpellWindow::onWindowResize);
|
int filterWidth = mSpellView->getSize().width - deleteButton->getSize().width - 3;
|
||||||
onWindowResize(t);
|
mFilterEdit->setSize(filterWidth, mFilterEdit->getSize().height);
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellWindow::~SpellWindow()
|
SpellWindow::~SpellWindow()
|
||||||
|
@ -258,10 +259,4 @@ namespace MWGui
|
||||||
else
|
else
|
||||||
onSpellSelected(spell.mId);
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,7 +36,6 @@ namespace MWGui
|
||||||
void onDeleteClicked(MyGUI::Widget *widget);
|
void onDeleteClicked(MyGUI::Widget *widget);
|
||||||
void onDeleteSpellAccept();
|
void onDeleteSpellAccept();
|
||||||
void askDeleteSpell(const std::string& spellId);
|
void askDeleteSpell(const std::string& spellId);
|
||||||
void onWindowResize(MyGUI::Window* window);
|
|
||||||
|
|
||||||
virtual void onPinToggled();
|
virtual void onPinToggled();
|
||||||
virtual void onTitleDoubleClicked();
|
virtual void onTitleDoubleClicked();
|
||||||
|
@ -45,7 +44,6 @@ namespace MWGui
|
||||||
SpellView* mSpellView;
|
SpellView* mSpellView;
|
||||||
SpellIcons* mSpellIcons;
|
SpellIcons* mSpellIcons;
|
||||||
MyGUI::EditBox* mFilterEdit;
|
MyGUI::EditBox* mFilterEdit;
|
||||||
MyGUI::Button* mDeleteButton;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float mUpdateTimer;
|
float mUpdateTimer;
|
||||||
|
|
|
@ -13,17 +13,17 @@
|
||||||
<Widget type="SpellView" skin="MW_SpellView" position="8 38 268 490" align="Left Top Stretch" name="SpellView">
|
<Widget type="SpellView" skin="MW_SpellView" position="8 38 268 490" align="Left Top Stretch" name="SpellView">
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="Widget" position="8 535 268 23" align="Left Bottom HStretch">
|
<Widget type="HBox" position="8 535 268 23" align="Right Bottom HStretch">
|
||||||
|
<Widget type="Spacer"/>
|
||||||
<!-- Spell deletion button -->
|
<!-- Spell deletion button -->
|
||||||
<Widget type="AutoSizedButton" skin="MW_Button" align="Right Bottom" position="268 0 0 24" name="DeleteSpellButton">
|
<Widget type="AutoSizedButton" skin="MW_Button" align="Right Bottom" position="8 535 0 23" name="DeleteSpellButton">
|
||||||
<Property key="ExpandDirection" value="Left"/>
|
|
||||||
<Property key="Caption" value="#{sDelete}"/>
|
<Property key="Caption" value="#{sDelete}"/>
|
||||||
<Property key="NeedKey" value="false"/>
|
<Property key="NeedKey" value="false"/>
|
||||||
</Widget>
|
</Widget>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
<!-- Search box-->
|
<!-- Search box-->
|
||||||
<Widget type="EditBox" skin="MW_TextBoxEditWithBorder" position="0 0 100 23" align="Left Bottom HStretch" name="FilterEdit">
|
<Widget type="EditBox" skin="MW_TextBoxEditWithBorder" position="8 535 268 23" align="Left Bottom HStretch" name="FilterEdit">
|
||||||
</Widget>
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
Loading…
Reference in a new issue