UI: Add a simple means of persisting data.

This commit is contained in:
Unknown W. Brackets committed 2016-01-22 22:40:16 -08:00
1 parent 84d815768b
commit f6772ec526
4 files changed
+31 -4

No files matched your search

+12 -1
View File
@@ -1,3 +1,4 @@
#include <map>
#include "base/display.h"
#include "input/input_state.h"
#include "input/keycodes.h"
@@ -19,13 +20,23 @@ UIScreen::~UIScreen() {
void UIScreen::DoRecreateViews() {
if (recreateViews_) {
UI::PersistMap persisted;
bool persisting = root_ != nullptr;
if (persisting) {
root_->PersistData(UI::PERSIST_SAVE, persisted);
}
delete root_;
root_ = 0;
root_ = nullptr;
CreateViews();
if (root_ && root_->GetDefaultFocusView()) {
root_->GetDefaultFocusView()->SetFocus();
}
recreateViews_ = false;
if (persisting) {
root_->PersistData(UI::PERSIST_RESTORE, persisted);
}
}
}