Revise how the language system works.

On Win32, the Language menubar is eliminated in favour of displaying a NewLanguageScreen on screens that are of type UIDialogScreenWithBackground/UIScreenWithBackground; UIScreen inheriting screens (e.g. GamePauseScreen) still require manual additions.
This commit is contained in:
The Dax committed 2013-11-03 19:21:53 -05:00
1 parent e2e74e81d6
commit 728101aebb
9 files changed
+65 -95

No files matched your search

+14 -11
View File
@@ -650,20 +650,11 @@ UI::EventReturn MainScreen::OnGameSelectedInstant(UI::EventParams &e) {
UI::EventReturn MainScreen::OnGameSettings(UI::EventParams &e) {
// screenManager()->push(new SettingsScreen());
auto gameSettings = new GameSettingsScreen("", "");
gameSettings->OnLanguageChanged.Handle(this, &MainScreen::OnLanguageChange);
gameSettings->OnRecentChanged.Handle(this, &MainScreen::OnRecentChange);
screenManager()->push(gameSettings);
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnLanguageChange(UI::EventParams &e) {
RecreateViews();
if (host) {
host->UpdateUI();
}
return UI::EVENT_DONE;
}
UI::EventReturn MainScreen::OnRecentChange(UI::EventParams &e) {
RecreateViews();
if (host) {
@@ -852,10 +843,22 @@ UI::EventReturn GamePauseScreen::OnCwCheat(UI::EventParams &e) {
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnLanguageChange(UI::EventParams &e) {
RecreateViews();
if (host) {
host->UpdateUI();
}
return UI::EVENT_DONE;
}
void GamePauseScreen::sendMessage(const char *message, const char *value) {
// Since the language message isn't allowed to be in native, we have to have add this
// to every screen which directly inherits from UIScreen(which are few right now, luckily).
if (!strcmp(message, "language")) {
screenManager()->RecreateAllViews();
I18NCategory *de = GetI18NCategory("Developer");
if (!strcmp(message, "language screen")) {
auto langScreen = new NewLanguageScreen(de->T("Language"));
langScreen->OnChoice.Handle(this, &GamePauseScreen::OnLanguageChange);
screenManager()->push(langScreen);
}
}