forked from mirror/openmw-tes3mp
Further unification of dialog API, all dialogs now have an open() method which updates gui content and makes it visible.
This commit is contained in:
parent
e39f700372
commit
12fe9305a6
5 changed files with 22 additions and 11 deletions
|
@ -41,6 +41,11 @@ GenerateClassResultDialog::GenerateClassResultDialog(MWWorld::Environment& envir
|
||||||
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
|
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GenerateClassResultDialog::open()
|
||||||
|
{
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
std::string GenerateClassResultDialog::getClassId() const
|
std::string GenerateClassResultDialog::getClassId() const
|
||||||
{
|
{
|
||||||
return className->getCaption();
|
return className->getCaption();
|
||||||
|
@ -363,7 +368,7 @@ void InfoBoxDialog::setButtons(ButtonList &buttons)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoBoxDialog::update()
|
void InfoBoxDialog::open()
|
||||||
{
|
{
|
||||||
// Fix layout
|
// Fix layout
|
||||||
layoutVertically(textBox, 4);
|
layoutVertically(textBox, 4);
|
||||||
|
@ -371,6 +376,7 @@ void InfoBoxDialog::update()
|
||||||
layoutVertically(mMainWidget, 4 + 6);
|
layoutVertically(mMainWidget, 4 + 6);
|
||||||
|
|
||||||
center();
|
center();
|
||||||
|
setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int InfoBoxDialog::getChosenButton() const
|
int InfoBoxDialog::getChosenButton() const
|
||||||
|
@ -417,8 +423,6 @@ ClassChoiceDialog::ClassChoiceDialog(MWWorld::Environment& environment)
|
||||||
buttons.push_back(mw->getGameSettingString("sClassChoiceMenu3", ""));
|
buttons.push_back(mw->getGameSettingString("sClassChoiceMenu3", ""));
|
||||||
buttons.push_back(mw->getGameSettingString("sBack", ""));
|
buttons.push_back(mw->getGameSettingString("sBack", ""));
|
||||||
setButtons(buttons);
|
setButtons(buttons);
|
||||||
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CreateClassDialog */
|
/* CreateClassDialog */
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace MWGui
|
||||||
std::string getText() const;
|
std::string getText() const;
|
||||||
void setButtons(ButtonList &buttons);
|
void setButtons(ButtonList &buttons);
|
||||||
|
|
||||||
void update();
|
void open();
|
||||||
int getChosenButton() const;
|
int getChosenButton() const;
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
|
@ -83,6 +83,8 @@ namespace MWGui
|
||||||
std::string getClassId() const;
|
std::string getClassId() const;
|
||||||
void setClassId(const std::string &classId);
|
void setClassId(const std::string &classId);
|
||||||
|
|
||||||
|
void open();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef delegates::CDelegate0 EventHandle_Void;
|
typedef delegates::CDelegate0 EventHandle_Void;
|
||||||
|
|
||||||
|
|
|
@ -95,6 +95,12 @@ ReviewDialog::ReviewDialog(MWWorld::Environment& environment, MyGUI::IntSize gam
|
||||||
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onOkClicked);
|
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onOkClicked);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReviewDialog::open()
|
||||||
|
{
|
||||||
|
updateSkillArea();
|
||||||
|
setVisible(true);
|
||||||
|
}
|
||||||
|
|
||||||
void ReviewDialog::onScrollChangePosition(MyGUI::VScrollPtr scroller, size_t pos)
|
void ReviewDialog::onScrollChangePosition(MyGUI::VScrollPtr scroller, size_t pos)
|
||||||
{
|
{
|
||||||
int diff = lastPos - pos;
|
int diff = lastPos - pos;
|
||||||
|
|
|
@ -41,7 +41,7 @@ namespace MWGui
|
||||||
void configureSkills(const SkillList& major, const SkillList& minor);
|
void configureSkills(const SkillList& major, const SkillList& minor);
|
||||||
void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value);
|
void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value);
|
||||||
|
|
||||||
void updateSkillArea();
|
void open();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
typedef delegates::CDelegate0 EventHandle_Void;
|
typedef delegates::CDelegate0 EventHandle_Void;
|
||||||
|
@ -74,6 +74,7 @@ namespace MWGui
|
||||||
MyGUI::WidgetPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
MyGUI::WidgetPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2);
|
||||||
void updateScroller();
|
void updateScroller();
|
||||||
|
void updateSkillArea();
|
||||||
|
|
||||||
void onScrollChangePosition(MyGUI::VScrollPtr scroller, size_t pos);
|
void onScrollChangePosition(MyGUI::VScrollPtr scroller, size_t pos);
|
||||||
void onWindowResize(MyGUI::WidgetPtr window);
|
void onWindowResize(MyGUI::WidgetPtr window);
|
||||||
|
|
|
@ -198,6 +198,7 @@ void WindowManager::updateVisible()
|
||||||
removeDialog(classChoiceDialog);
|
removeDialog(classChoiceDialog);
|
||||||
classChoiceDialog = new ClassChoiceDialog(environment);
|
classChoiceDialog = new ClassChoiceDialog(environment);
|
||||||
classChoiceDialog->eventButtonSelected = MyGUI::newDelegate(this, &WindowManager::onClassChoice);
|
classChoiceDialog->eventButtonSelected = MyGUI::newDelegate(this, &WindowManager::onClassChoice);
|
||||||
|
classChoiceDialog->open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,11 +278,9 @@ void WindowManager::updateVisible()
|
||||||
reviewDialog->configureSkills(playerMajorSkills, playerMinorSkills);
|
reviewDialog->configureSkills(playerMajorSkills, playerMinorSkills);
|
||||||
}
|
}
|
||||||
|
|
||||||
reviewDialog->updateSkillArea();
|
|
||||||
|
|
||||||
reviewDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onReviewDialogDone);
|
reviewDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onReviewDialogDone);
|
||||||
reviewDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onReviewDialogBack);
|
reviewDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onReviewDialogBack);
|
||||||
reviewDialog->setVisible(true);
|
reviewDialog->open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -585,7 +584,7 @@ void WindowManager::showClassQuestionDialog()
|
||||||
generateClassResultDialog->setClassId(generateClass);
|
generateClassResultDialog->setClassId(generateClass);
|
||||||
generateClassResultDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onGenerateClassBack);
|
generateClassResultDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onGenerateClassBack);
|
||||||
generateClassResultDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onGenerateClassDone);
|
generateClassResultDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onGenerateClassDone);
|
||||||
generateClassResultDialog->setVisible(true);
|
generateClassResultDialog->open();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -605,9 +604,8 @@ void WindowManager::showClassQuestionDialog()
|
||||||
buttons.push_back(steps[generateClassStep].buttons[1]);
|
buttons.push_back(steps[generateClassStep].buttons[1]);
|
||||||
buttons.push_back(steps[generateClassStep].buttons[2]);
|
buttons.push_back(steps[generateClassStep].buttons[2]);
|
||||||
generateClassQuestionDialog->setButtons(buttons);
|
generateClassQuestionDialog->setButtons(buttons);
|
||||||
generateClassQuestionDialog->update();
|
|
||||||
generateClassQuestionDialog->eventButtonSelected = MyGUI::newDelegate(this, &WindowManager::onClassQuestionChosen);
|
generateClassQuestionDialog->eventButtonSelected = MyGUI::newDelegate(this, &WindowManager::onClassQuestionChosen);
|
||||||
generateClassQuestionDialog->setVisible(true);
|
generateClassQuestionDialog->open();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WindowManager::onClassQuestionChosen(MyGUI::Widget* _sender, int _index)
|
void WindowManager::onClassQuestionChosen(MyGUI::Widget* _sender, int _index)
|
||||||
|
|
Loading…
Reference in a new issue