Просмотр исходного кода

Added a way to specify a texture along with text for GUIButton

Marko Pintera 12 лет назад
Родитель
Сommit
81010a9c66

+ 2 - 5
BansheeEngine/Include/BsEngineGUI.h

@@ -77,12 +77,9 @@ namespace BansheeEngine
 		static const CM::String DropDownBoxEntryHoverTex;
 
 		static const CM::String DropDownBoxBtnUpNormalTex;
-		static const CM::String DropDownBoxBtnUpHoverTex;
-
 		static const CM::String DropDownBoxBtnDownNormalTex;
-		static const CM::String DropDownBoxBtnDownHoverTex;
 
-		static const CM::String DropDownBoxBtnUpBgTex;
-		static const CM::String DropDownBoxBtnDownBgTex;
+		static const CM::String DropDownBoxBtnUpArrowTex;
+		static const CM::String DropDownBoxBtnDownArrowTex;
 	};
 }

+ 1 - 1
BansheeEngine/Include/BsGUIButton.h

@@ -62,8 +62,8 @@ namespace BansheeEngine
 		virtual CM::UINT32 _getRenderElementDepth(CM::UINT32 renderElementIdx) const;
 	private:
 		ImageSprite* mImageSprite;
+		ImageSprite* mContentImageSprite;
 		TextSprite* mTextSprite;
-		CM::UINT32 mNumImageRenderElements;
 
 		IMAGE_SPRITE_DESC mImageDesc;
 		GUIContent mContent;

+ 8 - 1
BansheeEngine/Include/BsGUIElementStyle.h

@@ -16,6 +16,11 @@ namespace BansheeEngine
 		CM::INT32 left, right, top, bottom;
 	};
 
+	enum class GUIImagePosition
+	{
+		Left, Right
+	};
+
 	struct BS_EXPORT GUIElementStyle
 	{
 		struct BS_EXPORT GUIElementStateStyle
@@ -27,7 +32,8 @@ namespace BansheeEngine
 		GUIElementStyle()
 			:fontSize(8), width(0), height(0),
 			fixedWidth(false), fixedHeight(false), minWidth(0), maxWidth(0),
-			minHeight(0), maxHeight(0), textHorzAlign(THA_Left), textVertAlign(TVA_Top), wordWrap(false)
+			minHeight(0), maxHeight(0), textHorzAlign(THA_Left), textVertAlign(TVA_Top), 
+			wordWrap(false), imagePosition(GUIImagePosition::Left)
 		{
 
 		}
@@ -36,6 +42,7 @@ namespace BansheeEngine
 		CM::UINT32 fontSize;
 		TextHorzAlign textHorzAlign;
 		TextVertAlign textVertAlign;
+		GUIImagePosition imagePosition;
 		bool wordWrap;
 
 		GUIElementStateStyle normal;

+ 40 - 41
BansheeEngine/Source/BsEngineGUI.cpp

@@ -75,13 +75,10 @@ namespace BansheeEngine
 	const String EngineGUI::DropDownBoxEntryHoverTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\DropDownButtonHover.psd";
 
 	const String EngineGUI::DropDownBoxBtnUpNormalTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\DropDownBoxBtnUpNormal.psd";
-	const String EngineGUI::DropDownBoxBtnUpHoverTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\DropDownBoxBtnUpHover.psd";
-
 	const String EngineGUI::DropDownBoxBtnDownNormalTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\DropDownBoxBtnDownNormal.psd";
-	const String EngineGUI::DropDownBoxBtnDownHoverTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\DropDownBoxBtnDownHover.psd";
 
-	const String EngineGUI::DropDownBoxBtnUpBgTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\DropDownBoxBtnUpBg.psd";
-	const String EngineGUI::DropDownBoxBtnDownBgTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\DropDownBoxBtnDownBg.psd";
+	const String EngineGUI::DropDownBoxBtnUpArrowTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\DropDownBoxBtnUpArrow.psd";
+	const String EngineGUI::DropDownBoxBtnDownArrowTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\DropDownBoxBtnDownArrow.psd";
 
 	const String EngineGUI::ScrollBarBgTex = "..\\..\\..\\..\\Data\\Editor\\Skin\\ScrollBarBg.psd";
 
@@ -426,13 +423,30 @@ namespace BansheeEngine
 
 		mSkin.setStyle("DropDownList", dropDownListStyle);
 
+		// DropDown scroll up button arrow
+		HTexture dropDownBtnScrollUpArrow = static_resource_cast<Texture>(Importer::instance().import(FileSystem::getCurrentPath() + "\\" + DropDownBoxBtnUpArrowTex));
+
+		GUIElementStyle dropDownScrollUpBtnArrowStyle;
+		dropDownScrollUpBtnArrowStyle.normal.texture = cm_shared_ptr<SpriteTexture, PoolAlloc>(std::cref(dropDownBtnScrollUpArrow));
+		dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
+		dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
+		dropDownScrollUpBtnArrowStyle.fixedHeight = true;
+		dropDownScrollUpBtnArrowStyle.fixedWidth = false;
+		dropDownScrollUpBtnArrowStyle.height = 7;
+		dropDownScrollUpBtnArrowStyle.width = 30;
+		dropDownScrollUpBtnArrowStyle.border.left = 1;
+		dropDownScrollUpBtnArrowStyle.border.right = 1;
+		dropDownScrollUpBtnArrowStyle.border.top = 1;
+		dropDownScrollUpBtnArrowStyle.border.bottom = 1;
+
+		mSkin.setStyle("DropDownScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
+
 		// DropDown scroll up button
 		HTexture dropDownBtnScrollUpNormal = static_resource_cast<Texture>(Importer::instance().import(FileSystem::getCurrentPath() + "\\" + DropDownBoxBtnUpNormalTex));
-		HTexture dropDownBtnScrollUpHover = static_resource_cast<Texture>(Importer::instance().import(FileSystem::getCurrentPath() + "\\" + DropDownBoxBtnUpHoverTex));
 
 		GUIElementStyle dropDownScrollUpBtnStyle;
 		dropDownScrollUpBtnStyle.normal.texture = cm_shared_ptr<SpriteTexture, PoolAlloc>(std::cref(dropDownBtnScrollUpNormal));
-		dropDownScrollUpBtnStyle.hover.texture = cm_shared_ptr<SpriteTexture, PoolAlloc>(std::cref(dropDownBtnScrollUpHover));
+		dropDownScrollUpBtnStyle.hover.texture = dropDownScrollUpBtnStyle.normal.texture;
 		dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
 		dropDownScrollUpBtnStyle.fixedHeight = true;
 		dropDownScrollUpBtnStyle.fixedWidth = false;
@@ -445,29 +459,30 @@ namespace BansheeEngine
 
 		mSkin.setStyle("DropDownScrollUpBtn", dropDownScrollUpBtnStyle);
 
-		// DropDown scroll up button background
-		HTexture dropDownBtnScrollUpBg = static_resource_cast<Texture>(Importer::instance().import(FileSystem::getCurrentPath() + "\\" + DropDownBoxBtnUpBgTex));
-
-		GUIElementStyle dropDownScrollUpBtnBgStyle;
-		dropDownScrollUpBtnBgStyle.normal.texture = cm_shared_ptr<SpriteTexture, PoolAlloc>(std::cref(dropDownBtnScrollUpBg));
-		dropDownScrollUpBtnBgStyle.fixedHeight = true;
-		dropDownScrollUpBtnBgStyle.fixedWidth = false;
-		dropDownScrollUpBtnBgStyle.height = 7;
-		dropDownScrollUpBtnBgStyle.width = 30;
-		dropDownScrollUpBtnBgStyle.border.left = 1;
-		dropDownScrollUpBtnBgStyle.border.right = 1;
-		dropDownScrollUpBtnBgStyle.border.top = 1;
-		dropDownScrollUpBtnBgStyle.border.bottom = 1;
-
-		mSkin.setStyle("DropDownScrollUpBtnBg", dropDownScrollUpBtnBgStyle);
+		// DropDown scroll down button arrow
+		HTexture dropDownBtnScrollDownArrow = static_resource_cast<Texture>(Importer::instance().import(FileSystem::getCurrentPath() + "\\" + DropDownBoxBtnDownArrowTex));
+
+		GUIElementStyle dropDownScrollDownBtnArrowStyle;
+		dropDownScrollDownBtnArrowStyle.normal.texture = cm_shared_ptr<SpriteTexture, PoolAlloc>(std::cref(dropDownBtnScrollDownArrow));
+		dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
+		dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
+		dropDownScrollDownBtnArrowStyle.fixedHeight = true;
+		dropDownScrollDownBtnArrowStyle.fixedWidth = false;
+		dropDownScrollDownBtnArrowStyle.height = 7;
+		dropDownScrollDownBtnArrowStyle.width = 30;
+		dropDownScrollDownBtnArrowStyle.border.left = 1;
+		dropDownScrollDownBtnArrowStyle.border.right = 1;
+		dropDownScrollDownBtnArrowStyle.border.top = 1;
+		dropDownScrollDownBtnArrowStyle.border.bottom = 1;
+		
+		mSkin.setStyle("DropDownScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
 
 		// DropDown scroll down button
 		HTexture dropDownBtnScrollDownNormal = static_resource_cast<Texture>(Importer::instance().import(FileSystem::getCurrentPath() + "\\" + DropDownBoxBtnDownNormalTex));
-		HTexture dropDownBtnScrollDownHover = static_resource_cast<Texture>(Importer::instance().import(FileSystem::getCurrentPath() + "\\" + DropDownBoxBtnDownHoverTex));
 
 		GUIElementStyle dropDownScrollDownBtnStyle;
 		dropDownScrollDownBtnStyle.normal.texture = cm_shared_ptr<SpriteTexture, PoolAlloc>(std::cref(dropDownBtnScrollDownNormal));
-		dropDownScrollDownBtnStyle.hover.texture = cm_shared_ptr<SpriteTexture, PoolAlloc>(std::cref(dropDownBtnScrollDownHover));
+		dropDownScrollDownBtnStyle.hover.texture = dropDownScrollDownBtnStyle.normal.texture;
 		dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
 		dropDownScrollDownBtnStyle.fixedHeight = true;
 		dropDownScrollDownBtnStyle.fixedWidth = false;
@@ -477,24 +492,8 @@ namespace BansheeEngine
 		dropDownScrollDownBtnStyle.border.right = 1;
 		dropDownScrollDownBtnStyle.border.top = 1;
 		dropDownScrollDownBtnStyle.border.bottom = 1;
-		
-		mSkin.setStyle("DropDownScrollDownBtn", dropDownScrollDownBtnStyle);
 
-		// DropDown scroll down button background
-		HTexture dropDownBtnScrollDownBg = static_resource_cast<Texture>(Importer::instance().import(FileSystem::getCurrentPath() + "\\" + DropDownBoxBtnDownBgTex));
-
-		GUIElementStyle dropDownScrollDownBtnBgStyle;
-		dropDownScrollDownBtnBgStyle.normal.texture = cm_shared_ptr<SpriteTexture, PoolAlloc>(std::cref(dropDownBtnScrollDownBg));
-		dropDownScrollDownBtnBgStyle.fixedHeight = true;
-		dropDownScrollDownBtnBgStyle.fixedWidth = false;
-		dropDownScrollDownBtnBgStyle.height = 7;
-		dropDownScrollDownBtnBgStyle.width = 30;
-		dropDownScrollDownBtnBgStyle.border.left = 1;
-		dropDownScrollDownBtnBgStyle.border.right = 1;
-		dropDownScrollDownBtnBgStyle.border.top = 1;
-		dropDownScrollDownBtnBgStyle.border.bottom = 1;
-
-		mSkin.setStyle("DropDownScrollDownBtnBg", dropDownScrollDownBtnBgStyle);
+		mSkin.setStyle("DropDownScrollDownBtn", dropDownScrollDownBtnStyle);
 		
 		// DropDown entry button
 		HTexture dropDownEntryBtnNormal = static_resource_cast<Texture>(Importer::instance().import(FileSystem::getCurrentPath() + "\\" + DropDownBoxEntryNormalTex));

+ 107 - 15
BansheeEngine/Source/BsGUIButton.cpp

@@ -19,11 +19,15 @@ namespace BansheeEngine
 	}
 
 	GUIButton::GUIButton(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mContent(content), mNumImageRenderElements(0)
+		:GUIElement(parent, style, layoutOptions), mContent(content), mContentImageSprite(nullptr)
 	{
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 		mTextSprite = cm_new<TextSprite, PoolAlloc>();
 
+		SpriteTexturePtr contentTex = content.getImage();
+		if(contentTex != nullptr)
+			mContentImageSprite = cm_new<ImageSprite, PoolAlloc>();
+
 		mImageDesc.texture = mStyle->normal.texture;
 
 		if(mImageDesc.texture != nullptr)
@@ -42,6 +46,9 @@ namespace BansheeEngine
 	{
 		cm_delete<PoolAlloc>(mTextSprite);
 		cm_delete<PoolAlloc>(mImageSprite);
+
+		if(mContentImageSprite != nullptr)
+			cm_delete<PoolAlloc>(mContentImageSprite);
 	}
 
 	GUIButton* GUIButton::create(GUIWidget& parent, const WString& text, const GUIElementStyle* style)
@@ -88,22 +95,35 @@ namespace BansheeEngine
 		UINT32 numElements = mImageSprite->getNumRenderElements();
 		numElements += mTextSprite->getNumRenderElements();
 
+		if(mContentImageSprite != nullptr)
+			numElements += mContentImageSprite->getNumRenderElements();
+
 		return numElements;
 	}
 
 	const HMaterial& GUIButton::getMaterial(UINT32 renderElementIdx) const
 	{
-		if(renderElementIdx >= mNumImageRenderElements)
-			return mTextSprite->getMaterial(mNumImageRenderElements - renderElementIdx);
+		UINT32 textSpriteIdx = mImageSprite->getNumRenderElements();
+		UINT32 contentImgSpriteIdx = textSpriteIdx + mTextSprite->getNumRenderElements();
+
+		if(renderElementIdx >= contentImgSpriteIdx)
+			return mContentImageSprite->getMaterial(contentImgSpriteIdx - renderElementIdx);
+		else if(renderElementIdx >= textSpriteIdx)
+			return mTextSprite->getMaterial(textSpriteIdx - renderElementIdx);
 		else
 			return mImageSprite->getMaterial(renderElementIdx);
 	}
 
 	UINT32 GUIButton::getNumQuads(UINT32 renderElementIdx) const
 	{
+		UINT32 textSpriteIdx = mImageSprite->getNumRenderElements();
+		UINT32 contentImgSpriteIdx = textSpriteIdx + mTextSprite->getNumRenderElements();
+
 		UINT32 numQuads = 0;
-		if(renderElementIdx >= mNumImageRenderElements)
-			numQuads = mTextSprite->getNumQuads(mNumImageRenderElements - renderElementIdx);
+		if(renderElementIdx >= contentImgSpriteIdx)
+			numQuads = mContentImageSprite->getNumQuads(contentImgSpriteIdx - renderElementIdx);
+		else if(renderElementIdx >= textSpriteIdx)
+			numQuads = mTextSprite->getNumQuads(textSpriteIdx - renderElementIdx);
 		else
 			numQuads = mImageSprite->getNumQuads(renderElementIdx);
 
@@ -116,7 +136,6 @@ namespace BansheeEngine
 		mImageDesc.height = mHeight;
 
 		mImageSprite->update(mImageDesc);
-		mNumImageRenderElements = mImageSprite->getNumRenderElements();
 
 		TEXT_SPRITE_DESC textDesc;
 		textDesc.text = mContent.getText();
@@ -132,6 +151,16 @@ namespace BansheeEngine
 
 		mTextSprite->update(textDesc);
 
+		if(mContentImageSprite != nullptr)
+		{
+			IMAGE_SPRITE_DESC contentImgDesc;
+			contentImgDesc.texture = mContent.getImage();
+			contentImgDesc.width = mContent.getImage()->getTexture()->getWidth();
+			contentImgDesc.height = mContent.getImage()->getTexture()->getHeight();
+
+			mContentImageSprite->update(contentImgDesc);
+		}
+
 		GUIElement::updateRenderElementsInternal();
 	}
 
@@ -162,7 +191,12 @@ namespace BansheeEngine
 
 	UINT32 GUIButton::_getRenderElementDepth(UINT32 renderElementIdx) const
 	{
-		if(renderElementIdx >= mNumImageRenderElements)
+		UINT32 textSpriteIdx = mImageSprite->getNumRenderElements();
+		UINT32 contentImgSpriteIdx = textSpriteIdx + mTextSprite->getNumRenderElements();
+
+		if(renderElementIdx >= contentImgSpriteIdx)
+			return _getDepth();
+		else if(renderElementIdx >= textSpriteIdx)
 			return _getDepth();
 		else
 			return _getDepth() + 1;
@@ -171,19 +205,77 @@ namespace BansheeEngine
 	void GUIButton::fillBuffer(UINT8* vertices, UINT8* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads, 
 		UINT32 vertexStride, UINT32 indexStride, UINT32 renderElementIdx) const
 	{
-		if(renderElementIdx >= mNumImageRenderElements)
+		UINT32 textSpriteIdx = mImageSprite->getNumRenderElements();
+		UINT32 contentImgSpriteIdx = textSpriteIdx + mTextSprite->getNumRenderElements();
+
+		if(renderElementIdx < textSpriteIdx)
 		{
-			Rect textBounds = getContentBounds();
-			Int2 offset(textBounds.x, textBounds.y);
-			Rect textClipRect = getContentClipRect();
+			mImageSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, 
+				vertexStride, indexStride, renderElementIdx, mOffset, mClipRect);
 
-			mTextSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, 
-			vertexStride, indexStride, mNumImageRenderElements - renderElementIdx, offset, textClipRect);
+			return;
+		}
+
+		Rect contentBounds = getContentBounds();
+		Rect contentClipRect = getContentClipRect();
+		Rect textBounds = mTextSprite->getBounds(Int2(), Rect());
+
+		Int2 textOffset;
+		Rect textClipRect;
+
+		Int2 imageOffset;
+		Rect imageClipRect;
+		if(mContentImageSprite != nullptr)
+		{
+			Rect imageBounds = mContentImageSprite->getBounds(Int2(), Rect());
+			UINT32 freeWidth = (UINT32)std::max(0, contentBounds.width - textBounds.width - imageBounds.width);
+			INT32 imageXOffset = (INT32)(freeWidth / 2);
+
+			if(mStyle->imagePosition == GUIImagePosition::Right)
+			{
+				INT32 imageReservedWidth = std::max(0, contentBounds.width - textBounds.width);
+
+				textOffset = Int2(contentBounds.x, contentBounds.y);
+				textClipRect = contentClipRect;
+				textClipRect.width = std::min(contentBounds.width - imageReservedWidth, textClipRect.width);
+
+				imageOffset = Int2(contentBounds.x + textBounds.width + imageXOffset, contentBounds.y);
+				imageClipRect = contentClipRect;
+				imageClipRect.x -= textBounds.width + imageXOffset;
+			}
+			else
+			{
+				INT32 imageReservedWidth = imageBounds.width + imageXOffset;
+
+				imageOffset = Int2(contentBounds.x + imageXOffset, contentBounds.y);
+				imageClipRect = contentClipRect;
+				imageClipRect.x -= imageXOffset;
+				imageClipRect.width = std::min(imageReservedWidth, imageClipRect.width);
+
+				textOffset = Int2(contentBounds.x + imageReservedWidth, contentBounds.y);
+				textClipRect = contentClipRect;
+				textClipRect.x -= imageReservedWidth;
+			}
+
+			INT32 imageYOffset = (contentBounds.height - imageBounds.height) / 2;
+			imageClipRect.y -= imageYOffset;
+			imageOffset.y += imageYOffset;
 		}
 		else
 		{
-			mImageSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, 
-			vertexStride, indexStride, renderElementIdx, mOffset, mClipRect);
+			textOffset = Int2(contentBounds.x, contentBounds.y);
+			textClipRect = contentClipRect;
+		}
+
+		if(renderElementIdx >= contentImgSpriteIdx)
+		{
+			mContentImageSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, 
+				vertexStride, indexStride, contentImgSpriteIdx - renderElementIdx, imageOffset, imageClipRect);
+		}
+		else
+		{
+			mTextSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, 
+			vertexStride, indexStride, textSpriteIdx - renderElementIdx, textOffset, textClipRect);
 		}
 	}
 

+ 6 - 14
BansheeEngine/Source/BsGUIDropDownBox.cpp

@@ -61,8 +61,8 @@ namespace BansheeEngine
 		UINT32 contentWidth = (UINT32)std::max(0, (INT32)width - (INT32)dropDownBoxStyle->margins.left - (INT32)dropDownBoxStyle->margins.right);
 
 		// Determine y position and whether to open upward or downward
-		UINT32 scrollButtonUpHeight = EngineGUI::instance().getSkin().getStyle("DropDownScrollUpBtnBg")->height;
-		UINT32 scrollButtonDownHeight = EngineGUI::instance().getSkin().getStyle("DropDownScrollDownBtnBg")->height;
+		UINT32 scrollButtonUpHeight = EngineGUI::instance().getSkin().getStyle("DropDownScrollUpBtn")->height;
+		UINT32 scrollButtonDownHeight = EngineGUI::instance().getSkin().getStyle("DropDownScrollDownBtn")->height;
 		UINT32 helperElementHeight = scrollButtonUpHeight + scrollButtonDownHeight + dropDownBoxStyle->margins.top + dropDownBoxStyle->margins.bottom;
 		UINT32 elementButtonHeight = EngineGUI::instance().getSkin().getStyle("DropDownEntryBtn")->height;
 
@@ -100,14 +100,10 @@ namespace BansheeEngine
 		UINT32 totalHeight = contentAreaHeight + helperElementHeight; 
 		
 		// Scroll up buttons
-		GUIArea* scrollUpBtnBgArea = GUIArea::create(*this, position.x + dropDownBoxStyle->margins.left, position.y, contentWidth, scrollButtonUpHeight);
-		scrollUpBtnBgArea->setDepth(101);
-		scrollUpBtnBgArea->getLayout().addElement(GUITexture::create(*this, GUIImageScaleMode::ScaleToFit, 
-			EngineGUI::instance().getSkin().getStyle("DropDownScrollUpBtnBg")));
-
 		GUIArea* scrollUpBtnArea = GUIArea::create(*this, position.x + dropDownBoxStyle->margins.left, position.y, contentWidth, scrollButtonUpHeight);
 		scrollUpBtnArea->setDepth(100);
-		GUIButton* scrollUpBtn = GUIButton::create(*this, L"", EngineGUI::instance().getSkin().getStyle("DropDownScrollUpBtn"));
+		const GUIElementStyle* scrollUpBtnArrow = EngineGUI::instance().getSkin().getStyle("DropDownScrollUpBtnArrow");
+		GUIButton* scrollUpBtn = GUIButton::create(*this, GUIContent(L"", scrollUpBtnArrow->normal.texture), EngineGUI::instance().getSkin().getStyle("DropDownScrollUpBtn"));
 		scrollUpBtnArea->getLayout().addElement(scrollUpBtn);
 
 		// Entry buttons
@@ -131,16 +127,12 @@ namespace BansheeEngine
 
 		// Scroll down buttons
 		UINT32 scrollBtnDownOffset = position.y + contentAreaYOffset + contentAreaHeight;
-		GUIArea* scrollDownBtnBgArea = GUIArea::create(*this, position.x + dropDownBoxStyle->margins.left, 
-			scrollBtnDownOffset, contentWidth, scrollButtonDownHeight);
-		scrollDownBtnBgArea->setDepth(101);
-		scrollDownBtnBgArea->getLayout().addElement(GUITexture::create(*this, GUIImageScaleMode::ScaleToFit, 
-			EngineGUI::instance().getSkin().getStyle("DropDownScrollDownBtnBg")));
 
 		GUIArea* scrollDownBtnArea = GUIArea::create(*this, position.x + dropDownBoxStyle->margins.left, 
 			scrollBtnDownOffset, contentWidth, scrollButtonDownHeight);
 		scrollDownBtnArea->setDepth(100);
-		GUIButton* scrollDownBtn = GUIButton::create(*this, L"", EngineGUI::instance().getSkin().getStyle("DropDownScrollDownBtn"));
+		const GUIElementStyle* scrollDownBtnArrow = EngineGUI::instance().getSkin().getStyle("DropDownScrollDownBtnArrow");
+		GUIButton* scrollDownBtn = GUIButton::create(*this, GUIContent(L"", scrollDownBtnArrow->normal.texture), EngineGUI::instance().getSkin().getStyle("DropDownScrollDownBtn"));
 		scrollDownBtnArea->getLayout().addElement(scrollDownBtn);
 		
 		// Background frame

+ 1 - 1
BansheeEngine/Source/BsGUIElement.cpp

@@ -175,7 +175,7 @@ namespace BansheeEngine
 		Rect contentClipRect(offsetDiff.x, offsetDiff.y, contentBounds.width, contentBounds.height);
 		contentClipRect.clip(mClipRect);
 
-		// Transform into text sprite space
+		// Transform into content sprite space
 		contentClipRect.x -= offsetDiff.x;
 		contentClipRect.y -= offsetDiff.y;
 

+ 4 - 4
BansheeEngine/Source/BsGUIManager.cpp

@@ -623,10 +623,10 @@ namespace BansheeEngine
 			// Close drop down box if user clicks outside the drop down box
 			if(mDropDownBoxActive)
 			{
-				if(mMouseOverElement == nullptr || (&mMouseOverElement->_getParentWidget() != mDropDownBox.get()))
-				{
-					closeDropDownBox(-1);
-				}
+				//if(mMouseOverElement == nullptr || (&mMouseOverElement->_getParentWidget() != mDropDownBox.get()))
+				//{
+				//	closeDropDownBox(-1);
+				//}
 			}
 		}
 	}

+ 5 - 0
DropDown.txt

@@ -1,6 +1,11 @@
 Add support for images on buttons. Replace dropdownbox scroll buttons with that.
 Drop down box gets closed the same frame it was opened on! Need to delay the close one frame.
 
+GUI ignores image in GUIContent for most elements.
+ - Also I don't have a way of specifiying drop down box skin. It always uses whichever skin is active but this might be a problem when
+   the user wants his own skin for the game and I want my own skin for the editor. I might want to cache the active skin on DropDownList initialization
+   and then provide it to GUIManager::openDropDownBox.
+
 Immediate TODO:
  - Add support for images in GUIButton
    - With placement options (left/right of the text)

+ 2 - 0
Notes.txt

@@ -23,6 +23,8 @@ Reminders:
   - When specifying GUIElement layout using (for example) GUILayoutOptions::expandableX then it would be useful if I didn't have to provide the Y height, and instead make it use 
     the default value for that GUIElement type. For most elements I will only be changing width, and height will remain default (labels, buttons, toggles, drop down lists, etc.) 
 	so this would be helpful in a way I wouldn't need to look up actual element height in EngineGUI.
+  - GUI currently ignores tooltips in GUIContent. 
+  - A way to initialize BansheeEngine without RenderSystem or any kind of UI. So that it may be used for server building as well.
 
 Potential optimizations:
  - bulkPixelConversion is EXTREMELY poorly unoptimized. Each pixel it calls a separate method that does redudant operations every pixel.