Skip to content
LeviMC
English
AutoLightDark
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/controls/TextCharEventResult.h"
9#include "mc/client/gui/screens/ControlCollectionChange.h"
10#include "mc/client/gui/screens/GamepadCursorData.h"
11#include "mc/client/gui/screens/ScreenEvent.h"
12#include "mc/client/gui/screens/TextEditFocusedListener.h"
13#include "mc/deps/core/utility/NonOwnerPointer.h"
14#include "mc/deps/core/utility/pub_sub/Publisher.h"
15#include "mc/deps/core/utility/pub_sub/Subscription.h"
16#include "mc/deps/input/InputMode.h"
17#include "mc/deps/input/enums/ButtonState.h"
18#include "mc/deps/input/enums/DirectionId.h"
19#include "mc/deps/input/enums/FocusImpact.h"
20
21// auto generated forward declare list
22// clang-format off
24class FocusManager;
26class InputComponent;
27class KeyboardManager;
28class LayoutManager;
29class RectangleArea;
34class ScreenSettings;
35class ScreenViewProxy;
38class UIControl;
41class UIPropertyBag;
42class UIRenderContext;
43class VisualTree;
44namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
45// clang-format on
46
47class ScreenView {
48public:
49 // ScreenView inner types declare
50 // clang-format off
51 struct DelayedCommand;
52 struct TouchPadData;
53 // clang-format on
54
55 // ScreenView inner types define
56 enum class DelayedCommandLocation : int {
57 DirtyVisualTree = 0,
58 PostLayout = 1,
59 };
60
61 struct DelayedCommand {
62 public:
63 // DelayedCommand inner types define
64 using Result = ::std::pair<::ui::DirtyFlag, bool>;
65
66 public:
67 // member variables
68 // NOLINTBEGIN
69 ::ll::TypedStorage<8, 64, ::std::function<::std::pair<::ui::DirtyFlag, bool>()>> mAction;
70 ::ll::TypedStorage<4, 4, ::ScreenView::DelayedCommandLocation> location;
71 // NOLINTEND
72 };
73
74 struct TouchPadData {
75 public:
76 // member variables
77 // NOLINTBEGIN
78 ::ll::TypedStorage<4, 4, int> mTouchId;
79 ::ll::TypedStorage<4, 8, ::glm::vec2> mPreviousPosition;
80 ::ll::TypedStorage<4, 8, ::glm::vec2> mCurrentPosition;
81 // NOLINTEND
82 };
83
84 using clock_type = ::std::chrono::steady_clock;
85
86 using duration_sec = ::std::chrono::duration<float, ::std::ratio<1, 1>>;
87
88public:
89 // member variables
90 // NOLINTBEGIN
91 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastTime;
92 ::ll::TypedStorage<4, 4, float> mTickTime;
93 ::ll::TypedStorage<8, 8, double> mLastRawJoystickEventTime;
94 ::ll::TypedStorage<4, 8, ::glm::vec2> mSize;
95 ::ll::TypedStorage<4, 4, int> mMenuUpButtonId;
96 ::ll::TypedStorage<4, 4, int> mMenuDownButtonId;
97 ::ll::TypedStorage<4, 4, int> mMenuLeftButtonId;
98 ::ll::TypedStorage<4, 4, int> mMenuRightButtonId;
99 ::ll::TypedStorage<4, 4, int> mMenuTabLeftButtonId;
100 ::ll::TypedStorage<4, 4, int> mMenuTabRightButtonId;
101 ::ll::TypedStorage<4, 8, ::std::array<uint, 2>> mPointerButtonIds;
102 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::ScreenController>> mController;
103 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::VisualTree>> mVisualTree;
104 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mAlwaysBindControls;
105 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mInputControls;
106 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mScrollViewControls;
107 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mOutOfModalScopeScrollViewControls;
108 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mAnimationControls;
109 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mFactoryControls;
110 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mTextEditBoxControls;
111 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mAlwaysListeningInputControls;
112 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mRenderableControls;
113 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mFlyingItemRendererControls;
114 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mSliderControls;
115 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mCustomRendererControls;
116 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mCustomFrameUpdateControls;
117 ::ll::TypedStorage<
118 8,
119 16,
120 ::std::map<::std::vector<::std::shared_ptr<::UIControl>>*, ::std::vector<::std::shared_ptr<::UIControl>>>>
121 mControlsToRemove;
122 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScreenRenderBatch>> mRootRenderBatch;
123 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::UIAnimationController>> mAnimationController;
124 ::ll::TypedStorage<8, 64, ::std::unordered_map<uint, ::std::vector<::std::weak_ptr<::UIControl>>>>
125 mReservedButtonUpEvents;
126 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mSelectedControl;
127 ::ll::TypedStorage<4, 4, ::InputMode> mInputMode;
128 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::LayoutManager>> mLayoutManager;
129 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::FocusManager>> mFocusManager;
130 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::ITTSEventManager>> mTTSEventManager;
131 ::ll::TypedStorage<1, 1, bool> mTextToSpeechEnabled;
132 ::ll::TypedStorage<8, 32, ::std::string> mTTSSectionHeader;
133 ::ll::TypedStorage<4, 4, float> mCurrentSliderValue;
134 ::ll::TypedStorage<1, 1, bool> mIsGUIScaleSlider;
135 ::ll::TypedStorage<8, 64, ::std::unordered_map<int, ::ui::CardinalDirection>> mControllerStickDirections;
136 ::ll::TypedStorage<4, 4, int> mControllerLastMoved;
137 ::ll::TypedStorage<4, 4, int> mCursorTick;
138 ::ll::TypedStorage<4, 4, float const> mControllerXThreshold;
139 ::ll::TypedStorage<4, 4, float const> mControllerYThreshold;
140 ::ll::TypedStorage<4, 72, ::glm::vec2[9]> mControllerStickValues;
141 ::ll::TypedStorage<4, 8, ::GamepadCursorData> mGamepadCursorData;
142 ::ll::TypedStorage<4, 8, ::glm::vec2> mGamepadCursorPosition;
143 ::ll::TypedStorage<1, 1, bool> mHasSetInitialPosition;
144 ::ll::TypedStorage<1, 1, bool> mGamepadCursorFocusModeEnabled;
145 ::ll::TypedStorage<1, 1, bool> mGamepadCursorMagnetEnabled;
146 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mGamepadMagnetControl;
147 ::ll::TypedStorage<4, 4, float> mGamepadMoveTime;
148 ::ll::TypedStorage<4, 8, ::glm::vec2> mGamepadTrackedDirection;
149 ::ll::TypedStorage<1, 1, bool> mGamepadHasTapped;
150 ::ll::TypedStorage<4, 20, ::ScreenView::TouchPadData> mTouchPadData;
151 ::ll::TypedStorage<4, 8, ::glm::vec2> mPointerLocationPrevious;
152 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastPointInTime;
153 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mCurrentTime;
154 ::ll::TypedStorage<8, 8, ::std::chrono::nanoseconds> mTimeAccumulator;
155 ::ll::TypedStorage<8, 16, ::std::optional<::std::chrono::steady_clock::time_point>> mScreenEntranceTime;
156 ::ll::TypedStorage<8, 16, ::std::optional<::std::chrono::nanoseconds>> mTimeToFirstRender;
157 ::ll::TypedStorage<4, 4, ::std::chrono::duration<float, ::std::ratio<1, 1>> const> mFixedAnimationUpdateRate;
158 ::ll::TypedStorage<4, 4, float> mKeyboardHeight;
159 ::ll::TypedStorage<1, 1, bool> mShouldShowKeyboard;
160 ::ll::TypedStorage<1, 1, bool> mInitKeyboard;
161 ::ll::TypedStorage<4, 4, float> mCurrentObfuscateTime;
162 ::ll::TypedStorage<8, 8, ::KeyboardManager&> mKeyboardManager;
163 ::ll::TypedStorage<8, 24, ::std::vector<::RectangleArea>> mInputAreas;
164 ::ll::TypedStorage<8, 8, ::UIMeasureStrategy&> mMeasureStrategy;
165 ::ll::TypedStorage<1, 1, bool> mCanMoveFocus;
166 ::ll::TypedStorage<1, 1, ::FocusImpact> mNextFocusAction;
167 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::UIControlFactory>> mControlFactory;
168 ::ll::TypedStorage<8, 40, ::std::queue<::ScreenEvent, ::std::deque<::ScreenEvent>>> mAnimationEvents;
169 ::ll::TypedStorage<8, 40, ::std::queue<::ScreenEvent, ::std::deque<::ScreenEvent>>> mCustomRendererEvents;
170 ::ll::TypedStorage<4, 8, ::glm::vec2> mStartLocation;
171 ::ll::TypedStorage<4, 4, float> mTimeUntilNextPointerHeldEvent;
172 ::ll::TypedStorage<4, 4, float> mDelayBetweenEachPointerHeldEvent;
173 ::ll::TypedStorage<1, 1, bool> mShouldSendPointerHeldEvents;
174 ::ll::TypedStorage<8, 24, ::std::vector<::ScreenView::DelayedCommand>> mDelayedCommands;
175 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScreenViewProxy>> mProxy;
176 ::ll::TypedStorage<8, 40, ::std::queue<::std::string, ::std::deque<::std::string>>> mQueuedTextChange;
177 ::ll::TypedStorage<1, 1, bool> mIsExiting;
178 ::ll::TypedStorage<1, 1, bool> mIsEntering;
179 ::ll::TypedStorage<1, 1, bool> mIsInitialized;
180 ::ll::TypedStorage<1, 1, bool> mHasFocus;
181 ::ll::TypedStorage<1, 1, bool> mHasHadFocus;
182 ::ll::TypedStorage<1, 1, bool> mIsTerminating;
183 ::ll::TypedStorage<1, 1, bool> mDirectionalButtonWasPressed;
184 ::ll::TypedStorage<1, 1, bool> mDelayedFocusRefresh;
185 ::ll::TypedStorage<1, 1, ::TextEditFocusedListener> mTextEditFocusedListener;
186 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::ScreenLoadTimeTracker>> mScreenLoadTimeTracker;
187 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mFocusChangeSub;
188 // NOLINTEND
189
190public:
191 // prevent constructor by default
192 ScreenView& operator=(ScreenView const&);
193 ScreenView(ScreenView const&);
194 ScreenView();
195
196public:
197 // member functions
198 // NOLINTBEGIN
199 MCNAPI void _adjustScrollToControl(::UIControl& control);
200
201 MCNAPI void
202 _adjustScrollToFocusedControl(::UIControl& focusedControl, bool selectNearestControl, bool isRightStickScrolling);
203
204 MCNAPI void _advanceToNextTab(bool right);
205
206 MCNAPI void _bindData(bool doAllBinds);
207
208 MCNAPI void
209 _changeInputControlCollection(::UIControl& control, ::ControlCollectionChange change, bool const isRemoveCallback);
210
211 MCNAPI void _debugRenderControl(::UIRenderContext& context, ::UIControl const& control) const;
212
215 ::UIControl const& control,
216 ::std::vector<::UIControl const*>& visited
217 ) const;
218
219 MCNAPI void _deselectControl(bool forceDeselect, bool hoverAfterDeselect);
220
221 MCNAPI void _executeDelayedCommands(::ScreenView::DelayedCommandLocation location);
222
223 MCAPI void _fireSelectedStateChangeEvent(::TextEditComponent const& textEditComponent, bool state);
224
226 bool finished,
227 ::TextCharEventResult result,
228 uint id,
229 int index,
230 ::UIPropertyBag* propertyBag
231 );
232
234 ::std::weak_ptr<::UIControl> previousFocusControl,
235 ::std::weak_ptr<::UIControl> currentFocusControl
236 );
237
238 MCNAPI void _forwardEventToAnimationControls(::ScreenEvent const& screenEvent);
239
240 MCNAPI ::std::shared_ptr<::UIControl> _getGamepadCursorFocusedControl() const;
241
242 MCNAPI ::ScreenSettings const* _getScreenComponent() const;
243
244 MCNAPI void _handleDirtyVisualTree(bool overrideFocusControl, bool doAllBinds);
245
246 MCAPI void _handlePointerLocation(
247 ::glm::vec2 const& position,
248 ::FocusImpact focusImpact,
249 bool forceHandleWhenMotionless,
250 bool isRightStickScrolling
251 );
252
253 MCNAPI void _handleStickScrolling(::DirectionId directionId);
254
255 MCNAPI void _processControllerDirection(::DirectionId directionId);
256
258
260 ::std::shared_ptr<::UIControl> focusedControl,
261 bool excludeControlHeader,
262 bool notInterruptible
263 );
264
265 MCNAPI void _queueTextToSpeechTextboxCharacter(::std::string const& inputStr);
266
267 MCNAPI void _resetButtonState(::UIControl& control);
268
269 MCNAPI void _resetFocusedControl();
270
271 MCNAPI void
272 _resetInputControl(::UIControl& control, ::InputComponent* const inputComponent, bool const handleModalChange);
273
274 MCNAPI void _scrollToGridItem(::UIControl* gridControl, int itemIndex, int numItems);
275
276 MCNAPI void _selectControl(::UIControl& control, bool isHandlingTextChar);
277
279 ::ui::CardinalDirection direction,
280 bool overrideOrigin,
281 ::glm::vec2 const overridePos,
282 bool isRightStickScrolling
283 );
284
285 MCNAPI void _sendScrollEvent(::UIControl& parent, float delta) const;
286
287 MCNAPI void _setGamepadCursorFocusMode(bool focusModeEnabled);
288
289 MCNAPI void _setKeyboardHeight(float height);
290
291 MCNAPI void _switchTabToTargetIndex(::std::vector<::std::shared_ptr<::UIControl>>& tabControls, int targetIndex);
292
293 MCNAPI bool _updateControlCollections(bool overrideFocusControl);
294
295 MCNAPI void
296 _updateFocusControl(bool forceUpdate, bool forceFocusToAdjust, bool isRightStickScrolling, bool isHandlingTextChar);
297
298 MCNAPI void _updateInputAreas();
299
301
302 MCNAPI void cleanInputComponents();
303
304 MCNAPI ::std::string getRoute() const;
305
306 MCAPI ::std::string getScreenName() const;
307
308 MCAPI void handleButtonEvent(uint buttonId, ::ButtonState buttonState, ::FocusImpact focusImpact);
309
310 MCNAPI bool
311 handlePointerLocation(::glm::vec2 const& position, bool forceMotionlessPointer, ::FocusImpact focusImpact);
312
314
315 MCAPI void render(::UIRenderContext& uiRenderContext);
316
317 MCNAPI void resize();
318
319 MCNAPI void setInitialized();
320
321 MCAPI ~ScreenView();
322 // NOLINTEND
323
324public:
325 // static functions
326 // NOLINTBEGIN
328 ::UIControl const* currentVisualTreeRoot,
329 ::std::weak_ptr<::UIControl> const& stateControl
330 );
331
332 MCNAPI static bool _isFocusMagnetEnabled(::std::shared_ptr<::UIControl> const& control);
333
334 MCNAPI static bool _shouldBindChildren(bool doAllBinds, ::UIControl& control, ::DataBindingComponent& dataBinding);
335 // NOLINTEND
336
337public:
338 // static variables
339 // NOLINTBEGIN
340 MCNAPI static ::Bedrock::PubSub::Publisher<void(), ::Bedrock::PubSub::ThreadModel::MultiThreaded, 0>&
342
343 MCNAPI static bool& sIsDebuggingFocus();
344
345 MCNAPI static bool& sRenderDebugControls();
346 // NOLINTEND
347
348public:
349 // destructor thunk
350 // NOLINTBEGIN
351 MCAPI void $dtor();
352 // NOLINTEND
353};
Definition DataBindingComponent.h:5
Definition FocusManager.h:5
Definition ITTSEventManager.h:5
Definition InputComponent.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
MCAPI void _switchTabToTargetIndex(::std::vector<::std::shared_ptr<::UIControl > > &tabControls, int targetIndex)
MCAPI::ScreenSettings const * _getScreenComponent() const
MCAPI void _setKeyboardHeight(float height)
MCAPI void _sendScrollEvent(::UIControl &parent, float delta) const
MCAPI void _updateFocusControl(bool forceUpdate, bool forceFocusToAdjust, bool isRightStickScrolling, bool isHandlingTextChar)
MCAPI void _changeInputControlCollection(::UIControl &control, ::ControlCollectionChange change, bool const isRemoveCallback)
static MCAPI bool _isFocusMagnetEnabled(::std::shared_ptr<::UIControl > const &control)
MCAPI void _executeDelayedCommands(::ScreenView::DelayedCommandLocation location)
MCAPI void _adjustScrollToControl(::UIControl &control)
MCAPI void _adjustScrollToFocusedControl(::UIControl &focusedControl, bool selectNearestControl, bool isRightStickScrolling)
MCAPI void _selectNextFocusObject(::ui::CardinalDirection direction, bool overrideOrigin, ::glm::vec2 const overridePos, bool isRightStickScrolling)
MCAPI void _bindData(bool doAllBinds)
MCAPI void _scrollToGridItem(::UIControl *gridControl, int itemIndex, int numItems)
MCAPI void resize()
MCAPI void _advanceToNextTab(bool right)
static MCAPI bool _shouldBindChildren(bool doAllBinds, ::UIControl &control, ::DataBindingComponent &dataBinding)
MCAPI void _resetFocusedControl()
MCAPI void _queueTextToSpeechIfEnabled(::std::shared_ptr<::UIControl > focusedControl, bool excludeControlHeader, bool notInterruptible)
static MCAPI bool & sIsDebuggingFocus()
MCAPI void _debugRenderControl(::UIRenderContext &context, ::UIControl const &control) const
MCAPI void _setGamepadCursorFocusMode(bool focusModeEnabled)
MCAPI void _handleStickScrolling(::DirectionId directionId)
MCAPI void _debugRenderFocusControl(::UIRenderContext &context, ::UIControl const &control, ::std::vector<::UIControl const * > &visited) const
MCAPI void _processControllerDirection(::DirectionId directionId)
MCAPI bool isGamepadDeflectionModeEnabled() const
MCAPI void _resetInputControl(::UIControl &control, ::InputComponent *const inputComponent, bool const handleModalChange)
static MCAPI bool & sRenderDebugControls()
MCAPI void _resetButtonState(::UIControl &control)
static MCAPI bool _hasStateControlInDifferentTree(::UIControl const *currentVisualTreeRoot, ::std::weak_ptr<::UIControl > const &stateControl)
MCAPI::std::string getRoute() const
MCAPI void setInitialized()
MCAPI void _updateKeyboardVisibility()
static MCAPI ::Bedrock::PubSub::Publisher< void(), ::Bedrock::PubSub::ThreadModel::MultiThreaded, 0 > & mDebugChangePublisher()
MCAPI void cleanInputComponents()
MCAPI void _deselectControl(bool forceDeselect, bool hoverAfterDeselect)
MCAPI void _queueTextToSpeechTextboxCharacter(::std::string const &inputStr)
MCAPI bool handlePointerLocation(::glm::vec2 const &position, bool forceMotionlessPointer, ::FocusImpact focusImpact)
MCAPI ::std::shared_ptr<::UIControl > _getGamepadCursorFocusedControl() const
MCAPI void _processEvents(::ScreenInputContext &context)
MCAPI void _selectControl(::UIControl &control, bool isHandlingTextChar)
MCAPI void _handleDirtyVisualTree(bool overrideFocusControl, bool doAllBinds)
MCAPI bool _updateControlCollections(bool overrideFocusControl)
MCAPI void _forwardEventToAnimationControls(::ScreenEvent const &screenEvent)
MCAPI void _updateInputAreas()
MCAPI void _focusChangeCallback(::std::weak_ptr<::UIControl > previousFocusControl, ::std::weak_ptr<::UIControl > currentFocusControl)
MCAPI void _fireTextChangedEvent(bool finished, ::TextCharEventResult result, uint id, int index, ::UIPropertyBag *propertyBag)
Definition TextEditComponent.h:5
Definition UIAnimationController.h:5
Definition UIControlFactory.h:5
Definition UIControl.h:5
Definition UIMeasureStrategy.h:5
Definition UIPropertyBag.h:5
Definition UIRenderContext.h:5
Definition VisualTree.h:5
Definition ScreenEvent.h:5
Definition ScreenView.h:18
Definition ScreenView.h:16
Definition context.h:5