Преглед изворни кода

Added a (still unused) "disabled" flag to GUIElement
Minor fixes to GUISkin inspector

BearishSun пре 10 година
родитељ
комит
c4e5e86f41

+ 35 - 11
BansheeEngine/Include/BsGUIElementBase.h

@@ -36,9 +36,11 @@ namespace BansheeEngine
 		{
 			GUIElem_Dirty = 0x01,
 			GUIElem_Hidden = 0x02,
-			GUIElem_Disabled = 0x04,
-			GUIElem_HiddenLocal = 0x08,
-			GUIElem_DisabledLocal = 0x10
+			GUIElem_Inactive = 0x04,
+			GUIElem_HiddenSelf = 0x08,
+			GUIElem_InactiveSelf = 0x10,
+			GUIElem_Disabled = 0x20,
+			GUIElem_DisabledSelf = 0x40
 		};
 
 	public:
@@ -91,11 +93,17 @@ namespace BansheeEngine
 		void setVisible(bool visible);
 
 		/**
-		 * @brief	Enables or disables this element and recursively applies the same state to all the child elements.
+		 * @brief	Activates or deactives this element and recursively applies the same state to all the child elements.
 		 * 			This has the same effect as ::setVisible, but when disabled it will also remove the element from the 
 		 * 			layout, essentially having the same effect is if you destroyed the element.
 		 */
-		void setEnabled(bool enabled);
+		void setActive(bool active);
+
+		/**
+		 * @brief	Disables or enables the element. Disabled elements cannot be interacted with and have a faded out 
+		 *			appearance.
+		 */
+		void setDisabled(bool disabled);
 
 		/**
 		 * @brief	Returns non-clipped bounds of the GUI element. Relative to a parent GUI panel.
@@ -279,18 +287,26 @@ namespace BansheeEngine
 		CGUIWidget* _getParentWidget() const { return mParentWidget; }
 
 		/**
-		 * @brief	Returns if element is visible or hidden.
+		 * @brief	Checks if element is visible or hidden.
 		 *
 		 * @note	Internal method.
 		 */
 		bool _isVisible() const { return (mFlags & GUIElem_Hidden) == 0; }
 
 		/**
-		 * @brief	Returns if element is enabled or disabled.
+		 * @brief	Checks if element is active or inactive. Inactive elements are not visible, don't take up space
+		 *			in their parent layouts, and can't be interacted with.
+		 *
+		 * @note	Internal method.
+		 */
+		bool _isActive() const { return (mFlags & GUIElem_Inactive) == 0; }
+
+		/**
+		 * @brief	Checks if element is disabled. Disabled elements cannot be interacted with and have a faded out appearance.
 		 *
 		 * @note	Internal method.
 		 */
-		bool _isEnabled() const { return (mFlags & GUIElem_Disabled) == 0; }
+		bool _isDisabled() const { return (mFlags & GUIElem_Disabled) != 0; }
 
 		/**
 		 * Internal version of ::setVisible that doesn't modify local visibility, instead it is only meant to be called
@@ -301,12 +317,20 @@ namespace BansheeEngine
 		void _setVisible(bool visible);
 
 		/**
-		 * Internal version of ::setEnabled that doesn't modify local state, instead it is only meant to be called
+		 * Internal version of ::setActive that doesn't modify local state, instead it is only meant to be called
 		 * on child elements of the element whose state was modified.
 		 *  
-		 * @copydoc setVisible
+		 * @copydoc setActive
+		 */
+		void _setActive(bool active);
+
+		/**
+		 * Internal version of ::setDisabled that doesn't modify local state, instead it is only meant to be called
+		 * on child elements of the element whose state was modified.
+		 *  
+		 * @copydoc setDisabled
 		 */
-		void _setEnabled(bool enabled);
+		void _setDisabled(bool disabled);
 
 		/**
 		 * @brief	Changes the active GUI element widget. This allows you to move an element

+ 71 - 33
BansheeEngine/Source/BsGUIElementBase.cpp

@@ -221,28 +221,28 @@ namespace BansheeEngine
 
 	void GUIElementBase::setVisible(bool visible)
 	{
-		// No visibility states matter if object is disabled
-		if (!_isEnabled())
+		// No visibility states matter if object is not active
+		if (!_isActive())
 			return;
 
-		bool visibleLocal = (mFlags & GUIElem_HiddenLocal) == 0;
-		if (visibleLocal != visible)
+		bool visibleSelf = (mFlags & GUIElem_HiddenSelf) == 0;
+		if (visibleSelf != visible)
 		{
-			// If making an element visible make sure to mark layout as dirty, as we didn't track any dirty flags while the element was disabled
+			// If making an element visible make sure to mark layout as dirty, as we didn't track any dirty flags while the element was inactive
 			if (!visible)
 			{
 				if (_isVisible())
 					_markMeshAsDirty();
 
-				mFlags |= GUIElem_Hidden | GUIElem_HiddenLocal;
+				mFlags |= GUIElem_Hidden | GUIElem_HiddenSelf;
 			}
 			else
 			{
 				if (mParentElement != nullptr && !mParentElement->_isVisible())
-					mFlags &= ~GUIElem_HiddenLocal;
+					mFlags &= ~GUIElem_HiddenSelf;
 				else
 				{
-					mFlags &= ~(GUIElem_Hidden | GUIElem_HiddenLocal);
+					mFlags &= ~(GUIElem_Hidden | GUIElem_HiddenSelf);
 					_markLayoutAsDirty();
 				}
 			}
@@ -262,8 +262,8 @@ namespace BansheeEngine
 			}
 			else
 			{
-				bool childVisibleLocal = (child->mFlags & GUIElem_HiddenLocal) == 0;
-				if (childVisibleLocal)
+				bool childVisibleSelf = (child->mFlags & GUIElem_HiddenSelf) == 0;
+				if (childVisibleSelf)
 				{
 					child->mFlags &= ~GUIElem_Hidden;
 					child->_setVisible(true);
@@ -272,64 +272,102 @@ namespace BansheeEngine
 		}
 	}
 
-	void GUIElementBase::setEnabled(bool enabled)
+	void GUIElementBase::setActive(bool active)
 	{
-		static const UINT8 ENABLE_FLAGS = GUIElem_Disabled | GUIElem_Hidden | GUIElem_DisabledLocal | GUIElem_HiddenLocal;
+		static const UINT8 ACTIVE_FLAGS = GUIElem_Inactive | GUIElem_Hidden | GUIElem_InactiveSelf | GUIElem_HiddenSelf;
 
-		bool enabledLocal = (mFlags & GUIElem_DisabledLocal) == 0;
-		if (enabledLocal != enabled)
+		bool activeSelf = (mFlags & GUIElem_InactiveSelf) == 0;
+		if (activeSelf != active)
 		{
-			if (!enabled)
+			if (!active)
 			{
-				if (_isEnabled())
+				if (_isActive())
 					_markLayoutAsDirty();
 
-				mFlags |= ENABLE_FLAGS;
+				mFlags |= ACTIVE_FLAGS;
 			}
 			else
 			{
 				if (mParentElement != nullptr)
 				{
-					if (!mParentElement->_isEnabled())
-						mFlags &= ~(GUIElem_DisabledLocal | GUIElem_HiddenLocal);
+					if (!mParentElement->_isActive())
+						mFlags &= ~(GUIElem_InactiveSelf | GUIElem_HiddenSelf);
 					else
 					{
 						if (!mParentElement->_isVisible())
-							mFlags &= ~(GUIElem_Disabled | GUIElem_DisabledLocal | GUIElem_HiddenLocal);
+							mFlags &= ~(GUIElem_Inactive | GUIElem_InactiveSelf | GUIElem_HiddenSelf);
 						else
-							mFlags &= ~ENABLE_FLAGS;
+							mFlags &= ~ACTIVE_FLAGS;
 					}
 				}
 				else
-					mFlags &= ~ENABLE_FLAGS;
+					mFlags &= ~ACTIVE_FLAGS;
 
-				if (_isEnabled())
+				if (_isActive())
 					_markLayoutAsDirty();
 			}
 
-			_setEnabled(enabled);
-			_setVisible(enabled);
+			_setActive(active);
+			_setVisible(active);
 		}
 	}
 
-	void GUIElementBase::_setEnabled(bool enabled)
+	void GUIElementBase::_setActive(bool active)
 	{
 		for (auto& child : mChildren)
 		{
-			if (!enabled)
+			if (!active)
 			{
-				child->mFlags |= GUIElem_Disabled;
-				child->_setEnabled(false);
+				child->mFlags |= GUIElem_Inactive;
+				child->_setActive(false);
 			}
 			else
 			{
-				bool childEnabledLocal = (child->mFlags & GUIElem_DisabledLocal) == 0;
-				if (childEnabledLocal)
+				bool childActiveSelf = (child->mFlags & GUIElem_InactiveSelf) == 0;
+				if (childActiveSelf)
+				{
+					child->mFlags &= ~GUIElem_Inactive;
+					child->_setActive(true);
+				}
+			}
+		}
+	}
+
+	void GUIElementBase::setDisabled(bool disabled)
+	{
+		bool disabledSelf = (mFlags & GUIElem_DisabledSelf) != 0;
+		if (disabledSelf != disabled)
+		{
+			if (!disabled)
+				mFlags &= ~(GUIElem_Disabled | GUIElem_DisabledSelf);
+			else
+				mFlags |= (GUIElem_Disabled | GUIElem_DisabledSelf);
+
+			if (_isVisible())
+				_markContentAsDirty();
+
+			_setDisabled(disabled);
+		}
+	}
+
+	void GUIElementBase::_setDisabled(bool disabled)
+	{
+		for (auto& child : mChildren)
+		{
+			if (!disabled)
+			{
+				bool disabledSelf = (child->mFlags & GUIElem_DisabledSelf) != 0;
+				if (!disabledSelf)
 				{
 					child->mFlags &= ~GUIElem_Disabled;
-					child->_setEnabled(true);
+					child->_setDisabled(false);
 				}
 			}
+			else
+			{
+				child->mFlags |= GUIElem_Disabled;
+				child->_setDisabled(true);
+			}
 		}
 	}
 
@@ -402,7 +440,7 @@ namespace BansheeEngine
 		element->_setParent(this);
 		mChildren.push_back(element);
 
-		element->_setEnabled(_isEnabled());
+		element->_setActive(_isActive());
 		element->_setVisible(_isVisible());
 
 		_markLayoutAsDirty();

+ 1 - 1
BansheeEngine/Source/BsGUILayout.cpp

@@ -48,7 +48,7 @@ namespace BansheeEngine
 		element->_setParent(this);
 		mChildren.insert(mChildren.begin() + idx, element);
 		
-		element->_setEnabled(_isEnabled());
+		element->_setActive(_isActive());
 		element->_setVisible(_isVisible());
 
 		_markLayoutAsDirty();

+ 4 - 4
BansheeEngine/Source/BsGUILayoutX.cpp

@@ -17,7 +17,7 @@ namespace BansheeEngine
 		Vector2I minSize;
 		for (auto& child : mChildren)
 		{
-			if (!child->_isEnabled())
+			if (!child->_isActive())
 				continue;
 
 			LayoutSizeRange sizeRange = child->_calculateLayoutSizeRange();
@@ -58,7 +58,7 @@ namespace BansheeEngine
 		{
 			LayoutSizeRange& childSizeRange = mChildSizeRanges[childIdx];
 
-			if (child->_isEnabled())
+			if (child->_isActive())
 			{
 				childSizeRange = child->_getLayoutSizeRange();
 				if (child->_getType() == GUIElementBase::Type::FixedSpace)
@@ -121,7 +121,7 @@ namespace BansheeEngine
 			}
 			else if (child->_getType() == GUIElementBase::Type::FlexibleSpace)
 			{
-				if (child->_isEnabled())
+				if (child->_isActive())
 				{
 					numFlexibleSpaces++;
 					numNonClampedElements++;
@@ -402,7 +402,7 @@ namespace BansheeEngine
 		GUILayoutData childData = data;
 		for(auto& child : mChildren)
 		{
-			if (child->_isEnabled())
+			if (child->_isActive())
 			{
 				childData.area = elementAreas[childIdx];
 				childData.clipRect = childData.area;

+ 4 - 4
BansheeEngine/Source/BsGUILayoutY.cpp

@@ -17,7 +17,7 @@ namespace BansheeEngine
 
 		for (auto& child : mChildren)
 		{
-			if (!child->_isEnabled())
+			if (!child->_isActive())
 				continue;
 
 			LayoutSizeRange sizeRange = child->_calculateLayoutSizeRange();
@@ -58,7 +58,7 @@ namespace BansheeEngine
 		{
 			LayoutSizeRange& childSizeRange = mChildSizeRanges[childIdx];
 
-			if (child->_isEnabled())
+			if (child->_isActive())
 			{
 				childSizeRange = child->_getLayoutSizeRange();
 				if (child->_getType() == GUIElementBase::Type::FixedSpace)
@@ -121,7 +121,7 @@ namespace BansheeEngine
 			}
 			else if (child->_getType() == GUIElementBase::Type::FlexibleSpace)
 			{
-				if (child->_isEnabled())
+				if (child->_isActive())
 				{
 					numFlexibleSpaces++;
 					numNonClampedElements++;
@@ -401,7 +401,7 @@ namespace BansheeEngine
 		GUILayoutData childData = data;
 		for(auto& child : mChildren)
 		{
-			if (child->_isEnabled())
+			if (child->_isActive())
 			{
 				childData.area = elementAreas[childIdx];
 				childData.clipRect = childData.area;

+ 3 - 3
BansheeEngine/Source/BsGUIPanel.cpp

@@ -27,7 +27,7 @@ namespace BansheeEngine
 
 		for (auto& child : mChildren)
 		{
-			if (!child->_isEnabled())
+			if (!child->_isActive())
 				continue;
 
 			LayoutSizeRange sizeRange = child->_calculateLayoutSizeRange();
@@ -94,7 +94,7 @@ namespace BansheeEngine
 		{
 			LayoutSizeRange& childSizeRange = mChildSizeRanges[childIdx];
 
-			if (child->_isEnabled())
+			if (child->_isActive())
 			{
 				childSizeRange = _getElementSizeRange(child);
 
@@ -235,7 +235,7 @@ namespace BansheeEngine
 
 		for (auto& child : mChildren)
 		{
-			if (child->_isEnabled())
+			if (child->_isActive())
 			{
 				childData.area = elementAreas[childIdx];
 

+ 3 - 3
BansheeEngine/Source/BsGUIScrollArea.cpp

@@ -68,7 +68,7 @@ namespace BansheeEngine
 		// then they're not needed and the range is valid. And if it doesn't
 		// fit the area will get clipped anyway and including the scroll bars
 		// won't change the size much, but it would complicate this method significantly.
-		if (mContentLayout->_isEnabled())
+		if (mContentLayout->_isActive())
 			return mDimensions.calculateSizeRange(_getOptimalSize());
 
 		return mDimensions.calculateSizeRange(Vector2I());
@@ -90,7 +90,7 @@ namespace BansheeEngine
 		UINT32 childIdx = 0;
 		for (auto& child : mChildren)
 		{
-			if (child->_isEnabled())
+			if (child->_isActive())
 				mChildSizeRanges[childIdx] = child->_getLayoutSizeRange();
 			else
 				mChildSizeRanges[childIdx] = LayoutSizeRange();
@@ -272,7 +272,7 @@ namespace BansheeEngine
 		Rect2I& vertScrollBounds = elementAreas[vertScrollIdx];
 
 		// Layout
-		if (mContentLayout->_isEnabled())
+		if (mContentLayout->_isActive())
 		{
 			Rect2I layoutClipRect = data.clipRect;
 			layoutClipRect.width = (UINT32)mVisibleSize.x;

+ 6 - 3
MBansheeEditor/GUI/GUIDictionaryField.cs

@@ -317,7 +317,7 @@ namespace BansheeEditor
             isExpanded = expanded;
 
             if (guiChildLayout != null)
-                guiChildLayout.Enabled = isExpanded && (rows.Count > 0 || IsEditInProgress());
+                guiChildLayout.Active = isExpanded && (rows.Count > 0 || IsEditInProgress());
         }
 
         /// <summary>
@@ -461,7 +461,7 @@ namespace BansheeEditor
             editRowIdx = rowIdx;
 
             rows[rowIdx].EditMode = true;
-            guiChildLayout.Enabled = rows.Count > 0 && isExpanded;
+            guiChildLayout.Active = rows.Count > 0 && isExpanded;
         }
 
         /// <summary>
@@ -756,7 +756,7 @@ namespace BansheeEditor
         internal bool Enabled
         {
             get { return enabled; }
-            set { enabled = value; rowLayout.Enabled = value; }
+            set { enabled = value; rowLayout.Active = value; }
         }
 
         /// <summary>
@@ -810,7 +810,10 @@ namespace BansheeEditor
                 rowLayout = parentLayout.AddLayoutY();
 
             if (keyRowLayout == null)
+            {
                 keyRowLayout = rowLayout.AddLayoutX();
+                rowLayout.AddSpace(7);
+            }
 
             if (keyLayout == null)
                 keyLayout = keyRowLayout.AddLayoutY();

+ 2 - 2
MBansheeEditor/GUI/GUIListField.cs

@@ -86,7 +86,7 @@ namespace BansheeEditor
                 {
                     guiChildLayout = layout.AddLayoutX();
                     guiChildLayout.AddSpace(IndentAmount);
-                    guiChildLayout.Enabled = isExpanded;
+                    guiChildLayout.Active = isExpanded;
 
                     GUIPanel guiContentPanel = guiChildLayout.AddPanel();
                     GUILayoutX guiIndentLayoutX = guiContentPanel.AddLayoutX();
@@ -185,7 +185,7 @@ namespace BansheeEditor
             isExpanded = expanded;
 
             if (guiChildLayout != null)
-                guiChildLayout.Enabled = isExpanded;
+                guiChildLayout.Active = isExpanded;
         }
 
         /// <summary>

+ 1 - 1
MBansheeEditor/Inspector/Inspector.cs

@@ -77,7 +77,7 @@ namespace BansheeEditor
         /// <param name="visible">True to make the GUI elements visible.</param>
         internal virtual void SetVisible(bool visible)
         {
-            rootGUI.Enabled = visible;
+            rootGUI.Active = visible;
         }
 
         /// <summary>

+ 2 - 2
MBansheeEditor/Inspector/InspectorWindow.cs

@@ -160,7 +160,7 @@ namespace BansheeEditor
             inspectorScrollArea = new GUIScrollArea();
             scrollAreaHighlight = new GUITexture(Builtin.WhiteTexture);
             scrollAreaHighlight.SetTint(HIGHLIGHT_COLOR);
-            scrollAreaHighlight.Enabled = false;
+            scrollAreaHighlight.Active = false;
 
             GUI.AddElement(inspectorScrollArea);
             GUIPanel inspectorPanel = inspectorScrollArea.Layout.AddPanel();
@@ -498,7 +498,7 @@ namespace BansheeEditor
             }
 
             if (scrollAreaHighlight != null)
-                scrollAreaHighlight.Enabled = isValidDrag;
+                scrollAreaHighlight.Active = isValidDrag;
         }
 
         /// <summary>

+ 4 - 4
MBansheeEditor/Inspectors/CameraInspector.cs

@@ -155,13 +155,13 @@ namespace BansheeEditor
         {
             if (type == ProjectionType.Orthographic)
             {
-                fieldOfView.Enabled = false;
-                orthoHeight.Enabled = true;
+                fieldOfView.Active = false;
+                orthoHeight.Active = true;
             }
             else
             {
-                fieldOfView.Enabled = true;
-                orthoHeight.Enabled = false;
+                fieldOfView.Active = true;
+                orthoHeight.Active = false;
             }
         }
     }

+ 14 - 12
MBansheeEditor/Inspectors/GUISkinInspector.cs

@@ -99,10 +99,8 @@ namespace BansheeEditor
             /// <inheritdoc/>
             protected override GUILayoutX CreateKeyGUI(GUILayoutY layout)
             {
-                string key = GetKey<string>();
-
                 GUILayoutX titleLayout = layout.AddLayoutX();
-                keyField = new GUITextField(new LocEdString((string)key));
+                keyField = new GUITextField(new LocEdString("Style name"));
                 titleLayout.AddElement(keyField);
 
                 keyField.OnChanged += SetKey;
@@ -245,9 +243,9 @@ namespace BansheeEditor
 
                 fixedWidthField.OnChanged += x =>
                 {
-                    widthField.Enabled = x;
-                    minWidthField.Enabled = !x;
-                    maxWidthField.Enabled = !x;
+                    widthField.Active = x;
+                    minWidthField.Active = !x;
+                    maxWidthField.Active = !x;
                 };
 
                 widthField.OnChanged += x => style.Width = x;
@@ -256,9 +254,9 @@ namespace BansheeEditor
 
                 fixedHeightField.OnChanged += x =>
                 {
-                    heightField.Enabled = x;
-                    minHeightField.Enabled = !x;
-                    maxHeightField.Enabled = !x;
+                    heightField.Active = x;
+                    minHeightField.Active = !x;
+                    maxHeightField.Active = !x;
                 };
 
                 heightField.OnChanged += x => style.Height = x;
@@ -326,14 +324,14 @@ namespace BansheeEditor
                 /// <param name="layout">Layout to append the GUI elements to.</param>
                 public GUIElementStateStyleGUI(LocString title, GUIElementStateStyle state, GUILayout layout)
                 {
-                    foldout = new GUIToggleField(title);
+                    foldout = new GUIToggleField(title, 100, EditorStyles.Foldout);
                     textureField = new GUIResourceField(typeof(SpriteTexture), new LocEdString("Texture"));
                     textColorField = new GUIColorField(new LocEdString("Text color"));
 
                     foldout.OnChanged += x =>
                     {
-                        textureField.Enabled = x;
-                        textColorField.Enabled = x;
+                        textureField.Active = x;
+                        textColorField.Active = x;
                     };
 
                     textureField.OnChanged += x =>
@@ -355,6 +353,10 @@ namespace BansheeEditor
                     layout.AddElement(foldout);
                     layout.AddElement(textureField);
                     layout.AddElement(textColorField);
+
+                    foldout.Value = false;
+                    textureField.Active = false;
+                    textColorField.Active = false;
                 }
 
                 /// <summary>

+ 9 - 9
MBansheeEditor/Inspectors/LightInspector.cs

@@ -80,21 +80,21 @@ namespace BansheeEditor
         {
             if (type == LightType.Directional)
             {
-                rangeField.Enabled = false;
-                spotAngleField.Enabled = false;
-                spotFalloffAngleField.Enabled = false;
+                rangeField.Active = false;
+                spotAngleField.Active = false;
+                spotFalloffAngleField.Active = false;
             }
             else if (type == LightType.Point)
             {
-                rangeField.Enabled = true;
-                spotAngleField.Enabled = false;
-                spotFalloffAngleField.Enabled = false;
+                rangeField.Active = true;
+                spotAngleField.Active = false;
+                spotFalloffAngleField.Active = false;
             }
             else
             {
-                rangeField.Enabled = true;
-                spotAngleField.Enabled = true;
-                spotFalloffAngleField.Enabled = true;
+                rangeField.Active = true;
+                spotAngleField.Active = true;
+                spotFalloffAngleField.Active = true;
             }
         }
 

+ 1 - 3
MBansheeEditor/Inspectors/StringTableInspector.cs

@@ -117,10 +117,8 @@ namespace BansheeEditor
             /// <inheritdoc/>
             protected override GUILayoutX CreateKeyGUI(GUILayoutY layout)
             {
-                string key = GetKey<string>();
-
                 GUILayoutX titleLayout = layout.AddLayoutX();
-                keyField = new GUITextField(new LocEdString(key));
+                keyField = new GUITextField(new LocEdString("Identifier"));
                 titleLayout.AddElement(keyField);
 
                 keyField.OnChanged += SetKey;

+ 2 - 2
MBansheeEditor/Library/LibraryGUIEntry.cs

@@ -207,7 +207,7 @@ namespace BansheeEditor
             renameTextBox.Text = name;
             renameTextBox.Focus = true;
 
-            label.Enabled = false;
+            label.Active = false;
         }
 
         /// <summary>
@@ -221,7 +221,7 @@ namespace BansheeEditor
                 renameTextBox = null;
             }
 
-            label.Enabled = true;
+            label.Active = true;
         }
 
         /// <summary>

+ 17 - 6
MBansheeEngine/GUI/GUIElement.cs

@@ -34,7 +34,7 @@ namespace BansheeEngine
 
         /// <summary>
         /// Makes the element hidden or visible. This will not affect the layout as the room for the element will still
-        /// be reserved in the parent layout, use <see cref="Enabled"/> if you need to affect the layout as well.
+        /// be reserved in the parent layout, use <see cref="Active"/> if you need to affect the layout as well.
         /// </summary>
         public bool Visible
         {
@@ -42,12 +42,20 @@ namespace BansheeEngine
         }
 
         /// <summary>
-        /// Disables or enables an element, making it hidden or visible. When disabled it is essentially removed from the 
-        /// parent achieving the similar effect as if the element was destroyed.
+        /// Activates or deactivates the element, making it hidden or visible. When disabled it is essentially removed from 
+        /// the parent achieving the similar effect as if the element was destroyed.
         /// </summary>
-        public bool Enabled
+        public bool Active
         {
-            set { Internal_SetEnabled(mCachedPtr, value); }
+            set { Internal_SetActive(mCachedPtr, value); }
+        }
+
+        /// <summary>
+        /// Disables or enables the element. Disabled elements cannot be interacted with and have a faded out appearance.
+        /// </summary>
+        public bool Disabled
+        {
+            set { Internal_SetDisabled(mCachedPtr, value); }
         }
 
         /// <summary>
@@ -160,7 +168,10 @@ namespace BansheeEngine
         private static extern void Internal_SetVisible(IntPtr nativeInstance, bool visible);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
-        private static extern void Internal_SetEnabled(IntPtr nativeInstance, bool enabled);
+        private static extern void Internal_SetActive(IntPtr nativeInstance, bool enabled);
+
+        [MethodImpl(MethodImplOptions.InternalCall)]
+        private static extern void Internal_SetDisabled(IntPtr nativeInstance, bool disabled);
 
         [MethodImpl(MethodImplOptions.InternalCall)]
         private static extern void Internal_SetFocus(IntPtr nativeInstance, bool focus);

+ 2 - 1
SBansheeEngine/Include/BsScriptGUIElement.h

@@ -138,7 +138,8 @@ namespace BansheeEngine
 		/************************************************************************/
 		static void internal_destroy(ScriptGUIElementBaseTBase* nativeInstance);
 		static void internal_setVisible(ScriptGUIElementBaseTBase* nativeInstance, bool visible);
-		static void internal_setEnabled(ScriptGUIElementBaseTBase* nativeInstance, bool enabled);
+		static void internal_setActive(ScriptGUIElementBaseTBase* nativeInstance, bool active);
+		static void internal_setDisabled(ScriptGUIElementBaseTBase* nativeInstance, bool disabled);
 		static void internal_setFocus(ScriptGUIElementBaseTBase* nativeInstance, bool focus);
 		static Rect2I internal_getBounds(ScriptGUIElementBaseTBase* nativeInstance);
 		static void internal_setBounds(ScriptGUIElementBaseTBase* nativeInstance, Rect2I bounds);

+ 12 - 3
SBansheeEngine/Source/BsScriptGUIElement.cpp

@@ -76,7 +76,8 @@ namespace BansheeEngine
 	{
 		metaData.scriptClass->addInternalCall("Internal_Destroy", &ScriptGUIElement::internal_destroy);
 		metaData.scriptClass->addInternalCall("Internal_SetVisible", &ScriptGUIElement::internal_setVisible);
-		metaData.scriptClass->addInternalCall("Internal_SetEnabled", &ScriptGUIElement::internal_setEnabled);
+		metaData.scriptClass->addInternalCall("Internal_SetActive", &ScriptGUIElement::internal_setActive);
+		metaData.scriptClass->addInternalCall("Internal_SetDisabled", &ScriptGUIElement::internal_setDisabled);
 		metaData.scriptClass->addInternalCall("Internal_SetFocus", &ScriptGUIElement::internal_setFocus);
 		metaData.scriptClass->addInternalCall("Internal_GetBounds", &ScriptGUIElement::internal_getBounds);
 		metaData.scriptClass->addInternalCall("Internal_SetBounds", &ScriptGUIElement::internal_setBounds);
@@ -105,12 +106,20 @@ namespace BansheeEngine
 		nativeInstance->getGUIElement()->setVisible(visible);
 	}
 
-	void ScriptGUIElement::internal_setEnabled(ScriptGUIElementBaseTBase* nativeInstance, bool enabled)
+	void ScriptGUIElement::internal_setActive(ScriptGUIElementBaseTBase* nativeInstance, bool enabled)
 	{
 		if (nativeInstance->isDestroyed())
 			return;
 
-		nativeInstance->getGUIElement()->setEnabled(enabled);
+		nativeInstance->getGUIElement()->setActive(enabled);
+	}
+
+	void ScriptGUIElement::internal_setDisabled(ScriptGUIElementBaseTBase* nativeInstance, bool disabled)
+	{
+		if (nativeInstance->isDestroyed())
+			return;
+
+		nativeInstance->getGUIElement()->setDisabled(disabled);
 	}
 
 	void ScriptGUIElement::internal_setFocus(ScriptGUIElementBaseTBase* nativeInstance, bool focus)