LeviLamina
Loading...
Searching...
No Matches
FocusManager.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/screens/RecentFocusVector.h"
8#include "mc/deps/core/utility/pub_sub/Publisher.h"
9
10// auto generated forward declare list
11// clang-format off
14class UIControl;
15struct SweepDescription;
16struct SweepResult;
17namespace Bedrock::PubSub::ThreadModel { struct SingleThreaded; }
18// clang-format on
19
20class FocusManager {
21public:
22 // member variables
23 // NOLINTBEGIN
24 ::ll::TypedStorage<4, 8, ::glm::vec2> mSize;
25 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mFocusControls;
26 bool mFocusActive : 1;
27 bool mFocusResetFlag : 1;
28 bool mFindClosestControl : 1;
29 bool mFocusPositionCaptured : 1;
30 bool mNeedsDefaultFocusUpdate : 1;
31 bool mIncludeMagnetControls : 1;
32 bool mRepeatTTS : 1;
33 ::ll::TypedStorage<1, 1, bool> mScrollToFocusedControlIfClipped;
34 bool mHoverNothing : 1;
35 ::ll::TypedStorage<4, 4, int> mFocusedControlIndex;
36 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mFocusedControl;
37 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mPreviousFocusedControl;
38 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mLostFocusControl;
39 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mCurrentModalRoot;
40 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mCurrentFocusContainer;
41 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mRootOfFocusTree;
42 ::ll::TypedStorage<8, 32, ::RecentFocusVector> mRecentFocusList;
43 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::FocusManagerProxy>> mProxy;
44 ::ll::TypedStorage<8, 32, ::std::string> mPendingFocusControlID;
45 ::ll::TypedStorage<4, 4, int> mPendingFocusControlIndex;
46 ::ll::TypedStorage<1, 1, bool> mHasPendingFocusControl;
47 ::ll::TypedStorage<8, 32, ::std::string> mPendingFocusCollectionIndexName;
48 ::ll::TypedStorage<
49 8,
50 48,
51 ::Bedrock::PubSub::Publisher<
52 void(::std::weak_ptr<::UIControl>, ::std::weak_ptr<::UIControl>),
53 ::Bedrock::PubSub::ThreadModel::SingleThreaded,
54 0>>
55 mFocusChangePub;
56 // NOLINTEND
57
58public:
59 // member functions
60 // NOLINTBEGIN
61 MCAPI FocusManager();
62
63 MCAPI ::std::shared_ptr<::UIControl> _findFocusContainerControlFor(::std::shared_ptr<::UIControl> forControl) const;
64
65 MCAPI int _findFocusControlIndex(::UIControl const& startControl) const;
66
67 MCAPI ::SweepResult _getControlAtFocusPoint(
68 ::SweepDescription const& desc,
69 ::std::vector<::std::shared_ptr<::UIControl>> const& controls
70 );
71
72 MCAPI ::std::shared_ptr<::UIControl> _getFocusContainterControl();
73
74 MCAPI ::std::shared_ptr<::UIControl> _getLastGoodFocusedControl(::std::shared_ptr<::UIControl> oldFocusedControl);
75
76 MCAPI bool _handleFocusContainerLogic(::ui::CardinalDirection direction, ::std::shared_ptr<::UIControl> toControl);
77
78 MCAPI bool _passesParentClipping(::std::shared_ptr<::UIControl> const& control, ::glm::vec2 const& checkPos);
79
80 MCAPI void _setFocusControlFromIndex(int focusControlIndex, bool overrideLastFocus);
81
82 MCAPI void _setFocusControlFromWeakPtr(::std::weak_ptr<::UIControl> control);
83
84 MCAPI void _setFocusControlInternal(::UIControl const& control, bool allowDefault, bool overrideLastFocus);
85
86 MCAPI void _sweepForClosestControl(::std::shared_ptr<::UIControl> focusedControl);
87
88 MCAPI ::SweepResult _sweepForControl(
89 ::SweepDescription const& desc,
90 ::std::vector<::std::shared_ptr<::UIControl>> const& controls,
91 bool hasWrapped
92 );
93
94 MCAPI ::SweepResult _sweepForControlDirectional(
95 ::SweepDescription const& desc,
96 ::std::vector<::std::shared_ptr<::UIControl>> const& controls,
97 bool hasWrapped
98 );
99
100 MCAPI ::SweepResult _sweepForControlFocusOverride(
101 ::SweepDescription const& desc,
102 ::std::vector<::std::shared_ptr<::UIControl>> const& controls,
103 bool hasWrapped
104 );
105
106 MCAPI void
107 _sweepToNextFocusObject(::ui::CardinalDirection direction, bool overrideOrigin, ::glm::vec2 const& overridePos);
108
109 MCAPI bool _trySetLastGoodFocus(::std::shared_ptr<::UIControl> oldFocusedControl);
110
111 MCAPI void _updateFocusContainer(
112 ::std::weak_ptr<::UIControl> oldFocusedControl,
113 bool updateControlIndex,
114 bool overrideLastFocus
115 );
116
117 MCAPI void _updateFocusControlIndex();
118
119 MCAPI void _updateLostFocusControlList(::std::weak_ptr<::UIControl> control);
120
121 MCAPI void _updateRootOfFocusTree();
122
123 MCAPI bool _useLastFocus(
124 ::ui::CardinalDirection direction,
125 ::FocusContainerComponent* toFocusContainerComp,
126 ::FocusContainerComponent* fromFocusContainerComp
127 ) const;
128
129 MCAPI void addControl(::UIControl& control);
130
131 MCAPI void clearPendingFocusControl();
132
133 MCAPI void defaultFocus();
134
135 MCAPI bool hasFocusedControl();
136
137 MCAPI void removeControl(
138 ::UIControl& control,
139 ::std::map<::std::vector<::std::shared_ptr<::UIControl>>*, ::std::vector<::std::shared_ptr<::UIControl>>>&
140 controlsToRemove
141 );
142
143 MCAPI bool setFocusControl(::UIControl const& control, bool allowDefault);
144
145 MCAPI void setFocusedControlToLostFocus();
146
147 MCAPI void setModalRoot(::std::shared_ptr<::UIControl>& control);
148
149 MCAPI void setPendingFocusControl(::std::string const& name, ::std::string const& collectionName, int index);
150
151 MCAPI void updateDefaultFocusIfNeeded();
152
153 MCAPI bool updatePendingFocusControl();
154
155 MCAPI void validateFocusControl();
156
157 MCAPI ~FocusManager();
158 // NOLINTEND
159
160public:
161 // constructor thunks
162 // NOLINTBEGIN
163 MCAPI void* $ctor();
164 // NOLINTEND
165
166public:
167 // destructor thunk
168 // NOLINTBEGIN
169 MCAPI void $dtor();
170 // NOLINTEND
171};
Definition FocusContainerComponent.h:5
Definition FocusManagerProxy.h:5
Definition FocusManager.h:5
Definition UIControl.h:5
Definition SweepDescription.h:5
Definition SweepResult.h:5