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
13class 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 void _setFocusControlFromIndex(int focusControlIndex, bool overrideLastFocus);
79
80 MCAPI void _setFocusControlFromWeakPtr(::std::weak_ptr<::UIControl> control);
81
82 MCAPI void _setFocusControlInternal(::UIControl const& control, bool allowDefault, bool overrideLastFocus);
83
84 MCAPI void _sweepForClosestControl(::std::shared_ptr<::UIControl> focusedControl);
85
86 MCAPI ::SweepResult _sweepForControl(
87 ::SweepDescription const& desc,
88 ::std::vector<::std::shared_ptr<::UIControl>> const& controls,
89 bool hasWrapped
90 );
91
92 MCAPI ::SweepResult _sweepForControlDirectional(
93 ::SweepDescription const& desc,
94 ::std::vector<::std::shared_ptr<::UIControl>> const& controls,
95 bool hasWrapped
96 );
97
98 MCAPI ::SweepResult _sweepForControlFocusOverride(
99 ::SweepDescription const& desc,
100 ::std::vector<::std::shared_ptr<::UIControl>> const& controls,
101 bool hasWrapped
102 );
103
104 MCAPI void
105 _sweepToNextFocusObject(::ui::CardinalDirection direction, bool overrideOrigin, ::glm::vec2 const& overridePos);
106
107 MCAPI void _updateFocusContainer(
108 ::std::weak_ptr<::UIControl> oldFocusedControl,
109 bool updateControlIndex,
110 bool overrideLastFocus
111 );
112
113 MCAPI void _updateFocusControlIndex();
114
115 MCAPI void _updateLostFocusControlList(::std::weak_ptr<::UIControl> control);
116
117 MCAPI void _updateRootOfFocusTree();
118
119 MCAPI bool _useLastFocus(
120 ::ui::CardinalDirection direction,
121 ::FocusContainerComponent* toFocusContainerComp,
122 ::FocusContainerComponent* fromFocusContainerComp
123 ) const;
124
125 MCAPI void addControl(::UIControl& control);
126
127 MCAPI void clearPendingFocusControl();
128
129 MCAPI void defaultFocus();
130
131 MCAPI bool hasFocusedControl();
132
133 MCAPI void removeControl(
134 ::UIControl& control,
135 ::std::map<::std::vector<::std::shared_ptr<::UIControl>>*, ::std::vector<::std::shared_ptr<::UIControl>>>&
136 controlsToRemove
137 );
138
139 MCAPI bool setFocusControl(::UIControl const& control, bool allowDefault);
140
141 MCAPI void setFocusedControlToLostFocus();
142
143 MCAPI void setModalRoot(::std::shared_ptr<::UIControl>& control);
144
145 MCAPI void setPendingFocusControl(::std::string const& name, ::std::string const& collectionName, int index);
146
147 MCAPI void updateDefaultFocusIfNeeded();
148
149 MCAPI bool updatePendingFocusControl();
150
151 MCAPI void validateFocusControl();
152
153 MCAPI ~FocusManager();
154 // NOLINTEND
155
156public:
157 // constructor thunks
158 // NOLINTBEGIN
159 MCAPI void* $ctor();
160 // NOLINTEND
161
162public:
163 // destructor thunk
164 // NOLINTBEGIN
165 MCAPI void $dtor();
166 // NOLINTEND
167};
Definition FocusManagerProxy.h:5
Definition FocusManager.h:5
Definition UIControl.h:5
Definition FocusContainerComponent.h:5
Definition SweepDescription.h:5
Definition SweepResult.h:5