mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Call the base class sendMessage when handling messages from native, so every screen can refresh from a language update at any time.
This commit is contained in:
parent
a28151437b
commit
db370c1fd3
8 changed files with 27 additions and 23 deletions
|
@ -214,9 +214,9 @@ void ControlMappingScreen::CreateViews() {
|
|||
}
|
||||
|
||||
void ControlMappingScreen::sendMessage(const char *message, const char *value) {
|
||||
if (!strcmp(message, "language")) {
|
||||
screenManager()->RecreateAllViews();
|
||||
}
|
||||
// Always call the base class method first to handle the most common messages.
|
||||
UIDialogScreenWithBackground::sendMessage(message, value);
|
||||
|
||||
if (!strcmp(message, "settings")) {
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
screenManager()->push(new GameSettingsScreen(""));
|
||||
|
|
|
@ -92,12 +92,6 @@ void CwCheatScreen::CreateViews() {
|
|||
}
|
||||
}
|
||||
|
||||
void CwCheatScreen::sendMessage(const char *message, const char *value) {
|
||||
if (!strcmp(message, "language")) {
|
||||
screenManager()->RecreateAllViews();
|
||||
}
|
||||
}
|
||||
|
||||
UI::EventReturn CwCheatScreen::OnBack(UI::EventParams ¶ms)
|
||||
{
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
|
|
|
@ -42,7 +42,6 @@ public:
|
|||
UI::EventReturn OnEnableAll(UI::EventParams ¶ms);
|
||||
protected:
|
||||
virtual void CreateViews();
|
||||
virtual void sendMessage(const char *message, const char *value);
|
||||
|
||||
private:
|
||||
UI::EventReturn OnCheckBox(UI::EventParams ¶ms);
|
||||
|
|
|
@ -353,9 +353,9 @@ void GameSettingsScreen::update(InputState &input) {
|
|||
}
|
||||
|
||||
void GameSettingsScreen::sendMessage(const char *message, const char *value) {
|
||||
if (!strcmp(message, "language")) {
|
||||
screenManager()->RecreateAllViews();
|
||||
}
|
||||
// Always call the base class method first to handle the most common messages.
|
||||
UIDialogScreenWithBackground::sendMessage(message, value);
|
||||
|
||||
if (!strcmp(message, "control mapping")) {
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
screenManager()->push(new ControlMappingScreen());
|
||||
|
@ -502,12 +502,6 @@ void DeveloperToolsScreen::CreateViews() {
|
|||
list->Add(new Choice(d->T("Back")))->OnClick.Handle(this, &DeveloperToolsScreen::OnBack);
|
||||
}
|
||||
|
||||
void DeveloperToolsScreen::sendMessage(const char *message, const char *value){
|
||||
if (!strcmp(message, "language")) {
|
||||
screenManager()->RecreateAllViews();
|
||||
}
|
||||
}
|
||||
|
||||
UI::EventReturn DeveloperToolsScreen::OnBack(UI::EventParams &e) {
|
||||
screenManager()->finishDialog(this, DR_OK);
|
||||
|
||||
|
|
|
@ -93,7 +93,6 @@ public:
|
|||
|
||||
protected:
|
||||
virtual void CreateViews();
|
||||
virtual void sendMessage(const char *message, const char *value);
|
||||
|
||||
private:
|
||||
UI::EventReturn OnBack(UI::EventParams &e);
|
||||
|
|
|
@ -586,12 +586,12 @@ void MainScreen::CreateViews() {
|
|||
}
|
||||
|
||||
void MainScreen::sendMessage(const char *message, const char *value) {
|
||||
// Always call the base class method first to handle the most common messages.
|
||||
UIScreenWithBackground::sendMessage(message, value);
|
||||
|
||||
if (!strcmp(message, "boot")) {
|
||||
screenManager()->switchScreen(new EmuScreen(value));
|
||||
}
|
||||
if (!strcmp(message, "language")) {
|
||||
screenManager()->RecreateAllViews();
|
||||
}
|
||||
if (!strcmp(message, "control mapping")) {
|
||||
UpdateUIState(UISTATE_MENU);
|
||||
screenManager()->push(new ControlMappingScreen());
|
||||
|
@ -845,6 +845,8 @@ UI::EventReturn GamePauseScreen::OnCwCheat(UI::EventParams &e) {
|
|||
}
|
||||
|
||||
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();
|
||||
}
|
||||
|
|
|
@ -94,16 +94,30 @@ void DrawBackground(float alpha) {
|
|||
}
|
||||
}
|
||||
|
||||
void HandleCommonMessages(const char *message, const char *value, ScreenManager *manager) {
|
||||
if (!strcmp(message, "language")) {
|
||||
manager->RecreateAllViews();
|
||||
}
|
||||
}
|
||||
|
||||
void UIScreenWithBackground::DrawBackground(UIContext &dc) {
|
||||
::DrawBackground(1.0f);
|
||||
dc.Flush();
|
||||
}
|
||||
|
||||
void UIScreenWithBackground::sendMessage(const char *message, const char *value) {
|
||||
HandleCommonMessages(message, value, screenManager());
|
||||
}
|
||||
|
||||
void UIDialogScreenWithBackground::DrawBackground(UIContext &dc) {
|
||||
::DrawBackground(1.0f);
|
||||
dc.Flush();
|
||||
}
|
||||
|
||||
void UIDialogScreenWithBackground::sendMessage(const char *message, const char *value) {
|
||||
HandleCommonMessages(message, value, screenManager());
|
||||
}
|
||||
|
||||
PromptScreen::PromptScreen(std::string message, std::string yesButtonText, std::string noButtonText, std::function<void(bool)> callback)
|
||||
: message_(message), callback_(callback) {
|
||||
I18NCategory *d = GetI18NCategory("Dialog");
|
||||
|
|
|
@ -33,6 +33,7 @@ public:
|
|||
UIScreenWithBackground() : UIScreen() {}
|
||||
protected:
|
||||
virtual void DrawBackground(UIContext &dc);
|
||||
virtual void sendMessage(const char *message, const char *value);
|
||||
};
|
||||
|
||||
class UIDialogScreenWithBackground : public UIDialogScreen {
|
||||
|
@ -40,6 +41,7 @@ public:
|
|||
UIDialogScreenWithBackground() : UIDialogScreen() {}
|
||||
protected:
|
||||
virtual void DrawBackground(UIContext &dc);
|
||||
virtual void sendMessage(const char *message, const char *value);
|
||||
};
|
||||
|
||||
class PromptScreen : public UIDialogScreenWithBackground {
|
||||
|
|
Loading…
Add table
Reference in a new issue