BsGUIFieldBase.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. #include "BsGUIFieldBase.h"
  2. #include "BsGUILabel.h"
  3. #include "BsGUILayout.h"
  4. #include "BsGUIWidget.h"
  5. #include "BsGUISkin.h"
  6. namespace BansheeEngine
  7. {
  8. const UINT32 GUIFieldBase::DEFAULT_LABEL_WIDTH = 100;
  9. GUIFieldBase::GUIFieldBase(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
  10. const String& labelStyle, const GUILayoutOptions& layoutOptions, bool withLabel)
  11. :GUIElementContainer(layoutOptions), mLabel(nullptr)
  12. {
  13. mLayout = &addLayoutXInternal(this);
  14. if(withLabel)
  15. {
  16. mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), labelStyle);
  17. mLayout->addElement(mLabel);
  18. }
  19. }
  20. void GUIFieldBase::_updateLayoutInternal(INT32 x, INT32 y, UINT32 width, UINT32 height,
  21. RectI clipRect, UINT8 widgetDepth, UINT16 areaDepth)
  22. {
  23. mLayout->_updateLayoutInternal(x, y, width, height, clipRect, widgetDepth, areaDepth);
  24. }
  25. Vector2I GUIFieldBase::_getOptimalSize() const
  26. {
  27. return mLayout->_getOptimalSize();
  28. }
  29. }