mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-02 12:32:03 +01:00
Instead of hiding the non-matching views in every tab and disabling the tabs without matches, the search tab now builds each page and shows the matching settings right there, where they can be changed, grouped under their tab and section. Matching a section header shows the whole section, and matching a hint shows its setting. Searches match both the translated and the English text. Each result has an arrow that switches to the setting's tab, scrolls it to the middle and highlights it. The other tabbed screens with search (Developer Tools) keep the old filter for now. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
74 lines
2.2 KiB
C++
74 lines
2.2 KiB
C++
#pragma once
|
|
|
|
#include "ppsspp_config.h"
|
|
#include <functional>
|
|
|
|
#include "Common/UI/UIScreen.h"
|
|
#include "Common/Render/TextureAtlas.h"
|
|
#include "Common/System/System.h"
|
|
#include "Core/ConfigValues.h"
|
|
#include "UI/BaseScreens.h"
|
|
|
|
namespace UI {
|
|
class TabHolder;
|
|
}
|
|
|
|
enum class TabDialogFlags {
|
|
Default = 0,
|
|
HorizontalOnlyIcons = 1,
|
|
VerticalShowIcons = 2,
|
|
AddAutoTitles = 4,
|
|
ContextMenuInPortrait = 8,
|
|
};
|
|
ENUM_CLASS_BITOPS(TabDialogFlags);
|
|
|
|
enum class TabFlags {
|
|
Default = 0,
|
|
NonScrollable = 1,
|
|
};
|
|
ENUM_CLASS_BITOPS(TabFlags);
|
|
|
|
class UITabbedBaseDialogScreen : public UIBaseDialogScreen {
|
|
public:
|
|
// currentTabSetting can be null if you don't want to persist the current tab.
|
|
UITabbedBaseDialogScreen(const Path &gamePath, int *currentTabSetting = nullptr, TabDialogFlags flags = TabDialogFlags::Default);
|
|
void AddTab(const char *tag, std::string_view title, ImageID imageId, std::function<void(UI::LinearLayout *)> createCallback, TabFlags flags = TabFlags::Default);
|
|
void AddTab(const char *tag, std::string_view title, std::function<void(UI::LinearLayout *)> createCallback, TabFlags flags = TabFlags::Default) {
|
|
AddTab(tag, title, ImageID::invalid(), createCallback, flags);
|
|
}
|
|
void CreateViews() override;
|
|
|
|
protected:
|
|
// Load data and define your tabs here.
|
|
virtual void PreCreateViews() {}
|
|
virtual void CreateTabs() = 0;
|
|
virtual void CreateExtraButtons(UI::ViewGroup *verticalLayout, int margins) {}
|
|
virtual bool ShowSearchControls() const { return true; }
|
|
virtual void EnsureTabs();
|
|
virtual bool UsePopupMenuInPortrait() const { return false; }
|
|
virtual bool ForceHorizontalTabs() const { return false; }
|
|
|
|
int GetCurrentTab() const;
|
|
void SetCurrentTab(int tab);
|
|
// Whether there's room and a way to type a search.
|
|
static bool CanShowSearch();
|
|
|
|
void sendMessage(UIMessage message, const char *value) override;
|
|
|
|
private:
|
|
void ApplySearchFilter();
|
|
|
|
UI::TabHolder *tabHolder_ = nullptr;
|
|
UI::TextView *filterNotice_ = nullptr;
|
|
UI::Choice *clearSearchChoice_ = nullptr;
|
|
UI::TextView *noSearchResults_ = nullptr;
|
|
|
|
// If we recreate the views while this is active we show it again
|
|
std::string oldSettingInfo_;
|
|
std::string searchFilter_;
|
|
|
|
int *currentTabSetting_ = nullptr;
|
|
|
|
TabDialogFlags flags_ = TabDialogFlags::Default;
|
|
};
|