mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-03 09:19:41 +00:00
Make trade balance label editable
This commit is contained in:
parent
de7fcf0beb
commit
a1bdf20958
3 changed files with 18 additions and 2 deletions
|
@ -74,6 +74,8 @@ namespace MWGui
|
|||
mDecreaseButton->eventMouseButtonPressed += MyGUI::newDelegate(this, &TradeWindow::onDecreaseButtonPressed);
|
||||
mDecreaseButton->eventMouseButtonReleased += MyGUI::newDelegate(this, &TradeWindow::onBalanceButtonReleased);
|
||||
|
||||
mTotalBalance->eventEditTextChange += MyGUI::newDelegate(this, &TradeWindow::onBalanceEdited);
|
||||
|
||||
setCoord(400, 0, 400, 300);
|
||||
}
|
||||
|
||||
|
@ -410,6 +412,19 @@ namespace MWGui
|
|||
mBalanceButtonsState = BBS_None;
|
||||
}
|
||||
|
||||
void TradeWindow::onBalanceEdited(MyGUI::EditBox *_sender)
|
||||
{
|
||||
try
|
||||
{
|
||||
unsigned int count = boost::lexical_cast<unsigned int>(_sender->getCaption());
|
||||
mCurrentBalance = count * (mCurrentBalance >= 0 ? 1 : -1);
|
||||
updateLabels();
|
||||
}
|
||||
catch (std::bad_cast&)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
void TradeWindow::onIncreaseButtonTriggered()
|
||||
{
|
||||
if(mCurrentBalance<=-1) mCurrentBalance -= 1;
|
||||
|
|
|
@ -55,7 +55,7 @@ namespace MWGui
|
|||
MyGUI::Button* mIncreaseButton;
|
||||
MyGUI::Button* mDecreaseButton;
|
||||
MyGUI::TextBox* mTotalBalanceLabel;
|
||||
MyGUI::TextBox* mTotalBalance;
|
||||
MyGUI::EditBox* mTotalBalance;
|
||||
|
||||
MyGUI::Widget* mBottomPane;
|
||||
|
||||
|
@ -91,6 +91,7 @@ namespace MWGui
|
|||
void onIncreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
||||
void onDecreaseButtonPressed(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
||||
void onBalanceButtonReleased(MyGUI::Widget* _sender, int _left, int _top, MyGUI::MouseButton _id);
|
||||
void onBalanceEdited(MyGUI::EditBox* _sender);
|
||||
|
||||
void onIncreaseButtonTriggered();
|
||||
void onDecreaseButtonTriggered();
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
</Widget>
|
||||
|
||||
<Widget type="TextBox" skin="SandText" position="48 0 140 24" name="TotalBalanceLabel" align="Left Top "/>
|
||||
<Widget type="TextBox" skin="SandText" position="48 28 140 24" name="TotalBalance" align="Left Top">
|
||||
<Widget type="EditBox" skin="MW_TextEdit" position="48 28 140 24" name="TotalBalance" align="Left Top">
|
||||
<Property key="TextAlign" value="Center"/>
|
||||
</Widget>
|
||||
|
||||
|
|
Loading…
Reference in a new issue