Merge pull request #1246 from akortunov/develop

Menu improvements
pull/196/head
scrawl 8 years ago committed by GitHub
commit 8d8f293a65

@ -17,19 +17,26 @@ namespace MWGui
}
void ConfirmationDialog::askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage)
{
mCancelButton->setCaptionWithReplacing(cancelMessage);
mOkButton->setCaptionWithReplacing(confirmMessage);
askForConfirmation(message);
}
void ConfirmationDialog::askForConfirmation(const std::string& message)
{
setVisible(true);
mMessage->setCaptionWithReplacing(message);
mCancelButton->setCaptionWithReplacing(cancelMessage);
mOkButton->setCaptionWithReplacing(confirmMessage);
int height = mMessage->getTextSize().height + 60;
int height = mMessage->getTextSize().height + 72;
int width = mMessage->getTextSize().width + 24;
mMainWidget->setSize(mMainWidget->getWidth(), height);
mMainWidget->setSize(width, height);
mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height+24);
mMessage->setSize(mMessage->getWidth(), mMessage->getTextSize().height + 24);
center();
}

@ -9,7 +9,8 @@ namespace MWGui
{
public:
ConfirmationDialog();
void askForConfirmation(const std::string& message, const std::string& confirmMessage="#{sOk}", const std::string& cancelMessage="#{sCancel}");
void askForConfirmation(const std::string& message);
void askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage);
virtual void exit();
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -253,6 +253,21 @@ namespace MWGui
return;
}
}
else
{
MWBase::StateManager::State state = MWBase::Environment::get().getStateManager()->getState();
// If game is running, ask for confirmation first
if (state == MWBase::StateManager::State_Running && !reallySure)
{
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
dialog->askForConfirmation("#{sMessage1}");
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &SaveGameDialog::onConfirmationGiven);
dialog->eventCancelClicked.clear();
return;
}
}
setVisible(false);
MWBase::Environment::get().getWindowManager()->removeGuiMode (MWGui::GM_MainMenu);

@ -111,7 +111,7 @@
<Child type="Widget" skin="BTN_BottomRight" offset="132 20 4 4" align="Bottom Right"/>
<Child type="Widget" skin="BTN_BottomRight" offset="132 20 4 4" align="Bottom Right"/>
<BasisSkin type="SimpleText" offset="4 4 128 16" align="Stretch">
<BasisSkin type="SimpleText" offset="4 3 128 16" align="Stretch">
<State name="disabled" colour="#{fontcolour=disabled}" shift="0"/>
<State name="normal" colour="#{fontcolour=normal}" shift="0"/>
<State name="highlighted" colour="#{fontcolour=normal_over}" shift="0"/>

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 300 130" align="Center" name="_Main">
<Widget type="Window" skin="MW_DialogNoTransp" layer="Windows" position="0 0 360 130" align="Center" name="_Main">
<Property key="Visible" value="false"/>
<Widget type="EditBox" skin="MW_TextEditClient" position="16 8 268 130" name="Message" align="Center Top">
<Widget type="EditBox" skin="MW_TextEditClient" position="16 8 338 130" name="Message" align="Center Top">
<Property key="FontName" value="Default"/>
<Property key="TextAlign" value="Top HCenter"/>
<Property key="Static" value="true"/>
@ -12,14 +12,14 @@
<Property key="MultiLine" value="true"/>
</Widget>
<Widget type="VBox" position="0 89 292 24" align="Right Bottom">
<Widget type="VBox" position="0 89 352 24" align="Center Bottom">
<Widget type="HBox">
<Property key="Spacing" value="8"/>
<Widget type="AutoSizedButton" skin="MW_Button" name="OkButton" align="Right Bottom">
<Widget type="AutoSizedButton" skin="MW_Button" name="OkButton" align="Center Bottom">
<Property key="Caption" value="#{sYes}"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" name="CancelButton" align="Right Bottom">
<Widget type="AutoSizedButton" skin="MW_Button" name="CancelButton" align="Center Bottom">
<Property key="Caption" value="#{sNo}"/>
</Widget>
</Widget>

@ -1,29 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout" version="3.2.0">
<Widget type="Window" skin="MW_Dialog" position="0 0 600 128" align="Center" layer="Windows" name="_Main">
<Widget type="Window" skin="MW_DialogNoTransp" position="0 0 600 128" align="Center" layer="Windows" name="_Main">
<Property key="Visible" value="false"/>
<Widget type="TextBox" skin="SandText" position="4 4 592 24" align="Left Top HStretch" name="LabelText">
<Widget type="TextBox" skin="SandText" position="0 4 592 24" align="Left Top HStretch" name="LabelText">
<Property key="TextAlign" value="Center"/>
</Widget>
<Widget type="TextBox" skin="SandText" position="4 30 521 24" align="Left Top HStretch" name="ItemText">
<Property key="TextAlign" value="Right"/>
<Widget type="TextBox" skin="SandText" position="12 36 521 24" align="Left Top HStretch" name="ItemText">
<Property key="TextAlign" value="Left"/>
</Widget>
<Widget type="NumericEditBox" skin="MW_TextEdit" position="535 30 50 24" align="Right Top" name="ItemEdit">
<Widget type="NumericEditBox" skin="MW_TextEdit" position="535 36 50 24" align="Right Top" name="ItemEdit">
<Property key="TextAlign" value="Center"/>
</Widget>
<Widget type="MWScrollBar" skin="MW_HScroll" position="7 61 578 18" align="Left Top HStretch" name="CountSlider">
<Widget type="MWScrollBar" skin="MW_HScroll" position="7 67 578 18" align="Left Top HStretch" name="CountSlider">
<Property key="MoveToClick" value="true"/>
<Property key="Page" value="1"/>
<Property key="WheelPage" value="1"/>
</Widget>
<Widget type="HBox" skin="" position="0 88 585 24" align="Right Bottom">
<Widget type="Widget" skin="" position="0 12 0 0">
<UserString key="HStretch" value="true"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" position="4 0 53 24" align="Right Top" name="OkButton">
<Widget type="HBox" skin="" position="0 91 140 24" align="Center Bottom">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 53 24" align="Center Top" name="OkButton">
<Property key="Caption" value="#{sOk}"/>
</Widget>
<Widget type="AutoSizedButton" skin="MW_Button" position="61 0 78 24" align="Right Top" name="CancelButton">
<Widget type="AutoSizedButton" skin="MW_Button" position="0 0 86 24" align="Center Top" name="CancelButton">
<Property key="Caption" value="#{sCancel}"/>
</Widget>
</Widget>

@ -131,9 +131,9 @@
<Child type="Widget" skin="MW_Box" offset="0 0 516 516" align="Stretch"/>
<Child type="MWScrollBar" skin="MW_VScroll" offset="498 3 14 509" align="Right VStretch" name="VScroll"/>
<Child type="MWScrollBar" skin="MW_VScroll" offset="498 4 14 508" align="Right VStretch" name="VScroll"/>
<Child type="Widget" skin="" offset="3 3 493 509" align="Stretch" name="Client"/>
<Child type="Widget" skin="" offset="3 4 493 508" align="Stretch" name="Client"/>
</Resource>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout">
<Widget type="VBox" skin="MW_Dialog" layer="Windows" position="0 0 600 400" align="Center" name="_Main">
<Widget type="VBox" skin="MW_DialogNoTransp" layer="Windows" position="0 0 600 400" align="Center" name="_Main">
<Property key="Padding" value="12"/>
<Property key="Spacing" value="8"/>

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Resource" version="1.1">
<!-- Defines a transparent background -->
<!-- Defines a partially transparent background -->
<Resource type="ResourceSkin" name="BlackBG" size="8 8" texture="transparent">
<Property key="Colour" value="#{fontcolour=background}"/>
<BasisSkin type="MainSkin" offset="0 0 8 8">
@ -9,6 +9,14 @@
</BasisSkin>
</Resource>
<!-- Defines a non-transparent background -->
<Resource type="ResourceSkin" name="FullBlackBG" size="8 8" texture="black">
<BasisSkin type="MainSkin" offset="0 0 8 8">
<State name="normal" offset="0 0 8 8"/>
</BasisSkin>
</Resource>
<!-- Defines a non-transparent background -->
<Resource type="ResourceSkin" name="TransparentBG" size="8 8" texture="transparent">
<Property key="Colour" value="#{fontcolour=background}"/>
</Resource>
@ -883,4 +891,35 @@
<Property key="Scale" value="1 1 -1 -1"/>
</Child>
</Resource>
<Resource type="ResourceSkin" name="MW_DialogNoTransp" size="256 54">
<Child type="Widget" skin="FullBlackBG" offset="4 4 248 46" align="Stretch" name="Client"/>
<!-- Outer borders -->
<Child type="Widget" skin="DB_T" offset="4 0 248 4" align="Top HStretch" name="Border">
<Property key="Scale" value="0 1 0 -1"/>
</Child>
<Child type="Widget" skin="DB_L" offset="0 4 4 46" align="Left VStretch" name="Border">
<Property key="Scale" value="1 0 -1 0"/>
</Child>
<Child type="Widget" skin="DB_B" offset="4 50 248 4" align="Bottom HStretch" name="Border">
<Property key="Scale" value="0 0 0 1"/>
</Child>
<Child type="Widget" skin="DB_R" offset="252 4 4 46" align="Right VStretch" name="Border">
<Property key="Scale" value="0 0 1 0"/>
</Child>
<Child type="Widget" skin="DB_BR" offset="252 50 4 4" align="Right Bottom" name="Border">
<Property key="Scale" value="0 0 1 1"/>
</Child>
<Child type="Widget" skin="DB_BL" offset="0 50 4 4" align="Left Bottom" name="Border">
<Property key="Scale" value="1 0 -1 1"/>
</Child>
<Child type="Widget" skin="DB_TR" offset="252 0 4 4" align="Right Top" name="Border">
<Property key="Scale" value="0 1 1 -1"/>
</Child>
<Child type="Widget" skin="DB_TL" offset="0 0 4 4" align="Left Top" name="Border">
<Property key="Scale" value="1 1 -1 -1"/>
</Child>
</Resource>
</MyGUI>

Loading…
Cancel
Save