3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/client/gui/CardinalDirection.h"
7#include "mc/client/gui/DirtyFlag.h"
8#include "mc/client/gui/GameEventNotification.h"
9#include "mc/client/gui/controls/TextCharEventResult.h"
10#include "mc/client/gui/screens/ControlCollectionChange.h"
11#include "mc/client/gui/screens/GamepadCursorData.h"
12#include "mc/client/gui/screens/ScreenEvent.h"
13#include "mc/client/gui/screens/TextEditFocusedListener.h"
14#include "mc/deps/core/utility/NonOwnerPointer.h"
15#include "mc/deps/core/utility/pub_sub/Publisher.h"
16#include "mc/deps/core/utility/pub_sub/Subscription.h"
17#include "mc/deps/input/InputMode.h"
18#include "mc/deps/input/TextboxTextUpdateReason.h"
19#include "mc/deps/input/enums/ButtonState.h"
20#include "mc/deps/input/enums/DirectionId.h"
21#include "mc/deps/input/enums/FocusImpact.h"
22#include "mc/deps/input/enums/RawInputType.h"
52namespace Bedrock::PubSub::ThreadModel {
struct MultiThreaded; }
53namespace Json {
class Value; }
65 enum class DelayedCommandLocation :
int {
73 using Result = ::std::pair<::ui::DirtyFlag, bool>;
78 ::ll::TypedStorage<8, 64, ::std::function<::std::pair<::ui::DirtyFlag, bool>()>> mAction;
79 ::ll::TypedStorage<4, 4, ::ScreenView::DelayedCommandLocation> location;
87 ::ll::TypedStorage<4, 4, int> mTouchId;
88 ::ll::TypedStorage<4, 8, ::glm::vec2> mPreviousPosition;
89 ::ll::TypedStorage<4, 8, ::glm::vec2> mCurrentPosition;
93 using clock_type = ::std::chrono::steady_clock;
95 using duration_sec = ::std::chrono::duration<float, ::std::ratio<1, 1>>;
100 ::ll::TypedStorage<4, 4, float> mLastTime;
101 ::ll::TypedStorage<4, 4, float> mTickTime;
102 ::ll::TypedStorage<8, 8, double> mLastRawJoystickEventTime;
103 ::ll::TypedStorage<4, 8, ::glm::vec2> mSize;
104 ::ll::TypedStorage<4, 4, int> mMenuUpButtonId;
105 ::ll::TypedStorage<4, 4, int> mMenuDownButtonId;
106 ::ll::TypedStorage<4, 4, int> mMenuLeftButtonId;
107 ::ll::TypedStorage<4, 4, int> mMenuRightButtonId;
108 ::ll::TypedStorage<4, 4, int> mMenuTabLeftButtonId;
109 ::ll::TypedStorage<4, 4, int> mMenuTabRightButtonId;
110 ::ll::TypedStorage<4, 8, ::std::array<uint, 2>> mPointerButtonIds;
111 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::ScreenController>> mController;
112 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::VisualTree>> mVisualTree;
113 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mAlwaysBindControls;
114 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mInputControls;
115 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mScrollViewControls;
116 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mOutOfModalScopeScrollViewControls;
117 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mAnimationControls;
118 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mFactoryControls;
119 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mTextEditBoxControls;
120 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mAlwaysListeningInputControls;
121 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mRenderableControls;
122 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mFlyingItemRendererControls;
123 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mSliderControls;
124 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mCustomRendererControls;
125 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mCustomFrameUpdateControls;
129 ::std::map<::std::vector<::std::shared_ptr<::UIControl>>*, ::std::vector<::std::shared_ptr<::UIControl>>>>
131 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScreenRenderBatch>> mRootRenderBatch;
132 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::UIAnimationController>> mAnimationController;
133 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint, ::std::vector<::std::weak_ptr<::UIControl>>>>
134 mReservedButtonUpEvents;
135 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mSelectedControl;
136 ::ll::TypedStorage<4, 4, ::InputMode> mInputMode;
137 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::LayoutManager>> mLayoutManager;
138 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::FocusManager>> mFocusManager;
139 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::ITTSEventManager>> mTTSEventManager;
140 ::ll::TypedStorage<1, 1, bool> mTextToSpeechEnabled;
141 ::ll::TypedStorage<8, 32, ::std::string> mTTSSectionHeader;
142 ::ll::TypedStorage<4, 4, float> mCurrentSliderValue;
143 ::ll::TypedStorage<1, 1, bool> mIsGUIScaleSlider;
144 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::ui::CardinalDirection>> mControllerStickDirections;
145 ::ll::TypedStorage<4, 4, int> mControllerLastMoved;
146 ::ll::TypedStorage<4, 4, int> mCursorTick;
147 ::ll::TypedStorage<4, 4, float const> mControllerXThreshold;
148 ::ll::TypedStorage<4, 4, float const> mControllerYThreshold;
149 ::ll::TypedStorage<4, 72, ::glm::vec2[9]> mControllerStickValues;
150 ::ll::TypedStorage<4, 8, ::GamepadCursorData> mGamepadCursorData;
151 ::ll::TypedStorage<4, 8, ::glm::vec2> mGamepadCursorPosition;
152 ::ll::TypedStorage<1, 1, bool> mHasSetInitialPosition;
153 ::ll::TypedStorage<1, 1, bool> mGamepadCursorFocusModeEnabled;
154 ::ll::TypedStorage<1, 1, bool> mGamepadCursorMagnetEnabled;
155 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mGamepadMagnetControl;
156 ::ll::TypedStorage<4, 4, float> mGamepadMoveTime;
157 ::ll::TypedStorage<4, 8, ::glm::vec2> mGamepadTrackedDirection;
158 ::ll::TypedStorage<1, 1, bool> mGamepadHasTapped;
159 ::ll::TypedStorage<4, 20, ::ScreenView::TouchPadData> mTouchPadData;
160 ::ll::TypedStorage<4, 8, ::glm::vec2> mPointerLocationPrevious;
161 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastPointInTime;
162 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mCurrentTime;
163 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mTimeAccumulator;
164 ::ll::TypedStorage<4, 4, ::std::chrono::duration<float, ::std::ratio<1, 1>>
const> mFixedAnimationUpdateRate;
165 ::ll::TypedStorage<4, 4, float> mKeyboardHeight;
166 ::ll::TypedStorage<1, 1, bool> mShouldShowKeyboard;
167 ::ll::TypedStorage<1, 1, bool> mInitKeyboard;
168 ::ll::TypedStorage<4, 4, float> mCurrentObfuscateTime;
169 ::ll::TypedStorage<8, 8, ::KeyboardManager&> mKeyboardManager;
170 ::ll::TypedStorage<8, 24, ::std::vector<::RectangleArea>> mInputAreas;
171 ::ll::TypedStorage<8, 8, ::UIMeasureStrategy&> mMeasureStrategy;
172 ::ll::TypedStorage<1, 1, bool> mCanMoveFocus;
173 ::ll::TypedStorage<1, 1, ::FocusImpact> mNextFocusAction;
174 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::UIControlFactory>> mControlFactory;
175 ::ll::TypedStorage<8, 40, ::std::queue<::ScreenEvent, ::std::deque<::ScreenEvent>>> mAnimationEvents;
176 ::ll::TypedStorage<8, 40, ::std::queue<::ScreenEvent, ::std::deque<::ScreenEvent>>> mCustomRendererEvents;
177 ::ll::TypedStorage<4, 8, ::glm::vec2> mStartLocation;
178 ::ll::TypedStorage<4, 4, float> mTimeUntilNextPointerHeldEvent;
179 ::ll::TypedStorage<4, 4, float> mDelayBetweenEachPointerHeldEvent;
180 ::ll::TypedStorage<1, 1, bool> mShouldSendPointerHeldEvents;
181 ::ll::TypedStorage<8, 24, ::std::vector<::ScreenView::DelayedCommand>> mDelayedCommands;
182 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScreenViewProxy>> mProxy;
183 ::ll::TypedStorage<8, 40, ::std::queue<::std::string, ::std::deque<::std::string>>> mQueuedTextChange;
184 ::ll::TypedStorage<1, 1, bool> mIsExiting;
185 ::ll::TypedStorage<1, 1, bool> mIsEntering;
186 ::ll::TypedStorage<1, 1, bool> mIsInitialized;
187 ::ll::TypedStorage<1, 1, bool> mHasFocus;
188 ::ll::TypedStorage<1, 1, bool> mHasHadFocus;
189 ::ll::TypedStorage<1, 1, bool> mIsTerminating;
190 ::ll::TypedStorage<1, 1, bool> mDirectionalButtonWasPressed;
191 ::ll::TypedStorage<1, 1, bool> mDelayedFocusRefresh;
192 ::ll::TypedStorage<1, 1, ::TextEditFocusedListener> mTextEditFocusedListener;
193 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::ScreenLoadTimeTracker>> mScreenLoadTimeTracker;
194 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mFocusChangeSub;
199 ScreenView& operator=(ScreenView
const&);
200 ScreenView(ScreenView
const&);
207 ::KeyboardManager& keyboardManager,
208 ::std::shared_ptr<::ScreenController> controller,
209 ::std::unique_ptr<::VisualTree> visualTree,
210 ::std::shared_ptr<::UIControlFactory> controlFactory,
211 ::UIMeasureStrategy& measureStrategy,
212 ::std::unique_ptr<::LayoutManager> layoutManager,
213 ::GamepadCursorData gamepadCursorData,
214 ::std::weak_ptr<::ITTSEventManager> ttsEventManager
217 MCAPI
void _adjustScrollToControl(::UIControl& control);
220 _adjustScrollToFocusedControl(::UIControl& focusedControl,
bool selectNearestControl,
bool isRightStickScrolling);
222 MCAPI
void _advanceToNextTab(
bool right);
224 MCAPI
void _bindData(
bool doAllBinds);
227 _changeInputControlCollection(::UIControl& control, ::ControlCollectionChange change,
bool const isRemoveCallback);
229 MCAPI
void _debugRenderControl(::UIRenderContext& context, ::UIControl
const& control)
const;
231 MCAPI
void _debugRenderFocusControl(
232 ::UIRenderContext& context,
233 ::UIControl
const& control,
234 ::std::vector<::UIControl const*>& visited
237 MCAPI
void _deselectControl(
bool forceDeselect,
bool hoverAfterDeselect);
239 MCAPI
void _executeDelayedCommands(::ScreenView::DelayedCommandLocation location);
241 MCAPI
void _fireSelectedStateChangeEvent(::TextEditComponent
const& textEditComponent,
bool state);
243 MCAPI
void _fireTextChangedEvent(
245 ::TextCharEventResult result,
248 ::UIPropertyBag* propertyBag
251 MCAPI
void _focusChangeCallback(
252 ::std::weak_ptr<::UIControl> previousFocusControl,
253 ::std::weak_ptr<::UIControl> currentFocusControl
256 MCAPI
void _forwardEventToAnimationControls(::ScreenEvent
const& screenEvent);
258 MCAPI ::std::shared_ptr<::UIControl> _getGamepadCursorFocusedControl()
const;
260 MCAPI ::ScreenSettings
const* _getScreenComponent()
const;
262 MCAPI
void _handleDirtyVisualTree(
bool overrideFocusControl,
bool doAllBinds);
264 MCAPI
void _handlePointerLocation(
265 ::glm::vec2
const& position,
266 ::FocusImpact focusImpact,
267 bool forceHandleWhenMotionless,
268 bool isRightStickScrolling
271 MCAPI
void _handleSliderMovement();
273 MCAPI
void _handleStickScrolling(::DirectionId directionId);
275 MCAPI
void _passViewCommand();
277 MCAPI
void _processControllerCursorMove(::DirectionId directionId);
279 MCAPI
void _processControllerDirection(::DirectionId directionId);
281 MCAPI
void _processEvents(::ScreenInputContext& context);
283 MCAPI
void _queueTextToSpeechIfEnabled(
284 ::std::shared_ptr<::UIControl> focusedControl,
285 bool excludeControlHeader,
286 bool notInterruptible
289 MCAPI
void _queueTextToSpeechTextboxCharacter(::std::string
const& inputStr);
291 MCAPI
void _resetButtonState(::UIControl& control);
293 MCAPI
void _resetFocusedControl();
296 _resetInputControl(::UIControl& control, ::InputComponent*
const inputComponent,
bool const handleModalChange);
298 MCAPI
void _scrollToGridItem(::UIControl* gridControl,
int itemIndex,
int numItems);
300 MCAPI
void _selectControl(::UIControl& control,
bool isHandlingTextChar);
302 MCAPI
void _selectNextFocusObject(
303 ::ui::CardinalDirection direction,
305 ::glm::vec2
const overridePos,
306 bool isRightStickScrolling
309 MCAPI
void _sendScrollEvent(::UIControl& parent,
float delta)
const;
311 MCAPI
void _setGamepadCursorFocusMode(
bool focusModeEnabled);
313 MCAPI
void _setKeyboardHeight(
float height);
315 MCAPI
void _setupControlFactoryCallbacks();
317 MCAPI
void _switchTabToTargetIndex(::std::vector<::std::shared_ptr<::UIControl>>& tabControls,
int targetIndex);
319 MCAPI
bool _updateControlCollections(
bool overrideFocusControl);
322 _updateFocusControl(
bool forceUpdate,
bool forceFocusToAdjust,
bool isRightStickScrolling,
bool isHandlingTextChar);
324 MCAPI
void _updateInputAreas();
326 MCAPI
void _updateKeyboardVisibility();
328 MCAPI
void cleanInputComponents();
330 MCAPI
bool containsScreenNameSubstring(::std::string_view substring)
const;
332 MCAPI
bool equalsScreenName(::std::string_view comparison)
const;
334 MCAPI
void frameUpdate(::UIFrameUpdateContext& uiFrameUpdateContext);
336 MCAPI ::RectangleArea getAreaOfControlByName(::std::string
const& controlName)
const;
338 MCAPI ::std::vector<::RectangleArea> getInputAreas()
const;
340 MCAPI ::std::string getRawScreenName()
const;
342 MCAPI ::std::string getRoute()
const;
344 MCAPI ::std::string getScreenName()
const;
346 MCAPI ::std::string getScreenTelemetryName()
const;
348 MCAPI
void handleButtonEvent(uint buttonId, ::ButtonState buttonState, ::FocusImpact focusImpact);
350 MCAPI
void handleDirection(::DirectionId directionId,
float x,
float y, ::FocusImpact focusImpact);
352 MCAPI
void handleInputModeChanged(::InputMode inputMode);
355 handlePointerLocation(::glm::vec2
const& position,
bool forceMotionlessPointer, ::FocusImpact focusImpact);
357 MCAPI
void handleRawInputEvent(
int id, ::RawInputType keyType, ::ButtonState state,
bool allowRemapping);
359 MCAPI
void handleTouchPadTouch(::TouchPadTouchEventData
const& touchEventData, ::FocusImpact focusImpact);
361 MCAPI
bool isGamepadDeflectionModeEnabled()
const;
363 MCAPI
void onDelete(::CachedScenes& cache, ::TaskGroup& taskGroup);
365 MCAPI
void onFocusGained();
367 MCAPI
void onFocusLost();
369 MCAPI
void onGameEventNotification(::ui::GameEventNotification notification);
371 MCAPI
void onLeave();
373 MCAPI
void onScreenEntrance(
bool isRevisiting,
bool doScreenTransitions);
375 MCAPI
void onScreenExit(
bool isPopping,
bool doScreenTransitions, ::std::shared_ptr<::AbstractScene> pushedScene);
377 MCAPI
void reload(::Json::Value
const& globalVars);
379 MCAPI
void render(::UIRenderContext& uiRenderContext);
383 MCAPI
void setInitialized();
385 MCAPI
void setScreenLoadTimeTracker(::Bedrock::NonOwnerPointer<::ScreenLoadTimeTracker> tracker);
387 MCAPI
void setShouldSendEvents(
bool shouldSendEvents);
389 MCAPI
void setTextboxText(::std::string
const& text, ::TextboxTextUpdateReason reason);
397 MCAPI
static bool _isFocusEnabled(::std::shared_ptr<::UIControl>
const& control);
399 MCAPI
static bool _isFocusMagnetEnabled(::std::shared_ptr<::UIControl>
const& control);
401 MCAPI
static bool _shouldBindChildren(
bool doAllBinds, ::UIControl& control, ::DataBindingComponent& dataBinding);
407 MCAPI static ::Bedrock::PubSub::Publisher<void(), ::Bedrock::PubSub::ThreadModel::MultiThreaded, 0>&
408 mDebugChangePublisher();
410 MCAPI
static bool& sIsDebuggingFocus();
412 MCAPI
static bool& sRenderDebugControls();
419 ::KeyboardManager& keyboardManager,
420 ::std::shared_ptr<::ScreenController> controller,
421 ::std::unique_ptr<::VisualTree> visualTree,
422 ::std::shared_ptr<::UIControlFactory> controlFactory,
423 ::UIMeasureStrategy& measureStrategy,
424 ::std::unique_ptr<::LayoutManager> layoutManager,
425 ::GamepadCursorData gamepadCursorData,
426 ::std::weak_ptr<::ITTSEventManager> ttsEventManager
Definition AbstractScene.h:5
Definition CachedScenes.h:5
Definition DataBindingComponent.h:5
Definition FocusManager.h:5
Definition ITTSEventManager.h:5
Definition KeyboardManager.h:5
Definition LayoutManager.h:5
Definition RectangleArea.h:5
Definition ScreenController.h:5
Definition ScreenInputContext.h:5
Definition ScreenLoadTimeTracker.h:5
Definition ScreenRenderBatch.h:5
Definition ScreenSettings.h:5
Definition ScreenViewProxy.h:5
Definition ScreenView.h:5
Definition TaskGroup.h:61
Definition TextEditComponent.h:5
Definition UIAnimationController.h:5
Definition UIControlFactory.h:5
Definition UIFrameUpdateContext.h:5
Definition UIMeasureStrategy.h:5
Definition UIPropertyBag.h:5
Definition UIRenderContext.h:5
Definition VisualTree.h:5
Definition MultiThreaded.h:7
Definition ScreenView.h:18
Definition ScreenView.h:16
Definition TouchPadTouchEventData.h:5