mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-02-28 08:39:40 +00:00
Spell window: dynamically resize the edit box, change delete button caption
This commit is contained in:
parent
2d94fa20d2
commit
26ac7412a0
3 changed files with 19 additions and 6 deletions
|
@ -3,6 +3,7 @@
|
|||
#include <MyGUI_Button.h>
|
||||
#include <MyGUI_EditBox.h>
|
||||
#include <MyGUI_InputManager.h>
|
||||
#include <MyGUI_Window.h>
|
||||
|
||||
#include <components/misc/stringops.hpp>
|
||||
#include <components/settings/settings.hpp>
|
||||
|
@ -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<MyGUI::Window>();
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -15,8 +15,9 @@
|
|||
|
||||
<Widget type="Widget" position="8 535 268 23" align="Left Bottom HStretch">
|
||||
<!-- Spell deletion button -->
|
||||
<Widget type="Button" skin="MW_Button" align="Right Bottom" position="108 0 160 24" name="DeleteSpellButton">
|
||||
<Property key="Caption" value="#{sDeleteSpell}"/>
|
||||
<Widget type="AutoSizedButton" skin="MW_Button" align="Right Bottom" position="268 0 0 24" name="DeleteSpellButton">
|
||||
<Property key="ExpandDirection" value="Left"/>
|
||||
<Property key="Caption" value="#{sDelete}"/>
|
||||
<Property key="NeedKey" value="false"/>
|
||||
</Widget>
|
||||
|
||||
|
|
Loading…
Reference in a new issue