BsGUIFieldBase.cpp 1.1 KB

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