mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 01:29:41 +01:00
Merge pull request #22770 from hrydgard/settings-refactor-prep
UI: Small additions ahead of the settings screen rework
This commit is contained in:
7 files changed
+41
-2
No files matched your search
@@ -490,6 +490,25 @@ void ScrollView::ScrollTo(float newScrollPos) {
|
||||
scrollToTarget_ = true;
|
||||
}
|
||||
|
||||
void ScrollView::ScrollToCenter(const View *view) {
|
||||
const Bounds &vBounds = view->GetBounds();
|
||||
if (orientation_ == ORIENT_VERTICAL) {
|
||||
ScrollTo(layoutScrollPos_ + vBounds.centerY() - bounds_.y - bounds_.h * 0.5f);
|
||||
} else {
|
||||
ScrollTo(layoutScrollPos_ + vBounds.centerX() - bounds_.x - bounds_.w * 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView *GetEnclosingScrollView(View *view) {
|
||||
for (ViewGroup *group = view->Parent(); group; group = group->Parent()) {
|
||||
ScrollView *scrollView = dynamic_cast<ScrollView *>(group);
|
||||
if (scrollView) {
|
||||
return scrollView;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void ScrollView::ScrollRelative(float distance) {
|
||||
scrollTarget_ = scrollPos_ + distance;
|
||||
scrollToTarget_ = true;
|
||||
|
||||
@@ -5,6 +5,11 @@
|
||||
|
||||
namespace UI {
|
||||
|
||||
class ScrollView;
|
||||
|
||||
// The nearest scroll view the view is in, or null.
|
||||
ScrollView *GetEnclosingScrollView(View *view);
|
||||
|
||||
// A scrollview usually contains just a single child - a linear layout or similar.
|
||||
class ScrollView : public ViewGroup {
|
||||
public:
|
||||
@@ -21,6 +26,8 @@ public:
|
||||
|
||||
void ScrollTo(float newScrollPos);
|
||||
void ScrollToBottom();
|
||||
// Scrolls so that the view (which must be laid out) ends up in the middle.
|
||||
void ScrollToCenter(const View *view);
|
||||
void ScrollRelative(float distance);
|
||||
bool CanScroll() const;
|
||||
void Update() override;
|
||||
|
||||
@@ -217,6 +217,9 @@ void Clickable::DrawBG(UIContext &dc, const Style &style) {
|
||||
} else {
|
||||
dc.FillRoundRect(style.background, bounds_, dc.GetTheme().choiceRoundRadius, roundCorners_);
|
||||
}
|
||||
if (highlighted_) {
|
||||
dc.Draw()->DrawRoundRect(bounds_, dc.GetTheme().choiceRoundRadius, 0xFFFFFFFF, RoundRectStyle::OutlineThin, roundCorners_);
|
||||
}
|
||||
}
|
||||
|
||||
void Clickable::ClickInternal() {
|
||||
|
||||
@@ -565,6 +565,9 @@ public:
|
||||
|
||||
void FocusChanged(FocusFlags focusFlags) override;
|
||||
|
||||
// Outlines it, to point it out without the keyboard focus (which would turn on keyboard navigation).
|
||||
void SetHighlighted(bool highlighted) { highlighted_ = highlighted; }
|
||||
|
||||
Event OnClick;
|
||||
|
||||
protected:
|
||||
@@ -579,6 +582,7 @@ protected:
|
||||
int downCountDown_ = 0;
|
||||
bool dragging_ = false;
|
||||
bool down_ = false;
|
||||
bool highlighted_ = false;
|
||||
};
|
||||
|
||||
// TODO: Very similar to Choice, should probably merge them.
|
||||
|
||||
+4
-2
@@ -891,12 +891,14 @@ void NativeInit(int argc, const char *argv[], const CommandLineOptions &cmdLineO
|
||||
if (equals(cmdLineOptions.startScreen.value(), "touchscreentest")) {
|
||||
g_screenManager->switchScreen(new MainScreen());
|
||||
g_screenManager->push(new TouchTestScreen(Path()));
|
||||
}
|
||||
if (equals(cmdLineOptions.startScreen.value(), "gamesettings")) {
|
||||
} else if (equals(cmdLineOptions.startScreen.value(), "gamesettings")) {
|
||||
g_screenManager->switchScreen(new LogoScreen(AfterLogoScreen::TO_GAME_SETTINGS));
|
||||
} else if (equals(cmdLineOptions.startScreen.value(), "developertools")) {
|
||||
g_screenManager->switchScreen(new MainScreen());
|
||||
g_screenManager->push(new DeveloperToolsScreen(Path()));
|
||||
} else {
|
||||
WARN_LOG(Log::System, "Unknown start screen '%s'", cmdLineOptions.startScreen.value().c_str());
|
||||
g_screenManager->switchScreen(new LogoScreen(AfterLogoScreen::DEFAULT));
|
||||
}
|
||||
} else if (skipLogo && !boot_filename.empty()) {
|
||||
INFO_LOG(Log::System, "Launching EmuScreen with boot filename '%s'", boot_filename.c_str());
|
||||
|
||||
@@ -124,6 +124,7 @@ static const ImageMeta g_uiImageIDs[] = {
|
||||
{"I_ARROW_RIGHT", true},
|
||||
{"I_ARROW_UP", true},
|
||||
{"I_ARROW_DOWN", true},
|
||||
{"I_CHEVRON_RIGHT", false},
|
||||
{"I_SLIDERS", false},
|
||||
{"I_THREE_DOTS", true},
|
||||
{"I_INFO", false},
|
||||
|
||||
@@ -233,6 +233,9 @@
|
||||
d="m 20.003686,15.425178 -4.588999,-4.577262 -0.0308,3.553627 -4.535971,3e-6 v 2.072375 l 4.535971,-2e-6 0.031,3.529868 z"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.35133"
|
||||
sodipodi:nodetypes="cccccccc" /><path
|
||||
id="I_CHEVRON_RIGHT"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none"
|
||||
d="M 42.7172,1.7828 L 46.4343,5.5000 L 42.7172,9.2172 L 43.2828,9.7828 L 47.5657,5.5000 L 43.2828,1.2172 Z" /><path
|
||||
sodipodi:nodetypes="cccccccc"
|
||||
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.35133"
|
||||
d="m 26.009856,20.003745 4.57727,-4.589002 -3.55364,-0.03085 v -4.535978 l -2.07237,4e-6 v 4.535977 l -3.52987,0.03089 z"
|
||||
|
||||
|
Before Width: | Height: | Size: 172 KiB After Width: | Height: | Size: 172 KiB |
Reference in new issue
Block a user