forked from mirror/openmw-tes3mp
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:
parent
670174004a
commit
a59a53882f
4 changed files with 52 additions and 1 deletions
|
@ -63,6 +63,14 @@ RaceDialog::RaceDialog(MWWorld::Environment& environment)
|
||||||
getWidget(skillList, "SkillList");
|
getWidget(skillList, "SkillList");
|
||||||
getWidget(spellPowerList, "SpellPowerList");
|
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();
|
updateRaces();
|
||||||
updateSkills();
|
updateSkills();
|
||||||
updateSpellPowers();
|
updateSpellPowers();
|
||||||
|
@ -98,6 +106,16 @@ int wrap(int index, int max)
|
||||||
|
|
||||||
// widget controls
|
// widget controls
|
||||||
|
|
||||||
|
void RaceDialog::onOkClicked(MyGUI::Widget* _sender)
|
||||||
|
{
|
||||||
|
eventDone();
|
||||||
|
}
|
||||||
|
|
||||||
|
void RaceDialog::onBackClicked(MyGUI::Widget* _sender)
|
||||||
|
{
|
||||||
|
eventBack();
|
||||||
|
}
|
||||||
|
|
||||||
void RaceDialog::onHeadRotate(MyGUI::VScroll*, size_t _position)
|
void RaceDialog::onHeadRotate(MyGUI::VScroll*, size_t _position)
|
||||||
{
|
{
|
||||||
// TODO: Rotate head
|
// TODO: Rotate head
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
using namespace MyGUI;
|
using namespace MyGUI;
|
||||||
|
|
||||||
|
typedef delegates::CDelegate0 EventHandle_Void;
|
||||||
|
|
||||||
class RaceDialog : public OEngine::GUI::Layout
|
class RaceDialog : public OEngine::GUI::Layout
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -36,6 +38,18 @@ namespace MWGui
|
||||||
|
|
||||||
void setRace(const std::string &race);
|
void setRace(const std::string &race);
|
||||||
|
|
||||||
|
// 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:
|
protected:
|
||||||
void onHeadRotate(MyGUI::VScroll* _sender, size_t _position);
|
void onHeadRotate(MyGUI::VScroll* _sender, size_t _position);
|
||||||
|
|
||||||
|
@ -50,6 +64,9 @@ namespace MWGui
|
||||||
|
|
||||||
void onSelectRace(MyGUI::List* _sender, size_t _index);
|
void onSelectRace(MyGUI::List* _sender, size_t _index);
|
||||||
|
|
||||||
|
void onOkClicked(MyGUI::Widget* _sender);
|
||||||
|
void onBackClicked(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateRaces();
|
void updateRaces();
|
||||||
void updateSkills();
|
void updateSkills();
|
||||||
|
|
|
@ -27,6 +27,8 @@ WindowManager::WindowManager(MyGUI::Gui *_gui, MWWorld::Environment& environment
|
||||||
console = new Console(w,h, environment, extensions);
|
console = new Console(w,h, environment, extensions);
|
||||||
|
|
||||||
raceDialog = new RaceDialog (environment);
|
raceDialog = new RaceDialog (environment);
|
||||||
|
raceDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onRaceDialogDone);
|
||||||
|
raceDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onRaceDialogBack);
|
||||||
|
|
||||||
// The HUD is always on
|
// The HUD is always on
|
||||||
hud->setVisible(true);
|
hud->setVisible(true);
|
||||||
|
@ -122,3 +124,13 @@ void WindowManager::messageBox (const std::string& message, const std::vector<st
|
||||||
std::cout << std::endl;
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WindowManager::onRaceDialogDone()
|
||||||
|
{
|
||||||
|
raceDialog->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WindowManager::onRaceDialogBack()
|
||||||
|
{
|
||||||
|
raceDialog->setVisible(false);
|
||||||
|
}
|
||||||
|
|
|
@ -153,6 +153,10 @@ namespace MWGui
|
||||||
///< Set value for the given ID.
|
///< Set value for the given ID.
|
||||||
|
|
||||||
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
void messageBox (const std::string& message, const std::vector<std::string>& buttons);
|
||||||
|
|
||||||
|
private:
|
||||||
|
void onRaceDialogDone();
|
||||||
|
void onRaceDialogBack();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue