LeviLamina
Loading...
Searching...
No Matches
ScreenView.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
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/ControlCollectionFlag.h"
12#include "mc/client/gui/screens/GamepadCursorData.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/Subscription.h"
16#include "mc/deps/input/InputMode.h"
17#include "mc/deps/input/TextboxTextUpdateReason.h"
18#include "mc/deps/input/enums/ButtonState.h"
19#include "mc/deps/input/enums/DirectionId.h"
20#include "mc/deps/input/enums/FocusImpact.h"
21
22// auto generated forward declare list
23// clang-format off
24class AbstractScene;
25class KeyboardManager;
26class RectangleArea;
27class ScreenController;
28class ScreenViewProxy;
29class UIControl;
31class UIPropertyBag;
32class UIRenderContext;
34struct FocusComponent;
35struct FocusManager;
36struct ITTSEventManager;
37struct LayoutManager;
38struct ScreenEvent;
42struct ScreenSettings;
43struct SliderComponent;
47struct UIControlFactory;
48struct VisualTree;
49namespace Json { class Value; }
50// clang-format on
51
52class ScreenView {
53public:
54 // ScreenView inner types declare
55 // clang-format off
56 struct DelayedCommand;
57 struct TouchPadData;
58 // clang-format on
59
60 // ScreenView inner types define
61 enum class DelayedCommandLocation : int {
62 DirtyVisualTree = 0,
63 PostLayout = 1,
64 };
65
67 public:
68 // member variables
69 // NOLINTBEGIN
72 // NOLINTEND
73
74 public:
75 // prevent constructor by default
76 DelayedCommand& operator=(DelayedCommand const&);
79
80 public:
81 // member functions
82 // NOLINTBEGIN
84 // NOLINTEND
85
86 public:
87 // destructor thunk
88 // NOLINTBEGIN
89 MCNAPI void $dtor();
90 // NOLINTEND
91 };
92
93 struct TouchPadData {
94 public:
95 // member variables
96 // NOLINTBEGIN
100 // NOLINTEND
101
102 public:
103 // prevent constructor by default
104 TouchPadData& operator=(TouchPadData const&);
106 TouchPadData();
107 };
108
109 using clock_type = ::std::chrono::steady_clock;
110
111 using duration_sec = ::std::chrono::duration<float, ::std::ratio<1, 1>>;
112
113public:
114 // member variables
115 // NOLINTBEGIN
116 ::ll::TypedStorage<4, 4, float> mLastTime;
117 ::ll::TypedStorage<4, 4, float> mTickTime;
118 ::ll::TypedStorage<8, 8, double> mLastRawJoystickEventTime;
119 ::ll::TypedStorage<4, 8, ::glm::vec2> mSize;
120 ::ll::TypedStorage<4, 4, int> mMenuUpButtonId;
121 ::ll::TypedStorage<4, 4, int> mMenuDownButtonId;
122 ::ll::TypedStorage<4, 4, int> mMenuLeftButtonId;
123 ::ll::TypedStorage<4, 4, int> mMenuRightButtonId;
124 ::ll::TypedStorage<4, 4, int> mMenuTabLeftButtonId;
125 ::ll::TypedStorage<4, 4, int> mMenuTabRightButtonId;
126 ::ll::TypedStorage<4, 8, ::std::array<uint, 2>> mPointerButtonIds;
127 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::ScreenController>> mController;
128 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::VisualTree>> mVisualTree;
129 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mAlwaysBindControls;
130 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mInputControls;
131 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mScrollViewControls;
132 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mOutOfModalScopeScrollViewControls;
133 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mAnimationControls;
134 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mFactoryControls;
135 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mTextEditBoxControls;
136 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mAlwaysListeningInputControls;
137 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mRenderableControls;
138 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mFlyingItemRendererControls;
139 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mSliderControls;
140 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mCustomRendererControls;
141 ::ll::TypedStorage<
142 8,
143 16,
144 ::std::map<::std::vector<::std::shared_ptr<::UIControl>>*, ::std::vector<::std::shared_ptr<::UIControl>>>>
145 mControlsToRemove;
146 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScreenRenderBatch>> mRootRenderBatch;
147 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::UIAnimationController>> mAnimationController;
148 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint, ::std::vector<::std::weak_ptr<::UIControl>>>>
149 mReservedButtonUpEvents;
150 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mSelectedControl;
151 ::ll::TypedStorage<4, 4, ::InputMode> mInputMode;
152 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::LayoutManager>> mLayoutManager;
153 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::FocusManager>> mFocusManager;
154 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::ITTSEventManager>> mTTSEventManager;
155 ::ll::TypedStorage<1, 1, bool> mTextToSpeechEnabled;
156 ::ll::TypedStorage<8, 32, ::std::string> mTTSSectionHeader;
157 ::ll::TypedStorage<4, 4, float> mCurrentSliderValue;
158 ::ll::TypedStorage<1, 1, bool> mIsGUIScaleSlider;
159 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::ui::CardinalDirection>> mControllerStickDirections;
160 ::ll::TypedStorage<4, 4, int> mControllerLastMoved;
161 ::ll::TypedStorage<4, 4, int> mCursorTick;
162 ::ll::TypedStorage<4, 4, float const> mControllerXThreshold;
163 ::ll::TypedStorage<4, 4, float const> mControllerYThreshold;
164 ::ll::TypedStorage<4, 64, ::glm::vec2[8]> mControllerStickValues;
165 ::ll::TypedStorage<4, 8, ::GamepadCursorData> mGamepadCursorData;
166 ::ll::TypedStorage<4, 8, ::glm::vec2> mGamepadCursorPosition;
167 ::ll::TypedStorage<1, 1, bool> mHasSetInitialPosition;
168 ::ll::TypedStorage<1, 1, bool> mGamepadCursorFocusModeEnabled;
169 ::ll::TypedStorage<1, 1, bool> mGamepadCursorMagnetEnabled;
170 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mGamepadMagnetControl;
171 ::ll::TypedStorage<4, 4, float> mGamepadMoveTime;
172 ::ll::TypedStorage<4, 8, ::glm::vec2> mGamepadTrackedDirection;
173 ::ll::TypedStorage<1, 1, bool> mGamepadHasTapped;
174 ::ll::TypedStorage<4, 20, ::ScreenView::TouchPadData> mTouchPadData;
175 ::ll::TypedStorage<4, 8, ::glm::vec2> mPointerLocationPrevious;
176 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastPointInTime;
177 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mCurrentTime;
178 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mTimeAccumulator;
179 ::ll::TypedStorage<4, 4, ::std::chrono::duration<float, ::std::ratio<1, 1>> const> mFixedAnimationUpdateRate;
180 ::ll::TypedStorage<4, 4, float> mKeyboardHeight;
181 ::ll::TypedStorage<1, 1, bool> mShouldShowKeyboard;
182 ::ll::TypedStorage<1, 1, bool> mInitKeyboard;
183 ::ll::TypedStorage<4, 4, float> mCurrentObfuscateTime;
184 ::ll::TypedStorage<8, 8, ::KeyboardManager&> mKeyboardManager;
185 ::ll::TypedStorage<8, 24, ::std::vector<::RectangleArea>> mInputAreas;
186 ::ll::TypedStorage<8, 8, ::UIMeasureStrategy&> mMeasureStrategy;
187 ::ll::TypedStorage<1, 1, bool> mCanMoveFocus;
188 ::ll::TypedStorage<1, 1, ::FocusImpact> mNextFocusAction;
189 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::UIControlFactory>> mControlFactory;
190 ::ll::TypedStorage<8, 40, ::std::queue<::ScreenEvent, ::std::deque<::ScreenEvent>>> mAnimationEvents;
191 ::ll::TypedStorage<8, 40, ::std::queue<::ScreenEvent, ::std::deque<::ScreenEvent>>> mCustomRendererEvents;
192 ::ll::TypedStorage<4, 8, ::glm::vec2> mStartLocation;
193 ::ll::TypedStorage<4, 4, float> mTimeUntilNextPointerHeldEvent;
194 ::ll::TypedStorage<4, 4, float> mDelayBetweenEachPointerHeldEvent;
195 ::ll::TypedStorage<1, 1, bool> mShouldSendPointerHeldEvents;
196 ::ll::TypedStorage<8, 24, ::std::vector<::ScreenView::DelayedCommand>> mDelayedCommands;
197 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScreenViewProxy>> mProxy;
198 ::ll::TypedStorage<1, 1, bool> mIsExiting;
199 ::ll::TypedStorage<1, 1, bool> mIsEntering;
200 ::ll::TypedStorage<1, 1, bool> mIsInitialized;
201 ::ll::TypedStorage<1, 1, bool> mHasFocus;
202 ::ll::TypedStorage<1, 1, bool> mHasHadFocus;
203 ::ll::TypedStorage<1, 1, bool> mIsTerminating;
204 ::ll::TypedStorage<1, 1, bool> mDirectionalButtonWasPressed;
205 ::ll::TypedStorage<1, 1, bool> mDelayedFocusRefresh;
206 ::ll::TypedStorage<1, 1, ::TextEditFocusedListener> mTextEditFocusedListener;
207 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::ScreenLoadTimeTracker>> mScreenLoadTimeTracker;
208 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mFocusChangeSub;
209 // NOLINTEND
210
211public:
212 // prevent constructor by default
213 ScreenView& operator=(ScreenView const&);
214 ScreenView(ScreenView const&);
215 ScreenView();
216
217public:
218 // member functions
219 // NOLINTBEGIN
220 MCAPI ScreenView(
221 ::KeyboardManager& keyboardManager,
222 ::std::shared_ptr<::ScreenController> controller,
223 ::std::unique_ptr<::VisualTree> visualTree,
224 ::std::shared_ptr<::UIControlFactory> controlFactory,
225 ::UIMeasureStrategy& measureStrategy,
226 ::std::unique_ptr<::LayoutManager> layoutManager,
227 ::GamepadCursorData gamepadCursorData,
228 ::std::weak_ptr<::ITTSEventManager> ttsEventManager
229 );
230
231 MCAPI void _addToControlCollection(::UIControl& control, ::ControlCollectionFlag flag);
232
233 MCAPI void _adjustFocusedControlToScrollRegion(bool isRightStickScrolling);
234
235 MCAPI void _adjustScrollToControl(::UIControl& control);
236
237 MCAPI void
238 _adjustScrollToFocusedControl(::UIControl& focusedControl, bool selectNearestControl, bool isRightStickScrolling);
239
240 MCAPI void _adjustScrollToIncludePosition(
241 ::UIControl& parent,
242 ::glm::vec2 position,
243 ::glm::vec2 size,
244 bool isRightStickScrolling
245 );
246
247 MCAPI void _adjustScrollToTopPosition();
248
249 MCAPI void _advanceToNextToggleInNavigationTabGroup(bool right);
250
251 MCAPI void _bindData(bool doAllBinds);
252
253 MCAPI void
254 _changeInputControlCollection(::UIControl& control, ::ControlCollectionChange change, bool isRemoveCallback);
255
256 MCAPI void _clearTTSQueue();
257
258 MCAPI void _consumeFocusImpact(::FocusImpact focusImpact);
259
260 MCAPI void _debugRenderControl(::UIRenderContext& context, ::UIControl const& control) const;
261
262 MCAPI void _debugRenderFocusControl(
263 ::UIRenderContext& context,
264 ::UIControl const& control,
265 ::std::vector<::UIControl const*>& visited
266 ) const;
267
268 MCAPI void _deselectControl(bool forceDeselect, bool hoverAfterDeselect);
269
270 MCAPI void _executeDelayedCommands(::ScreenView::DelayedCommandLocation location);
271
272 MCAPI void _findAndSetFocusOnFocusableControlNotClippedVertical(
273 ::std::shared_ptr<::UIControl> rootControl,
274 bool searchUpwards,
275 bool isRightScrolling
276 );
277
278 MCAPI void _fireSelectedStateChangeEvent(::TextEditComponent const& textEditComponent, bool state);
279
280 MCAPI void _fireTextChangedEvent(
281 bool finished,
282 ::TextCharEventResult result,
283 uint id,
284 int index,
285 ::UIPropertyBag* propertyBag
286 );
287
288 MCAPI void _fireTextChangedEventTextEditControl(
289 ::TextEditComponent const& textEditComponent,
290 bool finished,
291 ::TextCharEventResult result
292 );
293
294 MCAPI void _focusChangeCallback(
295 ::std::weak_ptr<::UIControl> previousFocusControl,
296 ::std::weak_ptr<::UIControl> currentFocusControl
297 );
298
299 MCAPI void _focusControl(::UIControl& control);
300
301 MCAPI void _forwardEventToAnimationControls(::ScreenEvent const& screenEvent);
302
303 MCAPI ::std::shared_ptr<::UIControl> _getGamepadCursorFocusedControl() const;
304
305 MCAPI ::ScreenSettings const* _getScreenComponent() const;
306
307 MCAPI void _handleDirtyVisualTree(bool overrideFocusControl, bool doAllBinds);
308
309 MCAPI void _handlePointerLocation(
310 ::glm::vec2 const& position,
311 ::FocusImpact focusImpact,
312 bool forceHandleWhenMotionless,
313 bool isRightStickScrolling
314 );
315
316 MCAPI bool _handleScreenViewRefresh();
317
318 MCAPI void _handleSliderMovement();
319
320 MCAPI void _handleStickScrolling(::DirectionId directionId);
321
322 MCAPI void
323 _handleTTSOnSliderMovement(::SliderComponent* sliderComponent, ::std::shared_ptr<::UIControl>& focusedControl);
324
325 MCAPI bool _hasAnimationWithPlayAndEndEventId(uint playEventId, uint endEventId) const;
326
327 MCAPI bool _hasVisibleAnimationWithEndEventId(uint id) const;
328
329 MCAPI bool _isFocusable(::FocusComponent const& focus) const;
330
331 MCAPI bool _isTouchTTSEnabled() const;
332
333 MCAPI bool _notifyLayoutChange();
334
335 MCAPI void _passViewCommand();
336
337 MCAPI void _prepResevedButtonUpLists(::ScreenInputContext& context);
338
339 MCAPI void _processControllerCursorMove(::DirectionId directionId);
340
341 MCAPI void _processControllerDirection(::DirectionId directionId);
342
343 MCAPI void _processControllerFocusChange(::DirectionId directionId);
344
345 MCAPI void _processEvents(::ScreenInputContext& context);
346
347 MCAPI void _queueTextToSpeechIfEnabled(
348 ::std::shared_ptr<::UIControl> focusedControl,
349 bool excludeControlHeader,
350 bool notInterruptible
351 );
352
353 MCAPI void _queueTextToSpeechTextboxCharacter(::std::string const& inputStr);
354
355 MCAPI void _removeFromControlCollection(::UIControl& control, ::ControlCollectionFlag flag);
356
357 MCAPI void _renderBatches(::UIRenderContext& context, ::ScreenRenderBatch& screenRenderBatch, float deltaTime);
358
359 MCAPI void _resetFocusedControl();
360
361 MCAPI void _scrollToGridItem(::UIControl* gridControl, int itemIndex, int numItems);
362
363 MCAPI void _selectControl(::UIControl& control, bool isHandlingTextChar);
364
365 MCAPI void _selectNextFocusObject(
366 ::ui::CardinalDirection direction,
367 bool overrideOrigin,
368 ::glm::vec2 overridePos,
369 bool isRightStickScrolling
370 );
371
372 MCAPI void _sendScrollEvent(::UIControl& parent, float delta) const;
373
374 MCAPI void _setGamepadCursorFocusMode(bool focusModeEnabled);
375
376 MCAPI void _setKeyboardHeight(float height);
377
378 MCAPI void _setupControlFactoryCallbacks();
379
380 MCAPI void _switchTabToTargetIndex(::std::vector<::std::shared_ptr<::UIControl>>& tabControls, int targetIndex);
381
382 MCAPI void _update();
383
384 MCAPI bool _updateControlCollections(bool overrideFocusControl);
385
386 MCAPI void
387 _updateFocusControl(bool forceUpdate, bool forceFocusToAdjust, bool isRightStickScrolling, bool isHandlingTextChar);
388
389 MCAPI void _updateInputAreas();
390
391 MCAPI void _updateKeyboardVisibility();
392
393 MCAPI bool _updateSelectedControl(::ScreenInputContext& context, uint buttonId, ::ButtonState buttonState);
394
395 MCAPI void cleanInputComponents();
396
397 MCAPI ::std::string getRoute() const;
398
399 MCAPI ::std::string getScreenName() const;
400
401 MCAPI ::std::string getScreenTelemetryName() const;
402
403 MCAPI void handleButtonEvent(uint buttonId, ::ButtonState buttonState, ::FocusImpact focusImpact);
404
405 MCAPI void handleControlEvent(::ScreenEvent screenEvent);
406
407 MCAPI void handleDirection(::DirectionId directionId, float x, float y, ::FocusImpact focusImpact);
408
409 MCAPI void handleInputModeChanged(::InputMode inputMode);
410
411 MCAPI bool
412 handlePointerLocation(::glm::vec2 const& position, bool forceMotionlessPointer, ::FocusImpact focusImpact);
413
414 MCAPI void handleTextChar(::std::string const& inputUtf8, bool keepImePosition, ::FocusImpact focusImpact);
415
416 MCAPI void handleTouchPadTouch(::TouchPadTouchEventData const& touchEventData, ::FocusImpact focusImpact);
417
418 MCAPI bool isGamepadDeflectionModeEnabled() const;
419
420 MCAPI void onFocusGained();
421
422 MCAPI void onGameEventNotification(::ui::GameEventNotification notification);
423
424 MCAPI void onScreenEntrance(bool isRevisiting, bool doScreenTransitions);
425
426 MCAPI void onScreenExit(bool isPopping, bool doScreenTransitions, ::std::shared_ptr<::AbstractScene> pushedScene);
427
428 MCAPI void reload(::Json::Value const& globalVars);
429
430 MCAPI void render(::UIRenderContext& uiRenderContext);
431
432 MCAPI void resize();
433
434 MCAPI void setInitialized();
435
436 MCAPI void setScreenLoadTimeTracker(::Bedrock::NonOwnerPointer<::ScreenLoadTimeTracker> tracker);
437
438 MCAPI void setTextboxText(::std::string const& text, ::TextboxTextUpdateReason reason);
439
440 MCAPI ~ScreenView();
441 // NOLINTEND
442
443public:
444 // static functions
445 // NOLINTBEGIN
446 MCAPI static bool _shouldBindChildren(bool doAllBinds, ::UIControl& control, ::DataBindingComponent& dataBinding);
447 // NOLINTEND
448
449public:
450 // static variables
451 // NOLINTBEGIN
452 MCAPI static bool& sIsDebuggingFocus();
453
454 MCAPI static bool& sRenderDebugControls();
455 // NOLINTEND
456
457public:
458 // constructor thunks
459 // NOLINTBEGIN
460 MCAPI void* $ctor(
461 ::KeyboardManager& keyboardManager,
462 ::std::shared_ptr<::ScreenController> controller,
463 ::std::unique_ptr<::VisualTree> visualTree,
464 ::std::shared_ptr<::UIControlFactory> controlFactory,
465 ::UIMeasureStrategy& measureStrategy,
466 ::std::unique_ptr<::LayoutManager> layoutManager,
467 ::GamepadCursorData gamepadCursorData,
468 ::std::weak_ptr<::ITTSEventManager> ttsEventManager
469 );
470 // NOLINTEND
471
472public:
473 // destructor thunk
474 // NOLINTBEGIN
475 MCAPI void $dtor();
476 // NOLINTEND
477};
Definition AbstractScene.h:5
Definition KeyboardManager.h:5
Definition ScreenViewProxy.h:5
Definition ScreenView.h:5
Definition UIControl.h:5
Definition UIMeasureStrategy.h:5
Definition UIRenderContext.h:5
Definition DataBindingComponent.h:5
Definition FocusComponent.h:5
Definition FocusManager.h:5
Definition GamepadCursorData.h:5
Definition ITTSEventManager.h:5
Definition LayoutManager.h:5
Definition ScreenInputContext.h:5
Definition ScreenLoadTimeTracker.h:5
Definition ScreenRenderBatch.h:5
Definition ScreenSettings.h:5
Definition ScreenView.h:66
Definition ScreenView.h:93
Definition SliderComponent.h:5
Definition TextEditComponent.h:5
Definition TouchPadTouchEventData.h:5
Definition UIAnimationController.h:5
Definition UIControlFactory.h:5
Definition VisualTree.h:5
Definition Alias.h:14