فهرست منبع

Added GUIContent so I can more easily specific contents for various GUIElements that might need text/image/tooltip/etc

Marko Pintera 12 سال پیش
والد
کامیت
35072da756

+ 2 - 0
BansheeEngine/BansheeEngine.vcxproj

@@ -235,6 +235,7 @@
     <ClInclude Include="Include\BsGUIArea.h" />
     <ClInclude Include="Include\BsGUIArea.h" />
     <ClInclude Include="Include\BsGUIButton.h" />
     <ClInclude Include="Include\BsGUIButton.h" />
     <ClInclude Include="Include\BsGUICommandEvent.h" />
     <ClInclude Include="Include\BsGUICommandEvent.h" />
+    <ClInclude Include="Include\BsGUIContent.h" />
     <ClInclude Include="Include\BsGUIDropDownBox.h" />
     <ClInclude Include="Include\BsGUIDropDownBox.h" />
     <ClInclude Include="Include\BsGUIDropDownList.h" />
     <ClInclude Include="Include\BsGUIDropDownList.h" />
     <ClInclude Include="Include\BsGUIElementBase.h" />
     <ClInclude Include="Include\BsGUIElementBase.h" />
@@ -292,6 +293,7 @@
     <ClCompile Include="Source\BsEngineGUI.cpp" />
     <ClCompile Include="Source\BsEngineGUI.cpp" />
     <ClCompile Include="Source\BsGUIArea.cpp" />
     <ClCompile Include="Source\BsGUIArea.cpp" />
     <ClCompile Include="Source\BsGUIButton.cpp" />
     <ClCompile Include="Source\BsGUIButton.cpp" />
+    <ClCompile Include="Source\BsGUIContent.cpp" />
     <ClCompile Include="Source\BsGUIDropDownBox.cpp" />
     <ClCompile Include="Source\BsGUIDropDownBox.cpp" />
     <ClCompile Include="Source\BsGUIDropDownList.cpp" />
     <ClCompile Include="Source\BsGUIDropDownList.cpp" />
     <ClCompile Include="Source\BsGUIElement.cpp" />
     <ClCompile Include="Source\BsGUIElement.cpp" />

+ 6 - 0
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -204,6 +204,9 @@
     <ClInclude Include="Include\BsGUIDropDownBox.h">
     <ClInclude Include="Include\BsGUIDropDownBox.h">
       <Filter>Header Files\GUI</Filter>
       <Filter>Header Files\GUI</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\BsGUIContent.h">
+      <Filter>Header Files\GUI</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsGUIElement.cpp">
     <ClCompile Include="Source\BsGUIElement.cpp">
@@ -353,5 +356,8 @@
     <ClCompile Include="Source\BsGUIDropDownBox.cpp">
     <ClCompile Include="Source\BsGUIDropDownBox.cpp">
       <Filter>Source Files\GUI</Filter>
       <Filter>Source Files\GUI</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\BsGUIContent.cpp">
+      <Filter>Source Files\GUI</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 7 - 3
BansheeEngine/Include/BsGUIButton.h

@@ -3,6 +3,7 @@
 #include "BsPrerequisites.h"
 #include "BsPrerequisites.h"
 #include "BsGUIElement.h"
 #include "BsGUIElement.h"
 #include "BsImageSprite.h"
 #include "BsImageSprite.h"
+#include "BsGUIContent.h"
 #include "boost/signal.hpp"
 #include "boost/signal.hpp"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
@@ -14,8 +15,11 @@ namespace BansheeEngine
 
 
 		static GUIButton* create(GUIWidget& parent, const CM::WString& text, const GUIElementStyle* style = nullptr);
 		static GUIButton* create(GUIWidget& parent, const CM::WString& text, const GUIElementStyle* style = nullptr);
 		static GUIButton* create(GUIWidget& parent, const CM::WString& text, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 		static GUIButton* create(GUIWidget& parent, const CM::WString& text, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+
+		static GUIButton* create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style = nullptr);
+		static GUIButton* create(GUIWidget& parent, const GUIContent& content, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 	
 	
-		void setText(const CM::WString& text);
+		void setContent(const GUIContent& content);
 
 
 		boost::signal<void()> onClick;
 		boost::signal<void()> onClick;
 	protected:
 	protected:
@@ -62,9 +66,9 @@ namespace BansheeEngine
 		CM::UINT32 mNumImageRenderElements;
 		CM::UINT32 mNumImageRenderElements;
 
 
 		IMAGE_SPRITE_DESC mImageDesc;
 		IMAGE_SPRITE_DESC mImageDesc;
-		CM::WString mText;
+		GUIContent mContent;
 
 
-		GUIButton(GUIWidget& parent, const GUIElementStyle* style, const CM::WString& text, const GUILayoutOptions& layoutOptions);
+		GUIButton(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions);
 
 
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 	};
 	};

+ 27 - 0
BansheeEngine/Include/BsGUIContent.h

@@ -0,0 +1,27 @@
+#pragma once
+#include "BsPrerequisites.h"
+
+namespace BansheeEngine
+{
+	class BS_EXPORT GUIContent
+	{
+	public:
+		GUIContent(const CM::WString& text);
+		GUIContent(const CM::WString& text, const CM::WString& tooltip);
+
+		GUIContent(const SpriteTexturePtr& image);
+		GUIContent(const SpriteTexturePtr& image, const CM::WString& tooltip);
+
+		GUIContent(const CM::WString& text, const SpriteTexturePtr& image);
+		GUIContent(const CM::WString& text, const SpriteTexturePtr& image, const CM::WString& tooltip);
+
+		const CM::WString& getText() const { return mText; }
+		const SpriteTexturePtr& getImage() const { return mImage; }
+		const CM::WString& getTooltip() const { return mTooltipText; }
+
+	private:
+		CM::WString mText;
+		SpriteTexturePtr mImage;
+		CM::WString mTooltipText;
+	};
+}

+ 7 - 3
BansheeEngine/Include/BsGUILabel.h

@@ -3,6 +3,7 @@
 #include "BsPrerequisites.h"
 #include "BsPrerequisites.h"
 #include "BsGUIElement.h"
 #include "BsGUIElement.h"
 #include "BsTextSprite.h"
 #include "BsTextSprite.h"
+#include "BsGUIContent.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -14,7 +15,10 @@ namespace BansheeEngine
 		static GUILabel* create(GUIWidget& parent, const CM::WString& text, const GUIElementStyle* style = nullptr);
 		static GUILabel* create(GUIWidget& parent, const CM::WString& text, const GUIElementStyle* style = nullptr);
 		static GUILabel* create(GUIWidget& parent, const CM::WString& text, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 		static GUILabel* create(GUIWidget& parent, const CM::WString& text, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style = nullptr);
 
 
-		void setText(const CM::WString& text);
+		static GUILabel* create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style = nullptr);
+		static GUILabel* create(GUIWidget& parent, const GUIContent& content, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style = nullptr);
+
+		void setContent(const GUIContent& content);
 
 
 	protected:
 	protected:
 		~GUILabel();
 		~GUILabel();
@@ -54,10 +58,10 @@ namespace BansheeEngine
 		virtual CM::UINT32 _getOptimalHeight() const;
 		virtual CM::UINT32 _getOptimalHeight() const;
 	private:
 	private:
 		TextSprite* mTextSprite;
 		TextSprite* mTextSprite;
-		CM::WString mText;
+		GUIContent mContent;
 
 
 		TEXT_SPRITE_DESC mDesc;
 		TEXT_SPRITE_DESC mDesc;
 		
 		
-		GUILabel(GUIWidget& parent, const GUIElementStyle* style, const CM::WString& text, const GUILayoutOptions& layoutOptions);
+		GUILabel(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions);
 	};
 	};
 }
 }

+ 9 - 2
BansheeEngine/Include/BsGUIToggle.h

@@ -4,6 +4,7 @@
 #include "BsGUIElement.h"
 #include "BsGUIElement.h"
 #include "BsGUIToggleGroup.h"
 #include "BsGUIToggleGroup.h"
 #include "BsImageSprite.h"
 #include "BsImageSprite.h"
+#include "BsGUIContent.h"
 #include "boost/signal.hpp"
 #include "boost/signal.hpp"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
@@ -19,6 +20,12 @@ namespace BansheeEngine
 		static GUIToggle* create(GUIWidget& parent, const CM::WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
 		static GUIToggle* create(GUIWidget& parent, const CM::WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
 		static GUIToggle* create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const CM::WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
 		static GUIToggle* create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const CM::WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
 
 
+		static GUIToggle* create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const GUIContent& content, const GUIElementStyle* style = nullptr);
+
+		static GUIToggle* create(GUIWidget& parent, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
+		static GUIToggle* create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style = nullptr);
+
 		static std::shared_ptr<GUIToggleGroup> createToggleGroup();
 		static std::shared_ptr<GUIToggleGroup> createToggleGroup();
 
 
 		void toggleOn();
 		void toggleOn();
@@ -66,7 +73,7 @@ namespace BansheeEngine
 
 
 		virtual CM::UINT32 _getRenderElementDepth(CM::UINT32 renderElementIdx) const;
 		virtual CM::UINT32 _getRenderElementDepth(CM::UINT32 renderElementIdx) const;
 	protected:
 	protected:
-		GUIToggle(GUIWidget& parent, const GUIElementStyle* style, const CM::WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions);
+		GUIToggle(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions);
 
 
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 		virtual bool mouseEvent(const GUIMouseEvent& ev);
 
 
@@ -78,6 +85,6 @@ namespace BansheeEngine
 		bool mIsToggled;
 		bool mIsToggled;
 
 
 		IMAGE_SPRITE_DESC mImageDesc;
 		IMAGE_SPRITE_DESC mImageDesc;
-		CM::WString mText;
+		GUIContent mContent;
 	};
 	};
 }
 }

+ 1 - 0
BansheeEngine/Include/BsPrerequisites.h

@@ -56,6 +56,7 @@ namespace BansheeEngine
 	class GUIDropDownList;
 	class GUIDropDownList;
 	class GUIDropDownBox;
 	class GUIDropDownBox;
 	class DragAndDropManager;
 	class DragAndDropManager;
+	class GUIContent;
 
 
 	// 2D
 	// 2D
 	class TextSprite;
 	class TextSprite;

+ 18 - 8
BansheeEngine/Source/BsGUIButton.cpp

@@ -18,8 +18,8 @@ namespace BansheeEngine
 		return name;
 		return name;
 	}
 	}
 
 
-	GUIButton::GUIButton(GUIWidget& parent, const GUIElementStyle* style, const WString& text, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mText(text), mNumImageRenderElements(0)
+	GUIButton::GUIButton(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+		:GUIElement(parent, style, layoutOptions), mContent(content), mNumImageRenderElements(0)
 	{
 	{
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 		mTextSprite = cm_new<TextSprite, PoolAlloc>();
 		mTextSprite = cm_new<TextSprite, PoolAlloc>();
@@ -45,6 +45,16 @@ namespace BansheeEngine
 	}
 	}
 
 
 	GUIButton* GUIButton::create(GUIWidget& parent, const WString& text, const GUIElementStyle* style)
 	GUIButton* GUIButton::create(GUIWidget& parent, const WString& text, const GUIElementStyle* style)
+	{
+		return create(parent, GUIContent(text), style);
+	}
+
+	GUIButton* GUIButton::create(GUIWidget& parent, const WString& text, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style)
+	{
+		return create(parent, GUIContent(text), layoutOptions, style);
+	}
+
+	GUIButton* GUIButton::create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style)
 	{
 	{
 		if(style == nullptr)
 		if(style == nullptr)
 		{
 		{
@@ -52,10 +62,10 @@ namespace BansheeEngine
 			style = skin->getStyle(getGUITypeName());
 			style = skin->getStyle(getGUITypeName());
 		}
 		}
 
 
-		return new (cm_alloc<GUIButton, PoolAlloc>()) GUIButton(parent, style, text, getDefaultLayoutOptions(style));
+		return new (cm_alloc<GUIButton, PoolAlloc>()) GUIButton(parent, style, content, getDefaultLayoutOptions(style));
 	}
 	}
 
 
-	GUIButton* GUIButton::create(GUIWidget& parent, const WString& text, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style)
+	GUIButton* GUIButton::create(GUIWidget& parent, const GUIContent& content, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style)
 	{
 	{
 		if(style == nullptr)
 		if(style == nullptr)
 		{
 		{
@@ -63,12 +73,12 @@ namespace BansheeEngine
 			style = skin->getStyle(getGUITypeName());
 			style = skin->getStyle(getGUITypeName());
 		}
 		}
 
 
-		return new (cm_alloc<GUIButton, PoolAlloc>()) GUIButton(parent, style, text, layoutOptions);
+		return new (cm_alloc<GUIButton, PoolAlloc>()) GUIButton(parent, style, content, layoutOptions);
 	}
 	}
 
 
-	void GUIButton::setText(const CM::WString& text)
+	void GUIButton::setContent(const GUIContent& content)
 	{
 	{
-		mText = text;
+		mContent = content;
 
 
 		markContentAsDirty();
 		markContentAsDirty();
 	}
 	}
@@ -109,7 +119,7 @@ namespace BansheeEngine
 		mNumImageRenderElements = mImageSprite->getNumRenderElements();
 		mNumImageRenderElements = mImageSprite->getNumRenderElements();
 
 
 		TEXT_SPRITE_DESC textDesc;
 		TEXT_SPRITE_DESC textDesc;
-		textDesc.text = mText;
+		textDesc.text = mContent.getText();
 		textDesc.font = mStyle->font;
 		textDesc.font = mStyle->font;
 		textDesc.fontSize = mStyle->fontSize;
 		textDesc.fontSize = mStyle->fontSize;
 
 

+ 30 - 0
BansheeEngine/Source/BsGUIContent.cpp

@@ -0,0 +1,30 @@
+#include "BsGUIContent.h"
+
+using namespace CamelotFramework;
+
+namespace BansheeEngine
+{
+	GUIContent::GUIContent(const CM::WString& text)
+		:mText(text)
+	{ }
+
+	GUIContent::GUIContent(const CM::WString& text, const CM::WString& tooltip)
+		:mText(text), mTooltipText(tooltip)
+	{ }
+
+	GUIContent::GUIContent(const SpriteTexturePtr& image)
+		:mImage(image)
+	{ }
+
+	GUIContent::GUIContent(const SpriteTexturePtr& image, const CM::WString& tooltip)
+		:mImage(image), mTooltipText(tooltip)
+	{ }
+
+	GUIContent::GUIContent(const CM::WString& text, const SpriteTexturePtr& image)
+		:mText(text), mImage(image)
+	{ }
+
+	GUIContent::GUIContent(const CM::WString& text, const SpriteTexturePtr& image, const CM::WString& tooltip)
+		:mText(text), mImage(image), mTooltipText(tooltip)
+	{ }
+}

+ 3 - 2
BansheeEngine/Source/BsGUIDropDownBox.cpp

@@ -4,6 +4,7 @@
 #include "BsGUITexture.h"
 #include "BsGUITexture.h"
 #include "BsGUIButton.h"
 #include "BsGUIButton.h"
 #include "BsEngineGUI.h"
 #include "BsEngineGUI.h"
+#include "BsGUIContent.h"
 #include "CmViewport.h"
 #include "CmViewport.h"
 #include "BsGUIDropDownList.h"
 #include "BsGUIDropDownList.h"
 
 
@@ -161,7 +162,7 @@ namespace BansheeEngine
 		UINT32 i = mDropDownStartIdx;
 		UINT32 i = mDropDownStartIdx;
 		for(auto& button : mDropDownElementButtons)
 		for(auto& button : mDropDownElementButtons)
 		{
 		{
-			button->setText(mDropDownElements[i]);
+			button->setContent(GUIContent(mDropDownElements[i]));
 			i++;
 			i++;
 		}
 		}
 	}
 	}
@@ -177,7 +178,7 @@ namespace BansheeEngine
 		UINT32 i = mDropDownStartIdx;
 		UINT32 i = mDropDownStartIdx;
 		for(auto& button : mDropDownElementButtons)
 		for(auto& button : mDropDownElementButtons)
 		{
 		{
-			button->setText(mDropDownElements[i]);
+			button->setContent(GUIContent(mDropDownElements[i]));
 			i++;
 			i++;
 		}
 		}
 	}
 	}

+ 19 - 8
BansheeEngine/Source/BsGUILabel.cpp

@@ -10,12 +10,12 @@ using namespace CamelotFramework;
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	GUILabel::GUILabel(GUIWidget& parent, const GUIElementStyle* style, const WString& text, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mText(text)
+	GUILabel::GUILabel(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, const GUILayoutOptions& layoutOptions)
+		:GUIElement(parent, style, layoutOptions), mContent(content)
 	{
 	{
 		mTextSprite = cm_new<TextSprite, PoolAlloc>();
 		mTextSprite = cm_new<TextSprite, PoolAlloc>();
 
 
-		mDesc.text = text;
+		mDesc.text = content.getText();
 		mDesc.font = mStyle->font;
 		mDesc.font = mStyle->font;
 		mDesc.fontSize = mStyle->fontSize;
 		mDesc.fontSize = mStyle->fontSize;
 		mDesc.wordWrap = mStyle->wordWrap;
 		mDesc.wordWrap = mStyle->wordWrap;
@@ -102,14 +102,25 @@ namespace BansheeEngine
 		mTextSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, vertexStride, indexStride, renderElementIdx, mOffset, mClipRect);
 		mTextSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, vertexStride, indexStride, renderElementIdx, mOffset, mClipRect);
 	}
 	}
 
 
-	void GUILabel::setText(const CM::WString& text)
+	void GUILabel::setContent(const GUIContent& content)
 	{
 	{
-		mDesc.text = text;
+		mContent = content;
+		mDesc.text = content.getText();
 
 
 		markContentAsDirty();
 		markContentAsDirty();
 	}
 	}
 
 
 	GUILabel* GUILabel::create(GUIWidget& parent, const WString& text, const GUIElementStyle* style)
 	GUILabel* GUILabel::create(GUIWidget& parent, const WString& text, const GUIElementStyle* style)
+	{
+		return create(parent, GUIContent(text), style);
+	}
+
+	GUILabel* GUILabel::create(GUIWidget& parent, const WString& text, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style)
+	{
+		return create(parent, GUIContent(text), layoutOptions, style);
+	}
+
+	GUILabel* GUILabel::create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style)
 	{
 	{
 		if(style == nullptr)
 		if(style == nullptr)
 		{
 		{
@@ -117,10 +128,10 @@ namespace BansheeEngine
 			style = skin->getStyle(getGUITypeName());
 			style = skin->getStyle(getGUITypeName());
 		}
 		}
 
 
-		return new (cm_alloc<GUILabel, PoolAlloc>()) GUILabel(parent, style, text, getDefaultLayoutOptions(style));
+		return new (cm_alloc<GUILabel, PoolAlloc>()) GUILabel(parent, style, content, getDefaultLayoutOptions(style));
 	}
 	}
 
 
-	GUILabel* GUILabel::create(GUIWidget& parent, const WString& text, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style)
+	GUILabel* GUILabel::create(GUIWidget& parent, const GUIContent& content, const GUILayoutOptions& layoutOptions, const GUIElementStyle* style)
 	{
 	{
 		if(style == nullptr)
 		if(style == nullptr)
 		{
 		{
@@ -128,7 +139,7 @@ namespace BansheeEngine
 			style = skin->getStyle(getGUITypeName());
 			style = skin->getStyle(getGUITypeName());
 		}
 		}
 
 
-		return new (cm_alloc<GUILabel, PoolAlloc>()) GUILabel(parent, style, text, layoutOptions);
+		return new (cm_alloc<GUILabel, PoolAlloc>()) GUILabel(parent, style, content, layoutOptions);
 	}
 	}
 
 
 	const String& GUILabel::getGUITypeName()
 	const String& GUILabel::getGUITypeName()

+ 30 - 10
BansheeEngine/Source/BsGUIToggle.cpp

@@ -19,8 +19,8 @@ namespace BansheeEngine
 		return name;
 		return name;
 	}
 	}
 
 
-	GUIToggle::GUIToggle(GUIWidget& parent, const GUIElementStyle* style, const WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions)
-		:GUIElement(parent, style, layoutOptions), mText(text), mNumImageRenderElements(0), mIsToggled(false), mToggleGroup(nullptr)
+	GUIToggle::GUIToggle(GUIWidget& parent, const GUIElementStyle* style, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUILayoutOptions& layoutOptions)
+		:GUIElement(parent, style, layoutOptions), mContent(content), mNumImageRenderElements(0), mIsToggled(false), mToggleGroup(nullptr)
 	{
 	{
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 		mImageSprite = cm_new<ImageSprite, PoolAlloc>();
 		mTextSprite = cm_new<TextSprite, PoolAlloc>();
 		mTextSprite = cm_new<TextSprite, PoolAlloc>();
@@ -54,6 +54,26 @@ namespace BansheeEngine
 	}
 	}
 
 
 	GUIToggle* GUIToggle::create(GUIWidget& parent, const WString& text, const GUIElementStyle* style)
 	GUIToggle* GUIToggle::create(GUIWidget& parent, const WString& text, const GUIElementStyle* style)
+	{
+		return create(parent, GUIContent(text), style);
+	}
+
+	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const WString& text, const GUIElementStyle* style)
+	{
+		return create(parent, layoutOptions, GUIContent(text), style);
+	}
+
+	GUIToggle* GUIToggle::create(GUIWidget& parent, const WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
+	{
+		return create(parent, GUIContent(text), toggleGroup, style);
+	}
+
+	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
+	{
+		return create(parent, layoutOptions, GUIContent(text), toggleGroup, style);
+	}
+
+	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUIContent& content, const GUIElementStyle* style)
 	{
 	{
 		if(style == nullptr)
 		if(style == nullptr)
 		{
 		{
@@ -61,10 +81,10 @@ namespace BansheeEngine
 			style = skin->getStyle(getGUITypeName());
 			style = skin->getStyle(getGUITypeName());
 		}
 		}
 
 
-		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, text, nullptr, getDefaultLayoutOptions(style));
+		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, content, nullptr, getDefaultLayoutOptions(style));
 	}
 	}
 
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const WString& text, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const GUIContent& content, const GUIElementStyle* style)
 	{
 	{
 		if(style == nullptr)
 		if(style == nullptr)
 		{
 		{
@@ -72,10 +92,10 @@ namespace BansheeEngine
 			style = skin->getStyle(getGUITypeName());
 			style = skin->getStyle(getGUITypeName());
 		}
 		}
 
 
-		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, text, nullptr, layoutOptions);
+		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, content, nullptr, layoutOptions);
 	}
 	}
 
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
 	{
 	{
 		if(style == nullptr)
 		if(style == nullptr)
 		{
 		{
@@ -83,10 +103,10 @@ namespace BansheeEngine
 			style = skin->getStyle(getGUITypeName());
 			style = skin->getStyle(getGUITypeName());
 		}
 		}
 
 
-		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, text, toggleGroup, getDefaultLayoutOptions(style));
+		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, content, toggleGroup, getDefaultLayoutOptions(style));
 	}
 	}
 
 
-	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const WString& text, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
+	GUIToggle* GUIToggle::create(GUIWidget& parent, const GUILayoutOptions& layoutOptions, const GUIContent& content, std::shared_ptr<GUIToggleGroup> toggleGroup, const GUIElementStyle* style)
 	{
 	{
 		if(style == nullptr)
 		if(style == nullptr)
 		{
 		{
@@ -94,7 +114,7 @@ namespace BansheeEngine
 			style = skin->getStyle(getGUITypeName());
 			style = skin->getStyle(getGUITypeName());
 		}
 		}
 
 
-		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, text, toggleGroup, layoutOptions);
+		return new (cm_alloc<GUIToggle, PoolAlloc>()) GUIToggle(parent, style, content, toggleGroup, layoutOptions);
 	}
 	}
 
 
 	std::shared_ptr<GUIToggleGroup> GUIToggle::createToggleGroup()
 	std::shared_ptr<GUIToggleGroup> GUIToggle::createToggleGroup()
@@ -227,7 +247,7 @@ namespace BansheeEngine
 		mNumImageRenderElements = mImageSprite->getNumRenderElements();
 		mNumImageRenderElements = mImageSprite->getNumRenderElements();
 
 
 		TEXT_SPRITE_DESC textDesc;
 		TEXT_SPRITE_DESC textDesc;
-		textDesc.text = mText;
+		textDesc.text = mContent.getText();
 		textDesc.font = mStyle->font;
 		textDesc.font = mStyle->font;
 		textDesc.fontSize = mStyle->fontSize;
 		textDesc.fontSize = mStyle->fontSize;
 
 

+ 14 - 0
CSharpWrap.txt

@@ -45,3 +45,17 @@ Systems:
  - Debug
  - Debug
  - Input
  - Input
  - Time
  - Time
+
+
+ -----------------
+
+ Notes:
+  - I will need RequireComponent[] attribute. This attribute should automatically add the specified class to the wanted
+    GameObject. This is useful if you suddenly decide your class is now dependant on another, but you would otherwise have to manually
+	go through all instances of that GameObject in scene and add the required component.
+	  - HOWEVER, a more generic way of doing this (maybe using prefabs) would be useful. Because what happens when a class suddenly becomes
+	    dependant on a resource, or a specific instance of a class? In that case we cannot use RequireComponent.
+  - Use FrameUpdate[QueueIdx], OnCreate[QueueIdx], OnDestroy[QueueIdx] attributes to signify to the scripting system when to execute
+    certain methods. QueueIdx allows you to specify the order in which these methods will be called. In Unity you have Awake and Start methods
+	for initialization, but here you may just specify OnCreate[0] and OnCreate[1].
+	  - I will likely need C++ equivalents of these queues because C++ components will also require such ordering. 

+ 2 - 1
CamelotClient/Source/CmTestTextSprite.cpp

@@ -20,6 +20,7 @@
 #include "BsCamera.h"
 #include "BsCamera.h"
 #include "CmInput.h"
 #include "CmInput.h"
 #include "CmPlatform.h"
 #include "CmPlatform.h"
+#include "BsGUIContent.h"
 
 
 using namespace BansheeEngine;
 using namespace BansheeEngine;
 
 
@@ -57,6 +58,6 @@ namespace CamelotFramework
 	{
 	{
 		WString value = toWString(toString(Input::instance().getMousePosition().x) + " - " + toString(Input::instance().getMousePosition().y));
 		WString value = toWString(toString(Input::instance().getMousePosition().x) + " - " + toString(Input::instance().getMousePosition().y));
 
 
-		mLabel->setText(value);
+		mLabel->setContent(GUIContent(value));
 	}
 	}
 }
 }

+ 21 - 1
DropDown.txt

@@ -1,2 +1,22 @@
 Add support for images on buttons. Replace dropdownbox scroll buttons with that.
 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.
+Drop down box gets closed the same frame it was opened on! Need to delay the close one frame.
+
+Immediate TODO:
+ - Add support for images in GUIButton
+   - With placement options (left/right of the text)
+ - Update DropDown ScrollUp and ScrollDown buttons so they don't use two GUIAreas each and instead use a GUIButton with an image
+   - This will require slightly updated hover graphic (Arrow icon no longer should change color)
+ - Upon scroll up/down remove ScrollUp or ScrollDown buttons if that direction isn't usable anymore
+  - Delete its GUIArea and offset the content area, and possibly ScrollDown area
+
+----------------------------
+ - Elements can call addContextAction("Name", "Callback")
+   - This will be automatically rendered by GUIManager as a drop down menu when user clicks on it
+     - This kind of drop down menu will require separator buttons
+     - Also buttons with sub-menus
+     - It is probably useful to just add this functionality to DropDownBox
+   - Mousing over a sub-menu should upen another DropDownBox at that location
+     - I might need to modify DropDownBox input parameters so they accept GUElement as a parent, and not just GUIDropDownList
+     - Also another parameter to specify on which side of the GUIElement to open the box
+   - GUIManager drop down system could be extended so it handles multiple drop down boxes from various sources
+    - DropDownLists, context menus and toolbar menus

+ 1 - 7
EditorWindowDock.txt

@@ -4,15 +4,9 @@ Add icons to drag and drop - There's a built-in windows icon for this. I think.
 Add highlight to WindowMover so I can know when I'm mousing over it with a dragged window in hand
 Add highlight to WindowMover so I can know when I'm mousing over it with a dragged window in hand
 Ensure that dropping a window onto a mover will actually docks it properly
 Ensure that dropping a window onto a mover will actually docks it properly
 
 
-I still have the issue where GUIManager hack code got triggered
-Get rid of the GUIManager mouseUp hack when I ensure resize/move using non client areas work
-
 Prevent docking if available size is less than 20 pixels, otherwise there might be some weirdness
 Prevent docking if available size is less than 20 pixels, otherwise there might be some weirdness
 
 
-There are some weird issues with move/resize:
- - Moving will sometimes block and delay for 2-3 seconds
- - Resize will sometimes fail to register the resize area
- - If I overlap two windows and move along the bottom resize border of the child window to the main window slowly, the resize cursor doesn't change
+When using the scroll bar and then mousing over non-client area the scroll bar will get reset!
 
 
 ------------------------
 ------------------------