mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-25 07:56:37 +00:00 
			
		
		
		
	Further unification of dialog API, all dialogs now have an open() method which updates gui content and makes it visible.
This commit is contained in:
		
							parent
							
								
									e39f700372
								
							
						
					
					
						commit
						12fe9305a6
					
				
					 5 changed files with 22 additions and 11 deletions
				
			
		|  | @ -41,6 +41,11 @@ GenerateClassResultDialog::GenerateClassResultDialog(MWWorld::Environment& envir | |||
|     okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &GenerateClassResultDialog::onOkClicked); | ||||
| } | ||||
| 
 | ||||
| void GenerateClassResultDialog::open() | ||||
| { | ||||
|     setVisible(true); | ||||
| } | ||||
| 
 | ||||
| std::string GenerateClassResultDialog::getClassId() const | ||||
| { | ||||
|     return className->getCaption(); | ||||
|  | @ -363,7 +368,7 @@ void InfoBoxDialog::setButtons(ButtonList &buttons) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| void InfoBoxDialog::update() | ||||
| void InfoBoxDialog::open() | ||||
| { | ||||
|     // Fix layout
 | ||||
|     layoutVertically(textBox, 4); | ||||
|  | @ -371,6 +376,7 @@ void InfoBoxDialog::update() | |||
|     layoutVertically(mMainWidget, 4 + 6); | ||||
| 
 | ||||
|     center(); | ||||
|     setVisible(true); | ||||
| } | ||||
| 
 | ||||
| int InfoBoxDialog::getChosenButton() const | ||||
|  | @ -417,8 +423,6 @@ ClassChoiceDialog::ClassChoiceDialog(MWWorld::Environment& environment) | |||
|     buttons.push_back(mw->getGameSettingString("sClassChoiceMenu3", "")); | ||||
|     buttons.push_back(mw->getGameSettingString("sBack", "")); | ||||
|     setButtons(buttons); | ||||
| 
 | ||||
|     update(); | ||||
| } | ||||
| 
 | ||||
| /* CreateClassDialog */ | ||||
|  |  | |||
|  | @ -34,7 +34,7 @@ namespace MWGui | |||
|         std::string getText() const; | ||||
|         void setButtons(ButtonList &buttons); | ||||
| 
 | ||||
|         void update(); | ||||
|         void open(); | ||||
|         int getChosenButton() const; | ||||
| 
 | ||||
|         // Events
 | ||||
|  | @ -83,6 +83,8 @@ namespace MWGui | |||
|         std::string getClassId() const; | ||||
|         void setClassId(const std::string &classId); | ||||
| 
 | ||||
|         void open(); | ||||
| 
 | ||||
|         // Events
 | ||||
|         typedef delegates::CDelegate0 EventHandle_Void; | ||||
| 
 | ||||
|  |  | |||
|  | @ -95,6 +95,12 @@ ReviewDialog::ReviewDialog(MWWorld::Environment& environment, MyGUI::IntSize gam | |||
|     okButton->eventMouseButtonClick = MyGUI::newDelegate(this, &ReviewDialog::onOkClicked); | ||||
| } | ||||
| 
 | ||||
| void ReviewDialog::open() | ||||
| { | ||||
|     updateSkillArea(); | ||||
|     setVisible(true); | ||||
| } | ||||
| 
 | ||||
| void ReviewDialog::onScrollChangePosition(MyGUI::VScrollPtr scroller, size_t pos) | ||||
| { | ||||
|     int diff = lastPos - pos; | ||||
|  |  | |||
|  | @ -41,7 +41,7 @@ namespace MWGui | |||
|         void configureSkills(const SkillList& major, const SkillList& minor); | ||||
|         void setSkillValue(ESM::Skill::SkillEnum skillId, const MWMechanics::Stat<float>& value); | ||||
| 
 | ||||
|         void updateSkillArea(); | ||||
|         void open(); | ||||
| 
 | ||||
|         // Events
 | ||||
|         typedef delegates::CDelegate0 EventHandle_Void; | ||||
|  | @ -74,6 +74,7 @@ namespace MWGui | |||
|         MyGUI::WidgetPtr addValueItem(const std::string text, const std::string &value, ColorStyle style, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); | ||||
|         void addItem(const std::string text, MyGUI::IntCoord &coord1, MyGUI::IntCoord &coord2); | ||||
|         void updateScroller(); | ||||
|         void updateSkillArea(); | ||||
| 
 | ||||
|         void onScrollChangePosition(MyGUI::VScrollPtr scroller, size_t pos); | ||||
|         void onWindowResize(MyGUI::WidgetPtr window); | ||||
|  |  | |||
|  | @ -198,6 +198,7 @@ void WindowManager::updateVisible() | |||
|           removeDialog(classChoiceDialog); | ||||
|       classChoiceDialog = new ClassChoiceDialog(environment); | ||||
|       classChoiceDialog->eventButtonSelected = MyGUI::newDelegate(this, &WindowManager::onClassChoice); | ||||
|       classChoiceDialog->open(); | ||||
|       return; | ||||
|   } | ||||
| 
 | ||||
|  | @ -277,11 +278,9 @@ void WindowManager::updateVisible() | |||
|           reviewDialog->configureSkills(playerMajorSkills, playerMinorSkills); | ||||
|       } | ||||
| 
 | ||||
|       reviewDialog->updateSkillArea(); | ||||
| 
 | ||||
|       reviewDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onReviewDialogDone); | ||||
|       reviewDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onReviewDialogBack); | ||||
|       reviewDialog->setVisible(true); | ||||
|       reviewDialog->open(); | ||||
|       return; | ||||
|   } | ||||
| 
 | ||||
|  | @ -585,7 +584,7 @@ void WindowManager::showClassQuestionDialog() | |||
|         generateClassResultDialog->setClassId(generateClass); | ||||
|         generateClassResultDialog->eventBack = MyGUI::newDelegate(this, &WindowManager::onGenerateClassBack); | ||||
|         generateClassResultDialog->eventDone = MyGUI::newDelegate(this, &WindowManager::onGenerateClassDone); | ||||
|         generateClassResultDialog->setVisible(true); | ||||
|         generateClassResultDialog->open(); | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|  | @ -605,9 +604,8 @@ void WindowManager::showClassQuestionDialog() | |||
|     buttons.push_back(steps[generateClassStep].buttons[1]); | ||||
|     buttons.push_back(steps[generateClassStep].buttons[2]); | ||||
|     generateClassQuestionDialog->setButtons(buttons); | ||||
|     generateClassQuestionDialog->update(); | ||||
|     generateClassQuestionDialog->eventButtonSelected = MyGUI::newDelegate(this, &WindowManager::onClassQuestionChosen); | ||||
|     generateClassQuestionDialog->setVisible(true); | ||||
|     generateClassQuestionDialog->open(); | ||||
| } | ||||
| 
 | ||||
| void WindowManager::onClassQuestionChosen(MyGUI::Widget* _sender, int _index) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue