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/client/gui/controls/ComponentReceiveActionType.h"
10#include "mc/deps/core/math/Vec2.h"
11#include "mc/platform/brstd/function_ref.h"
27class UIControl :
public ::std::enable_shared_from_this<::UIControl> {
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;
45 using CompIdType = uint64;
47 using NameResolverFunc = ::std::function<void(::UIControl&, ::std::shared_ptr<::UIControl>)>;
49 using PostCreateFunc = ::std::function<void(::UIControl&)>;
54 ::ll::TypedStorage<4, 8, ::glm::vec2> mCachedPosition;
55 bool mCachedPositionDirty : 1;
57 ::ui::VisibilityFlag mVisible : 2;
58 bool mIsVisibleInTree : 1;
60 bool mAllAncestorsEnabled : 1;
62 bool mClipsChildren : 1;
63 bool mAllowClipping : 1;
65 bool mEnableClippingScissorTest : 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, 16, ::std::weak_ptr<::UIControl>> mParent;
83 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::UIControl>>> mChildren;
84 ::ll::TypedStorage<8, 8, uint64> mComponentsInUse;
85 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::UIComponent>>> mComponents;
86 ::ll::TypedStorage<8, 24, ::std::vector<::RenderableComponent*>> mRenderableComponentLookup;
87 ::ll::TypedStorage<8, 24, ::std::vector<::CustomFrameUpdateComponent*>> mCustomFrameUpdateComponentLookup;
88 ::ll::TypedStorage<8, 24, ::std::vector<::UIControl::ControlResolutionInfo>> mControlResolvers;
89 ::ll::TypedStorage<8, 24, ::std::vector<::std::function<void(::UIControl&)>>> mPostCreateVector;
90 ::ll::TypedStorage<8, 8, ::ControlScreenAction&> mControlScreenAction;
91 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::UIControl>> mModalAncestor;
96 UIControl& operator=(UIControl
const&);
97 UIControl(UIControl
const&);
103 MCAPI
explicit UIControl(::ControlScreenAction& controlScreenAction);
105 MCAPI
void _eraseComponentFromLookup(::UIComponent& component);
107 MCAPI uint _getComponentIndexFromBitId(uint64 bitId)
const;
109 MCAPI
void _propagateLockStateChange(
bool broadcastEvent);
111 MCAPI
void _registerControlNameResolver(
112 ::std::string
const& controlName,
113 ::ui::NameResolutionScope scope,
114 ::std::function<
void(::UIControl&, ::std::shared_ptr<::UIControl>)> setter
117 MCAPI
void _registerPostCreateCallback(::std::function<
void(::UIControl&)> setter);
119 MCAPI
void _resolveControlNames(::UIControl& rootControl);
121 MCAPI
void _resolvePostCreate();
123 MCAPI
void _setPositionDirty();
126 _setVisible(::ui::VisibilityFlag visibleFlags,
bool setLayoutChangedFlag,
bool doLayout,
bool shrinkInvisible);
128 MCAPI
void addChild(::std::shared_ptr<::UIControl> child, ::ui::ChildInsertPosition childInsertPosition);
130 MCAPI
void appendPropertyBag(::UIPropertyBag
const& propertyBag);
132 MCAPI ::ComponentReceiveActionType broadcastEvent(
133 ::VisualTree& visualTree,
134 ::ScreenInputContext& context,
135 ::UIAnimationController& animationController,
136 ::UIComponent* sender,
137 ::ScreenEvent
const& screenEvent
140 MCAPI
bool canBeFocused()
const;
142 MCAPI ::std::shared_ptr<::UIControl> clone(::UIControl* parent)
const;
144 MCAPI
bool containsPoint(::glm::vec2
const& point)
const;
146 MCAPI
void findAllCollectionIndices(::brstd::function_ref<
void(::std::string
const&,
int)> callback);
148 MCAPI
int findCollectionIndex(::std::string
const& collectionName)
const;
150 MCAPI ::RectangleArea getAABB()
const;
152 MCAPI ::std::shared_ptr<::UIControl> getAncestorWhere(::brstd::function_ref<
bool(::UIControl
const&)> predicate);
154 MCAPI ::std::string
const getPathedName()
const;
156 MCAPI ::glm::vec2
const& getPosition()
const;
158 MCAPI ::UIPropertyBag
const& getPropertyBag()
const;
160 MCFOLD ::UIPropertyBag& getPropertyBag();
162 MCAPI ::std::shared_ptr<::UIControl> moveChild(
int index,
bool notify);
164 MCAPI
void notifyBindingsUpdated(
165 ::std::vector<::std::string> controlList,
166 ::std::string propertyName,
171 MCAPI
void popBackChild();
173 MCAPI
void popFrontChild();
175 MCAPI
void reloadFromControl(::UIControl
const& control);
177 MCAPI
bool removeChild(::std::shared_ptr<::UIControl> control);
179 MCAPI
bool removeParentByName(::std::string
const& name);
181 MCAPI
void reset(
bool recursive,
bool shouldClearCollectionFlag);
183 MCAPI
void setEnabled(
bool enabled,
bool broadcastEvent);
185 MCAPI
void setIsTemplate(
bool isTemplate);
187 MCAPI
void setModalAncestor(::std::weak_ptr<::UIControl> control);
189 MCAPI
void setVisible(
bool visible,
bool setLayoutChangedFlag,
bool doLayout);
197 MCAPI
void* $ctor(::ControlScreenAction& controlScreenAction);
Definition RectangleArea.h:5
Definition UIAnimationController.h:5
Definition ControlScreenAction.h:5
Definition CustomFrameUpdateComponent.h:5
Definition RenderableComponent.h:5
Definition ScreenEvent.h:5
Definition ScreenInputContext.h:5
Definition UIComponent.h:5
Definition UIControl.h:13
Definition UIPropertyBag.h:5
Definition VisualTree.h:5