Use one event with a parameters instead of four events to tell with dialog we want to see

actorid
Jan-Peter Nilsson 14 years ago
parent a0ee11c51b
commit 5342bd77f1

@ -352,20 +352,20 @@ void ReviewDialog::onBackClicked(MyGUI::Widget* _sender)
void ReviewDialog::onNameClicked(MyGUI::Widget* _sender)
{
eventNameActivated();
eventActivateDialog(NAME_DIALOG);
}
void ReviewDialog::onRaceClicked(MyGUI::Widget* _sender)
{
eventRaceActivated();
eventActivateDialog(RACE_DIALOG);
}
void ReviewDialog::onClassClicked(MyGUI::Widget* _sender)
{
eventClassActivated();
eventActivateDialog(CLASS_DIALOG);
}
void ReviewDialog::onBirthSignClicked(MyGUI::Widget* _sender)
{
eventBirthSignActivated();
eventActivateDialog(BIRTHSIGN_DIALOG);
}

@ -22,6 +22,12 @@ namespace MWGui
class ReviewDialog : public WindowBase
{
public:
enum Dialogs {
NAME_DIALOG,
RACE_DIALOG,
CLASS_DIALOG,
BIRTHSIGN_DIALOG
};
typedef std::vector<int> SkillList;
ReviewDialog(MWWorld::Environment& environment);
@ -44,6 +50,7 @@ namespace MWGui
// Events
typedef delegates::CDelegate0 EventHandle_Void;
typedef delegates::CDelegate1<int> EventHandle_Int;
/** Event : Back button clicked.\n
signature : void method()\n
@ -54,26 +61,8 @@ namespace MWGui
signature : void method()\n
*/
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;
EventHandle_Int eventActivateDialog;
protected:
void onOkClicked(MyGUI::Widget* _sender);

@ -297,12 +297,7 @@ 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->eventActivateDialog = MyGUI::newDelegate(this, &WindowManager::onReviewActivateDialog);
reviewDialog->open();
return;
}
@ -968,39 +963,24 @@ void WindowManager::onReviewDialogBack()
setGuiMode(GM_Birth);
}
void WindowManager::onNameDialogActivate()
void WindowManager::onReviewActivateDialog(int parDialog)
{
if (reviewDialog)
removeDialog(reviewDialog);
reviewNext = true;
setGuiMode(GM_Name);
}
void WindowManager::onRaceDialogActivate()
{
if (reviewDialog)
removeDialog(reviewDialog);
reviewNext = true;
setGuiMode(GM_Race);
}
void WindowManager::onClassDialogActivate()
{
if (reviewDialog)
removeDialog(reviewDialog);
reviewNext = true;
setGuiMode(GM_Class);
}
void WindowManager::onBirthSignDialogActivate()
{
if (reviewDialog)
removeDialog(reviewDialog);
reviewNext = true;
setGuiMode(GM_Birth);
switch(parDialog)
{
case ReviewDialog::NAME_DIALOG:
setGuiMode(GM_Name);
break;
case ReviewDialog::RACE_DIALOG:
setGuiMode(GM_Race);
break;
case ReviewDialog::CLASS_DIALOG:
setGuiMode(GM_Class);
break;
case ReviewDialog::BIRTHSIGN_DIALOG:
setGuiMode(GM_Birth);
};
}

@ -291,10 +291,7 @@ namespace MWGui
// Character generation: Review dialog
void onReviewDialogDone();
void onReviewDialogBack();
void onNameDialogActivate();
void onRaceDialogActivate();
void onClassDialogActivate();
void onBirthSignDialogActivate();
void onReviewActivateDialog(int parDialog);
};
template<typename T>

Loading…
Cancel
Save