Confirmation dialogs size fix

0.6.1
Andrei Kortunov 8 years ago
parent e5a0f89934
commit df5a43363a

@ -17,19 +17,26 @@ namespace MWGui
} }
void ConfirmationDialog::askForConfirmation(const std::string& message, const std::string& confirmMessage, const std::string& cancelMessage) 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); setVisible(true);
mMessage->setCaptionWithReplacing(message); mMessage->setCaptionWithReplacing(message);
mCancelButton->setCaptionWithReplacing(cancelMessage); int height = mMessage->getTextSize().height + 60;
mOkButton->setCaptionWithReplacing(confirmMessage);
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(); center();
} }

@ -9,7 +9,8 @@ namespace MWGui
{ {
public: public:
ConfirmationDialog(); 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(); virtual void exit();
typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void; typedef MyGUI::delegates::CMultiDelegate0 EventHandle_Void;

@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout"> <MyGUI type="Layout">
<Widget type="Window" skin="MW_DialogNoTransp" 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"/> <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="FontName" value="Default"/>
<Property key="TextAlign" value="Top HCenter"/> <Property key="TextAlign" value="Top HCenter"/>
<Property key="Static" value="true"/> <Property key="Static" value="true"/>
@ -12,14 +12,14 @@
<Property key="MultiLine" value="true"/> <Property key="MultiLine" value="true"/>
</Widget> </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"> <Widget type="HBox">
<Property key="Spacing" value="8"/> <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}"/> <Property key="Caption" value="#{sYes}"/>
</Widget> </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}"/> <Property key="Caption" value="#{sNo}"/>
</Widget> </Widget>
</Widget> </Widget>

Loading…
Cancel
Save