mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-03 03:03:50 +01:00
UI: Persist selected tab on resize.
This commit is contained in:
1 parent
f6772ec526
commit
1c2ac798cd
2 files changed
+24
No files matched your search
@@ -1053,6 +1053,28 @@ EventReturn TabHolder::OnTabClick(EventParams &e) {
|
||||
return EVENT_DONE;
|
||||
}
|
||||
|
||||
void TabHolder::PersistData(PersistStatus status, PersistMap &storage) {
|
||||
const std::string &tag = Tag();
|
||||
|
||||
if (tag.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
PersistBuffer &buffer = storage["TabHolder::" + tag];
|
||||
switch (status) {
|
||||
case PERSIST_SAVE:
|
||||
buffer.resize(1);
|
||||
buffer[0] = currentTab_;
|
||||
break;
|
||||
|
||||
case PERSIST_RESTORE:
|
||||
if (buffer.size() == 1) {
|
||||
SetCurrentTab(buffer[0]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ChoiceStrip::ChoiceStrip(Orientation orientation, LayoutParams *layoutParams)
|
||||
: LinearLayout(orientation, layoutParams), selected_(0), topTabs_(false) {
|
||||
SetSpacing(0.0f);
|
||||
|
||||
@@ -323,6 +323,8 @@ public:
|
||||
int GetCurrentTab() const { return currentTab_; }
|
||||
std::string Describe() const override { return "TabHolder: " + View::Describe(); }
|
||||
|
||||
void PersistData(PersistStatus status, PersistMap &storage) override;
|
||||
|
||||
private:
|
||||
EventReturn OnTabClick(EventParams &e);
|
||||
|
||||
|
||||
Reference in new issue
Block a user