From 1c6b9a9b7b8e1a1154cf6684749bd7cc4105dd2a Mon Sep 17 00:00:00 2001 From: Jan Borsodi Date: Sat, 23 Oct 2010 01:00:07 +0200 Subject: [PATCH] Activated buttons in review dialog to go to the respective dialogs. --- apps/openmw/mwgui/review.cpp | 24 ++++++++++++++++++ apps/openmw/mwgui/review.hpp | 25 ++++++++++++++++++ apps/openmw/mwgui/window_manager.cpp | 38 +++++++++++++++++++++++++--- apps/openmw/mwgui/window_manager.hpp | 4 +++ 4 files changed, 87 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index dd693bc024..3406bf7c46 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -32,18 +32,22 @@ ReviewDialog::ReviewDialog(MWWorld::Environment& environment) getWidget(nameWidget, "NameText"); getWidget(button, "NameButton"); button->setCaption(wm->getGameSettingString("sName", "")); + button->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onNameClicked);; getWidget(raceWidget, "RaceText"); getWidget(button, "RaceButton"); button->setCaption(wm->getGameSettingString("sRace", "")); + button->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onRaceClicked);; getWidget(classWidget, "ClassText"); getWidget(button, "ClassButton"); button->setCaption(wm->getGameSettingString("sClass", "")); + button->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onClassClicked);; getWidget(birthSignWidget, "SignText"); getWidget(button, "SignButton"); button->setCaption(wm->getGameSettingString("sBirthSign", "")); + button->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onBirthSignClicked);; // Setup dynamic stats getWidget(health, "Health"); @@ -353,3 +357,23 @@ void ReviewDialog::onBackClicked(MyGUI::Widget* _sender) { eventBack(); } + +void ReviewDialog::onNameClicked(MyGUI::Widget* _sender) +{ + eventNameActivated(); +} + +void ReviewDialog::onRaceClicked(MyGUI::Widget* _sender) +{ + eventRaceActivated(); +} + +void ReviewDialog::onClassClicked(MyGUI::Widget* _sender) +{ + eventClassActivated(); +} + +void ReviewDialog::onBirthSignClicked(MyGUI::Widget* _sender) +{ + eventBirthSignActivated(); +} diff --git a/apps/openmw/mwgui/review.hpp b/apps/openmw/mwgui/review.hpp index f2d2cf8f13..234ae51373 100644 --- a/apps/openmw/mwgui/review.hpp +++ b/apps/openmw/mwgui/review.hpp @@ -56,10 +56,35 @@ namespace MWGui */ EventHandle_Void eventDone; + /** Event : Activate name dialog.\n + signature : void method()\n + */ + EventHandle_Void eventNameActivated; + + /** Event : Activate race dialog.\n + signature : void method()\n + */ + EventHandle_Void eventRaceActivated; + + /** Event : Activate class dialog.\n + signature : void method()\n + */ + EventHandle_Void eventClassActivated; + + /** Event : Activate birth sign dialog.\n + signature : void method()\n + */ + EventHandle_Void eventBirthSignActivated; + protected: void onOkClicked(MyGUI::Widget* _sender); void onBackClicked(MyGUI::Widget* _sender); + void onNameClicked(MyGUI::Widget* _sender); + void onRaceClicked(MyGUI::Widget* _sender); + void onClassClicked(MyGUI::Widget* _sender); + void onBirthSignClicked(MyGUI::Widget* _sender); + private: enum ColorStyle { diff --git a/apps/openmw/mwgui/window_manager.cpp b/apps/openmw/mwgui/window_manager.cpp index c2f870bd2e..b01fea3869 100644 --- a/apps/openmw/mwgui/window_manager.cpp +++ b/apps/openmw/mwgui/window_manager.cpp @@ -173,7 +173,7 @@ void WindowManager::updateVisible() std::string sName = getGameSettingString("sName", "Name"); nameDialog->setTextLabel(sName); nameDialog->setTextInput(playerName); - nameDialog->setNextButtonShow(nameChosen); + nameDialog->setNextButtonShow(nameChosen || reviewNext); nameDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onNameDialogDone); nameDialog->open(); return; @@ -184,7 +184,7 @@ void WindowManager::updateVisible() if (raceDialog) removeDialog(raceDialog); raceDialog = new RaceDialog(environment); - raceDialog->setNextButtonShow(raceChosen); + raceDialog->setNextButtonShow(raceChosen || reviewNext); raceDialog->setRaceId(playerRaceId); raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone); raceDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onRaceDialogBack); @@ -214,7 +214,7 @@ void WindowManager::updateVisible() if (pickClassDialog) removeDialog(pickClassDialog); pickClassDialog = new PickClassDialog(environment); - pickClassDialog->setNextButtonShow(classChosen); + pickClassDialog->setNextButtonShow(classChosen || reviewNext); pickClassDialog->setClassId(playerClass.name); pickClassDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onPickClassDialogDone); pickClassDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onPickClassDialogBack); @@ -238,7 +238,7 @@ void WindowManager::updateVisible() if (birthSignDialog) removeDialog(birthSignDialog); birthSignDialog = new BirthDialog(environment); - birthSignDialog->setNextButtonShow(birthSignChosen); + birthSignDialog->setNextButtonShow(birthSignChosen || reviewNext); birthSignDialog->setBirthId(playerBirthSignId); birthSignDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogDone); birthSignDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogBack); @@ -280,6 +280,12 @@ void WindowManager::updateVisible() reviewDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onReviewDialogDone); reviewDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onReviewDialogBack); + + reviewDialog->eventNameActivated = MyGUI::newDelegate(this, &WindowManager::onNameDialogActivate); + reviewDialog->eventRaceActivated = MyGUI::newDelegate(this, &WindowManager::onRaceDialogActivate); + reviewDialog->eventClassActivated = MyGUI::newDelegate(this, &WindowManager::onClassDialogActivate); + reviewDialog->eventBirthSignActivated = MyGUI::newDelegate(this, &WindowManager::onBirthSignDialogActivate); + reviewDialog->open(); return; } @@ -778,3 +784,27 @@ void WindowManager::onReviewDialogBack() setGuiMode(GM_Birth); } + +void WindowManager::onNameDialogActivate() +{ + reviewNext = true; + setGuiMode(GM_Name); +} + +void WindowManager::onRaceDialogActivate() +{ + reviewNext = true; + setGuiMode(GM_Race); +} + +void WindowManager::onClassDialogActivate() +{ + reviewNext = true; + setGuiMode(GM_Class); +} + +void WindowManager::onBirthSignDialogActivate() +{ + reviewNext = true; + setGuiMode(GM_Birth); +} diff --git a/apps/openmw/mwgui/window_manager.hpp b/apps/openmw/mwgui/window_manager.hpp index 75aa427aca..f9dd4f55df 100644 --- a/apps/openmw/mwgui/window_manager.hpp +++ b/apps/openmw/mwgui/window_manager.hpp @@ -279,6 +279,10 @@ namespace MWGui // Character generation: Review dialog void onReviewDialogDone(); void onReviewDialogBack(); + void onNameDialogActivate(); + void onRaceDialogActivate(); + void onClassDialogActivate(); + void onBirthSignDialogActivate(); }; template