فهرست منبع

Added various get/set methods for GUIElementStyle

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

+ 1 - 0
BansheeEngine/BansheeEngine.vcxproj

@@ -288,6 +288,7 @@
     <ClInclude Include="Include\BsScriptAssembly.h" />
     <ClInclude Include="Include\BsScriptClass.h" />
     <ClInclude Include="Include\BsScriptField.h" />
+    <ClInclude Include="Include\BsScriptMacros.h" />
     <ClInclude Include="Include\BsScriptManager.h" />
     <ClInclude Include="Include\BsScriptMethod.h" />
     <ClInclude Include="Include\BsScriptObject.h" />

+ 3 - 0
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -291,6 +291,9 @@
     <ClInclude Include="Include\BsScriptGUIElementStateStyle.h">
       <Filter>Header Files\Script</Filter>
     </ClInclude>
+    <ClInclude Include="Include\BsScriptMacros.h">
+      <Filter>Header Files\Script</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsGUIElement.cpp">

+ 2 - 0
BansheeEngine/Include/BsPrerequisites.h

@@ -73,6 +73,8 @@ namespace BansheeEngine
 	class ScriptFont;
 	class ScriptSpriteTexture;
 	class ScriptTexture2D;
+	class ScriptGUIElementStyle;
+	class ScriptGUIElementStateStyle;
 
 	// 2D
 	class TextSprite;

+ 1 - 1
BansheeEngine/Include/BsScriptFont.h

@@ -12,7 +12,7 @@ namespace BansheeEngine
 		static void initMetaData();
 
 		virtual void* getNative() const;
-		const CM::HFont& getInternalFont() const { return mFont; }
+		const CM::HFont& getInternalValue() const { return mFont; }
 
 	private:
 		static void internal_createInstanceExternal(MonoObject* instance, const CM::HFont& font);

+ 3 - 2
BansheeEngine/Include/BsScriptGUIElementStateStyle.h

@@ -12,6 +12,7 @@ namespace BansheeEngine
 		~ScriptGUIElementStateStyle();
 
 		static void initMetaData();
+		GUIElementStyle::GUIElementStateStyle* getInternalValue() const { return mElementStateStyle; }
 
 	private:
 		static void internal_createInstance(MonoObject* instance);
@@ -20,8 +21,8 @@ namespace BansheeEngine
 
 		static void initRuntimeData();
 
-		static void internal_GetTexture(ScriptGUIElementStateStyle* nativeInstance, MonoObject* value);
-		static void internal_SetTexture(ScriptGUIElementStateStyle* nativeInstance, ScriptSpriteTexture* value);
+		static void internal_GetTexture(ScriptGUIElementStateStyle* nativeInstance, MonoObject** value);
+		static void internal_SetTexture(ScriptGUIElementStateStyle* nativeInstance, MonoObject* value);
 
 		static void internal_GetTextColor(ScriptGUIElementStateStyle* nativeInstance, CM::Color* value);
 		static void internal_SetTextColor(ScriptGUIElementStateStyle* nativeInstance, CM::Color* value);

+ 59 - 41
BansheeEngine/Include/BsScriptGUIElementStyle.h

@@ -2,9 +2,18 @@
 
 #include "BsPrerequisites.h"
 #include "BsScriptObject.h"
+#include "BsGUIElementStyle.h"
 
 namespace BansheeEngine
 {
+	template<class ParentType, class Type>
+	class script_getset_value
+	{
+	private:
+		static void internal_get(ParentType* nativeInstance, Type* value);
+		static void internal_set(ParentType* nativeInstance, Type value);
+	};
+
 	class BS_EXPORT ScriptGUIElementStyle : public ScriptObject<ScriptGUIElementStyle>
 	{
 	public:
@@ -19,91 +28,100 @@ namespace BansheeEngine
 
 		static void initRuntimeData();
 
-		/*static MonoObject* internal_GetFont(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetFont(ScriptGUIElementStyle* nativeInstance, ScriptFont* value);
+		static void internal_GetFont(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
+		static void internal_SetFont(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
 
-		static int internal_GetFontSize(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetFontSize(ScriptGUIElementStyle* nativeInstance, int value);
+		static void internal_GetFontSize(ScriptGUIElementStyle* nativeInstance, CM::UINT32* value);
+		static void internal_SetFontSize(ScriptGUIElementStyle* nativeInstance, CM::UINT32 value);
 
-		static int internal_GetTextHorzAlign(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, int value);
+		static void internal_GetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, TextHorzAlign* value);
+		static void internal_SetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, TextHorzAlign value);
 
-		static int internal_GetTextVertAlign(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetTextVertAlign(ScriptGUIElementStyle* nativeInstance, int value);
+		static void internal_GetTextVertAlign(ScriptGUIElementStyle* nativeInstance, TextVertAlign* value);
+		static void internal_SetTextVertAlign(ScriptGUIElementStyle* nativeInstance, TextVertAlign value);
 
-		static int internal_GetImagePosition(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetImagePosition(ScriptGUIElementStyle* nativeInstance, int value);
+		static void internal_GetImagePosition(ScriptGUIElementStyle* nativeInstance, GUIImagePosition* value);
+		static void internal_SetImagePosition(ScriptGUIElementStyle* nativeInstance, GUIImagePosition value);
 
-		static bool internal_GetWordWrap(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetWordWrap(ScriptGUIElementStyle* nativeInstance, bool* value);
 		static void internal_SetWordWrap(ScriptGUIElementStyle* nativeInstance, bool value);
 
 
-		static MonoObject* internal_GetNormal(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetNormal(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
 		static void internal_SetNormal(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
 
-		static MonoObject* internal_GetHover(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetHover(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
 		static void internal_SetHover(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
 
-		static MonoObject* internal_GetActive(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetActive(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
 		static void internal_SetActive(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
 
-		static MonoObject* internal_GetFocused(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetFocused(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
 		static void internal_SetFocused(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
 
 
-		static MonoObject* internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
 		static void internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
 
-		static MonoObject* internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
 		static void internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
 
-		static MonoObject* internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
 		static void internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
 
-		static MonoObject* internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance, MonoObject** value);
 		static void internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value);
 
 
-		static RectOffset internal_GetBorder(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset value);
+		static void internal_GetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
+		static void internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
 
-		static RectOffset internal_GetMargins(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset value);
+		static void internal_GetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
+		static void internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
 
-		static RectOffset internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset value);
+		static void internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
+		static void internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value);
 
 
-		static INT32 internal_GetWidth(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetWidth(ScriptGUIElementStyle* nativeInstance, INT32 value);
+		static void internal_GetWidth(ScriptGUIElementStyle* nativeInstance, CM::UINT32* value);
+		static void internal_SetWidth(ScriptGUIElementStyle* nativeInstance, CM::UINT32 value);
 
-		static INT32 internal_GetHeight(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetHeight(ScriptGUIElementStyle* nativeInstance, INT32 value);
+		static void internal_GetHeight(ScriptGUIElementStyle* nativeInstance, CM::UINT32* value);
+		static void internal_SetHeight(ScriptGUIElementStyle* nativeInstance, CM::UINT32 value);
 
-		static INT32 internal_GetMinWidth(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetMinWidth(ScriptGUIElementStyle* nativeInstance, INT32 value);
+		static void internal_GetMinWidth(ScriptGUIElementStyle* nativeInstance, CM::UINT32* value);
+		static void internal_SetMinWidth(ScriptGUIElementStyle* nativeInstance, CM::UINT32 value);
 
-		static INT32 internal_GetMaxWidth(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetMaxWidth(ScriptGUIElementStyle* nativeInstance, INT32 value);
+		static void internal_GetMaxWidth(ScriptGUIElementStyle* nativeInstance, CM::UINT32* value);
+		static void internal_SetMaxWidth(ScriptGUIElementStyle* nativeInstance, CM::UINT32 value);
 
-		static INT32 internal_GetMinHeight(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetMinHeight(ScriptGUIElementStyle* nativeInstance, INT32 value);
+		static void internal_GetMinHeight(ScriptGUIElementStyle* nativeInstance, CM::UINT32* value);
+		static void internal_SetMinHeight(ScriptGUIElementStyle* nativeInstance, CM::UINT32 value);
 
-		static INT32 internal_GetMaxHeight(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetMaxHeight(ScriptGUIElementStyle* nativeInstance, INT32 value);
+		static void internal_GetMaxHeight(ScriptGUIElementStyle* nativeInstance, CM::UINT32* value);
+		static void internal_SetMaxHeight(ScriptGUIElementStyle* nativeInstance, CM::UINT32 value);
 
-		static bool internal_GetFixedWidth(ScriptGUIElementStyle* nativeInstance);
+		static void internal_GetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool* value);
 		static void internal_SetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool value);
 
-		static bool internal_GetFixedHeight(ScriptGUIElementStyle* nativeInstance);
-		static void internal_SetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool value);*/
+		static void internal_GetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool* value);
+		static void internal_SetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool value);
 
 		ScriptGUIElementStyle(const CM::String& name);
 		ScriptGUIElementStyle(const CM::String& name, GUIElementStyle* externalStyle);
 
 		CM::String mName;
 		GUIElementStyle* mElementStyle;
-		ScriptFont* mFont;
 		bool mOwnsStyle;
+
+		ScriptFont* mFont;
+		ScriptGUIElementStyle* mNormal;
+		ScriptGUIElementStyle* mHover;
+		ScriptGUIElementStyle* mActive;
+		ScriptGUIElementStyle* mFocused;
+		ScriptGUIElementStyle* mNormalOn;
+		ScriptGUIElementStyle* mHoverOn;
+		ScriptGUIElementStyle* mActiveOn;
+		ScriptGUIElementStyle* mFocusedOn;
 	};
 }

+ 46 - 0
BansheeEngine/Include/BsScriptMacros.h

@@ -0,0 +1,46 @@
+#pragma once
+
+#define CM_SCRIPT_GETSET_VALUE(ParentType, Type, Name, Field)									\
+	void internal_Get##Name##(##ParentType##* nativeInstance, Type##* value)					\
+	{																							\
+		*value = nativeInstance->##Field;														\
+	}																							\
+																								\
+	void internal_Set##Name##(##ParentType##* nativeInstance, Type value)						\
+	{																							\
+		nativeInstance->##Field = value;															\
+	}																							\
+
+#define CM_SCRIPT_GETSET_REF_VALUE(ParentType, Type, Name, Field)								\
+	void internal_Get##Name##(##ParentType##* nativeInstance, Type##* value)					\
+	{																							\
+		*value = nativeInstance->##Field;														\
+	}																							\
+																								\
+	void internal_Set##Name##(##ParentType##* nativeInstance, Type* value)						\
+	{																							\
+		nativeInstance->##Field = *value;														\
+	}																							\
+
+#define CM_SCRIPT_GETSET_OBJECT(ParentType, Type, Name, FieldNative, FieldNativeRaw, FieldManaged)					\
+	void internal_Get##Name##(##ParentType##* nativeInstance, MonoObject** value)									\
+	{																												\
+		throwIfInstancesDontMatch(nativeInstance->##FieldManaged##, nativeInstance->##FieldNativeRaw##);				\
+																													\
+		if(nativeInstance->##FieldManaged != nullptr)																\
+		{																											\
+			*value = nativeInstance->##FieldManaged##->getManagedInstance();											\
+			return;																									\
+		}																											\
+																													\
+		*value = nullptr;																							\
+	}																												\
+																													\
+	void internal_Set##Name##(##ParentType##* nativeInstance, MonoObject* value)									\
+	{																												\
+		Type##* nativeValue = Type##::toNative(value);																\
+		nativeInstance->##FieldNative = nativeValue->getInternalValue();												\
+	}																												
+
+#define CM_SCRIPT_SETGET_META(Type, Name)																			\
+	metaData.scriptClass->addInternalCall("Internal_Get##Name##", &##Type##::internal_Get##Name##);

+ 6 - 0
BansheeEngine/Include/BsScriptObject.h

@@ -2,6 +2,7 @@
 
 #include "BsPrerequisites.h"
 #include "BsScriptMeta.h"
+#include "BsScriptField.h"
 #include "CmException.h"
 #include <mono/jit/jit.h>
 
@@ -44,6 +45,11 @@ namespace BansheeEngine
 		MonoObject* getManagedInstance() const { return mManagedInstance; }
 		virtual void* getNative() const { return nullptr; }
 
+		static Type* toNative(MonoObject* managedInstance)
+		{
+			return reinterpret_cast<Type*>(metaData.thisPtrField->getValue(managedInstance));
+		}
+
 	protected:
 		static ScriptMeta metaData;
 

+ 2 - 2
BansheeEngine/Source/BsScriptField.cpp

@@ -13,12 +13,12 @@ namespace BansheeEngine
 	void* ScriptField::getValue(MonoObject* instance)
 	{
 		void* value = nullptr;
-		mono_field_get_value(instance, mField, value);
+		mono_field_get_value(instance, mField, &value);
 		return value;
 	}
 
 	void ScriptField::setValue(MonoObject* instance, void* value)
 	{
-		mono_field_set_value(instance, mField, value);
+		mono_field_set_value(instance, mField, &value);
 	}
 }

+ 7 - 7
BansheeEngine/Source/BsScriptGUIElementStateStyle.cpp

@@ -70,28 +70,28 @@ namespace BansheeEngine
 		cm_delete(nativeInstance);
 	}
 
-	void ScriptGUIElementStateStyle::internal_GetTexture(ScriptGUIElementStateStyle* nativeInstance, MonoObject* value)
+	void ScriptGUIElementStateStyle::internal_GetTexture(ScriptGUIElementStateStyle* nativeInstance, MonoObject** value)
 	{
 		throwIfInstancesDontMatch(nativeInstance->mSpriteTexture, nativeInstance->mElementStateStyle->texture.get());
 
 		if(nativeInstance->mSpriteTexture != nullptr)
 		{
-			value = nativeInstance->mSpriteTexture->getManagedInstance();
+			*value = nativeInstance->mSpriteTexture->getManagedInstance();
 			return;
 		}
 
-		value = nullptr;
+		*value = nullptr;
 	}
 
-	void ScriptGUIElementStateStyle::internal_SetTexture(ScriptGUIElementStateStyle* nativeInstance, ScriptSpriteTexture* value)
+	void ScriptGUIElementStateStyle::internal_SetTexture(ScriptGUIElementStateStyle* nativeInstance, MonoObject* value)
 	{
-		nativeInstance->mElementStateStyle->texture = value->getInternalTexture();
+		ScriptSpriteTexture* nativeValue = ScriptSpriteTexture::toNative(value);
+		nativeInstance->mElementStateStyle->texture = nativeValue->getInternalTexture();
 	}
 
-
 	void ScriptGUIElementStateStyle::internal_GetTextColor(ScriptGUIElementStateStyle* nativeInstance, Color* value)
 	{
-		value = &nativeInstance->mElementStateStyle->textColor;
+		*value = nativeInstance->mElementStateStyle->textColor;
 	}
 
 	void ScriptGUIElementStateStyle::internal_SetTextColor(ScriptGUIElementStateStyle* nativeInstance, Color* value)

+ 171 - 86
BansheeEngine/Source/BsScriptGUIElementStyle.cpp

@@ -6,19 +6,22 @@
 #include "BsScriptFont.h"
 #include "CmException.h"
 #include "BsGUIElementStyle.h"
+#include "BsScriptGUIElementStateStyle.h"
 
 using namespace CamelotFramework;
 
 namespace BansheeEngine
 {
 	ScriptGUIElementStyle::ScriptGUIElementStyle(const String& name)
-		:mName(name), mElementStyle(cm_new<GUIElementStyle>()), mFont(nullptr), mOwnsStyle(true)
+		:mName(name), mElementStyle(cm_new<GUIElementStyle>()), mFont(nullptr), mOwnsStyle(true), mNormal(nullptr), mHover(nullptr),
+		mActive(nullptr), mFocused(nullptr), mNormalOn(nullptr), mHoverOn(nullptr), mActiveOn(nullptr), mFocusedOn(nullptr)
 	{
 
 	}
 
 	ScriptGUIElementStyle::ScriptGUIElementStyle(const String& name, GUIElementStyle* externalStyle)
-		:mName(name), mElementStyle(externalStyle), mFont(nullptr), mOwnsStyle(false)
+		:mName(name), mElementStyle(externalStyle), mFont(nullptr), mOwnsStyle(false), mNormal(nullptr), mHover(nullptr),
+		mActive(nullptr), mFocused(nullptr), mNormalOn(nullptr), mHoverOn(nullptr), mActiveOn(nullptr), mFocusedOn(nullptr)
 	{
 
 	}
@@ -40,6 +43,12 @@ namespace BansheeEngine
 	{
 		metaData.scriptClass->addInternalCall("Internal_CreateInstance", &ScriptGUIElementStyle::internal_createInstance);
 		metaData.scriptClass->addInternalCall("Internal_DestroyInstance", &ScriptGUIElementStyle::internal_destroyInstance);
+
+		metaData.scriptClass->addInternalCall("Internal_GetFont", &ScriptGUIElementStyle::internal_GetFont);
+		metaData.scriptClass->addInternalCall("Internal_SetFont", &ScriptGUIElementStyle::internal_SetFont);
+
+		metaData.scriptClass->addInternalCall("Internal_Getfont", &ScriptGUIElementStyle::internal_GetFont);
+		metaData.scriptClass->addInternalCall("Internal_Getfont", &ScriptGUIElementStyle::internal_GetFont);
 	}
 
 	void ScriptGUIElementStyle::internal_createInstance(MonoObject* instance, MonoString* name)
@@ -72,282 +81,358 @@ namespace BansheeEngine
 		cm_delete(nativeInstance);
 	}
 
-	/*MonoObject* ScriptGUIElementStyle::internal_GetFont(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetFont(ScriptGUIElementStyle* nativeInstance, MonoObject** value)
 	{
 		throwIfInstancesDontMatch(nativeInstance->mFont, nativeInstance->mElementStyle->font.get());
 
 		if(nativeInstance->mFont != nullptr)
-			return nativeInstance->mFont->getManagedInstance();
+		{
+			*value = nativeInstance->mFont->getManagedInstance();
+			return;
+		}
 
-		return nullptr;
+		*value = nullptr;
 	}
 
-	void ScriptGUIElementStyle::internal_SetFont(ScriptGUIElementStyle* nativeInstance, ScriptFont* value)
+	void ScriptGUIElementStyle::internal_SetFont(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
-		nativeInstance->mElementStyle->font = value->getInternalFont();
+		ScriptFont* nativeValue = ScriptFont::toNative(value);
+		nativeInstance->mElementStyle->font = nativeValue->getInternalValue();
 	}
 
 
-	int ScriptGUIElementStyle::internal_GetFontSize(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetFontSize(ScriptGUIElementStyle* nativeInstance, CM::UINT32* value)
 	{
-
+		*value = nativeInstance->mElementStyle->fontSize;
 	}
 
-	void ScriptGUIElementStyle::internal_SetFontSize(ScriptGUIElementStyle* nativeInstance, int value)
+	void ScriptGUIElementStyle::internal_SetFontSize(ScriptGUIElementStyle* nativeInstance, CM::UINT32 value)
 	{
-
+		nativeInstance->mElementStyle->fontSize = value;
 	}
 
 
-	int ScriptGUIElementStyle::internal_GetTextHorzAlign(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, TextHorzAlign* value)
 	{
-
+		*value = nativeInstance->mElementStyle->textHorzAlign;
 	}
 
-	void ScriptGUIElementStyle::internal_SetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, int value)
+	void ScriptGUIElementStyle::internal_SetTextHorzAlign(ScriptGUIElementStyle* nativeInstance, TextHorzAlign value)
 	{
-
+		nativeInstance->mElementStyle->textHorzAlign = value;
 	}
 
 
-	int ScriptGUIElementStyle::internal_GetTextVertAlign(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetTextVertAlign(ScriptGUIElementStyle* nativeInstance, TextVertAlign* value)
 	{
-
+		*value = nativeInstance->mElementStyle->textVertAlign;
 	}
 
-	void ScriptGUIElementStyle::internal_SetTextVertAlign(ScriptGUIElementStyle* nativeInstance, int value)
+	void ScriptGUIElementStyle::internal_SetTextVertAlign(ScriptGUIElementStyle* nativeInstance, TextVertAlign value)
 	{
-
+		nativeInstance->mElementStyle->textVertAlign = value;
 	}
 
 
-	int ScriptGUIElementStyle::internal_GetImagePosition(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetImagePosition(ScriptGUIElementStyle* nativeInstance, GUIImagePosition* value)
 	{
-
+		*value = nativeInstance->mElementStyle->imagePosition;
 	}
 
-	void ScriptGUIElementStyle::internal_SetImagePosition(ScriptGUIElementStyle* nativeInstance, int value)
+	void ScriptGUIElementStyle::internal_SetImagePosition(ScriptGUIElementStyle* nativeInstance, GUIImagePosition value)
 	{
-
+		nativeInstance->mElementStyle->imagePosition = value;
 	}
 
 
-	bool ScriptGUIElementStyle::internal_GetWordWrap(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetWordWrap(ScriptGUIElementStyle* nativeInstance, bool* value)
 	{
-
+		*value = nativeInstance->mElementStyle->wordWrap;
 	}
 
 	void ScriptGUIElementStyle::internal_SetWordWrap(ScriptGUIElementStyle* nativeInstance, bool value)
 	{
-
+		nativeInstance->mElementStyle->wordWrap = value;
 	}
 
-
-	MonoObject* ScriptGUIElementStyle::internal_GetNormal(ScriptGUIElementStyle* nativeInstance)
+	
+	void ScriptGUIElementStyle::internal_GetNormal(ScriptGUIElementStyle* nativeInstance, MonoObject** value)
 	{
+		throwIfInstancesDontMatch(nativeInstance->mNormal, &nativeInstance->mElementStyle->normal);
 
+		if(nativeInstance->mNormal != nullptr)
+		{
+			*value = nativeInstance->mNormal->getManagedInstance();
+			return;
+		}
+
+		*value = nullptr;
 	}
 
 	void ScriptGUIElementStyle::internal_SetNormal(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
-
+		ScriptGUIElementStateStyle* nativeValue = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle->normal = *nativeValue->getInternalValue();
 	}
 
 
-	MonoObject* ScriptGUIElementStyle::internal_GetHover(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetHover(ScriptGUIElementStyle* nativeInstance, MonoObject** value)
 	{
+		throwIfInstancesDontMatch(nativeInstance->mHover, &nativeInstance->mElementStyle->hover);
 
+		if(nativeInstance->mHover != nullptr)
+		{
+			*value = nativeInstance->mHover->getManagedInstance();
+			return;
+		}
+
+		*value = nullptr;
 	}
 
 	void ScriptGUIElementStyle::internal_SetHover(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
-
+		ScriptGUIElementStateStyle* nativeValue = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle->hover = *nativeValue->getInternalValue();
 	}
 
 
-	MonoObject* ScriptGUIElementStyle::internal_GetActive(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetActive(ScriptGUIElementStyle* nativeInstance, MonoObject** value)
 	{
+		throwIfInstancesDontMatch(nativeInstance->mActive, &nativeInstance->mElementStyle->active);
 
+		if(nativeInstance->mActive != nullptr)
+		{
+			*value = nativeInstance->mActive->getManagedInstance();
+			return;
+		}
+
+		*value = nullptr;
 	}
 
 	void ScriptGUIElementStyle::internal_SetActive(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
-
+		ScriptGUIElementStateStyle* nativeValue = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle->active = *nativeValue->getInternalValue();
 	}
 
 
-	MonoObject* ScriptGUIElementStyle::internal_GetFocused(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetFocused(ScriptGUIElementStyle* nativeInstance, MonoObject** value)
 	{
+		throwIfInstancesDontMatch(nativeInstance->mFocused, &nativeInstance->mElementStyle->focused);
+
+		if(nativeInstance->mFocused != nullptr)
+		{
+			*value = nativeInstance->mFocused->getManagedInstance();
+			return;
+		}
 
+		*value = nullptr;
 	}
 
 	void ScriptGUIElementStyle::internal_SetFocused(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
-
+		ScriptGUIElementStateStyle* nativeValue = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle->focused = *nativeValue->getInternalValue();
 	}
 
 
-	MonoObject* ScriptGUIElementStyle::internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetNormalOn(ScriptGUIElementStyle* nativeInstance, MonoObject** value)
 	{
+		throwIfInstancesDontMatch(nativeInstance->mNormalOn, &nativeInstance->mElementStyle->normalOn);
+
+		if(nativeInstance->mNormalOn != nullptr)
+		{
+			*value = nativeInstance->mNormalOn->getManagedInstance();
+			return;
+		}
 
+		*value = nullptr;
 	}
 
 	void ScriptGUIElementStyle::internal_SetNormalOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
-
+		ScriptGUIElementStateStyle* nativeValue = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle->normalOn = *nativeValue->getInternalValue();
 	}
 
 
-	MonoObject* ScriptGUIElementStyle::internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetHoverOn(ScriptGUIElementStyle* nativeInstance, MonoObject** value)
 	{
+		throwIfInstancesDontMatch(nativeInstance->mHoverOn, &nativeInstance->mElementStyle->hoverOn);
 
+		if(nativeInstance->mHoverOn != nullptr)
+		{
+			*value = nativeInstance->mHoverOn->getManagedInstance();
+			return;
+		}
+
+		*value = nullptr;
 	}
 
 	void ScriptGUIElementStyle::internal_SetHoverOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
-
+		ScriptGUIElementStateStyle* nativeValue = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle->hoverOn = *nativeValue->getInternalValue();
 	}
 
 
-	MonoObject* ScriptGUIElementStyle::internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetActiveOn(ScriptGUIElementStyle* nativeInstance, MonoObject** value)
 	{
+		throwIfInstancesDontMatch(nativeInstance->mActiveOn, &nativeInstance->mElementStyle->activeOn);
+
+		if(nativeInstance->mActiveOn != nullptr)
+		{
+			*value = nativeInstance->mActiveOn->getManagedInstance();
+			return;
+		}
 
+		*value = nullptr;
 	}
 
 	void ScriptGUIElementStyle::internal_SetActiveOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
-
+		ScriptGUIElementStateStyle* nativeValue = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle->activeOn = *nativeValue->getInternalValue();
 	}
 
 
-	MonoObject* ScriptGUIElementStyle::internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetFocusedOn(ScriptGUIElementStyle* nativeInstance, MonoObject** value)
 	{
+		throwIfInstancesDontMatch(nativeInstance->mFocusedOn, &nativeInstance->mElementStyle->focusedOn);
+
+		if(nativeInstance->mFocusedOn != nullptr)
+		{
+			*value = nativeInstance->mFocusedOn->getManagedInstance();
+			return;
+		}
 
+		*value = nullptr;
 	}
 
 	void ScriptGUIElementStyle::internal_SetFocusedOn(ScriptGUIElementStyle* nativeInstance, MonoObject* value)
 	{
-
+		ScriptGUIElementStateStyle* nativeValue = ScriptGUIElementStateStyle::toNative(value);
+		nativeInstance->mElementStyle->focusedOn = *nativeValue->getInternalValue();
 	}
 
 
-	RectOffset ScriptGUIElementStyle::internal_GetBorder(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
 	{
-
+		*value = nativeInstance->mElementStyle->border;
 	}
 
-	void ScriptGUIElementStyle::internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset value)
+	void ScriptGUIElementStyle::internal_SetBorder(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
 	{
-
+		nativeInstance->mElementStyle->border = *value;
 	}
 
 
-	RectOffset ScriptGUIElementStyle::internal_GetMargins(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
 	{
-
+		*value = nativeInstance->mElementStyle->margins;
 	}
 
-	void ScriptGUIElementStyle::internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset value)
+	void ScriptGUIElementStyle::internal_SetMargins(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
 	{
-
+		nativeInstance->mElementStyle->margins = *value;
 	}
 
 
-	RectOffset ScriptGUIElementStyle::internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
 	{
-
+		*value = nativeInstance->mElementStyle->contentOffset;
 	}
 
-	void ScriptGUIElementStyle::internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset value)
+	void ScriptGUIElementStyle::internal_SetContentOffset(ScriptGUIElementStyle* nativeInstance, RectOffset* value)
 	{
-
+		nativeInstance->mElementStyle->contentOffset = *value;
 	}
 
 
-	INT32 ScriptGUIElementStyle::internal_GetWidth(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value)
 	{
-
+		*value = nativeInstance->mElementStyle->width;
 	}
 
-	void ScriptGUIElementStyle::internal_SetWidth(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	void ScriptGUIElementStyle::internal_SetWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value)
 	{
-
+		nativeInstance->mElementStyle->width = value;
 	}
 
 
-	INT32 ScriptGUIElementStyle::internal_GetHeight(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetHeight(ScriptGUIElementStyle* nativeInstance, UINT32* value)
 	{
-
+		*value = nativeInstance->mElementStyle->height;
 	}
 
-	void ScriptGUIElementStyle::internal_SetHeight(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	void ScriptGUIElementStyle::internal_SetHeight(ScriptGUIElementStyle* nativeInstance, UINT32 value)
 	{
-
+		nativeInstance->mElementStyle->height = value;
 	}
 
 
-	INT32 ScriptGUIElementStyle::internal_GetMinWidth(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetMinWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value)
 	{
-
+		*value = nativeInstance->mElementStyle->minWidth;
 	}
 
-	void ScriptGUIElementStyle::internal_SetMinWidth(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	void ScriptGUIElementStyle::internal_SetMinWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value)
 	{
-
+		nativeInstance->mElementStyle->minWidth = value;
 	}
 
 
-	INT32 ScriptGUIElementStyle::internal_GetMaxWidth(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetMaxWidth(ScriptGUIElementStyle* nativeInstance, UINT32* value)
 	{
-
+		*value = nativeInstance->mElementStyle->maxWidth;
 	}
 
-	void ScriptGUIElementStyle::internal_SetMaxWidth(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	void ScriptGUIElementStyle::internal_SetMaxWidth(ScriptGUIElementStyle* nativeInstance, UINT32 value)
 	{
-
+		nativeInstance->mElementStyle->maxWidth = value;
 	}
 
 
-	INT32 ScriptGUIElementStyle::internal_GetMinHeight(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetMinHeight(ScriptGUIElementStyle* nativeInstance, UINT32* value)
 	{
-
+		*value = nativeInstance->mElementStyle->minHeight;
 	}
 
-	void ScriptGUIElementStyle::internal_SetMinHeight(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	void ScriptGUIElementStyle::internal_SetMinHeight(ScriptGUIElementStyle* nativeInstance, UINT32 value)
 	{
-
+		nativeInstance->mElementStyle->minHeight = value;
 	}
 
 
-	INT32 ScriptGUIElementStyle::internal_GetMaxHeight(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetMaxHeight(ScriptGUIElementStyle* nativeInstance, UINT32* value)
 	{
-
+		*value = nativeInstance->mElementStyle->maxHeight;
 	}
 
-	void ScriptGUIElementStyle::internal_SetMaxHeight(ScriptGUIElementStyle* nativeInstance, INT32 value)
+	void ScriptGUIElementStyle::internal_SetMaxHeight(ScriptGUIElementStyle* nativeInstance, UINT32 value)
 	{
-
+		nativeInstance->mElementStyle->maxHeight = value;
 	}
 
 
-	bool ScriptGUIElementStyle::internal_GetFixedWidth(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool* value)
 	{
-
+		*value = nativeInstance->mElementStyle->fixedWidth;
 	}
 
 	void ScriptGUIElementStyle::internal_SetFixedWidth(ScriptGUIElementStyle* nativeInstance, bool value)
 	{
-
+		nativeInstance->mElementStyle->fixedWidth = value;
 	}
 
 
-	bool ScriptGUIElementStyle::internal_GetFixedHeight(ScriptGUIElementStyle* nativeInstance)
+	void ScriptGUIElementStyle::internal_GetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool* value)
 	{
-
+		*value = nativeInstance->mElementStyle->fixedHeight;
 	}
 
 	void ScriptGUIElementStyle::internal_SetFixedHeight(ScriptGUIElementStyle* nativeInstance, bool value)
 	{
-
-	}*/
+		nativeInstance->mElementStyle->fixedHeight = value;
+	}
 }

+ 9 - 5
CSharpWrap.txt

@@ -138,17 +138,21 @@ When loading resources I need to be able to load both project resources and engi
  - BuiltinResources can be used for accessing default resources like GUI skin textures and similar
  - They're all loaded from a special folder that is set in EditorApplication
 
-
-IMMEDIATE TODO:
- - Finish up ScriptGUIElementstyle.cpp
- - Add ScriptGUIElementStateStyle
-
 Should I make sprite texture a resource?
  - Quite probably, and will need to replace any Ptr references with handle references. I want the user
    to be able to reference the resource in multiple locations and then he can easily edit the SpriteTexture as needed.
 
  BsApplication::getPrimaryViewport is not implemented
 
+ Consider moving all script stuff in a separate static lib?
+
+IMMEDIATE: 
+ - Fix the macros.
+ - Move them to a separate file.
+
+IGNORE RESOURCES FOR NOW. When building the GUI make sure that they all temporarily use the native skin
+
+
 ----------------------------
 
   I want my .exe to be native. Internally it will call MBansheeEngine and MBansheeEditor.

+ 57 - 57
MBansheeEngine/GUIElementStyle.cs

@@ -32,63 +32,63 @@ namespace BansheeEngine
 
         public Font font
         {
-            get { return Internal_GetFont(mCachedPtr); }
+            get { Font value; Internal_GetFont(mCachedPtr, out value); return value; }
             set { Internal_SetFont(mCachedPtr, value); }
         }
 
         public int fontSize
         {
-            get { return Internal_GetFontSize(mCachedPtr); }
+            get { int value; Internal_GetFontSize(mCachedPtr, out value); return value; }
             set { Internal_SetFontSize(mCachedPtr, value); }
         }
 
 
         public TextHorzAlign textHorzAlign
         {
-            get { return Internal_GetTextHorzAlign(mCachedPtr); }
+            get { TextHorzAlign value; Internal_GetTextHorzAlign(mCachedPtr, out value); return value; }
             set { Internal_SetTextHorzAlign(mCachedPtr, value); }
         }
 
         public TextVertAlign textVertAlign
         {
-            get { return Internal_GetTextVertAlign(mCachedPtr); }
+            get { TextVertAlign value; Internal_GetTextVertAlign(mCachedPtr, out value); return value; }
             set { Internal_SetTextVertAlign(mCachedPtr, value); }
         }
 
         public GUIImagePosition imagePosition
         {
-            get { return Internal_GetImagePosition(mCachedPtr); }
+            get { GUIImagePosition value; Internal_GetImagePosition(mCachedPtr, out value); return value; }
             set { Internal_SetImagePosition(mCachedPtr, value); }
         }
 
         public bool wordWrap
         {
-            get { return Internal_GetWordWrap(mCachedPtr); }
+            get { bool value; Internal_GetWordWrap(mCachedPtr, out value); return value; }
             set { Internal_SetWordWrap(mCachedPtr, value); }
         }
 
 
         public GUIElementStateStyle normal
         {
-            get { return Internal_GetNormal(mCachedPtr); }
+            get { GUIElementStateStyle value; Internal_GetNormal(mCachedPtr, out value); return value; }
             set { Internal_SetNormal(mCachedPtr, value); }
         }
 
         public GUIElementStateStyle hover
         {
-            get { return Internal_GetHover(mCachedPtr); }
+            get { GUIElementStateStyle value; Internal_GetHover(mCachedPtr, out value); return value; }
             set { Internal_SetHover(mCachedPtr, value); }
         }
 
         public GUIElementStateStyle active
         {
-            get { return Internal_GetActive(mCachedPtr); }
+            get { GUIElementStateStyle value; Internal_GetActive(mCachedPtr, out value); return value; }
             set { Internal_SetActive(mCachedPtr, value); }
         }
 
         public GUIElementStateStyle focused
         {
-            get { return Internal_GetFocused(mCachedPtr); }
+            get { GUIElementStateStyle value; Internal_GetFocused(mCachedPtr, out value); return value; }
             set { Internal_SetFocused(mCachedPtr, value); }
         }
 
@@ -96,93 +96,93 @@ namespace BansheeEngine
 		// For controls that can be turned on-off
         public GUIElementStateStyle normalOn
         {
-            get { return Internal_GetNormalOn(mCachedPtr); }
+            get { GUIElementStateStyle value; Internal_GetNormalOn(mCachedPtr, out value); return value; }
             set { Internal_SetNormalOn(mCachedPtr, value); }
         }
 
         public GUIElementStateStyle hoverOn
         {
-            get { return Internal_GetHoverOn(mCachedPtr); }
+            get { GUIElementStateStyle value; Internal_GetHoverOn(mCachedPtr, out value); return value; }
             set { Internal_SetHoverOn(mCachedPtr, value); }
         }
 
         public GUIElementStateStyle activeOn
         {
-            get { return Internal_GetActiveOn(mCachedPtr); }
+            get { GUIElementStateStyle value; Internal_GetActiveOn(mCachedPtr, out value); return value; }
             set { Internal_SetActiveOn(mCachedPtr, value); }
         }
 
         public GUIElementStateStyle focusedOn
         {
-            get { return Internal_GetFocusedOn(mCachedPtr); }
+            get { GUIElementStateStyle value; Internal_GetFocusedOn(mCachedPtr, out value); return value; }
             set { Internal_SetFocusedOn(mCachedPtr, value); }
         }
 
 
         public RectOffset border // Determines how the element is scaled (using the typical Scale9Grid approach)
         {
-            get { return Internal_GetBorder(mCachedPtr); }
-            set { Internal_SetBorder(mCachedPtr, value); }
+            get { RectOffset value; Internal_GetBorder(mCachedPtr, out value); return value; }
+            set { Internal_SetBorder(mCachedPtr, ref value); }
         }
 
         public RectOffset margins // Determines offset from the background graphics to the content. Input uses bounds offset by this value.
         {
-            get { return Internal_GetMargins(mCachedPtr); }
-            set { Internal_SetMargins(mCachedPtr, value); }
+            get { RectOffset value; Internal_GetMargins(mCachedPtr, out value); return value; }
+            set { Internal_SetMargins(mCachedPtr, ref value); }
         }
 
         public RectOffset contentOffset // Additional offset to the content, that doesn't effect the bounds. Applied on top of the margins offsets.
         {
-            get { return Internal_GetContentOffset(mCachedPtr); }
-            set { Internal_SetContentOffset(mCachedPtr, value); }
+            get { RectOffset value; Internal_GetContentOffset(mCachedPtr, out value); return value; }
+            set { Internal_SetContentOffset(mCachedPtr, ref value); }
         }
 
 
         public int width
         {
-            get { return Internal_GetWidth(mCachedPtr); }
+            get { int value; Internal_GetWidth(mCachedPtr, out value); return value; }
             set { Internal_SetWidth(mCachedPtr, value); }
         }
 
         public int height
         {
-            get { return Internal_GetHeight(mCachedPtr); }
+            get { int value; Internal_GetHeight(mCachedPtr, out value); return value; }
             set { Internal_SetHeight(mCachedPtr, value); }
         }
 
         public int minWidth
         {
-            get { return Internal_GetMinWidth(mCachedPtr); }
+            get { int value; Internal_GetMinWidth(mCachedPtr, out value); return value; }
             set { Internal_SetMinWidth(mCachedPtr, value); }
         }
         
         public int maxWidth
         {
-            get { return Internal_GetMaxWidth(mCachedPtr); }
+            get { int value; Internal_GetMaxWidth(mCachedPtr, out value); return value; }
             set { Internal_SetMaxWidth(mCachedPtr, value); }
         }
 
         public int minHeight
         {
-            get { return Internal_GetMinHeight(mCachedPtr); }
+            get { int value; Internal_GetMinHeight(mCachedPtr, out value); return value; }
             set { Internal_SetMinHeight(mCachedPtr, value); }
         }
 
         public int maxHeight
         {
-            get { return Internal_GetMaxHeight(mCachedPtr); }
+            get { int value; Internal_GetMaxHeight(mCachedPtr, out value); return value; }
             set { Internal_SetMaxHeight(mCachedPtr, value); }
         }
 
         public bool fixedWidth
         {
-            get { return Internal_GetFixedWidth(mCachedPtr); }
+            get { bool value; Internal_GetFixedWidth(mCachedPtr, out value); return value; }
             set { Internal_SetFixedWidth(mCachedPtr, value); }
         }
 
         public bool fixedHeight
         {
-            get { return Internal_GetFixedHeight(mCachedPtr); }
+            get { bool value; Internal_GetFixedHeight(mCachedPtr, out value); return value; }
             set { Internal_SetFixedHeight(mCachedPtr, value); }
         }
 
@@ -190,131 +190,131 @@ namespace BansheeEngine
         private static extern void Internal_CreateInstance(GUIElementStyle instance);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern Font Internal_GetFont(IntPtr nativeInstance);
+        private static extern void Internal_GetFont(IntPtr nativeInstance, out Font value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetFont(IntPtr nativeInstance, Font value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern int Internal_GetFontSize(IntPtr nativeInstance);
+        private static extern void Internal_GetFontSize(IntPtr nativeInstance, out int value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetFontSize(IntPtr nativeInstance, int value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern TextHorzAlign Internal_GetTextHorzAlign(IntPtr nativeInstance);
+        private static extern void Internal_GetTextHorzAlign(IntPtr nativeInstance, out TextHorzAlign value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetTextHorzAlign(IntPtr nativeInstance, TextHorzAlign value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern TextVertAlign Internal_GetTextVertAlign(IntPtr nativeInstance);
+        private static extern void Internal_GetTextVertAlign(IntPtr nativeInstance, out TextVertAlign value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetTextVertAlign(IntPtr nativeInstance, TextVertAlign value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern GUIImagePosition Internal_GetImagePosition(IntPtr nativeInstance);
+        private static extern void Internal_GetImagePosition(IntPtr nativeInstance, out GUIImagePosition value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetImagePosition(IntPtr nativeInstance, GUIImagePosition value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern bool Internal_GetWordWrap(IntPtr nativeInstance);
+        private static extern void Internal_GetWordWrap(IntPtr nativeInstance, out bool value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetWordWrap(IntPtr nativeInstance, bool value);
 
 
-        [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern GUIElementStateStyle Internal_GetNormal(IntPtr nativeInstance);
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_GetNormal(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetNormal(IntPtr nativeInstance, GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern GUIElementStateStyle Internal_GetHover(IntPtr nativeInstance);
+        private static extern void Internal_GetHover(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetHover(IntPtr nativeInstance, GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern GUIElementStateStyle Internal_GetActive(IntPtr nativeInstance);
+        private static extern void Internal_GetActive(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetActive(IntPtr nativeInstance, GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern GUIElementStateStyle Internal_GetFocused(IntPtr nativeInstance);
+        private static extern void Internal_GetFocused(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetFocused(IntPtr nativeInstance, GUIElementStateStyle value);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern GUIElementStateStyle Internal_GetNormalOn(IntPtr nativeInstance);
+        private static extern void Internal_GetNormalOn(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetNormalOn(IntPtr nativeInstance, GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern GUIElementStateStyle Internal_GetHoverOn(IntPtr nativeInstance);
+        private static extern void Internal_GetHoverOn(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetHoverOn(IntPtr nativeInstance, GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern GUIElementStateStyle Internal_GetActiveOn(IntPtr nativeInstance);
+        private static extern void Internal_GetActiveOn(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetActiveOn(IntPtr nativeInstance, GUIElementStateStyle value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern GUIElementStateStyle Internal_GetFocusedOn(IntPtr nativeInstance);
+        private static extern void Internal_GetFocusedOn(IntPtr nativeInstance, out GUIElementStateStyle value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetFocusedOn(IntPtr nativeInstance, GUIElementStateStyle value);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern RectOffset Internal_GetBorder(IntPtr nativeInstance);
+        private static extern void Internal_GetBorder(IntPtr nativeInstance, out RectOffset value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetBorder(IntPtr nativeInstance, RectOffset value);
+        private static extern void Internal_SetBorder(IntPtr nativeInstance, ref RectOffset value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern RectOffset Internal_GetMargins(IntPtr nativeInstance);
+        private static extern void Internal_GetMargins(IntPtr nativeInstance, out RectOffset value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetMargins(IntPtr nativeInstance, RectOffset value);
+        private static extern void Internal_SetMargins(IntPtr nativeInstance, ref RectOffset value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern RectOffset Internal_GetContentOffset(IntPtr nativeInstance);
+        private static extern void Internal_GetContentOffset(IntPtr nativeInstance, out RectOffset value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern void Internal_SetContentOffset(IntPtr nativeInstance, RectOffset value);
+        private static extern void Internal_SetContentOffset(IntPtr nativeInstance, ref RectOffset value);
 
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern int Internal_GetWidth(IntPtr nativeInstance);
+        private static extern void Internal_GetWidth(IntPtr nativeInstance, out int value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetWidth(IntPtr nativeInstance, int value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern int Internal_GetHeight(IntPtr nativeInstance);
+        private static extern void Internal_GetHeight(IntPtr nativeInstance, out int value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetHeight(IntPtr nativeInstance, int value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern int Internal_GetMinWidth(IntPtr nativeInstance);
+        private static extern void Internal_GetMinWidth(IntPtr nativeInstance, out int value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetMinWidth(IntPtr nativeInstance, int value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern int Internal_GetMaxWidth(IntPtr nativeInstance);
+        private static extern void Internal_GetMaxWidth(IntPtr nativeInstance, out int value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetMaxWidth(IntPtr nativeInstance, int value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern int Internal_GetMinHeight(IntPtr nativeInstance);
+        private static extern void Internal_GetMinHeight(IntPtr nativeInstance, out int value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetMinHeight(IntPtr nativeInstance, int value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern int Internal_GetMaxHeight(IntPtr nativeInstance);
+        private static extern void Internal_GetMaxHeight(IntPtr nativeInstance, out int value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetMaxHeight(IntPtr nativeInstance, int value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern bool Internal_GetFixedWidth(IntPtr nativeInstance);
+        private static extern void Internal_GetFixedWidth(IntPtr nativeInstance, out bool value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetFixedWidth(IntPtr nativeInstance, bool value);
 
         [MethodImpl(MethodImplOptions.InternalCall)] 
-        private static extern bool Internal_GetFixedHeight(IntPtr nativeInstance);
+        private static extern void Internal_GetFixedHeight(IntPtr nativeInstance, out bool value);
         [MethodImpl(MethodImplOptions.InternalCall)] 
         private static extern void Internal_SetFixedHeight(IntPtr nativeInstance, bool value);
     }

+ 4 - 2
MBansheeEngine/Program.cs

@@ -8,9 +8,11 @@ namespace BansheeEngine
         static void Main()
         {
             GUIElementStateStyle dbgStyle = new GUIElementStateStyle();
-            //Color newColor = Color.red;
+            Color newColor = Color.red;
 
-            //dbgStyle.textColor = newColor;
+            dbgStyle.textColor = newColor;
+            Color myColor = dbgStyle.textColor;
+            dbgStyle.textColor = myColor;
         }
     }
 }