|
@@ -7,6 +7,7 @@
|
|
|
#include "BsGUILayoutOptions.h"
|
|
#include "BsGUILayoutOptions.h"
|
|
|
#include "BsGUIMouseEvent.h"
|
|
#include "BsGUIMouseEvent.h"
|
|
|
#include "BsGUIManager.h"
|
|
#include "BsGUIManager.h"
|
|
|
|
|
+#include "BsGUIHelper.h"
|
|
|
#include "CmTexture.h"
|
|
#include "CmTexture.h"
|
|
|
|
|
|
|
|
using namespace CamelotFramework;
|
|
using namespace CamelotFramework;
|
|
@@ -102,19 +103,7 @@ namespace BansheeEngine
|
|
|
mImageSprite->update(mImageDesc);
|
|
mImageSprite->update(mImageDesc);
|
|
|
mNumImageRenderElements = mImageSprite->getNumRenderElements();
|
|
mNumImageRenderElements = mImageSprite->getNumRenderElements();
|
|
|
|
|
|
|
|
- TEXT_SPRITE_DESC textDesc;
|
|
|
|
|
- textDesc.text = mElements[mSelectedIdx];
|
|
|
|
|
- textDesc.font = mStyle->font;
|
|
|
|
|
- textDesc.fontSize = mStyle->fontSize;
|
|
|
|
|
-
|
|
|
|
|
- Rect textBounds = getContentBounds();
|
|
|
|
|
-
|
|
|
|
|
- textDesc.width = textBounds.width;
|
|
|
|
|
- textDesc.height = textBounds.height;
|
|
|
|
|
- textDesc.horzAlign = mStyle->textHorzAlign;
|
|
|
|
|
- textDesc.vertAlign = mStyle->textVertAlign;
|
|
|
|
|
-
|
|
|
|
|
- mTextSprite->update(textDesc);
|
|
|
|
|
|
|
+ mTextSprite->update(getTextDesc());
|
|
|
|
|
|
|
|
GUIElement::updateRenderElementsInternal();
|
|
GUIElement::updateRenderElementsInternal();
|
|
|
}
|
|
}
|
|
@@ -126,22 +115,20 @@ namespace BansheeEngine
|
|
|
|
|
|
|
|
UINT32 GUIListBox::_getOptimalWidth() const
|
|
UINT32 GUIListBox::_getOptimalWidth() const
|
|
|
{
|
|
{
|
|
|
|
|
+ UINT32 imageWidth = 0;
|
|
|
if(mImageDesc.texture != nullptr)
|
|
if(mImageDesc.texture != nullptr)
|
|
|
- {
|
|
|
|
|
- return mImageDesc.texture->getTexture()->getWidth();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ imageWidth = mImageDesc.texture->getTexture()->getWidth();
|
|
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
|
+ return std::max(imageWidth, (UINT32)GUIHelper::calcOptimalContentsSize(mElements[mSelectedIdx], *mStyle, _getLayoutOptions()).x);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
UINT32 GUIListBox::_getOptimalHeight() const
|
|
UINT32 GUIListBox::_getOptimalHeight() const
|
|
|
{
|
|
{
|
|
|
|
|
+ UINT32 imageHeight = 0;
|
|
|
if(mImageDesc.texture != nullptr)
|
|
if(mImageDesc.texture != nullptr)
|
|
|
- {
|
|
|
|
|
- return mImageDesc.texture->getTexture()->getHeight();
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ imageHeight = mImageDesc.texture->getTexture()->getHeight();
|
|
|
|
|
|
|
|
- return 0;
|
|
|
|
|
|
|
+ return std::max(imageHeight, (UINT32)GUIHelper::calcOptimalContentsSize(mElements[mSelectedIdx], *mStyle, _getLayoutOptions()).y);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
UINT32 GUIListBox::_getRenderElementDepth(UINT32 renderElementIdx) const
|
|
UINT32 GUIListBox::_getRenderElementDepth(UINT32 renderElementIdx) const
|
|
@@ -216,4 +203,21 @@ namespace BansheeEngine
|
|
|
|
|
|
|
|
markContentAsDirty();
|
|
markContentAsDirty();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ TEXT_SPRITE_DESC GUIListBox::getTextDesc() const
|
|
|
|
|
+ {
|
|
|
|
|
+ TEXT_SPRITE_DESC textDesc;
|
|
|
|
|
+ textDesc.text = mElements[mSelectedIdx];
|
|
|
|
|
+ textDesc.font = mStyle->font;
|
|
|
|
|
+ textDesc.fontSize = mStyle->fontSize;
|
|
|
|
|
+
|
|
|
|
|
+ Rect textBounds = getContentBounds();
|
|
|
|
|
+
|
|
|
|
|
+ textDesc.width = textBounds.width;
|
|
|
|
|
+ textDesc.height = textBounds.height;
|
|
|
|
|
+ textDesc.horzAlign = mStyle->textHorzAlign;
|
|
|
|
|
+ textDesc.vertAlign = mStyle->textVertAlign;
|
|
|
|
|
+
|
|
|
|
|
+ return textDesc;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|