forked from teamnwah/openmw-tes3coop
Add delete button to save load menu (Fixes #1453)
This commit is contained in:
parent
881ae33b74
commit
311acfa8ff
3 changed files with 32 additions and 10 deletions
|
@ -30,11 +30,13 @@ namespace MWGui
|
||||||
getWidget(mInfoText, "InfoText");
|
getWidget(mInfoText, "InfoText");
|
||||||
getWidget(mOkButton, "OkButton");
|
getWidget(mOkButton, "OkButton");
|
||||||
getWidget(mCancelButton, "CancelButton");
|
getWidget(mCancelButton, "CancelButton");
|
||||||
|
getWidget(mDeleteButton, "DeleteButton");
|
||||||
getWidget(mSaveList, "SaveList");
|
getWidget(mSaveList, "SaveList");
|
||||||
getWidget(mSaveNameEdit, "SaveNameEdit");
|
getWidget(mSaveNameEdit, "SaveNameEdit");
|
||||||
getWidget(mSpacer, "Spacer");
|
getWidget(mSpacer, "Spacer");
|
||||||
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SaveGameDialog::onOkButtonClicked);
|
mOkButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SaveGameDialog::onOkButtonClicked);
|
||||||
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SaveGameDialog::onCancelButtonClicked);
|
mCancelButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SaveGameDialog::onCancelButtonClicked);
|
||||||
|
mDeleteButton->eventMouseButtonClick += MyGUI::newDelegate(this, &SaveGameDialog::onDeleteButtonClicked);
|
||||||
mCharacterSelection->eventComboChangePosition += MyGUI::newDelegate(this, &SaveGameDialog::onCharacterSelected);
|
mCharacterSelection->eventComboChangePosition += MyGUI::newDelegate(this, &SaveGameDialog::onCharacterSelected);
|
||||||
mSaveList->eventListChangePosition += MyGUI::newDelegate(this, &SaveGameDialog::onSlotSelected);
|
mSaveList->eventListChangePosition += MyGUI::newDelegate(this, &SaveGameDialog::onSlotSelected);
|
||||||
mSaveList->eventListMouseItemActivate += MyGUI::newDelegate(this, &SaveGameDialog::onSlotMouseClick);
|
mSaveList->eventListMouseItemActivate += MyGUI::newDelegate(this, &SaveGameDialog::onSlotMouseClick);
|
||||||
|
@ -54,13 +56,16 @@ namespace MWGui
|
||||||
onSlotSelected(sender, pos);
|
onSlotSelected(sender, pos);
|
||||||
|
|
||||||
if (pos != MyGUI::ITEM_NONE && MyGUI::InputManager::getInstance().isShiftPressed())
|
if (pos != MyGUI::ITEM_NONE && MyGUI::InputManager::getInstance().isShiftPressed())
|
||||||
{
|
confirmDeleteSave();
|
||||||
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
|
}
|
||||||
dialog->open("#{sMessage3}");
|
|
||||||
dialog->eventOkClicked.clear();
|
void SaveGameDialog::confirmDeleteSave()
|
||||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onDeleteSlotConfirmed);
|
{
|
||||||
dialog->eventCancelClicked.clear();
|
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
|
||||||
}
|
dialog->open("#{sMessage3}");
|
||||||
|
dialog->eventOkClicked.clear();
|
||||||
|
dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onDeleteSlotConfirmed);
|
||||||
|
dialog->eventCancelClicked.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SaveGameDialog::onDeleteSlotConfirmed()
|
void SaveGameDialog::onDeleteSlotConfirmed()
|
||||||
|
@ -175,6 +180,9 @@ namespace MWGui
|
||||||
mCharacterSelection->setVisible(load);
|
mCharacterSelection->setVisible(load);
|
||||||
mSpacer->setUserString("Hidden", load ? "false" : "true");
|
mSpacer->setUserString("Hidden", load ? "false" : "true");
|
||||||
|
|
||||||
|
mDeleteButton->setUserString("Hidden", load ? "false" : "true");
|
||||||
|
mDeleteButton->setVisible(load);
|
||||||
|
|
||||||
if (!load)
|
if (!load)
|
||||||
{
|
{
|
||||||
mCurrentCharacter = MWBase::Environment::get().getStateManager()->getCurrentCharacter (false);
|
mCurrentCharacter = MWBase::Environment::get().getStateManager()->getCurrentCharacter (false);
|
||||||
|
@ -188,6 +196,12 @@ namespace MWGui
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SaveGameDialog::onDeleteButtonClicked(MyGUI::Widget *sender)
|
||||||
|
{
|
||||||
|
if (mCurrentSlot)
|
||||||
|
confirmDeleteSave();
|
||||||
|
}
|
||||||
|
|
||||||
void SaveGameDialog::onConfirmationGiven()
|
void SaveGameDialog::onConfirmationGiven()
|
||||||
{
|
{
|
||||||
accept(true);
|
accept(true);
|
||||||
|
|
|
@ -24,8 +24,11 @@ namespace MWGui
|
||||||
void setLoadOrSave(bool load);
|
void setLoadOrSave(bool load);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void confirmDeleteSave();
|
||||||
|
|
||||||
void onCancelButtonClicked (MyGUI::Widget* sender);
|
void onCancelButtonClicked (MyGUI::Widget* sender);
|
||||||
void onOkButtonClicked (MyGUI::Widget* sender);
|
void onOkButtonClicked (MyGUI::Widget* sender);
|
||||||
|
void onDeleteButtonClicked (MyGUI::Widget* sender);
|
||||||
void onCharacterSelected (MyGUI::ComboBox* sender, size_t pos);
|
void onCharacterSelected (MyGUI::ComboBox* sender, size_t pos);
|
||||||
// Slot selected (mouse click or arrow keys)
|
// Slot selected (mouse click or arrow keys)
|
||||||
void onSlotSelected (MyGUI::ListBox* sender, size_t pos);
|
void onSlotSelected (MyGUI::ListBox* sender, size_t pos);
|
||||||
|
@ -51,6 +54,7 @@ namespace MWGui
|
||||||
MyGUI::EditBox* mInfoText;
|
MyGUI::EditBox* mInfoText;
|
||||||
MyGUI::Button* mOkButton;
|
MyGUI::Button* mOkButton;
|
||||||
MyGUI::Button* mCancelButton;
|
MyGUI::Button* mCancelButton;
|
||||||
|
MyGUI::Button* mDeleteButton;
|
||||||
MyGUI::ListBox* mSaveList;
|
MyGUI::ListBox* mSaveList;
|
||||||
MyGUI::EditBox* mSaveNameEdit;
|
MyGUI::EditBox* mSaveNameEdit;
|
||||||
MyGUI::Widget* mSpacer;
|
MyGUI::Widget* mSpacer;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
<MyGUI type="Layout">
|
<MyGUI type="Layout">
|
||||||
<Widget type="VBox" skin="MW_Dialog" layer="Windows" position="0 0 600 400" name="_Main">
|
<Widget type="VBox" skin="MW_Dialog" layer="Windows" position="0 0 600 400" name="_Main">
|
||||||
<Property key="Padding" value="8"/>
|
<Property key="Padding" value="8"/>
|
||||||
<Property key="Spacing" value="6"/>
|
<Property key="Spacing" value="6"/>
|
||||||
|
|
||||||
<Widget type="HBox" skin="">
|
<Widget type="HBox" skin="">
|
||||||
<UserString key="HStretch" value="true"/>
|
<UserString key="HStretch" value="true"/>
|
||||||
|
@ -49,10 +49,14 @@
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
</Widget>
|
</Widget>
|
||||||
|
|
||||||
<Widget type="HBox" skin="">
|
<Widget type="HBox" skin="">
|
||||||
<UserString key="HStretch" value="true"/>
|
<UserString key="HStretch" value="true"/>
|
||||||
|
<Widget type="AutoSizedButton" skin="MW_Button" name="DeleteButton">
|
||||||
|
<Property key="Caption" value="#{sDeleteGame}"/>
|
||||||
|
</Widget>
|
||||||
|
|
||||||
<Widget type="EditBox" skin="MW_TextEdit" name="SaveNameEdit">
|
<Widget type="EditBox" skin="MW_TextEdit" name="SaveNameEdit">
|
||||||
<UserString key="HStretch" value="true"/>
|
<UserString key="HStretch" value="true"/>
|
||||||
<UserString key="VStretch" value="true"/>
|
<UserString key="VStretch" value="true"/>
|
||||||
|
|
Loading…
Reference in a new issue