mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-01 20:18:15 +01:00
Dialog screens (tabbed, two-pane, simple and the others built on UIBaseDialogScreen) center their content at up to 1400 wide, instead of stretching settings rows and buttons across very wide windows. On large screens, those screens and the main screen also get an inset on all sides, since controls right at the edge are hard to see there. It grows with the screen's smaller dimension, from nothing at 600 to the full inset at 1000, and is always full on TVs. The game, popups, and the screens that position things to match the game's screen (display layout, touch control layout and tests, custom button and visual mapping) are left as they were. The root's bounds are computed by UIScreen::GetContentBounds, since UI::Margins can't hold widths this large. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
71 lines
2.3 KiB
C++
71 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <functional>
|
|
|
|
#include "Common/UI/Context.h"
|
|
#include "Common/Input/InputState.h"
|
|
#include "Common/UI/Screen.h"
|
|
|
|
namespace UI {
|
|
|
|
struct Margins;
|
|
enum class FocusFlags;
|
|
enum class FocusMove;
|
|
|
|
// The ONLY global is the currently focused item.
|
|
// Can be and often is null.
|
|
void EnableFocusMovement(bool enable);
|
|
bool IsFocusMovementEnabled();
|
|
View *GetFocusedView();
|
|
void SetFocusedView(View *view, FocusFlags cause, bool force = false);
|
|
// Scrolls the focused view into sight at the start of the next update, once it's been laid out.
|
|
// For focusing a view that was just created, since SetFocus doesn't scroll by itself.
|
|
void ScrollFocusedViewIntoView();
|
|
void RemoveQueuedEventsByEvent(Event *e);
|
|
void RemoveQueuedEventsByView(View * v);
|
|
|
|
void EventTriggered(Event *e, EventParams params);
|
|
DialogResult DispatchEvents();
|
|
|
|
class ViewGroup;
|
|
|
|
// Where Tab (FocusMove::NEXT) and Shift+Tab (FocusMove::PREV) move the focus to, wrapping around
|
|
// at the ends. See ViewGroup::CollectTabOrder for what counts as a stop and in what order.
|
|
// nullptr if there's nothing focusable at all. Exposed mainly so it can be tested directly.
|
|
View *FindTabOrderNeighbor(ViewGroup *root, View *focusedView, FocusMove direction);
|
|
|
|
void LayoutViewHierarchy(const UIContext &dc, const UI::Margins &rootMargins, UI::ViewGroup *root, ViewLayoutMode layoutMode, bool immersiveMode);
|
|
void LayoutViewHierarchy(const UIContext &dc, const Bounds &rootBounds, UI::ViewGroup *root);
|
|
DialogResult UpdateViewHierarchy(ViewGroup *root, bool canEnableFocusMovement = true);
|
|
|
|
enum class KeyEventResult {
|
|
IGNORE_KEY, // Don't let it be processed.
|
|
PASS_THROUGH, // Let it be processed, but return false.
|
|
ACCEPT, // Let it be processed, but return true.
|
|
};
|
|
|
|
KeyEventResult KeyEventToFocusMoves(const KeyInput &key);
|
|
|
|
bool KeyEvent(const KeyInput &key, ViewGroup *root);
|
|
void TouchEvent(const TouchInput &touch, ViewGroup *root);
|
|
void AxisEvent(const AxisInput &axis, ViewGroup *root);
|
|
|
|
enum class UISound {
|
|
SELECT = 0,
|
|
BACK,
|
|
CONFIRM,
|
|
TOGGLE_ON,
|
|
TOGGLE_OFF,
|
|
ACHIEVEMENT_UNLOCKED,
|
|
LEADERBOARD_SUBMITTED,
|
|
COUNT,
|
|
};
|
|
|
|
void SetSoundCallback(std::function<void(UISound)> func);
|
|
|
|
// This is only meant for actual UI navigation sound, not achievements.
|
|
// Call directly into the player for other UI effects.
|
|
void PlayUISound(UISound sound);
|
|
|
|
} // namespace UI
|