Browse Source

GUI refactor - everything compiles and runs

Marko Pintera 11 years ago
parent
commit
caf9bb3152

+ 5 - 0
BansheeEditor/Source/BsMainEditorWindow.cpp

@@ -7,6 +7,8 @@
 #include "CmRenderTexture.h"
 #include "BsApplication.h"
 #include "CmProfiler.h"
+#include "BsGUIArea.h"
+#include "BsGUILayout.h"
 
 // DEBUG ONLY
 #include "CmTestTextSprite.h"
@@ -33,6 +35,9 @@ namespace BansheeEditor
 	{
 		mDockManager = DockManager::create(mRenderWindow.get());
 
+		GUIArea* dockArea = GUIArea::createStretchedXY(*mGUI.get(), 0, 0, 0, 0);
+		dockArea->getLayout().addElement(mDockManager);
+
 		updateAreas();
 
 		mMenuBar->addMenuItem(L"File/New project", nullptr);

+ 1 - 0
BansheeEngine/Include/BsGUIInputTool.h

@@ -50,6 +50,7 @@ namespace BansheeEngine
 		CM::RectI getCharRect(CM::UINT32 charIdx) const;
 		CM::RectI getLocalCharRect(CM::UINT32 charIdx) const;
 		CM::INT32 getCharIdxAtPos(const CM::Vector2I& pos) const;
+		bool isDescValid() const;
 
 		/**
 		 * @brief	Gets a character index AFTER the input index. 

+ 5 - 6
BansheeEngine/Source/BsGUIInputCaret.cpp

@@ -227,10 +227,11 @@ namespace BansheeEngine
 
 	Vector2I GUIInputCaret::getCaretPosition(const CM::Vector2I& offset) const
 	{
-		if(mTextDesc.text.size() > 0)
+		if(mTextDesc.text.size() > 0 && isDescValid())
 		{
 			UINT32 curPos = 0;
 			UINT32 numLines = getNumLines();
+
 			for(UINT32 i = 0; i < numLines; i++)
 			{
 				const GUIInputLineDesc& lineDesc = getLineDesc(i);
@@ -256,10 +257,8 @@ namespace BansheeEngine
 
 			return Vector2I(charRect.x + charRect.width, yOffset);
 		}
-		else
-		{
-			return offset;
-		}		
+
+		return offset;
 	}
 
 	UINT32 GUIInputCaret::getCaretHeight() const
@@ -268,7 +267,7 @@ namespace BansheeEngine
 		if(charIdx > 0)
 			charIdx -= 1;	
 
-		if(charIdx < (UINT32)mTextDesc.text.size())
+		if(charIdx < (UINT32)mTextDesc.text.size() && isDescValid())
 		{
 			UINT32 lineIdx = getLineForChar(charIdx);
 			return getLineDesc(lineIdx).getLineHeight();

+ 11 - 0
BansheeEngine/Source/BsGUIInputTool.cpp

@@ -253,6 +253,17 @@ namespace BansheeEngine
 		return false;
 	}
 
+	bool GUIInputTool::isDescValid() const
+	{
+		// We we have some text but line descs are empty we may assume
+		// something went wrong when creating the line descs, therefore it is
+		// not valid and no text is displayed.
+		if(mTextDesc.text.size() > 0)
+			return mLineDescs.size() > 0;
+
+		return true;
+	}
+
 	GUIInputLineDesc::GUIInputLineDesc(CM::UINT32 startChar, CM::UINT32 endChar, CM::UINT32 lineHeight, CM::INT32 lineYStart, bool includesNewline)
 		:mStartChar(startChar), mEndChar(endChar), mLineHeight(lineHeight), mLineYStart(lineYStart), mIncludesNewline(includesNewline)
 	{

+ 5 - 0
Inspector.txt

@@ -23,6 +23,11 @@ Boost any replacement: http://www.codeproject.com/Articles/11250/High-Performanc
 
 -------------
 
+Get rid of the CamelotFramework namespace
+ - I shouldn't need to prefix each variable with CM::
+
+Fix C# interface to GUI elements
+
 REFACTOR c++ GUI a bit:
  - GameObjectField
    - When dragging over GameObjectField cursor needs to change depending whether drop will be accepted or not

+ 4 - 4
MBansheeEngine/GUI/GUIButton.cs

@@ -13,19 +13,19 @@ namespace BansheeEngine
         public event OnHoverDelegate OnHover;
         public event OnOutDelegate OnOut;
 
-        public GUIButton(GUIContent content, GUIElementStyle style, params GUIOption[] options)
+        public GUIButton(GUIContent content, string style, params GUIOption[] options)
         {
             Internal_CreateInstance(this, content, style, options);
         }
 
-        public GUIButton(GUIContent content, GUIElementStyle style)
+        public GUIButton(GUIContent content, string style)
         {
             Internal_CreateInstance(this, content, style, new GUIOption[0]);
         }
 
         public GUIButton(GUIContent content, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, null, options);
+            Internal_CreateInstance(this, content, "", options);
         }
 
         public void SetContent(GUIContent content)
@@ -52,7 +52,7 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIButton instance, GUIContent content, GUIElementStyle style, GUIOption[] options);
+        private static extern void Internal_CreateInstance(GUIButton instance, GUIContent content, string style, GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);

+ 2 - 2
MBansheeEngine/GUI/GUILabel.cs

@@ -5,7 +5,7 @@ namespace BansheeEngine
 {
     public sealed class GUILabel : GUIElement
     {
-        public GUILabel(GUIContent content, GUIElementStyle style, params GUIOption[] options)
+        public GUILabel(GUIContent content, string style, params GUIOption[] options)
         {
             Internal_CreateInstance(this, content, style, options);
         }
@@ -16,7 +16,7 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUILabel instance, GUIContent content, GUIElementStyle style, GUIOption[] options);
+        private static extern void Internal_CreateInstance(GUILabel instance, GUIContent content, string style, GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);

+ 3 - 3
MBansheeEngine/GUI/GUIListBox.cs

@@ -9,14 +9,14 @@ namespace BansheeEngine
 
         public event OnSelectionChangedDelegate OnSelectionChanged;
 
-        public GUIListBox(LocString[] elements, GUIElementStyle style, params GUIOption[] options)
+        public GUIListBox(LocString[] elements, string style, params GUIOption[] options)
         {
             Internal_CreateInstance(this, elements, style, options);
         }
 
         public GUIListBox(LocString[] elements, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, elements, null, options);
+            Internal_CreateInstance(this, elements, "", options);
         }
 
         public void SetElements(LocString[] elements)
@@ -31,7 +31,7 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIListBox instance, LocString[] elements, GUIElementStyle style, params GUIOption[] options);
+        private static extern void Internal_CreateInstance(GUIListBox instance, LocString[] elements, string style, params GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetElements(IntPtr nativeInstance, LocString[] elements);

+ 10 - 10
MBansheeEngine/GUI/GUIScrollArea.cs

@@ -18,38 +18,38 @@ namespace BansheeEngine
             get { return _mainLayout; }
         }
 
-        public GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, GUIElementStyle scrollBarStyle, 
-            GUIElementStyle scrollAreaStyle, params GUIOption[] options)
+        public GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, string scrollBarStyle,
+            string scrollAreaStyle, params GUIOption[] options)
         {
             Internal_CreateInstance(this, vertBarType, horzBarType, scrollBarStyle, scrollAreaStyle, options);
             _mainLayout = new GUILayoutY(this);
         }
 
-        public GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, GUIElementStyle style, params GUIOption[] options)
+        public GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, string style, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, vertBarType, horzBarType, null, style, options);
+            Internal_CreateInstance(this, vertBarType, horzBarType, "", style, options);
             _mainLayout = new GUILayoutY(this);
         }
 
         public GUIScrollArea(ScrollBarType vertBarType, ScrollBarType horzBarType, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, vertBarType, horzBarType, null, null, options);
+            Internal_CreateInstance(this, vertBarType, horzBarType, "", "", options);
             _mainLayout = new GUILayoutY(this);
         }
 
-        public GUIScrollArea(GUIElementStyle style, params GUIOption[] options)
+        public GUIScrollArea(string style, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, ScrollBarType.ShowIfDoesntFit, ScrollBarType.ShowIfDoesntFit, null, style, options);
+            Internal_CreateInstance(this, ScrollBarType.ShowIfDoesntFit, ScrollBarType.ShowIfDoesntFit, "", style, options);
             _mainLayout = new GUILayoutY(this);
         }
 
         public GUIScrollArea(params GUIOption[] options)
         {
-            Internal_CreateInstance(this, ScrollBarType.ShowIfDoesntFit, ScrollBarType.ShowIfDoesntFit, null, null, options);
+            Internal_CreateInstance(this, ScrollBarType.ShowIfDoesntFit, ScrollBarType.ShowIfDoesntFit, "", "", options);
             _mainLayout = new GUILayoutY(this);
         }
 
-        public GUIScrollArea(GUIElementStyle scrollBarStyle, GUIElementStyle scrollAreaStyle, params GUIOption[] options)
+        public GUIScrollArea(string scrollBarStyle, string scrollAreaStyle, params GUIOption[] options)
         {
             Internal_CreateInstance(this, ScrollBarType.ShowIfDoesntFit, ScrollBarType.ShowIfDoesntFit, scrollBarStyle, scrollAreaStyle, options);
             _mainLayout = new GUILayoutY(this);
@@ -64,6 +64,6 @@ namespace BansheeEngine
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_CreateInstance(GUIScrollArea instance, ScrollBarType vertBarType, ScrollBarType horzBarType,
-            GUIElementStyle scrollBarStyle, GUIElementStyle scrollAreaStyle, params GUIOption[] options);
+            string scrollBarStyle, string scrollAreaStyle, params GUIOption[] options);
     }
 }

+ 5 - 5
MBansheeEngine/GUI/GUITextBox.cs

@@ -5,24 +5,24 @@ namespace BansheeEngine
 {
     public sealed class GUITextBox : GUIElement
     {
-        public GUITextBox(bool multiline, GUIElementStyle style, params GUIOption[] options)
+        public GUITextBox(bool multiline, string style, params GUIOption[] options)
         {
             Internal_CreateInstance(this, multiline, style, options);
         }
 
         public GUITextBox(bool multiline, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, multiline, null, options);
+            Internal_CreateInstance(this, multiline, "", options);
         }
 
-        public GUITextBox(GUIElementStyle style, params GUIOption[] options)
+        public GUITextBox(string style, params GUIOption[] options)
         {
             Internal_CreateInstance(this, false, style, options);
         }
 
         public GUITextBox(params GUIOption[] options)
         {
-            Internal_CreateInstance(this, false, null, options);
+            Internal_CreateInstance(this, false, "", options);
         }
 
         public string text
@@ -32,7 +32,7 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUITextBox instance, bool multiline, GUIElementStyle style, GUIOption[] options);
+        private static extern void Internal_CreateInstance(GUITextBox instance, bool multiline, string style, GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetText(IntPtr nativeInstance, string text);

+ 6 - 6
MBansheeEngine/GUI/GUITexture.cs

@@ -13,24 +13,24 @@ namespace BansheeEngine
 
     public sealed class GUITexture : GUIElement
     {
-        public GUITexture(SpriteTexture texture, GUIImageScaleMode scale, GUIElementStyle style, params GUIOption[] options)
+        public GUITexture(SpriteTexture texture, GUIImageScaleMode scale, string style, params GUIOption[] options)
         {
             Internal_CreateInstance(this, texture, scale, style, options);
         }
 
         public GUITexture(SpriteTexture texture, GUIImageScaleMode scale, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, texture, scale, null, options);
+            Internal_CreateInstance(this, texture, scale, "", options);
         }
 
-        public GUITexture(SpriteTexture texture, GUIElementStyle style, params GUIOption[] options)
+        public GUITexture(SpriteTexture texture, string style, params GUIOption[] options)
         {
             Internal_CreateInstance(this, texture, GUIImageScaleMode.StretchToFit, style, options);
         }
 
         public GUITexture(SpriteTexture texture, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, texture, GUIImageScaleMode.StretchToFit, null, options);
+            Internal_CreateInstance(this, texture, GUIImageScaleMode.StretchToFit, "", options);
         }
 
         public void SetTexture(SpriteTexture texture)
@@ -39,8 +39,8 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUITexture instance, SpriteTexture texture, 
-            GUIImageScaleMode scale, GUIElementStyle style, GUIOption[] options);
+        private static extern void Internal_CreateInstance(GUITexture instance, SpriteTexture texture,
+            GUIImageScaleMode scale, string style, GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetTexture(IntPtr nativeInstance, SpriteTexture texture);

+ 8 - 8
MBansheeEngine/GUI/GUIToggle.cs

@@ -15,34 +15,34 @@ namespace BansheeEngine
         public event OnOutDelegate OnOut;
         public event OnToggleDelegate OnToggled;
 
-        public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, GUIElementStyle style, params GUIOption[] options)
+        public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, string style, params GUIOption[] options)
         {
             Internal_CreateInstance(this, content, toggleGroup, style, options);
         }
 
-        public GUIToggle(GUIContent content, GUIElementStyle style, params GUIOption[] options)
+        public GUIToggle(GUIContent content, string style, params GUIOption[] options)
         {
             Internal_CreateInstance(this, content, null, style, options);
         }
 
-        public GUIToggle(GUIContent content, GUIElementStyle style)
+        public GUIToggle(GUIContent content, string style)
         {
             Internal_CreateInstance(this, content, null, style, new GUIOption[0]);
         }
 
         public GUIToggle(GUIContent content, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, null, null, options);
+            Internal_CreateInstance(this, content, null, "", options);
         }
 
-        public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, GUIElementStyle style)
+        public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, string style)
         {
             Internal_CreateInstance(this, content, toggleGroup, style, new GUIOption[0]);
         }
 
         public GUIToggle(GUIContent content, GUIToggleGroup toggleGroup, params GUIOption[] options)
         {
-            Internal_CreateInstance(this, content, toggleGroup, null, options);
+            Internal_CreateInstance(this, content, toggleGroup, "", options);
         }
 
         public void SetContent(GUIContent content)
@@ -85,8 +85,8 @@ namespace BansheeEngine
         }
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_CreateInstance(GUIToggle instance, GUIContent content, 
-            GUIToggleGroup toggleGroup, GUIElementStyle style, GUIOption[] options);
+        private static extern void Internal_CreateInstance(GUIToggle instance, GUIContent content,
+            GUIToggleGroup toggleGroup, string style, GUIOption[] options);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetContent(IntPtr nativeInstance, GUIContent content);

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIButton.h

@@ -14,7 +14,7 @@ namespace BansheeEngine
 		void* getNativeRaw() const { return mButton; }
 
 	private:
-		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoObject* style, MonoArray* guiOptions);
+		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions);
 		static void internal_destroyInstance(ScriptGUIButton* nativeInstance);
 		static void internal_setContent(ScriptGUIButton* nativeInstance, MonoObject* content);
 

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIInputBox.h

@@ -15,7 +15,7 @@ namespace BansheeEngine
 		void* getNativeRaw() const { return mInputBox; }
 
 	private:
-		static void internal_createInstance(MonoObject* instance, bool multiline, MonoObject* style, MonoArray* guiOptions);
+		static void internal_createInstance(MonoObject* instance, bool multiline, MonoString* style, MonoArray* guiOptions);
 		static void internal_destroyInstance(ScriptGUIInputBox* nativeInstance);
 
 		static void internal_setText(ScriptGUIInputBox* nativeInstance, MonoString* text);

+ 1 - 1
SBansheeEngine/Include/BsScriptGUILabel.h

@@ -14,7 +14,7 @@ namespace BansheeEngine
 		void* getNativeRaw() const { return mLabel; }
 
 	private:
-		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoObject* style, MonoArray* guiOptions);
+		static void internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions);
 		static void internal_destroyInstance(ScriptGUILabel* nativeInstance);
 		static void internal_setContent(ScriptGUILabel* nativeInstance, MonoObject* content);
 

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIListBox.h

@@ -15,7 +15,7 @@ namespace BansheeEngine
 		void* getNativeRaw() const { return mListBox; }
 
 	private:
-		static void internal_createInstance(MonoObject* instance, MonoArray* elements, MonoObject* style, MonoArray* guiOptions);
+		static void internal_createInstance(MonoObject* instance, MonoArray* elements, MonoString* style, MonoArray* guiOptions);
 		static void internal_destroyInstance(ScriptGUIListBox* nativeInstance);
 		static void internal_setElements(ScriptGUIListBox* nativeInstance, MonoArray* elements);
 

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIScrollArea.h

@@ -16,7 +16,7 @@ namespace BansheeEngine
 
 	private:
 		static void internal_createInstance(MonoObject* instance, ScrollBarType vertBarType, ScrollBarType horzBarType, 
-			MonoObject* scrollBarStyle, MonoObject* scrollAreaStyle, MonoArray* guiOptions);
+			MonoString* scrollBarStyle, MonoString* scrollAreaStyle, MonoArray* guiOptions);
 		static void internal_destroyInstance(ScriptGUIScrollArea* nativeInstance);
 
 		static void internal_destroy(ScriptGUIScrollArea* nativeInstance);

+ 1 - 1
SBansheeEngine/Include/BsScriptGUITexture.h

@@ -16,7 +16,7 @@ namespace BansheeEngine
 
 	private:
 		static void internal_createInstance(MonoObject* instance, MonoObject* texture, 
-			GUIImageScaleMode scale, MonoObject* style, MonoArray* guiOptions);
+			GUIImageScaleMode scale, MonoString* style, MonoArray* guiOptions);
 		static void internal_destroyInstance(ScriptGUITexture* nativeInstance);
 		static void internal_setTexture(ScriptGUITexture* nativeInstance, MonoObject* texture);
 

+ 1 - 1
SBansheeEngine/Include/BsScriptGUIToggle.h

@@ -15,7 +15,7 @@ namespace BansheeEngine
 
 	private:
 		static void internal_createInstance(MonoObject* instance, MonoObject* content, 
-			MonoObject* toggleGroup, MonoObject* style, MonoArray* guiOptions);
+			MonoObject* toggleGroup, MonoString* style, MonoArray* guiOptions);
 		static void internal_destroyInstance(ScriptGUIToggle* nativeInstance);
 		static void internal_setContent(ScriptGUIToggle* nativeInstance, MonoObject* content);
 		static void internal_toggleOn(ScriptGUIToggle* nativeInstance);

+ 2 - 7
SBansheeEngine/Source/BsScriptGUIButton.cpp

@@ -62,7 +62,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void ScriptGUIButton::internal_createInstance(MonoObject* instance, MonoObject* content, MonoObject* style, MonoArray* guiOptions)
+	void ScriptGUIButton::internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions)
 	{
 		GUIOptions options;
 
@@ -70,13 +70,8 @@ namespace BansheeEngine
 		for(UINT32 i = 0; i < arrayLen; i++)
 			options.addOption(mono_array_get(guiOptions, GUIOption, i));
 
-		GUIElementStyle* elemStyle = nullptr;
-
-		if(style != nullptr)
-			elemStyle = ScriptGUIElementStyle::toNative(style)->getInternalValue();
-
 		GUIContent nativeContent(ScriptGUIContent::getText(content), ScriptGUIContent::getImage(content), ScriptGUIContent::getTooltip(content));
-		GUIButton* guiButton = GUIButton::create(nativeContent, options, elemStyle);
+		GUIButton* guiButton = GUIButton::create(nativeContent, options, toString(MonoUtil::monoToWString(style)));
 
 		guiButton->onClick.connect(std::bind(&ScriptGUIButton::onClick, instance));
 		guiButton->onHover.connect(std::bind(&ScriptGUIButton::onHover, instance));

+ 2 - 7
SBansheeEngine/Source/BsScriptGUIInputBox.cpp

@@ -55,7 +55,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void ScriptGUIInputBox::internal_createInstance(MonoObject* instance, bool multiline, MonoObject* style, MonoArray* guiOptions)
+	void ScriptGUIInputBox::internal_createInstance(MonoObject* instance, bool multiline, MonoString* style, MonoArray* guiOptions)
 	{
 		GUIOptions options;
 
@@ -63,12 +63,7 @@ namespace BansheeEngine
 		for(UINT32 i = 0; i < arrayLen; i++)
 			options.addOption(mono_array_get(guiOptions, GUIOption, i));
 
-		GUIElementStyle* elemStyle = nullptr;
-
-		if(style != nullptr)
-			elemStyle = ScriptGUIElementStyle::toNative(style)->getInternalValue();
-
-		GUIInputBox* guiInputBox = GUIInputBox::create(multiline, options, elemStyle);
+		GUIInputBox* guiInputBox = GUIInputBox::create(multiline, options, toString(MonoUtil::monoToWString(style)));
 
 		ScriptGUIInputBox* nativeInstance = new (cm_alloc<ScriptGUIInputBox>()) ScriptGUIInputBox(guiInputBox);
 		nativeInstance->createInstance(instance);

+ 2 - 7
SBansheeEngine/Source/BsScriptGUILabel.cpp

@@ -53,7 +53,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void ScriptGUILabel::internal_createInstance(MonoObject* instance, MonoObject* content, MonoObject* style, MonoArray* guiOptions)
+	void ScriptGUILabel::internal_createInstance(MonoObject* instance, MonoObject* content, MonoString* style, MonoArray* guiOptions)
 	{
 		GUIOptions options;
 
@@ -61,13 +61,8 @@ namespace BansheeEngine
 		for(UINT32 i = 0; i < arrayLen; i++)
 			options.addOption(mono_array_get(guiOptions, GUIOption, i));
 
-		GUIElementStyle* elemStyle = nullptr;
-		
-		if(style != nullptr)
-			elemStyle = ScriptGUIElementStyle::toNative(style)->getInternalValue();
-
 		GUIContent nativeContent(ScriptGUIContent::getText(content), ScriptGUIContent::getImage(content), ScriptGUIContent::getTooltip(content));
-		GUILabel* guiLabel = GUILabel::create(nativeContent, options, elemStyle);
+		GUILabel* guiLabel = GUILabel::create(nativeContent, options, toString(MonoUtil::monoToWString(style)));
 
 		ScriptGUILabel* nativeInstance = new (cm_alloc<ScriptGUILabel>()) ScriptGUILabel(guiLabel);
 		nativeInstance->createInstance(instance);

+ 2 - 7
SBansheeEngine/Source/BsScriptGUIListBox.cpp

@@ -58,7 +58,7 @@ namespace BansheeEngine
 		}
 	}
 
-	void ScriptGUIListBox::internal_createInstance(MonoObject* instance, MonoArray* elements, MonoObject* style, MonoArray* guiOptions)
+	void ScriptGUIListBox::internal_createInstance(MonoObject* instance, MonoArray* elements, MonoString* style, MonoArray* guiOptions)
 	{
 		GUIOptions options;
 
@@ -66,11 +66,6 @@ namespace BansheeEngine
 		for(UINT32 i = 0; i < optionsArrayLen; i++)
 			options.addOption(mono_array_get(guiOptions, GUIOption, i));
 
-		GUIElementStyle* elemStyle = nullptr;
-
-		if(style != nullptr)
-			elemStyle = ScriptGUIElementStyle::toNative(style)->getInternalValue();
-
 		UINT32 elementsArrayLen = (UINT32)mono_array_length(elements);
 		Vector<HString>::type nativeElements;
 		for(UINT32 i = 0; i < elementsArrayLen; i++)
@@ -86,7 +81,7 @@ namespace BansheeEngine
 			}
 		}
 
-		GUIListBox* guiListBox = GUIListBox::create(nativeElements, options, elemStyle);
+		GUIListBox* guiListBox = GUIListBox::create(nativeElements, options, toString(MonoUtil::monoToWString(style)));
 		guiListBox->onSelectionChanged.connect(std::bind(&ScriptGUIListBox::onSelectionChanged, instance, std::placeholders::_1));
 
 		ScriptGUIListBox* nativeInstance = new (cm_alloc<ScriptGUIListBox>()) ScriptGUIListBox(guiListBox);

+ 3 - 12
SBansheeEngine/Source/BsScriptGUIScrollArea.cpp

@@ -54,7 +54,7 @@ namespace BansheeEngine
 	}
 
 	void ScriptGUIScrollArea::internal_createInstance(MonoObject* instance, ScrollBarType vertBarType, ScrollBarType horzBarType, 
-		MonoObject* scrollBarStyle, MonoObject* scrollAreaStyle, MonoArray* guiOptions)
+		MonoString* scrollBarStyle, MonoString* scrollAreaStyle, MonoArray* guiOptions)
 	{
 		GUIOptions options;
 
@@ -62,17 +62,8 @@ namespace BansheeEngine
 		for(UINT32 i = 0; i < arrayLen; i++)
 			options.addOption(mono_array_get(guiOptions, GUIOption, i));
 
-		GUIElementStyle* scrollAreaNativeStyle = nullptr;
-
-		if(scrollAreaStyle != nullptr)
-			scrollAreaNativeStyle = ScriptGUIElementStyle::toNative(scrollAreaStyle)->getInternalValue();
-
-		GUIElementStyle* scrollBarNativeStyle = nullptr;
-
-		if(scrollBarNativeStyle != nullptr)
-			scrollBarNativeStyle = ScriptGUIElementStyle::toNative(scrollBarStyle)->getInternalValue();
-
-		GUIScrollArea* guiScrollArea = GUIScrollArea::create(vertBarType, horzBarType, options, scrollBarNativeStyle, scrollAreaNativeStyle);
+		GUIScrollArea* guiScrollArea = GUIScrollArea::create(vertBarType, horzBarType, options, 
+			toString(MonoUtil::monoToWString(scrollBarStyle)), toString(MonoUtil::monoToWString(scrollAreaStyle)));
 
 		ScriptGUIScrollArea* nativeInstance = new (cm_alloc<ScriptGUIScrollArea>()) ScriptGUIScrollArea(guiScrollArea);
 		nativeInstance->createInstance(instance);

+ 2 - 7
SBansheeEngine/Source/BsScriptGUITexture.cpp

@@ -55,7 +55,7 @@ namespace BansheeEngine
 	}
 
 	void ScriptGUITexture::internal_createInstance(MonoObject* instance, MonoObject* texture, 
-		GUIImageScaleMode scale, MonoObject* style, MonoArray* guiOptions)
+		GUIImageScaleMode scale, MonoString* style, MonoArray* guiOptions)
 	{
 		GUIOptions options;
 
@@ -63,16 +63,11 @@ namespace BansheeEngine
 		for(UINT32 i = 0; i < arrayLen; i++)
 			options.addOption(mono_array_get(guiOptions, GUIOption, i));
 
-		GUIElementStyle* elemStyle = nullptr;
-
-		if(style != nullptr)
-			elemStyle = ScriptGUIElementStyle::toNative(style)->getInternalValue();
-
 		HSpriteTexture nativeTexture;
 		if(texture != nullptr)
 			nativeTexture = ScriptSpriteTexture::toNative(texture)->getInternalValue();
 
-		GUITexture* guiTexture = GUITexture::create(nativeTexture, scale, options, elemStyle);
+		GUITexture* guiTexture = GUITexture::create(nativeTexture, scale, options, toString(MonoUtil::monoToWString(style)));
 
 		ScriptGUITexture* nativeInstance = new (cm_alloc<ScriptGUITexture>()) ScriptGUITexture(guiTexture);
 		nativeInstance->createInstance(instance);

+ 2 - 6
SBansheeEngine/Source/BsScriptGUIToggle.cpp

@@ -70,7 +70,7 @@ namespace BansheeEngine
 	}
 
 	void ScriptGUIToggle::internal_createInstance(MonoObject* instance, MonoObject* content, 
-		MonoObject* toggleGroup, MonoObject* style, MonoArray* guiOptions)
+		MonoObject* toggleGroup, MonoString* style, MonoArray* guiOptions)
 	{
 		GUIOptions options;
 
@@ -78,16 +78,12 @@ namespace BansheeEngine
 		for(UINT32 i = 0; i < arrayLen; i++)
 			options.addOption(mono_array_get(guiOptions, GUIOption, i));
 
-		GUIElementStyle* elemStyle = nullptr;
-		if(style != nullptr)
-			elemStyle = ScriptGUIElementStyle::toNative(style)->getInternalValue();
-
 		ScriptGUIToggleGroup* scriptToggleGroup = nullptr;
 		if(scriptToggleGroup != nullptr)
 			scriptToggleGroup = ScriptGUIToggleGroup::toNative(toggleGroup);
 
 		GUIContent nativeContent(ScriptGUIContent::getText(content), ScriptGUIContent::getImage(content), ScriptGUIContent::getTooltip(content));
-		GUIToggle* guiToggle = GUIToggle::create(nativeContent, scriptToggleGroup->getInternalValue(), options, elemStyle);
+		GUIToggle* guiToggle = GUIToggle::create(nativeContent, scriptToggleGroup->getInternalValue(), options, toString(MonoUtil::monoToWString(style)));
 
 		guiToggle->onClick.connect(std::bind(&ScriptGUIToggle::onClick, instance));
 		guiToggle->onHover.connect(std::bind(&ScriptGUIToggle::onHover, instance));