LeviLamina
Loading...
Searching...
No Matches
UIControl.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/ChildInsertPosition.h"
7#include "mc/client/gui/NameResolutionScope.h"
8#include "mc/client/gui/VisibilityFlag.h"
9#include "mc/client/gui/controls/ComponentReceiveActionType.h"
10#include "mc/deps/core/math/Vec2.h"
11#include "mc/platform/brstd/function_ref.h"
12
13// auto generated forward declare list
14// clang-format off
17class RectangleArea;
21class UIComponent;
22class UIPropertyBag;
23class VisualTree;
24struct ScreenEvent;
25// clang-format on
26
27class UIControl : public ::std::enable_shared_from_this<::UIControl> {
28public:
29 // UIControl inner types declare
30 // clang-format off
32 // clang-format on
33
34 // UIControl inner types define
36 public:
37 // member variables
38 // NOLINTBEGIN
39 ::ll::TypedStorage<8, 32, ::std::string> targetControlName;
40 ::ll::TypedStorage<4, 4, ::ui::NameResolutionScope> scope;
41 ::ll::TypedStorage<8, 64, ::std::function<void(::UIControl&, ::std::shared_ptr<::UIControl>)>> setter;
42 // NOLINTEND
43 };
44
45 using CompIdType = uint64;
46
47 using NameResolverFunc = ::std::function<void(::UIControl&, ::std::shared_ptr<::UIControl>)>;
48
49 using PostCreateFunc = ::std::function<void(::UIControl&)>;
50
51public:
52 // member variables
53 // NOLINTBEGIN
54 ::ll::TypedStorage<4, 8, ::glm::vec2> mCachedPosition;
55 bool mCachedPositionDirty : 1;
56 bool mHover : 1;
57 ::ui::VisibilityFlag mVisible : 2;
58 bool mIsVisibleInTree : 1;
59 bool mEnabled : 1;
60 bool mAllAncestorsEnabled : 1;
61 bool mSelected : 1;
62 bool mClipsChildren : 1;
63 bool mAllowClipping : 1;
64 bool mIsClipped : 1;
65 bool mEnableClippingScissorTest : 1;
66 bool mIsTemplate : 1;
67 bool mPropagateAlpha : 1;
68 bool mDelayCollectionUpdate : 1;
69 bool mTextToSpeechTriggered : 1;
70 ::ll::TypedStorage<2, 2, ushort> mControlCollectionFlag;
71 ::ll::TypedStorage<8, 32, ::std::string> mName;
72 ::ll::TypedStorage<4, 8, ::glm::vec2> mParentRelativePosition;
73 ::ll::TypedStorage<4, 8, ::glm::vec2> mSize;
74 ::ll::TypedStorage<4, 8, ::glm::vec2> mMinSize;
75 ::ll::TypedStorage<4, 8, ::glm::vec2> mMaxSize;
76 ::ll::TypedStorage<4, 4, float> mAlpha;
77 ::ll::TypedStorage<4, 4, int> mZOrder;
78 ::ll::TypedStorage<4, 4, int> mLayer;
79 ::ll::TypedStorage<4, 8, ::Vec2> mClipOffset;
80 ::ll::TypedStorage<4, 4, uint> mClipChangeEventId;
81 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::UIPropertyBag>> mPropertyBag;
82 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::UIPropertyBag>> mPropertyBagToPropagateToChildren;
83 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mParent;
84 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mChildren;
85 ::ll::TypedStorage<8, 8, uint64> mComponentsInUse;
86 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::UIComponent>>> mComponents;
87 ::ll::TypedStorage<8, 24, ::std::vector<::RenderableComponent*>> mRenderableComponentLookup;
88 ::ll::TypedStorage<8, 24, ::std::vector<::CustomFrameUpdateComponent*>> mCustomFrameUpdateComponentLookup;
89 ::ll::TypedStorage<8, 24, ::std::vector<::UIControl::ControlResolutionInfo>> mControlResolvers;
90 ::ll::TypedStorage<8, 24, ::std::vector<::std::function<void(::UIControl&)>>> mPostCreateVector;
91 ::ll::TypedStorage<8, 8, ::ControlScreenAction&> mControlScreenAction;
92 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mModalAncestor;
93 // NOLINTEND
94
95public:
96 // prevent constructor by default
97 UIControl& operator=(UIControl const&);
98 UIControl(UIControl const&);
99 UIControl();
100
101public:
102 // member functions
103 // NOLINTBEGIN
104 MCAPI explicit UIControl(::ControlScreenAction& controlScreenAction);
105
106 MCAPI void _eraseComponentFromLookup(::UIComponent& component);
107
108 MCAPI uint _getComponentIndexFromBitId(uint64 bitId) const;
109
110 MCAPI void _propagateLockStateChange(bool broadcastEvent);
111
112 MCAPI void _registerControlNameResolver(
113 ::std::string const& controlName,
114 ::ui::NameResolutionScope scope,
115 ::std::function<void(::UIControl&, ::std::shared_ptr<::UIControl>)> setter
116 );
117
118 MCAPI void _registerPostCreateCallback(::std::function<void(::UIControl&)> setter);
119
120 MCAPI void _resolveControlNames(::UIControl& rootControl);
121
122 MCAPI void _resolvePostCreate();
123
124 MCAPI void _setPositionDirty();
125
126 MCAPI void
127 _setVisible(::ui::VisibilityFlag visibleFlags, bool setLayoutChangedFlag, bool doLayout, bool shrinkInvisible);
128
129 MCAPI void addChild(::std::shared_ptr<::UIControl> child, ::ui::ChildInsertPosition childInsertPosition);
130
131 MCAPI void appendPropertyBag(::UIPropertyBag const& propertyBag);
132
133 MCAPI ::ComponentReceiveActionType broadcastEvent(
134 ::VisualTree& visualTree,
135 ::ScreenInputContext& context,
136 ::UIAnimationController& animationController,
137 ::UIComponent* sender,
138 ::ScreenEvent const& screenEvent
139 );
140
141 MCAPI bool canBeFocused() const;
142
143 MCAPI ::std::shared_ptr<::UIControl> clone(::UIControl* parent) const;
144
145 MCAPI bool containsPoint(::glm::vec2 const& point) const;
146
147 MCAPI void findAllCollectionIndices(::brstd::function_ref<void(::std::string const&, int)> callback);
148
149 MCAPI int findCollectionIndex(::std::string const& collectionName) const;
150
151 MCAPI ::RectangleArea getAABB() const;
152
153 MCAPI ::std::shared_ptr<::UIControl> getAncestorWhere(::brstd::function_ref<bool(::UIControl const&)> predicate);
154
155 MCAPI ::std::string const getPathedName() const;
156
157 MCAPI ::glm::vec2 const& getPosition() const;
158
159 MCFOLD ::UIPropertyBag const& getPropertyBag() const;
160
161 MCFOLD ::UIPropertyBag& getPropertyBag();
162
163 MCAPI ::std::shared_ptr<::UIControl> moveChild(int index, bool notify);
164
165 MCAPI void notifyBindingsUpdated(
166 ::std::vector<::std::string> controlList,
167 ::std::string propertyName,
168 bool value,
169 bool siblingScope
170 );
171
172 MCAPI void popBackChild();
173
174 MCAPI void popFrontChild();
175
176 MCAPI void processPropertyBags(
177 ::std::unique_ptr<::UIPropertyBag> propertyBag,
178 ::std::unique_ptr<::UIPropertyBag> propertyBagForChildren
179 );
180
181 MCAPI void reloadFromControl(::UIControl const& control);
182
183 MCAPI bool removeChild(::std::shared_ptr<::UIControl> control);
184
185 MCAPI bool removeParentByName(::std::string const& name);
186
187 MCAPI void reset(bool recursive, bool shouldClearCollectionFlag);
188
189 MCAPI void setEnabled(bool enabled, bool broadcastEvent);
190
191 MCAPI void setIsTemplate(bool isTemplate);
192
193 MCAPI void setModalAncestor(::std::weak_ptr<::UIControl> control);
194
195 MCAPI void setVisible(bool visible, bool setLayoutChangedFlag, bool doLayout);
196
197 MCAPI ~UIControl();
198 // NOLINTEND
199
200public:
201 // constructor thunks
202 // NOLINTBEGIN
203 MCAPI void* $ctor(::ControlScreenAction& controlScreenAction);
204 // NOLINTEND
205
206public:
207 // destructor thunk
208 // NOLINTBEGIN
209 MCAPI void $dtor();
210 // NOLINTEND
211};
Definition ControlScreenAction.h:5
Definition CustomFrameUpdateComponent.h:5
Definition RectangleArea.h:5
Definition RenderableComponent.h:5
Definition ScreenInputContext.h:5
Definition UIAnimationController.h:5
Definition UIComponent.h:5
Definition UIControl.h:5
Definition UIPropertyBag.h:5
Definition VisualTree.h:5
Definition ScreenEvent.h:5
Definition UIControl.h:13