1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:29:55 +00:00

Added events for ok/back buttons on race dialog, this is now hooked to functions in the window manager. For now they simple hide the window.

This commit is contained in:
Jan Borsodi 2010-09-14 19:33:40 +02:00
parent 670174004a
commit a59a53882f
4 changed files with 52 additions and 1 deletions

View file

@ -63,6 +63,14 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment)
getWidget(skillList, "SkillList");
getWidget(spellPowerList, "SpellPowerList");
MyGUI::ButtonPtr okButton;
getWidget(okButton, "OKButton");
okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onOkClicked);
MyGUI::ButtonPtr backButton;
getWidget(backButton, "BackButton");
backButton->eventMouseButtonClick = MyGUI::newDelegate(this, &RaceDialog::onBackClicked);
updateRaces();
updateSkills();
updateSpellPowers();
@ -98,6 +106,16 @@ int wrap(int index, int max)
// widget controls
void RaceDialog::onOkClicked(MyGUI::Widget* _sender)
{
eventDone();
}
void RaceDialog::onBackClicked(MyGUI::Widget* _sender)
{
eventBack();
}
void RaceDialog::onHeadRotate(MyGUI::VScroll*, size_t _position)
{
// TODO: Rotate head

View file

@ -29,6 +29,8 @@ namespace MWGui
{
using namespace MyGUI;
typedef delegates::CDelegate0 EventHandle_Void;
class RaceDialog : public OEngine::GUI::Layout
{
public:
@ -36,7 +38,19 @@ namespace MWGui
void setRace(const std::string &race);
protected:
// Events
/** Event : Back button clicked.\n
signature : void method()\n
*/
EventHandle_Void eventBack;
/** Event : Dialog finished, OK button clicked.\n
signature : void method()\n
*/
EventHandle_Void eventDone;
protected:
void onHeadRotate(MyGUI::VScroll* _sender, size_t _position);
void onSelectPreviousGender(MyGUI::Widget* _sender);
@ -50,6 +64,9 @@ namespace MWGui
void onSelectRace(MyGUI::List* _sender, size_t _index);
void onOkClicked(MyGUI::Widget* _sender);
void onBackClicked(MyGUI::Widget* _sender);
private:
void updateRaces();
void updateSkills();

View file

@ -27,6 +27,8 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
console = new Console(w,h, environment, extensions);
raceDialog = new RaceDialog (environment);
raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone);
raceDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onRaceDialogBack);
// The HUD is always on
hud->setVisible(true);
@ -122,3 +124,13 @@ void WindowManager::messageBox (const std::string& message, const std::vector<st
std::cout << std::endl;
}
}
void WindowManager::onRaceDialogDone()
{
raceDialog->setVisible(false);
}
void WindowManager::onRaceDialogBack()
{
raceDialog->setVisible(false);
}

View file

@ -153,6 +153,10 @@ namespace MWGui
///< Set value for the given ID.
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
private:
void onRaceDialogDone();
void onRaceDialogBack();
};
}
#endif