forked from teamnwah/openmw-tes3coop
Added dialog for editing description in custom class dialog.
This commit is contained in:
parent
ee101440a2
commit
8acf04fc08
5 changed files with 123 additions and 2 deletions
|
@ -233,6 +233,7 @@ CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment, MyGUI::I
|
|||
, specDialog(nullptr)
|
||||
, attribDialog(nullptr)
|
||||
, skillDialog(nullptr)
|
||||
, descDialog(nullptr)
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
|
@ -327,6 +328,7 @@ CreateClassDialog::~CreateClassDialog()
|
|||
delete specDialog;
|
||||
delete attribDialog;
|
||||
delete skillDialog;
|
||||
delete descDialog;
|
||||
}
|
||||
|
||||
void CreateClassDialog::setNextButtonShow(bool shown)
|
||||
|
@ -374,6 +376,8 @@ void CreateClassDialog::onDialogCancel()
|
|||
attribDialog->setVisible(false);
|
||||
if (skillDialog)
|
||||
skillDialog->setVisible(false);
|
||||
if (descDialog)
|
||||
descDialog->setVisible(false);
|
||||
// TODO: Delete dialogs here
|
||||
}
|
||||
|
||||
|
@ -458,7 +462,18 @@ void CreateClassDialog::onSkillSelected()
|
|||
|
||||
void CreateClassDialog::onDescriptionClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
// TODO: Show description dialog
|
||||
if (descDialog)
|
||||
delete descDialog;
|
||||
descDialog = new DescriptionDialog(environment, environment.mWindowManager->getGui()->getViewSize());
|
||||
descDialog->setTextInput(description);
|
||||
descDialog->eventDone = MyGUI::newDelegate(this, &CreateClassDialog::onDescriptionEntered);
|
||||
descDialog->setVisible(true);
|
||||
}
|
||||
|
||||
void CreateClassDialog::onDescriptionEntered()
|
||||
{
|
||||
description = descDialog->getTextInput();
|
||||
descDialog->setVisible(false);
|
||||
}
|
||||
|
||||
void CreateClassDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||
|
@ -702,3 +717,34 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
|
|||
{
|
||||
eventCancel();
|
||||
}
|
||||
|
||||
/* DescriptionDialog */
|
||||
|
||||
DescriptionDialog::DescriptionDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize)
|
||||
: Layout("openmw_chargen_class_description_layout.xml")
|
||||
, environment(environment)
|
||||
{
|
||||
// Centre dialog
|
||||
MyGUI::IntCoord coord = mMainWidget->getCoord();
|
||||
coord.left = (gameWindowSize.width - coord.width)/2;
|
||||
coord.top = (gameWindowSize.height - coord.height)/2;
|
||||
mMainWidget->setCoord(coord);
|
||||
|
||||
getWidget(textEdit, "TextEdit");
|
||||
|
||||
// TODO: These buttons should be managed by a Dialog class
|
||||
MyGUI::ButtonPtr okButton;
|
||||
getWidget(okButton, "OKButton");
|
||||
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &DescriptionDialog::onOkClicked);
|
||||
okButton->setCaption(environment.mWindowManager->getGameSettingString("sInputMenu1", ""));
|
||||
|
||||
// Make sure the edit box has focus
|
||||
MyGUI::InputManager::getInstance().setKeyFocusWidget(textEdit);
|
||||
}
|
||||
|
||||
// widget controls
|
||||
|
||||
void DescriptionDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||
{
|
||||
eventDone();
|
||||
}
|
||||
|
|
|
@ -171,6 +171,31 @@ namespace MWGui
|
|||
ESM::Skill::SkillEnum skillId;
|
||||
};
|
||||
|
||||
class DescriptionDialog : public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
DescriptionDialog(MWWorld::Environment& environment, MyGUI::IntSize gameWindowSize);
|
||||
|
||||
std::string getTextInput() const { return textEdit ? textEdit->getOnlyText() : ""; }
|
||||
void setTextInput(const std::string &text) { if (textEdit) textEdit->setOnlyText(text); }
|
||||
|
||||
// Events
|
||||
typedef delegates::CDelegate0 EventHandle_Void;
|
||||
|
||||
/** Event : Dialog finished, OK button clicked.\n
|
||||
signature : void method()\n
|
||||
*/
|
||||
EventHandle_Void eventDone;
|
||||
|
||||
protected:
|
||||
void onOkClicked(MyGUI::Widget* _sender);
|
||||
|
||||
private:
|
||||
MWWorld::Environment& environment;
|
||||
|
||||
MyGUI::EditPtr textEdit;
|
||||
};
|
||||
|
||||
class CreateClassDialog : public OEngine::GUI::Layout
|
||||
{
|
||||
public:
|
||||
|
@ -197,7 +222,6 @@ namespace MWGui
|
|||
EventHandle_Void eventDone;
|
||||
|
||||
protected:
|
||||
void onDescriptionClicked(MyGUI::Widget* _sender);
|
||||
void onOkClicked(MyGUI::Widget* _sender);
|
||||
void onBackClicked(MyGUI::Widget* _sender);
|
||||
|
||||
|
@ -207,6 +231,8 @@ namespace MWGui
|
|||
void onAttributeSelected();
|
||||
void onSkillClicked(Widgets::MWSkillPtr _sender);
|
||||
void onSkillSelected();
|
||||
void onDescriptionClicked(MyGUI::Widget* _sender);
|
||||
void onDescriptionEntered();
|
||||
void onDialogCancel();
|
||||
|
||||
private:
|
||||
|
@ -218,10 +244,12 @@ namespace MWGui
|
|||
Widgets::MWSkillPtr majorSkill0, majorSkill1, majorSkill2, majorSkill3, majorSkill4;
|
||||
Widgets::MWSkillPtr minorSkill0, minorSkill1, minorSkill2, minorSkill3, minorSkill4;
|
||||
std::vector<Widgets::MWSkillPtr> skills;
|
||||
std::string description;
|
||||
|
||||
SelectSpecializationDialog *specDialog;
|
||||
SelectAttributeDialog *attribDialog;
|
||||
SelectSkillDialog *skillDialog;
|
||||
DescriptionDialog *descDialog;
|
||||
|
||||
ESM::Class::Specialization specializationId;
|
||||
};
|
||||
|
|
1
extern/mygui_3.0.1/CMakeLists.txt
vendored
1
extern/mygui_3.0.1/CMakeLists.txt
vendored
|
@ -48,6 +48,7 @@ configure_file("${SDIR}/openmw_chargen_create_class_layout.xml" "${DDIR}/openmw_
|
|||
configure_file("${SDIR}/openmw_chargen_select_specialization_layout.xml" "${DDIR}/openmw_chargen_select_specialization_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_chargen_select_attribute_layout.xml" "${DDIR}/openmw_chargen_select_attribute_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_chargen_select_skill_layout.xml" "${DDIR}/openmw_chargen_select_skill_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_chargen_class_description_layout.xml" "${DDIR}/openmw_chargen_class_description_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_chargen_birth_layout.xml" "${DDIR}/openmw_chargen_birth_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_inventory_window_layout.xml" "${DDIR}/openmw_inventory_window_layout.xml" COPYONLY)
|
||||
configure_file("${SDIR}/openmw_layers.xml" "${DDIR}/openmw_layers.xml" COPYONLY)
|
||||
|
|
18
extern/mygui_3.0.1/openmw_resources/openmw_chargen_class_description_layout.xml
vendored
Normal file
18
extern/mygui_3.0.1/openmw_resources/openmw_chargen_class_description_layout.xml
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<MyGUI type="Layout">
|
||||
<Widget type="Window" skin="MW_Dialog" layer="Windows" position="0 0 249 249" name="_Main">
|
||||
|
||||
<!-- Edit box -->
|
||||
<Widget type="Edit" skin="MW_TextBoxEdit" position="14 14 220 192" name="TextEdit" align="ALIGN_LEFT ALIGN_TOP STRETCH">
|
||||
<Property key="Edit_MultiLine" value="1" />
|
||||
<Property key="Edit_VisibleVScroll" value="1" />
|
||||
<Property key="Edit_WordWrap" value="1" />
|
||||
</Widget>
|
||||
|
||||
<!-- Dialog buttons -->
|
||||
<Widget type="Button" skin="MW_Button" position="177 214 57 24" name="OKButton">
|
||||
<Property key="Widget_Caption" value="Enter"/>
|
||||
</Widget>
|
||||
</Widget>
|
||||
</MyGUI>
|
|
@ -10,6 +10,16 @@
|
|||
|
||||
<BasisSkin type="EditText" offset = "0 0 10 10" align = "Stretch"/>
|
||||
</Skin>
|
||||
|
||||
<Skin name = "MW_TextBoxEditClient" size = "10 10">
|
||||
<Property key="FontName" value = "MyGUI_CoreFont.18"/>
|
||||
<Property key="FontHeight" value = "18" />
|
||||
<Property key="AlignText" value = "ALIGN_LEFT ALIGN_TOP" />
|
||||
<Property key="Colour" value = "0.6 0.6 0.6" />
|
||||
|
||||
<BasisSkin type="EditText" offset = "0 0 10 10" align = "Stretch"/>
|
||||
</Skin>
|
||||
|
||||
<Skin name = "MW_TextEdit" size = "512 20" texture="mwgui.png">
|
||||
<BasisSkin type="SubSkin" offset = "0 0 512 2" align = "ALIGN_TOP ALIGN_HSTRETCH">
|
||||
<State name="normal" offset = "2 2 512 2"/>
|
||||
|
@ -26,4 +36,22 @@
|
|||
|
||||
<Child type="Widget" skin="MW_TextEditClient" offset = "2 2 508 18" align = "Stretch" name = "Client"/>
|
||||
</Skin>
|
||||
|
||||
<Skin name = "MW_TextBoxEdit" size = "512 20" texture="mwgui.png">
|
||||
<BasisSkin type="SubSkin" offset = "0 0 512 2" align = "ALIGN_TOP ALIGN_HSTRETCH">
|
||||
<State name="normal" offset = "2 2 512 2"/>
|
||||
</BasisSkin>
|
||||
<BasisSkin type="SubSkin" offset = "0 2 2 16" align = "ALIGN_LEFT ALIGN_VSTRETCH">
|
||||
<State name="normal" offset = "2 4 2 16"/>
|
||||
</BasisSkin>
|
||||
<BasisSkin type="SubSkin" offset = "510 2 2 16" align = "ALIGN_RIGHT ALIGN_VSTRETCH">
|
||||
<State name="normal" offset = "512 4 2 16"/>
|
||||
</BasisSkin>
|
||||
<BasisSkin type="SubSkin" offset = "0 18 512 2" align = "ALIGN_BOTTOM ALIGN_HSTRETCH">
|
||||
<State name="normal" offset = "2 20 512 2"/>
|
||||
</BasisSkin>
|
||||
|
||||
<Child type="Widget" skin="MW_TextBoxEditClient" offset = "2 2 490 18" align = "Stretch" name = "Client"/>
|
||||
<Child type="VScroll" skin="MW_VScroll" offset = "494 3 14 14" align = "Right VStretch" name = "VScroll"/>
|
||||
</Skin>
|
||||
</MyGUI>
|
||||
|
|
Loading…
Reference in a new issue