Add RecreateAllViews function

This commit is contained in:
shenweip 2013-09-14 13:47:08 +08:00
parent 67183f5822
commit fd4501b91a
3 changed files with 12 additions and 1 deletions

View File

@ -155,6 +155,12 @@ void ScreenManager::pop() {
}
}
void ScreenManager::RecreateAllViews() {
for (auto it = stack_.begin(); it != stack_.end(); ++it) {
it->screen->RecreateViews();
}
}
void ScreenManager::finishDialog(const Screen *dialog, DialogResult result) {
if (dialog != stack_.back().screen) {
ELOG("Wrong dialog being finished!");

View File

@ -48,6 +48,8 @@ public:
virtual void axis(const AxisInput &touch) {}
virtual void sendMessage(const char *msg, const char *value) {}
virtual void RecreateViews() {}
ScreenManager *screenManager() { return screenManager_; }
void setScreenManager(ScreenManager *sm) { screenManager_ = sm; }
@ -89,6 +91,9 @@ public:
// Push a dialog box in front. Currently 1-level only.
void push(Screen *screen, int layerFlags = 0);
// Recreate all views
void RecreateAllViews();
// Pops the dialog away.
void finishDialog(const Screen *dialog, DialogResult result = DR_OK);

View File

@ -23,7 +23,7 @@ protected:
virtual void CreateViews() = 0;
virtual void DrawBackground(UIContext &dc) {}
void RecreateViews() { recreateViews_ = true; }
virtual void RecreateViews() { recreateViews_ = true; }
UI::ViewGroup *root_;