@ -1,6 +1,4 @@
# include "class.hpp"
# include "class.hpp"
# include "../mwworld/environment.hpp"
# include "../mwworld/world.hpp"
# include "window_manager.hpp"
# include "window_manager.hpp"
# include "components/esm_store/store.hpp"
# include "components/esm_store/store.hpp"
@ -17,14 +15,13 @@ using namespace MWGui;
/* GenerateClassResultDialog */
/* GenerateClassResultDialog */
GenerateClassResultDialog : : GenerateClassResultDialog ( MWWorld: : Environment & environment )
GenerateClassResultDialog : : GenerateClassResultDialog ( WindowManager& parWindowManager )
: WindowBase ( " openmw_chargen_generate_class_result_layout.xml " , environment )
: WindowBase ( " openmw_chargen_generate_class_result_layout.xml " , parWindowManager )
{
{
// Centre dialog
// Centre dialog
center ( ) ;
center ( ) ;
WindowManager * wm = environment . mWindowManager ;
setText ( " ReflectT " , mWindowManager . getGameSettingString ( " sMessageQuestionAnswer1 " , " " ) ) ;
setText ( " ReflectT " , wm - > getGameSettingString ( " sMessageQuestionAnswer1 " , " " ) ) ;
getWidget ( classImage , " ClassImage " ) ;
getWidget ( classImage , " ClassImage " ) ;
getWidget ( className , " ClassName " ) ;
getWidget ( className , " ClassName " ) ;
@ -53,7 +50,7 @@ void GenerateClassResultDialog::setClassId(const std::string &classId)
{
{
currentClassId = classId ;
currentClassId = classId ;
classImage - > setImageTexture ( std : : string ( " textures \\ levelup \\ " ) + currentClassId + " .dds " ) ;
classImage - > setImageTexture ( std : : string ( " textures \\ levelup \\ " ) + currentClassId + " .dds " ) ;
ESMS : : ESMStore & store = environment. mWorld - > getStore ( ) ;
ESMS : : ESMStore & store = mWindowManager. getStore ( ) ;
className - > setCaption ( store . classes . find ( currentClassId ) - > name ) ;
className - > setCaption ( store . classes . find ( currentClassId ) - > name ) ;
}
}
@ -61,7 +58,7 @@ void GenerateClassResultDialog::setClassId(const std::string &classId)
void GenerateClassResultDialog : : onOkClicked ( MyGUI : : Widget * _sender )
void GenerateClassResultDialog : : onOkClicked ( MyGUI : : Widget * _sender )
{
{
eventDone ( ) ;
eventDone ( this ) ;
}
}
void GenerateClassResultDialog : : onBackClicked ( MyGUI : : Widget * _sender )
void GenerateClassResultDialog : : onBackClicked ( MyGUI : : Widget * _sender )
@ -71,31 +68,30 @@ void GenerateClassResultDialog::onBackClicked(MyGUI::Widget* _sender)
/* PickClassDialog */
/* PickClassDialog */
PickClassDialog : : PickClassDialog ( MWWorld: : Environment & environment )
PickClassDialog : : PickClassDialog ( WindowManager& parWindowManager )
: WindowBase ( " openmw_chargen_class_layout.xml " , environment )
: WindowBase ( " openmw_chargen_class_layout.xml " , parWindowManager )
{
{
// Centre dialog
// Centre dialog
center ( ) ;
center ( ) ;
WindowManager * wm = environment . mWindowManager ;
setText ( " SpecializationT " , mWindowManager . getGameSettingString ( " sChooseClassMenu1 " , " Specialization " ) ) ;
setText ( " SpecializationT " , wm - > getGameSettingString ( " sChooseClassMenu1 " , " Specialization " ) ) ;
getWidget ( specializationName , " SpecializationName " ) ;
getWidget ( specializationName , " SpecializationName " ) ;
setText ( " FavoriteAttributesT " , wm- > getGameSettingString ( " sChooseClassMenu2 " , " Favorite Attributes: " ) ) ;
setText ( " FavoriteAttributesT " , mWindowManager. getGameSettingString ( " sChooseClassMenu2 " , " Favorite Attributes: " ) ) ;
getWidget ( favoriteAttribute [ 0 ] , " FavoriteAttribute0 " ) ;
getWidget ( favoriteAttribute [ 0 ] , " FavoriteAttribute0 " ) ;
getWidget ( favoriteAttribute [ 1 ] , " FavoriteAttribute1 " ) ;
getWidget ( favoriteAttribute [ 1 ] , " FavoriteAttribute1 " ) ;
favoriteAttribute [ 0 ] - > setWindowManager ( wm ) ;
favoriteAttribute [ 0 ] - > setWindowManager ( & mWindowManager ) ;
favoriteAttribute [ 1 ] - > setWindowManager ( wm ) ;
favoriteAttribute [ 1 ] - > setWindowManager ( & mWindowManager ) ;
setText ( " MajorSkillT " , wm- > getGameSettingString ( " sChooseClassMenu3 " , " Major Skills: " ) ) ;
setText ( " MajorSkillT " , mWindowManager. getGameSettingString ( " sChooseClassMenu3 " , " Major Skills: " ) ) ;
setText ( " MinorSkillT " , wm- > getGameSettingString ( " sChooseClassMenu4 " , " Minor Skills: " ) ) ;
setText ( " MinorSkillT " , mWindowManager. getGameSettingString ( " sChooseClassMenu4 " , " Minor Skills: " ) ) ;
for ( int i = 0 ; i < 5 ; i + + )
for ( int i = 0 ; i < 5 ; i + + )
{
{
char theIndex = ' 0 ' + i ;
char theIndex = ' 0 ' + i ;
getWidget ( majorSkill [ i ] , std : : string ( " MajorSkill " ) . append ( 1 , theIndex ) ) ;
getWidget ( majorSkill [ i ] , std : : string ( " MajorSkill " ) . append ( 1 , theIndex ) ) ;
getWidget ( minorSkill [ i ] , std : : string ( " MinorSkill " ) . append ( 1 , theIndex ) ) ;
getWidget ( minorSkill [ i ] , std : : string ( " MinorSkill " ) . append ( 1 , theIndex ) ) ;
majorSkill [ i ] - > setWindowManager ( wm ) ;
majorSkill [ i ] - > setWindowManager ( & mWindowManager ) ;
minorSkill [ i ] - > setWindowManager ( wm ) ;
minorSkill [ i ] - > setWindowManager ( & mWindowManager ) ;
}
}
getWidget ( classList , " ClassList " ) ;
getWidget ( classList , " ClassList " ) ;
@ -173,7 +169,7 @@ void PickClassDialog::setClassId(const std::string &classId)
void PickClassDialog : : onOkClicked ( MyGUI : : Widget * _sender )
void PickClassDialog : : onOkClicked ( MyGUI : : Widget * _sender )
{
{
eventDone ( ) ;
eventDone ( this ) ;
}
}
void PickClassDialog : : onBackClicked ( MyGUI : : Widget * _sender )
void PickClassDialog : : onBackClicked ( MyGUI : : Widget * _sender )
@ -200,7 +196,7 @@ void PickClassDialog::updateClasses()
{
{
classList - > removeAllItems ( ) ;
classList - > removeAllItems ( ) ;
ESMS : : ESMStore & store = environment. mWorld - > getStore ( ) ;
ESMS : : ESMStore & store = mWindowManager. getStore ( ) ;
ESMS : : RecListT < ESM : : Class > : : MapType : : const_iterator it = store . classes . list . begin ( ) ;
ESMS : : RecListT < ESM : : Class > : : MapType : : const_iterator it = store . classes . list . begin ( ) ;
ESMS : : RecListT < ESM : : Class > : : MapType : : const_iterator end = store . classes . list . end ( ) ;
ESMS : : RecListT < ESM : : Class > : : MapType : : const_iterator end = store . classes . list . end ( ) ;
@ -224,8 +220,7 @@ void PickClassDialog::updateStats()
{
{
if ( currentClassId . empty ( ) )
if ( currentClassId . empty ( ) )
return ;
return ;
WindowManager * wm = environment . mWindowManager ;
ESMS : : ESMStore & store = mWindowManager . getStore ( ) ;
ESMS : : ESMStore & store = environment . mWorld - > getStore ( ) ;
const ESM : : Class * klass = store . classes . search ( currentClassId ) ;
const ESM : : Class * klass = store . classes . search ( currentClassId ) ;
if ( ! klass )
if ( ! klass )
return ;
return ;
@ -237,7 +232,7 @@ void PickClassDialog::updateStats()
" sSpecializationMagic " ,
" sSpecializationMagic " ,
" sSpecializationStealth "
" sSpecializationStealth "
} ;
} ;
specializationName - > setCaption ( wm- > getGameSettingString ( specIds [ specialization ] , specIds [ specialization ] ) ) ;
specializationName - > setCaption ( mWindowManager. getGameSettingString ( specIds [ specialization ] , specIds [ specialization ] ) ) ;
favoriteAttribute [ 0 ] - > setAttributeId ( klass - > data . attribute [ 0 ] ) ;
favoriteAttribute [ 0 ] - > setAttributeId ( klass - > data . attribute [ 0 ] ) ;
favoriteAttribute [ 1 ] - > setAttributeId ( klass - > data . attribute [ 1 ] ) ;
favoriteAttribute [ 1 ] - > setAttributeId ( klass - > data . attribute [ 1 ] ) ;
@ -283,8 +278,8 @@ void InfoBoxDialog::layoutVertically(MyGUI::WidgetPtr widget, int margin)
widget - > setSize ( width , pos ) ;
widget - > setSize ( width , pos ) ;
}
}
InfoBoxDialog : : InfoBoxDialog ( MWWorld: : Environment & environment )
InfoBoxDialog : : InfoBoxDialog ( WindowManager& parWindowManager )
: WindowBase ( " openmw_infobox_layout.xml " , environment )
: WindowBase ( " openmw_infobox_layout.xml " , parWindowManager )
, currentButton ( - 1 )
, currentButton ( - 1 )
{
{
getWidget ( textBox , " TextBox " ) ;
getWidget ( textBox , " TextBox " ) ;
@ -358,7 +353,7 @@ void InfoBoxDialog::onButtonClicked(MyGUI::WidgetPtr _sender)
if ( * it = = _sender )
if ( * it = = _sender )
{
{
currentButton = i ;
currentButton = i ;
eventButtonSelected ( _sender, i) ;
eventButtonSelected ( i) ;
return ;
return ;
}
}
+ + i ;
+ + i ;
@ -367,23 +362,22 @@ void InfoBoxDialog::onButtonClicked(MyGUI::WidgetPtr _sender)
/* ClassChoiceDialog */
/* ClassChoiceDialog */
ClassChoiceDialog : : ClassChoiceDialog ( MWWorld: : Environment & environment )
ClassChoiceDialog : : ClassChoiceDialog ( WindowManager& parWindowManager )
: InfoBoxDialog ( environment )
: InfoBoxDialog ( parWindowManager )
{
{
WindowManager * mw = environment . mWindowManager ;
setText ( " " ) ;
setText ( " " ) ;
ButtonList buttons ;
ButtonList buttons ;
buttons . push_back ( m w- > getGameSettingString ( " sClassChoiceMenu1 " , " " ) ) ;
buttons . push_back ( m WindowManager. getGameSettingString ( " sClassChoiceMenu1 " , " " ) ) ;
buttons . push_back ( m w- > getGameSettingString ( " sClassChoiceMenu2 " , " " ) ) ;
buttons . push_back ( m WindowManager. getGameSettingString ( " sClassChoiceMenu2 " , " " ) ) ;
buttons . push_back ( m w- > getGameSettingString ( " sClassChoiceMenu3 " , " " ) ) ;
buttons . push_back ( m WindowManager. getGameSettingString ( " sClassChoiceMenu3 " , " " ) ) ;
buttons . push_back ( m w- > getGameSettingString ( " sBack " , " " ) ) ;
buttons . push_back ( m WindowManager. getGameSettingString ( " sBack " , " " ) ) ;
setButtons ( buttons ) ;
setButtons ( buttons ) ;
}
}
/* CreateClassDialog */
/* CreateClassDialog */
CreateClassDialog : : CreateClassDialog ( MWWorld: : Environment & environment )
CreateClassDialog : : CreateClassDialog ( WindowManager& parWindowManager )
: WindowBase ( " openmw_chargen_create_class_layout.xml " , environment )
: WindowBase ( " openmw_chargen_create_class_layout.xml " , parWindowManager )
, specDialog ( nullptr )
, specDialog ( nullptr )
, attribDialog ( nullptr )
, attribDialog ( nullptr )
, skillDialog ( nullptr )
, skillDialog ( nullptr )
@ -392,22 +386,21 @@ CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment)
// Centre dialog
// Centre dialog
center ( ) ;
center ( ) ;
WindowManager * wm = environment . mWindowManager ;
setText ( " SpecializationT " , mWindowManager . getGameSettingString ( " sChooseClassMenu1 " , " Specialization " ) ) ;
setText ( " SpecializationT " , wm - > getGameSettingString ( " sChooseClassMenu1 " , " Specialization " ) ) ;
getWidget ( specializationName , " SpecializationName " ) ;
getWidget ( specializationName , " SpecializationName " ) ;
specializationName - > setCaption ( wm- > getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ ESM : : Class : : Combat ] , " " ) ) ;
specializationName - > setCaption ( mWindowManager. getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ ESM : : Class : : Combat ] , " " ) ) ;
specializationName - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & CreateClassDialog : : onSpecializationClicked ) ;
specializationName - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & CreateClassDialog : : onSpecializationClicked ) ;
setText ( " FavoriteAttributesT " , wm- > getGameSettingString ( " sChooseClassMenu2 " , " Favorite Attributes: " ) ) ;
setText ( " FavoriteAttributesT " , mWindowManager. getGameSettingString ( " sChooseClassMenu2 " , " Favorite Attributes: " ) ) ;
getWidget ( favoriteAttribute0 , " FavoriteAttribute0 " ) ;
getWidget ( favoriteAttribute0 , " FavoriteAttribute0 " ) ;
getWidget ( favoriteAttribute1 , " FavoriteAttribute1 " ) ;
getWidget ( favoriteAttribute1 , " FavoriteAttribute1 " ) ;
favoriteAttribute0 - > setWindowManager ( wm ) ;
favoriteAttribute0 - > setWindowManager ( & mWindowManager ) ;
favoriteAttribute1 - > setWindowManager ( wm ) ;
favoriteAttribute1 - > setWindowManager ( & mWindowManager ) ;
favoriteAttribute0 - > eventClicked = MyGUI : : newDelegate ( this , & CreateClassDialog : : onAttributeClicked ) ;
favoriteAttribute0 - > eventClicked = MyGUI : : newDelegate ( this , & CreateClassDialog : : onAttributeClicked ) ;
favoriteAttribute1 - > eventClicked = MyGUI : : newDelegate ( this , & CreateClassDialog : : onAttributeClicked ) ;
favoriteAttribute1 - > eventClicked = MyGUI : : newDelegate ( this , & CreateClassDialog : : onAttributeClicked ) ;
setText ( " MajorSkillT " , wm- > getGameSettingString ( " sSkillClassMajor " , " " ) ) ;
setText ( " MajorSkillT " , mWindowManager. getGameSettingString ( " sSkillClassMajor " , " " ) ) ;
setText ( " MinorSkillT " , wm- > getGameSettingString ( " sSkillClassMinor " , " " ) ) ;
setText ( " MinorSkillT " , mWindowManager. getGameSettingString ( " sSkillClassMinor " , " " ) ) ;
for ( int i = 0 ; i < 5 ; i + + )
for ( int i = 0 ; i < 5 ; i + + )
{
{
char theIndex = ' 0 ' + i ;
char theIndex = ' 0 ' + i ;
@ -420,11 +413,11 @@ CreateClassDialog::CreateClassDialog(MWWorld::Environment& environment)
std : : vector < Widgets : : MWSkillPtr > : : const_iterator end = skills . end ( ) ;
std : : vector < Widgets : : MWSkillPtr > : : const_iterator end = skills . end ( ) ;
for ( std : : vector < Widgets : : MWSkillPtr > : : const_iterator it = skills . begin ( ) ; it ! = end ; + + it )
for ( std : : vector < Widgets : : MWSkillPtr > : : const_iterator it = skills . begin ( ) ; it ! = end ; + + it )
{
{
( * it ) - > setWindowManager ( wm ) ;
( * it ) - > setWindowManager ( & mWindowManager ) ;
( * it ) - > eventClicked = MyGUI : : newDelegate ( this , & CreateClassDialog : : onSkillClicked ) ;
( * it ) - > eventClicked = MyGUI : : newDelegate ( this , & CreateClassDialog : : onSkillClicked ) ;
}
}
setText ( " LabelT " , wm- > getGameSettingString ( " sName " , " " ) ) ;
setText ( " LabelT " , mWindowManager. getGameSettingString ( " sName " , " " ) ) ;
getWidget ( editName , " EditName " ) ;
getWidget ( editName , " EditName " ) ;
// Make sure the edit box has focus
// Make sure the edit box has focus
@ -566,7 +559,7 @@ void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
{
{
if ( specDialog )
if ( specDialog )
delete specDialog ;
delete specDialog ;
specDialog = new SelectSpecializationDialog ( environment, environment . mWindowManager- > getGui ( ) - > getViewSize ( ) ) ;
specDialog = new SelectSpecializationDialog ( mWindowManager) ;
specDialog - > eventCancel = MyGUI : : newDelegate ( this , & CreateClassDialog : : onDialogCancel ) ;
specDialog - > eventCancel = MyGUI : : newDelegate ( this , & CreateClassDialog : : onDialogCancel ) ;
specDialog - > eventItemSelected = MyGUI : : newDelegate ( this , & CreateClassDialog : : onSpecializationSelected ) ;
specDialog - > eventItemSelected = MyGUI : : newDelegate ( this , & CreateClassDialog : : onSpecializationSelected ) ;
specDialog - > setVisible ( true ) ;
specDialog - > setVisible ( true ) ;
@ -575,7 +568,7 @@ void CreateClassDialog::onSpecializationClicked(MyGUI::WidgetPtr _sender)
void CreateClassDialog : : onSpecializationSelected ( )
void CreateClassDialog : : onSpecializationSelected ( )
{
{
specializationId = specDialog - > getSpecializationId ( ) ;
specializationId = specDialog - > getSpecializationId ( ) ;
specializationName - > setCaption ( environment. mWindowManager - > getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ specializationId ] , " " ) ) ;
specializationName - > setCaption ( mWindowManager. getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ specializationId ] , " " ) ) ;
specDialog - > setVisible ( false ) ;
specDialog - > setVisible ( false ) ;
}
}
@ -583,7 +576,7 @@ void CreateClassDialog::onAttributeClicked(Widgets::MWAttributePtr _sender)
{
{
if ( attribDialog )
if ( attribDialog )
delete attribDialog ;
delete attribDialog ;
attribDialog = new SelectAttributeDialog ( environment, environment . mWindowManager- > getGui ( ) - > getViewSize ( ) ) ;
attribDialog = new SelectAttributeDialog ( mWindowManager) ;
attribDialog - > setAffectedWidget ( _sender ) ;
attribDialog - > setAffectedWidget ( _sender ) ;
attribDialog - > eventCancel = MyGUI : : newDelegate ( this , & CreateClassDialog : : onDialogCancel ) ;
attribDialog - > eventCancel = MyGUI : : newDelegate ( this , & CreateClassDialog : : onDialogCancel ) ;
attribDialog - > eventItemSelected = MyGUI : : newDelegate ( this , & CreateClassDialog : : onAttributeSelected ) ;
attribDialog - > eventItemSelected = MyGUI : : newDelegate ( this , & CreateClassDialog : : onAttributeSelected ) ;
@ -612,7 +605,7 @@ void CreateClassDialog::onSkillClicked(Widgets::MWSkillPtr _sender)
{
{
if ( skillDialog )
if ( skillDialog )
delete skillDialog ;
delete skillDialog ;
skillDialog = new SelectSkillDialog ( environment, environment . mWindowManager- > getGui ( ) - > getViewSize ( ) ) ;
skillDialog = new SelectSkillDialog ( mWindowManager) ;
skillDialog - > setAffectedWidget ( _sender ) ;
skillDialog - > setAffectedWidget ( _sender ) ;
skillDialog - > eventCancel = MyGUI : : newDelegate ( this , & CreateClassDialog : : onDialogCancel ) ;
skillDialog - > eventCancel = MyGUI : : newDelegate ( this , & CreateClassDialog : : onDialogCancel ) ;
skillDialog - > eventItemSelected = MyGUI : : newDelegate ( this , & CreateClassDialog : : onSkillSelected ) ;
skillDialog - > eventItemSelected = MyGUI : : newDelegate ( this , & CreateClassDialog : : onSkillSelected ) ;
@ -643,21 +636,21 @@ void CreateClassDialog::onSkillSelected()
void CreateClassDialog : : onDescriptionClicked ( MyGUI : : Widget * _sender )
void CreateClassDialog : : onDescriptionClicked ( MyGUI : : Widget * _sender )
{
{
descDialog = new DescriptionDialog ( environment, environment . mWindowManager- > getGui ( ) - > getViewSize ( ) ) ;
descDialog = new DescriptionDialog ( mWindowManager) ;
descDialog - > setTextInput ( description ) ;
descDialog - > setTextInput ( description ) ;
descDialog - > eventDone = MyGUI : : newDelegate ( this , & CreateClassDialog : : onDescriptionEntered ) ;
descDialog - > eventDone = MyGUI : : newDelegate ( this , & CreateClassDialog : : onDescriptionEntered ) ;
descDialog - > setVisible ( true ) ;
descDialog - > setVisible ( true ) ;
}
}
void CreateClassDialog : : onDescriptionEntered ( )
void CreateClassDialog : : onDescriptionEntered ( WindowBase * parWindow )
{
{
description = descDialog - > getTextInput ( ) ;
description = descDialog - > getTextInput ( ) ;
environment. mWindowManager - > removeDialog ( descDialog ) ;
mWindowManager. removeDialog ( descDialog ) ;
}
}
void CreateClassDialog : : onOkClicked ( MyGUI : : Widget * _sender )
void CreateClassDialog : : onOkClicked ( MyGUI : : Widget * _sender )
{
{
eventDone ( ) ;
eventDone ( this ) ;
}
}
void CreateClassDialog : : onBackClicked ( MyGUI : : Widget * _sender )
void CreateClassDialog : : onBackClicked ( MyGUI : : Widget * _sender )
@ -667,31 +660,29 @@ void CreateClassDialog::onBackClicked(MyGUI::Widget* _sender)
/* SelectSpecializationDialog */
/* SelectSpecializationDialog */
SelectSpecializationDialog : : SelectSpecializationDialog ( MWWorld: : Environment & environment , MyGUI : : IntSize gameWindowSize )
SelectSpecializationDialog : : SelectSpecializationDialog ( WindowManager& parWindowManager )
: WindowBase ( " openmw_chargen_select_specialization_layout.xml " , environment )
: WindowBase ( " openmw_chargen_select_specialization_layout.xml " , parWindowManager )
{
{
// Centre dialog
// Centre dialog
center ( ) ;
center ( ) ;
WindowManager * wm = environment . mWindowManager ;
setText ( " LabelT " , mWindowManager . getGameSettingString ( " sSpecializationMenu1 " , " " ) ) ;
setText ( " LabelT " , wm - > getGameSettingString ( " sSpecializationMenu1 " , " " ) ) ;
getWidget ( specialization0 , " Specialization0 " ) ;
getWidget ( specialization0 , " Specialization0 " ) ;
getWidget ( specialization1 , " Specialization1 " ) ;
getWidget ( specialization1 , " Specialization1 " ) ;
getWidget ( specialization2 , " Specialization2 " ) ;
getWidget ( specialization2 , " Specialization2 " ) ;
specialization0 - > setCaption ( wm- > getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ ESM : : Class : : Combat ] , " " ) ) ;
specialization0 - > setCaption ( mWindowManager. getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ ESM : : Class : : Combat ] , " " ) ) ;
specialization0 - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSpecializationDialog : : onSpecializationClicked ) ;
specialization0 - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSpecializationDialog : : onSpecializationClicked ) ;
specialization1 - > setCaption ( wm- > getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ ESM : : Class : : Magic ] , " " ) ) ;
specialization1 - > setCaption ( mWindowManager. getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ ESM : : Class : : Magic ] , " " ) ) ;
specialization1 - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSpecializationDialog : : onSpecializationClicked ) ;
specialization1 - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSpecializationDialog : : onSpecializationClicked ) ;
specialization2 - > setCaption ( wm- > getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ ESM : : Class : : Stealth ] , " " ) ) ;
specialization2 - > setCaption ( mWindowManager. getGameSettingString ( ESM : : Class : : gmstSpecializationIds [ ESM : : Class : : Stealth ] , " " ) ) ;
specialization2 - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSpecializationDialog : : onSpecializationClicked ) ;
specialization2 - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSpecializationDialog : : onSpecializationClicked ) ;
specializationId = ESM : : Class : : Combat ;
specializationId = ESM : : Class : : Combat ;
// TODO: These buttons should be managed by a Dialog class
// TODO: These buttons should be managed by a Dialog class
MyGUI : : ButtonPtr cancelButton ;
MyGUI : : ButtonPtr cancelButton ;
getWidget ( cancelButton , " CancelButton " ) ;
getWidget ( cancelButton , " CancelButton " ) ;
cancelButton - > setCaption ( wm- > getGameSettingString ( " sCancel " , " " ) ) ;
cancelButton - > setCaption ( mWindowManager. getGameSettingString ( " sCancel " , " " ) ) ;
cancelButton - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSpecializationDialog : : onCancelClicked ) ;
cancelButton - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSpecializationDialog : : onCancelClicked ) ;
}
}
@ -718,15 +709,13 @@ void SelectSpecializationDialog::onCancelClicked(MyGUI::Widget* _sender)
/* SelectAttributeDialog */
/* SelectAttributeDialog */
SelectAttributeDialog : : SelectAttributeDialog ( MWWorld: : Environment & environment , MyGUI : : IntSize gameWindowSize )
SelectAttributeDialog : : SelectAttributeDialog ( WindowManager& parWindowManager )
: WindowBase ( " openmw_chargen_select_attribute_layout.xml " , environment )
: WindowBase ( " openmw_chargen_select_attribute_layout.xml " , parWindowManager )
{
{
// Centre dialog
// Centre dialog
center ( ) ;
center ( ) ;
WindowManager * wm = environment . mWindowManager ;
setText ( " LabelT " , mWindowManager . getGameSettingString ( " sAttributesMenu1 " , " " ) ) ;
setText ( " LabelT " , wm - > getGameSettingString ( " sAttributesMenu1 " , " " ) ) ;
for ( int i = 0 ; i < 8 ; + + i )
for ( int i = 0 ; i < 8 ; + + i )
{
{
@ -734,7 +723,7 @@ SelectAttributeDialog::SelectAttributeDialog(MWWorld::Environment& environment,
char theIndex = ' 0 ' + i ;
char theIndex = ' 0 ' + i ;
getWidget ( attribute , std : : string ( " Attribute " ) . append ( 1 , theIndex ) ) ;
getWidget ( attribute , std : : string ( " Attribute " ) . append ( 1 , theIndex ) ) ;
attribute - > setWindowManager ( wm ) ;
attribute - > setWindowManager ( & parWindowManager ) ;
attribute - > setAttributeId ( ESM : : Attribute : : attributeIds [ i ] ) ;
attribute - > setAttributeId ( ESM : : Attribute : : attributeIds [ i ] ) ;
attribute - > eventClicked = MyGUI : : newDelegate ( this , & SelectAttributeDialog : : onAttributeClicked ) ;
attribute - > eventClicked = MyGUI : : newDelegate ( this , & SelectAttributeDialog : : onAttributeClicked ) ;
}
}
@ -742,7 +731,7 @@ SelectAttributeDialog::SelectAttributeDialog(MWWorld::Environment& environment,
// TODO: These buttons should be managed by a Dialog class
// TODO: These buttons should be managed by a Dialog class
MyGUI : : ButtonPtr cancelButton ;
MyGUI : : ButtonPtr cancelButton ;
getWidget ( cancelButton , " CancelButton " ) ;
getWidget ( cancelButton , " CancelButton " ) ;
cancelButton - > setCaption ( wm- > getGameSettingString ( " sCancel " , " " ) ) ;
cancelButton - > setCaption ( mWindowManager. getGameSettingString ( " sCancel " , " " ) ) ;
cancelButton - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectAttributeDialog : : onCancelClicked ) ;
cancelButton - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectAttributeDialog : : onCancelClicked ) ;
}
}
@ -763,18 +752,16 @@ void SelectAttributeDialog::onCancelClicked(MyGUI::Widget* _sender)
/* SelectSkillDialog */
/* SelectSkillDialog */
SelectSkillDialog : : SelectSkillDialog ( MWWorld: : Environment & environment , MyGUI : : IntSize gameWindowSize )
SelectSkillDialog : : SelectSkillDialog ( WindowManager& parWindowManager )
: WindowBase ( " openmw_chargen_select_skill_layout.xml " , environment )
: WindowBase ( " openmw_chargen_select_skill_layout.xml " , parWindowManager )
{
{
// Centre dialog
// Centre dialog
center ( ) ;
center ( ) ;
WindowManager * wm = environment . mWindowManager ;
setText ( " LabelT " , mWindowManager . getGameSettingString ( " sSkillsMenu1 " , " " ) ) ;
setText ( " CombatLabelT " , mWindowManager . getGameSettingString ( " sSpecializationCombat " , " " ) ) ;
setText ( " LabelT " , wm - > getGameSettingString ( " sSkillsMenu1 " , " " ) ) ;
setText ( " MagicLabelT " , mWindowManager . getGameSettingString ( " sSpecializationMagic " , " " ) ) ;
setText ( " CombatLabelT " , wm - > getGameSettingString ( " sSpecializationCombat " , " " ) ) ;
setText ( " StealthLabelT " , mWindowManager . getGameSettingString ( " sSpecializationStealth " , " " ) ) ;
setText ( " MagicLabelT " , wm - > getGameSettingString ( " sSpecializationMagic " , " " ) ) ;
setText ( " StealthLabelT " , wm - > getGameSettingString ( " sSpecializationStealth " , " " ) ) ;
for ( int i = 0 ; i < 9 ; i + + )
for ( int i = 0 ; i < 9 ; i + + )
{
{
@ -824,7 +811,7 @@ SelectSkillDialog::SelectSkillDialog(MWWorld::Environment& environment, MyGUI::I
{
{
for ( int i = 0 ; i < 9 ; + + i )
for ( int i = 0 ; i < 9 ; + + i )
{
{
skills [ spec ] [ i ] . widget - > setWindowManager ( wm ) ;
skills [ spec ] [ i ] . widget - > setWindowManager ( & mWindowManager ) ;
skills [ spec ] [ i ] . widget - > setSkillId ( skills [ spec ] [ i ] . skillId ) ;
skills [ spec ] [ i ] . widget - > setSkillId ( skills [ spec ] [ i ] . skillId ) ;
skills [ spec ] [ i ] . widget - > eventClicked = MyGUI : : newDelegate ( this , & SelectSkillDialog : : onSkillClicked ) ;
skills [ spec ] [ i ] . widget - > eventClicked = MyGUI : : newDelegate ( this , & SelectSkillDialog : : onSkillClicked ) ;
}
}
@ -833,7 +820,7 @@ SelectSkillDialog::SelectSkillDialog(MWWorld::Environment& environment, MyGUI::I
// TODO: These buttons should be managed by a Dialog class
// TODO: These buttons should be managed by a Dialog class
MyGUI : : ButtonPtr cancelButton ;
MyGUI : : ButtonPtr cancelButton ;
getWidget ( cancelButton , " CancelButton " ) ;
getWidget ( cancelButton , " CancelButton " ) ;
cancelButton - > setCaption ( wm- > getGameSettingString ( " sCancel " , " " ) ) ;
cancelButton - > setCaption ( mWindowManager. getGameSettingString ( " sCancel " , " " ) ) ;
cancelButton - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSkillDialog : : onCancelClicked ) ;
cancelButton - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & SelectSkillDialog : : onCancelClicked ) ;
}
}
@ -852,8 +839,8 @@ void SelectSkillDialog::onCancelClicked(MyGUI::Widget* _sender)
/* DescriptionDialog */
/* DescriptionDialog */
DescriptionDialog : : DescriptionDialog ( MWWorld: : Environment & environment , MyGUI : : IntSize gameWindowSize )
DescriptionDialog : : DescriptionDialog ( WindowManager& parWindowManager )
: WindowBase ( " openmw_chargen_class_description_layout.xml " , environment )
: WindowBase ( " openmw_chargen_class_description_layout.xml " , parWindowManager )
{
{
// Centre dialog
// Centre dialog
center ( ) ;
center ( ) ;
@ -864,7 +851,7 @@ DescriptionDialog::DescriptionDialog(MWWorld::Environment& environment, MyGUI::I
MyGUI : : ButtonPtr okButton ;
MyGUI : : ButtonPtr okButton ;
getWidget ( okButton , " OKButton " ) ;
getWidget ( okButton , " OKButton " ) ;
okButton - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & DescriptionDialog : : onOkClicked ) ;
okButton - > eventMouseButtonClick = MyGUI : : newDelegate ( this , & DescriptionDialog : : onOkClicked ) ;
okButton - > setCaption ( environment. mWindowManager - > getGameSettingString ( " sInputMenu1 " , " " ) ) ;
okButton - > setCaption ( mWindowManager. getGameSettingString ( " sInputMenu1 " , " " ) ) ;
// Make sure the edit box has focus
// Make sure the edit box has focus
MyGUI : : InputManager : : getInstance ( ) . setKeyFocusWidget ( textEdit ) ;
MyGUI : : InputManager : : getInstance ( ) . setKeyFocusWidget ( textEdit ) ;
@ -874,5 +861,5 @@ DescriptionDialog::DescriptionDialog(MWWorld::Environment& environment, MyGUI::I
void DescriptionDialog : : onOkClicked ( MyGUI : : Widget * _sender )
void DescriptionDialog : : onOkClicked ( MyGUI : : Widget * _sender )
{
{
eventDone ( ) ;
eventDone ( this ) ;
}
}