3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/client/gui/ChildInsertPosition.h"
7#include "mc/client/gui/NameResolutionScope.h"
8#include "mc/client/gui/VisibilityFlag.h"
9#include "mc/deps/core/math/Vec2.h"
10#include "mc/platform/brstd/function_ref.h"
21class UIControl :
public ::std::enable_shared_from_this<::UIControl> {
33 ::ll::TypedStorage<8, 32, ::std::string> targetControlName;
34 ::ll::TypedStorage<4, 4, ::ui::NameResolutionScope> scope;
35 ::ll::TypedStorage<8, 64, ::std::function<void(::UIControl&, ::std::shared_ptr<::UIControl>)>> setter;
40 ControlResolutionInfo();
45 MCAPI ControlResolutionInfo(
46 ::std::string
const& aTargetControlName,
47 ::ui::NameResolutionScope aScope,
48 ::std::function<
void(::UIControl&, ::std::shared_ptr<::UIControl>)> aSetter
56 ::std::string
const& aTargetControlName,
57 ::ui::NameResolutionScope aScope,
58 ::std::function<
void(::UIControl&, ::std::shared_ptr<::UIControl>)> aSetter
63 using CompIdType = uint64;
65 using NameResolverFunc = ::std::function<void(::UIControl&, ::std::shared_ptr<::UIControl>)>;
67 using PostCreateFunc = ::std::function<void(::UIControl&)>;
72 ::ll::TypedStorage<4, 8, ::glm::vec2> mCachedPosition;
73 bool mCachedPositionDirty : 1;
75 ::ui::VisibilityFlag mVisible : 2;
76 bool mIsVisibleInTree : 1;
78 bool mAllAncestorsEnabled : 1;
80 bool mClipsChildren : 1;
81 bool mAllowClipping : 1;
83 bool mEnableClippingScissorTest : 1;
85 bool mPropagateAlpha : 1;
86 bool mDelayCollectionUpdate : 1;
87 bool mTextToSpeechTriggered : 1;
88 ::ll::TypedStorage<2, 2, ushort> mControlCollectionFlag;
89 ::ll::TypedStorage<8, 32, ::std::string> mName;
90 ::ll::TypedStorage<4, 8, ::glm::vec2> mParentRelativePosition;
91 ::ll::TypedStorage<4, 8, ::glm::vec2> mSize;
92 ::ll::TypedStorage<4, 8, ::glm::vec2> mMinSize;
93 ::ll::TypedStorage<4, 8, ::glm::vec2> mMaxSize;
94 ::ll::TypedStorage<4, 4, float> mAlpha;
95 ::ll::TypedStorage<4, 4, int> mZOrder;
96 ::ll::TypedStorage<4, 4, int> mLayer;
97 ::ll::TypedStorage<4, 8, ::Vec2> mClipOffset;
98 ::ll::TypedStorage<4, 4, uint> mClipChangeEventId;
99 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::UIPropertyBag>> mPropertyBag;
100 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::UIPropertyBag>> mPropertyBagToPropagateToChildren;
101 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mParent;
102 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mChildren;
103 ::ll::TypedStorage<8, 8, uint64> mComponentsInUse;
104 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::UIComponent>>> mComponents;
105 ::ll::TypedStorage<8, 24, ::std::vector<::RenderableComponent*>> mRenderableComponentLookup;
106 ::ll::TypedStorage<8, 24, ::std::vector<::CustomFrameUpdateComponent*>> mCustomFrameUpdateComponentLookup;
107 ::ll::TypedStorage<8, 24, ::std::vector<::UIControl::ControlResolutionInfo>> mControlResolvers;
108 ::ll::TypedStorage<8, 24, ::std::vector<::std::function<void(::UIControl&)>>> mPostCreateVector;
109 ::ll::TypedStorage<8, 8, ::ControlScreenAction&> mControlScreenAction;
110 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mModalAncestor;
115 UIControl& operator=(UIControl
const&);
116 UIControl(UIControl
const&);
122 MCAPI
void _propagateLockStateChange(
bool broadcastEvent);
124 MCAPI
void _registerControlNameResolver(
125 ::std::string
const& controlName,
126 ::ui::NameResolutionScope scope,
127 ::std::function<
void(::UIControl&, ::std::shared_ptr<::UIControl>)> setter
130 MCAPI
void _registerPostCreateCallback(::std::function<
void(::UIControl&)> setter);
132 MCAPI
void _resolveControlNames(::UIControl& rootControl);
134 MCAPI
void _resolvePostCreate();
136 MCAPI
void _setCachedPosition()
const;
138 MCAPI
void _setPositionDirty();
141 _setVisible(::ui::VisibilityFlag visibleFlags,
bool setLayoutChangedFlag,
bool doLayout,
bool shrinkInvisible);
143 MCAPI
void addChild(::std::shared_ptr<::UIControl> child, ::ui::ChildInsertPosition childInsertPosition);
145 MCAPI ::std::shared_ptr<::UIControl> clone(::UIControl* parent)
const;
147 MCAPI
void findAllCollectionIndices(::brstd::function_ref<
void(::std::string
const&,
int)> callback);
149 MCAPI
int findCollectionIndex(::std::string
const& collectionName)
const;
151 MCAPI ::std::shared_ptr<::UIControl> getAncestorWhere(::brstd::function_ref<
bool(::UIControl
const&)> predicate);
153 MCAPI ::std::string
const getPathedName()
const;
155 MCFOLD ::UIPropertyBag
const& getPropertyBag()
const;
157 MCFOLD ::UIPropertyBag& getPropertyBag();
159 MCAPI ::std::shared_ptr<::UIControl> moveChild(
int index,
bool notify);
161 MCAPI
void notifyBindingsUpdated(
162 ::std::vector<::std::string> controlList,
163 ::std::string propertyName,
168 MCAPI
void popBackChild();
170 MCAPI
void popFrontChild();
172 MCAPI
void processPropertyBags(
173 ::std::unique_ptr<::UIPropertyBag> propertyBag,
174 ::std::unique_ptr<::UIPropertyBag> propertyBagForChildren
177 MCAPI
void reloadFromControl(::UIControl
const& control);
179 MCAPI
bool removeChild(::std::shared_ptr<::UIControl> control);
181 MCAPI
void reset(
bool recursive,
bool shouldClearCollectionFlag);
183 MCAPI
void setEnabled(
bool enabled,
bool broadcastEvent);
185 MCAPI
void setIsTemplate(
bool isTemplate);
Definition ControlScreenAction.h:5
Definition CustomFrameUpdateComponent.h:5
Definition RenderableComponent.h:5
Definition UIComponent.h:5
Definition UIPropertyBag.h:5
Definition UIControl.h:13