27 struct RenderTargetInfo;
38 public ICroppedRectangle,
41 public delegates::IDelegateUnlink,
43 public WidgetContainer,
47 friend class WidgetManager;
61 Widget* createWidgetT(
62 std::string_view _type,
63 std::string_view _skin,
66 std::string_view _name = {});
69 Widget* createWidgetT(
70 std::string_view _type,
71 std::string_view _skin,
77 std::string_view _name = {});
80 Widget* createWidgetRealT(
81 std::string_view _type,
82 std::string_view _skin,
85 std::string_view _name = {});
88 Widget* createWidgetRealT(
89 std::string_view _type,
90 std::string_view _skin,
96 std::string_view _name = {});
101 T* createWidget(std::string_view _skin,
const IntCoord& _coord, Align _align, std::string_view _name = {})
103 return static_cast<T*
>(createWidgetT(T::getClassTypeName(), _skin, _coord, _align, _name));
109 std::string_view _skin,
115 std::string_view _name = {})
117 return static_cast<T*
>(
118 createWidgetT(T::getClassTypeName(), _skin,
IntCoord(_left, _top, _width, _height), _align, _name));
123 T* createWidgetReal(std::string_view _skin,
const FloatCoord& _coord, Align _align, std::string_view _name = {})
125 return static_cast<T*
>(createWidgetRealT(T::getClassTypeName(), _skin, _coord, _align, _name));
131 std::string_view _skin,
137 std::string_view _name = {})
139 return static_cast<T*
>(
140 createWidgetRealT(T::getClassTypeName(), _skin, _left, _top, _width, _height, _align, _name));
152 Widget* createWidgetT(
154 std::string_view _type,
155 std::string_view _skin,
158 std::string_view _layer = {},
159 std::string_view _name = {});
165 std::string_view _skin,
168 std::string_view _layer = {},
169 std::string_view _name = {})
171 return static_cast<T*
>(createWidgetT(_style, T::getClassTypeName(), _skin, _coord, _align, _layer, _name));
175 void setPosition(
const IntPoint& _point)
override;
177 void setSize(
const IntSize& _size)
override;
179 void setCoord(
const IntCoord& _coord)
override;
182 void setPosition(
int _left,
int _top);
184 void setSize(
int _width,
int _height);
186 void setCoord(
int _left,
int _top,
int _width,
int _height);
189 void setRealPosition(
const FloatPoint& _point);
191 void setRealSize(
const FloatSize& _size);
196 void setRealPosition(
float _left,
float _top);
198 void setRealSize(
float _width,
float _height);
200 void setRealCoord(
float _left,
float _top,
float _width,
float _height);
203 const std::string& getName()
const;
206 virtual void setVisible(
bool _value);
208 bool getVisible()
const;
214 void setDepth(
int _value);
216 int getDepth()
const;
219 bool getInheritedVisible()
const;
222 virtual void setAlign(Align _value);
224 Align getAlign()
const;
227 void setRotation(
float _radians);
228 float getRotation()
const;
230 void setRotationCenter(
const FloatPoint& _center);
235 void localToLayer(
FloatPoint* _points,
size_t _count)
const;
244 void setAlpha(
float _alpha);
246 float getAlpha()
const;
258 void setInheritsAlpha(
bool _inherits);
260 bool getInheritsAlpha()
const;
262 void setColour(
const Colour& _value);
265 bool isRootWidget()
const;
268 Widget* getParent()
const;
277 size_t getChildCount()
const;
280 Widget* getChildAt(
size_t _index)
const;
286 Widget* findWidget(std::string_view _name);
294 virtual void setEnabled(
bool _value);
296 void setEnabledSilent(
bool _value);
298 bool getEnabled()
const;
301 bool getInheritedEnabled()
const;
307 Widget* getClientWidget();
308 const Widget* getClientWidget()
const;
313 void detachFromWidget(std::string_view _layer = {});
320 void attachToWidget(Widget* _parent, WidgetStyle _style = WidgetStyle::Child, std::string_view _layer = {});
323 void changeWidgetSkin(std::string_view _skinName);
330 void setWidgetStyle(WidgetStyle _style, std::string_view _layer = {});
332 WidgetStyle getWidgetStyle()
const;
338 void setProperty(std::string_view _key, std::string_view _value);
369 virtual size_t _getItemIndex(Widget* _item)
const;
372 void _forcePick(Widget* _widget);
377 std::string_view _skinName,
379 ICroppedRectangle* _croppedParent,
380 std::string_view _name);
383 void _destroyChildWidget(Widget* _widget)
override;
385 void _setContainer(Widget* _value);
386 Widget* _getContainer()
const;
389 bool _checkPoint(
int _left,
int _top)
const;
390 void _transformVertices(
Vertex* _vertices,
size_t _count,
const RenderTargetInfo& _info)
const;
391 bool _hasRotation()
const override;
393 Widget* _createSkinWidget(
395 std::string_view _type,
396 std::string_view _skin,
399 std::string_view _layer = {},
400 std::string_view _name = {});
403 virtual void _resetContainer(
bool _update);
405 bool _setWidgetState(std::string_view _state);
407 void _updateChilds(
bool _fullSort);
413 virtual void shutdownOverride();
414 virtual void initialiseOverride();
418 using WidgetContainer::baseCreateWidget;
420 Widget* baseCreateWidget(
422 std::string_view _type,
423 std::string_view _skin,
426 std::string_view _layer,
427 std::string_view _name,
432 virtual size_t _getContainerIndex(
const IntPoint& _point)
const;
434 virtual void baseUpdateEnable();
436 ILayerItem* getLayerItemByPoint(
int _left,
int _top)
const override;
437 const IntCoord& getLayerItemCoord()
const override;
440 void assignWidget(T*& _widget, std::string_view _name)
443 for (
const auto& iter : mWidgetChildSkin)
445 Widget* find = iter->findWidget(_name);
448 _widget = find->castType<T>(
false);
456 virtual void onWidgetCreated(Widget* _widget);
457 virtual void onWidgetDestroy(Widget* _widget);
459 void setWidgetClient(Widget* _widget);
461 Widget* _getClientWidget();
462 const Widget* _getClientWidget()
const;
464 virtual void setPropertyOverride(std::string_view _key, std::string_view _value);
467 struct RotationTransform
478 const WidgetInfo* initialiseWidgetSkinBase(ResourceSkin* _skinInfo, ResourceLayout* _templateInfo);
479 void shutdownWidgetSkinBase();
482 void _updateCoord(
const IntSize& _oldSize);
483 void _updateGeometry(
const IntSize* _oldSize =
nullptr);
485 void _detachFromWidget(std::string_view _layer);
487 void _updateVisible();
489 void _updateEnabled();
491 float _getRealAlpha()
const;
493 void _createChildSkinWidget(ResourceSkin* _info);
494 void _destroyChildSkinWidget();
496 void _parseSkinProperties(ResourceSkin* _info);
497 void _checkInheristProperties();
500 ILayerItem* getLayerItemByRotatedPoint(
int _left,
int _top)
const;
501 ILayerItem* pickChildrenOrSelf(
IntPoint _point)
const;
502 void updateRotationTransform();
503 void updateWorldHasRotation();
504 RotationTransform getWorldRotationTransform()
const;
505 void invalidateRotation();
507 void _linkChildWidget(Widget* _widget)
override;
509 void setSkinProperty(ResourceSkin* _info);
511 void resizeLayerItemView(
const IntSize& _oldView,
const IntSize& _newView)
override;
516 Widget* mWidgetClient{
nullptr};
523 bool mInheritedEnabled{
true};
526 bool mInheritedVisible{
true};
530 bool mInheritsAlpha{
true};
534 Widget* mParent{
nullptr};
536 WidgetStyle mWidgetStyle{WidgetStyle::Child};
538 Widget* mContainer{
nullptr};
540 Align mAlign{Align::Default};
541 float mRotation{0.0f};
543 bool mCustomRotationCenter{
false};
545 RotationTransform mRotationTransform;
547 bool mWorldHasRotation{
false};
#define MYGUI_RTTI_DERIVED(DerivedType)
constexpr float ALPHA_MAX
types::TPoint< int > IntPoint
types::TCoord< float > FloatCoord
types::TPoint< float > FloatPoint
delegates::MultiDelegate< Widget * > EventHandle_WidgetVoid
EventPairConvertStringView< delegates::MultiDelegate< Widget *, const std::string &, const std::string & >, delegates::MultiDelegate< Widget *, std::string_view, std::string_view > > EventHandle_WidgetStringString
types::TSize< float > FloatSize
types::TCoord< int > IntCoord
types::TSize< int > IntSize
std::vector< Widget * > VectorWidgetPtr