| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #include "GUI/BsGUIFieldBase.h"
- #include "GUI/BsGUILabel.h"
- #include "GUI/BsGUILayoutX.h"
- #include "GUI/BsGUILayoutUtility.h"
- namespace bs
- {
- const UINT32 GUIFieldBase::DEFAULT_LABEL_WIDTH = 100;
- GUIFieldBase::GUIFieldBase(const PrivatelyConstruct& dummy, const GUIContent& labelContent, UINT32 labelWidth,
- const String& style, const GUIDimensions& dimensions, bool withLabel)
- :GUIElementContainer(dimensions, style), mLabel(nullptr)
- {
- mLayout = GUILayoutX::create();
- _registerChildElement(mLayout);
- if(withLabel)
- {
- mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), getSubStyleName(getLabelStyleType()));
- mLayout->addElement(mLabel);
- }
- }
- void GUIFieldBase::_updateLayoutInternal(const GUILayoutData& data)
- {
- mLayout->_setLayoutData(data);
- mLayout->_updateLayoutInternal(data);
- }
- Vector2I GUIFieldBase::_getOptimalSize() const
- {
- return GUILayoutUtility::calcOptimalSize(mLayout);
- }
- void GUIFieldBase::styleUpdated()
- {
- if (mLabel != nullptr)
- mLabel->setStyle(getSubStyleName(getLabelStyleType()));
- }
- }
|