mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Make more dev screens usable in portrait by converting them to TabbedDialogScreen
This commit is contained in:
@@ -7,24 +7,31 @@
|
||||
#include "Common/UI/TabHolder.h"
|
||||
#include "UI/TabbedDialogScreen.h"
|
||||
|
||||
void TabbedUIDialogScreenWithGameBackground::AddTab(const char *tag, std::string_view title, std::function<void(UI::LinearLayout *)> createCallback, bool isSearch) {
|
||||
void TabbedUIDialogScreenWithGameBackground::AddTab(const char *tag, std::string_view title, std::function<void(UI::LinearLayout *)> createCallback, TabFlags flags) {
|
||||
using namespace UI;
|
||||
|
||||
tabHolder_->AddTabDeferred(title, [createCallback = std::move(createCallback), tag]() -> UI::ViewGroup * {
|
||||
ViewGroup *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
scroll->SetTag(tag);
|
||||
tabHolder_->AddTabDeferred(title, [createCallback = std::move(createCallback), tag, flags]() -> UI::ViewGroup * {
|
||||
ViewGroup *scroll = nullptr;
|
||||
if (!(flags & TabFlags::NonScrollable)) {
|
||||
scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
scroll->SetTag(tag);
|
||||
}
|
||||
LinearLayout *contents = new LinearLayoutList(ORIENT_VERTICAL);
|
||||
contents->SetSpacing(0);
|
||||
scroll->Add(contents);
|
||||
createCallback(contents);
|
||||
return scroll;
|
||||
if (scroll) {
|
||||
scroll->Add(contents);
|
||||
return scroll;
|
||||
} else {
|
||||
return contents;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void TabbedUIDialogScreenWithGameBackground::CreateViews() {
|
||||
PreCreateViews();
|
||||
|
||||
bool vertical = UseVerticalLayout();
|
||||
bool vertical = UseVerticalLayout() || ForceHorizontalTabs();
|
||||
|
||||
// Information in the top left.
|
||||
// Back button to the bottom left.
|
||||
@@ -92,7 +99,7 @@ void TabbedUIDialogScreenWithGameBackground::CreateViews() {
|
||||
clearSearchChoice_->SetVisibility(searchFilter_.empty() ? UI::V_GONE : UI::V_VISIBLE);
|
||||
|
||||
noSearchResults_ = searchSettings->Add(new TextView("", new LinearLayoutParams(Margins(20, 5))));
|
||||
}, true);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -120,6 +127,14 @@ void TabbedUIDialogScreenWithGameBackground::EnsureTabs() {
|
||||
}
|
||||
}
|
||||
|
||||
int TabbedUIDialogScreenWithGameBackground::GetCurrentTab() const {
|
||||
return tabHolder_->GetCurrentTab();
|
||||
}
|
||||
|
||||
void TabbedUIDialogScreenWithGameBackground::SetCurrentTab(int tab) {
|
||||
tabHolder_->SetCurrentTab(tab);
|
||||
}
|
||||
|
||||
void TabbedUIDialogScreenWithGameBackground::ApplySearchFilter() {
|
||||
using namespace UI;
|
||||
auto se = GetI18NCategory(I18NCat::SEARCH);
|
||||
|
||||
Reference in New Issue
Block a user