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

Assets for GUI Controls

This epic check-in allows any control to use ImageAssets, Bitmaps, or Default Rendering to render themselves based on the profile! Additionally, all controls can now use 1 frame per state or 9 frames per state for BOTH bitmaps and ImageAssets!
Peter Robinson 4 лет назад
Родитель
Сommit
54d85eaae1
80 измененных файлов с 522 добавлено и 747 удалено
  1. 0 3
      engine/compilers/VisualStudio 2017/Torque 2D.vcxproj
  2. 0 9
      engine/compilers/VisualStudio 2017/Torque 2D.vcxproj.filters
  3. 0 3
      engine/compilers/VisualStudio 2019/Torque 2D.vcxproj
  4. 0 9
      engine/compilers/VisualStudio 2019/Torque 2D.vcxproj.filters
  5. 4 4
      engine/source/2d/gui/guiSceneObjectCtrl.cc
  6. 1 8
      engine/source/gui/buttons/guiButtonCtrl.cc
  7. 9 33
      engine/source/gui/buttons/guiCheckBoxCtrl.cc
  8. 16 6
      engine/source/gui/buttons/guiRadioCtrl.cc
  9. 2 2
      engine/source/gui/containers/guiRolloutCtrl.cc
  10. 10 177
      engine/source/gui/containers/guiScrollCtrl.cc
  11. 0 6
      engine/source/gui/containers/guiScrollCtrl.h
  12. 2 2
      engine/source/gui/containers/guiTabBookCtrl.cc
  13. 2 2
      engine/source/gui/editor/guiMenuBar.cc
  14. 2 2
      engine/source/gui/guiControl.cc
  15. 184 194
      engine/source/gui/guiDefaultControlRender.cc
  16. 7 5
      engine/source/gui/guiDefaultControlRender.h
  17. 4 4
      engine/source/gui/guiPopUpCtrl.cc
  18. 1 1
      engine/source/gui/guiSliderCtrl.cc
  19. 2 2
      engine/source/gui/guiTextEditCtrl.cc
  20. 159 126
      engine/source/gui/guiTypes.cc
  21. 24 5
      engine/source/gui/guiTypes.h
  22. 0 3
      toybox/Sandbox/1/assets/gui/ReplayBtn128x128Down.asset.taml
  23. BIN
      toybox/Sandbox/1/assets/gui/ReplayBtn128x128Down.png
  24. 0 3
      toybox/Sandbox/1/assets/gui/ReplayBtn128x128Hover.asset.taml
  25. BIN
      toybox/Sandbox/1/assets/gui/ReplayBtn128x128Hover.png
  26. 0 3
      toybox/Sandbox/1/assets/gui/ReplayBtn128x128Inactive.asset.taml
  27. BIN
      toybox/Sandbox/1/assets/gui/ReplayBtn128x128Inactive.png
  28. 0 3
      toybox/Sandbox/1/assets/gui/ReplayBtn128x128Up.asset.taml
  29. BIN
      toybox/Sandbox/1/assets/gui/ReplayBtn128x128Up.png
  30. 0 3
      toybox/Sandbox/1/assets/gui/mediumCancelDown.asset.taml
  31. BIN
      toybox/Sandbox/1/assets/gui/mediumCancelDown.png
  32. 0 3
      toybox/Sandbox/1/assets/gui/mediumCancelHover.asset.taml
  33. BIN
      toybox/Sandbox/1/assets/gui/mediumCancelHover.png
  34. 0 3
      toybox/Sandbox/1/assets/gui/mediumCancelInactive.asset.taml
  35. BIN
      toybox/Sandbox/1/assets/gui/mediumCancelInactive.png
  36. 0 3
      toybox/Sandbox/1/assets/gui/mediumCancelNormal.asset.taml
  37. BIN
      toybox/Sandbox/1/assets/gui/mediumCancelNormal.png
  38. 7 0
      toybox/Sandbox/1/assets/gui/minusButton.asset.taml
  39. BIN
      toybox/Sandbox/1/assets/gui/minusButton.png
  40. 0 3
      toybox/Sandbox/1/assets/gui/minusButtonDown.asset.taml
  41. BIN
      toybox/Sandbox/1/assets/gui/minusButtonDown.png
  42. 0 3
      toybox/Sandbox/1/assets/gui/minusButtonHover.asset.taml
  43. BIN
      toybox/Sandbox/1/assets/gui/minusButtonHover.png
  44. 0 3
      toybox/Sandbox/1/assets/gui/minusButtonInactive.asset.taml
  45. BIN
      toybox/Sandbox/1/assets/gui/minusButtonInactive.png
  46. 0 3
      toybox/Sandbox/1/assets/gui/minusButtonNormal.asset.taml
  47. BIN
      toybox/Sandbox/1/assets/gui/minusButtonNormal.png
  48. 7 0
      toybox/Sandbox/1/assets/gui/northArrow.asset.taml
  49. BIN
      toybox/Sandbox/1/assets/gui/northArrow.png
  50. 0 3
      toybox/Sandbox/1/assets/gui/northArrowDown.asset.taml
  51. BIN
      toybox/Sandbox/1/assets/gui/northArrowDown.png
  52. 0 3
      toybox/Sandbox/1/assets/gui/northArrowHover.asset.taml
  53. BIN
      toybox/Sandbox/1/assets/gui/northArrowHover.png
  54. 0 3
      toybox/Sandbox/1/assets/gui/northArrowNormal.asset.taml
  55. BIN
      toybox/Sandbox/1/assets/gui/northArrowNormal.png
  56. 7 0
      toybox/Sandbox/1/assets/gui/plusButton.asset.taml
  57. BIN
      toybox/Sandbox/1/assets/gui/plusButton.png
  58. 0 3
      toybox/Sandbox/1/assets/gui/plusButtonDown.asset.taml
  59. BIN
      toybox/Sandbox/1/assets/gui/plusButtonDown.png
  60. 0 3
      toybox/Sandbox/1/assets/gui/plusButtonHover.asset.taml
  61. BIN
      toybox/Sandbox/1/assets/gui/plusButtonHover.png
  62. 0 3
      toybox/Sandbox/1/assets/gui/plusButtonInactive.asset.taml
  63. BIN
      toybox/Sandbox/1/assets/gui/plusButtonInactive.png
  64. 0 3
      toybox/Sandbox/1/assets/gui/plusButtonNormal.asset.taml
  65. BIN
      toybox/Sandbox/1/assets/gui/plusButtonNormal.png
  66. 7 0
      toybox/Sandbox/1/assets/gui/southArrow.asset.taml
  67. BIN
      toybox/Sandbox/1/assets/gui/southArrow.png
  68. 0 3
      toybox/Sandbox/1/assets/gui/southArrowDown.asset.taml
  69. BIN
      toybox/Sandbox/1/assets/gui/southArrowDown.png
  70. 0 3
      toybox/Sandbox/1/assets/gui/southArrowHover.asset.taml
  71. BIN
      toybox/Sandbox/1/assets/gui/southArrowHover.png
  72. 0 3
      toybox/Sandbox/1/assets/gui/southArrowNormal.asset.taml
  73. BIN
      toybox/Sandbox/1/assets/gui/southArrowNormal.png
  74. 16 39
      toybox/Sandbox/1/gui/ToolboxDialog.gui.taml
  75. 33 1
      toybox/Sandbox/1/gui/guiProfiles.cs
  76. BIN
      toybox/Sandbox/1/gui/images/checkBox.png
  77. BIN
      toybox/Sandbox/1/gui/images/checkBox2.png
  78. BIN
      toybox/Sandbox/1/gui/images/radioButton.png
  79. BIN
      toybox/Sandbox/1/gui/images/radioButton2.png
  80. 16 38
      toybox/Sandbox/1/scripts/customToolboxGui.cs

+ 0 - 3
engine/compilers/VisualStudio 2017/Torque 2D.vcxproj

@@ -266,7 +266,6 @@
     <ClCompile Include="..\..\source\2d\core\Utility.cc" />
     <ClCompile Include="..\..\source\2d\core\Vector2.cc" />
     <ClCompile Include="..\..\source\2d\experimental\composites\WaveComposite.cc" />
-    <ClCompile Include="..\..\source\2d\gui\guiImageButtonCtrl.cc" />
     <ClCompile Include="..\..\source\2d\gui\guiSceneObjectCtrl.cc" />
     <ClCompile Include="..\..\source\2d\gui\guiSpriteCtrl.cc" />
     <ClCompile Include="..\..\source\2d\gui\SceneWindow.cc" />
@@ -714,8 +713,6 @@
     <ClInclude Include="..\..\source\2d\core\Vector2_ScriptBinding.h" />
     <ClInclude Include="..\..\source\2d\experimental\composites\WaveComposite.h" />
     <ClInclude Include="..\..\source\2d\experimental\composites\WaveComposite_ScriptBinding.h" />
-    <ClInclude Include="..\..\source\2d\gui\guiImageButtonCtrl.h" />
-    <ClInclude Include="..\..\source\2d\gui\guiImageButtonCtrl_ScriptBindings.h" />
     <ClInclude Include="..\..\source\2d\gui\guiSceneObjectCtrl.h" />
     <ClInclude Include="..\..\source\2d\gui\guiSpriteCtrl.h" />
     <ClInclude Include="..\..\source\2d\gui\guiSpriteCtrl_ScriptBindings.h" />

+ 0 - 9
engine/compilers/VisualStudio 2017/Torque 2D.vcxproj.filters

@@ -1116,9 +1116,6 @@
     <ClCompile Include="..\..\source\2d\scene\WorldQuery.cc">
       <Filter>2d\scene</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\source\2d\gui\guiImageButtonCtrl.cc">
-      <Filter>2d\gui</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\source\2d\gui\guiSpriteCtrl.cc">
       <Filter>2d\gui</Filter>
     </ClCompile>
@@ -2556,12 +2553,6 @@
     <ClInclude Include="..\..\source\2d\scene\WorldQuery.h">
       <Filter>2d\scene</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\source\2d\gui\guiImageButtonCtrl.h">
-      <Filter>2d\gui</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\source\2d\gui\guiImageButtonCtrl_ScriptBindings.h">
-      <Filter>2d\gui</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\source\2d\gui\guiSpriteCtrl.h">
       <Filter>2d\gui</Filter>
     </ClInclude>

+ 0 - 3
engine/compilers/VisualStudio 2019/Torque 2D.vcxproj

@@ -266,7 +266,6 @@
     <ClCompile Include="..\..\source\2d\core\Utility.cc" />
     <ClCompile Include="..\..\source\2d\core\Vector2.cc" />
     <ClCompile Include="..\..\source\2d\experimental\composites\WaveComposite.cc" />
-    <ClCompile Include="..\..\source\2d\gui\guiImageButtonCtrl.cc" />
     <ClCompile Include="..\..\source\2d\gui\guiSceneObjectCtrl.cc" />
     <ClCompile Include="..\..\source\2d\gui\guiSpriteCtrl.cc" />
     <ClCompile Include="..\..\source\2d\gui\SceneWindow.cc" />
@@ -714,8 +713,6 @@
     <ClInclude Include="..\..\source\2d\core\Vector2_ScriptBinding.h" />
     <ClInclude Include="..\..\source\2d\experimental\composites\WaveComposite.h" />
     <ClInclude Include="..\..\source\2d\experimental\composites\WaveComposite_ScriptBinding.h" />
-    <ClInclude Include="..\..\source\2d\gui\guiImageButtonCtrl.h" />
-    <ClInclude Include="..\..\source\2d\gui\guiImageButtonCtrl_ScriptBindings.h" />
     <ClInclude Include="..\..\source\2d\gui\guiSceneObjectCtrl.h" />
     <ClInclude Include="..\..\source\2d\gui\guiSpriteCtrl.h" />
     <ClInclude Include="..\..\source\2d\gui\guiSpriteCtrl_ScriptBindings.h" />

+ 0 - 9
engine/compilers/VisualStudio 2019/Torque 2D.vcxproj.filters

@@ -1116,9 +1116,6 @@
     <ClCompile Include="..\..\source\2d\scene\WorldQuery.cc">
       <Filter>2d\scene</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\source\2d\gui\guiImageButtonCtrl.cc">
-      <Filter>2d\gui</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\source\2d\gui\guiSpriteCtrl.cc">
       <Filter>2d\gui</Filter>
     </ClCompile>
@@ -2556,12 +2553,6 @@
     <ClInclude Include="..\..\source\2d\scene\WorldQuery.h">
       <Filter>2d\scene</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\source\2d\gui\guiImageButtonCtrl.h">
-      <Filter>2d\gui</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\source\2d\gui\guiImageButtonCtrl_ScriptBindings.h">
-      <Filter>2d\gui</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\source\2d\gui\guiSpriteCtrl.h">
       <Filter>2d\gui</Filter>
     </ClInclude>

+ 4 - 4
engine/source/2d/gui/guiSceneObjectCtrl.cc

@@ -227,21 +227,21 @@ void GuiSceneObjectCtrl::onRender(Point2I offset, const RectI& updateRect)
       if( mDepressed )
       {
          if( mHasTexture )
-            renderSizableBitmapBordersFilled( ctrlRect, 3, mProfile );
+			 renderUniversalRect( ctrlRect, mProfile, GuiControlState::SelectedState);
          else
             dglDrawRectFill( ctrlRect, mProfile->mFillColorHL );
       }
       else if ( mMouseOver )
       {
          if( mHasTexture )
-            renderSizableBitmapBordersFilled( ctrlRect, 2, mProfile );
+			 renderUniversalRect( ctrlRect, mProfile, GuiControlState::HighlightState);
          else
             dglDrawRectFill( ctrlRect, mProfile->mFillColorHL );
       }
       else
       {
          if( mHasTexture )
-            renderSizableBitmapBordersFilled( ctrlRect, 1, mProfile );
+			 renderUniversalRect( ctrlRect, mProfile, GuiControlState::NormalState);
          else
             dglDrawRectFill( ctrlRect, mProfile->mFillColor );
       }
@@ -262,7 +262,7 @@ void GuiSceneObjectCtrl::onRender(Point2I offset, const RectI& updateRect)
 
       // Draw Canvas color for object
 	if( mHasTexture )
-		renderSizableBitmapBordersFilled( objRect, 4, mProfile );
+		renderUniversalRect( objRect, mProfile, GuiControlState::DisabledState);
 	else
 		dglDrawRectFill( objRect, mProfile->mFillColorNA );
 

+ 1 - 8
engine/source/gui/buttons/guiButtonCtrl.cc

@@ -278,14 +278,7 @@ void GuiButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
 	GuiControlState currentState = getCurrentState();
 	RectI ctrlRect = applyMargins(offset, mBounds.extent, currentState, mProfile);
 
-	if(mProfile->mBitmapName != NULL && mProfile->constructBitmapArray() >= 36)
-	{
-		renderSizableBitmapBordersFilled(ctrlRect, getBitmapIndex(currentState), mProfile );
-	}
-	else
-	{
-		renderBorderedRect(ctrlRect, mProfile, currentState, getFillColor(currentState));
-	}
+	renderUniversalRect(ctrlRect, mProfile, currentState, getFillColor(currentState), true);
 
 	//Render Text
 	dglSetBitmapModulation(mProfile->getFontColor(currentState));

+ 9 - 33
engine/source/gui/buttons/guiCheckBoxCtrl.cc

@@ -64,18 +64,18 @@ bool GuiCheckBoxCtrl::onWake()
 
 void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
 {
-	GuiControlState currentState = GuiControlState::NormalState;
+	GuiControlState currentState = mStateOn ? GuiControlState::NormalStateOn : GuiControlState::NormalState;
 	if (!mActive)
 	{
-		currentState = GuiControlState::DisabledState;
+		currentState = mStateOn ? GuiControlState::DisabledStateOn : GuiControlState::DisabledState;
 	}
-	else if (mDepressed || mStateOn)
+	else if (mDepressed)
 	{
-		currentState = GuiControlState::SelectedState;
+		currentState = mStateOn ? GuiControlState::SelectedStateOn : GuiControlState::SelectedState;
 	}
 	else if (mMouseOver)
 	{
-		currentState = GuiControlState::HighlightState;
+		currentState = mStateOn ? GuiControlState::HighlightStateOn : GuiControlState::HighlightState;
 	}
 
 	RectI ctrlRect = applyMargins(offset, mBounds.extent, currentState, mProfile);
@@ -92,33 +92,9 @@ void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
 	{
 		boxRect.extent.y = contentRect.point.y + contentRect.extent.y - boxRect.point.y;
 	}
-
-	if(mProfile->mBitmapName != NULL && mProfile->constructBitmapArray() >= 6)
-	{
-		//Use the bitmap to create the checkbox
-		S32 index = 1;
-		if (mStateOn || mDepressed)
-		{
-			index = 2;
-		}
-		if (mMouseOver)
-		{
-			index += 2;
-		}
-		else if (!mActive)
-		{
-			index += 4;
-		}
-
-		RectI dest = RectI(offset + mBoxOffset, mBoxExtent);
-		dglClearBitmapModulation();
-		dglDrawBitmapStretchSR(mProfile->mTextureHandle, dest, mProfile->mBitmapArrayRects[index-1]);
-	}
-	else
-	{
-		//Draw the checkbox
-		renderInnerControl(boxRect, currentState);
-	}
+	
+	//Draw the checkbox
+	renderInnerControl(boxRect, currentState);
 
 	RectI textRect(contentRect.point + mTextOffset, mTextExtent);
 
@@ -142,7 +118,7 @@ void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
 
 void GuiCheckBoxCtrl::renderInnerControl(RectI &boxRect, const GuiControlState currentState)
 {
-	renderBorderedRect(boxRect, mProfile, currentState);
+	renderUniversalRect(boxRect, mProfile, currentState);
 }
 
 void GuiCheckBoxCtrl::onAction()

+ 16 - 6
engine/source/gui/buttons/guiRadioCtrl.cc

@@ -43,14 +43,24 @@ void GuiRadioCtrl::initPersistFields()
 
 void GuiRadioCtrl::renderInnerControl(RectI &boxRect, const GuiControlState currentState)
 {
-	S32 radius = boxRect.extent.x;
-	if (boxRect.extent.y < radius)
+	U8 stateIndex = currentState;
+
+	if ((mProfile->mImageAsset->isAssetValid() && mProfile->mImageAsset->getFrameCount() > stateIndex) 
+		|| (mProfile->mBitmapName != NULL && mProfile->constructBitmapArray() > stateIndex))
+	{
+		renderUniversalRect(boxRect, mProfile, currentState);
+	}
+	else 
 	{
-		radius = boxRect.extent.y;
+		S32 radius = boxRect.extent.x;
+		if (boxRect.extent.y < radius)
+		{
+			radius = boxRect.extent.y;
+		}
+		radius = (S32)round(radius / 2);
+		Point2I center = Point2I(boxRect.point.x + (boxRect.extent.x / 2), boxRect.point.y + (boxRect.extent.y / 2));
+		renderBorderedCircle(center, radius, mProfile, currentState);
 	}
-	radius = (S32)round(radius / 2);
-	Point2I center = Point2I(boxRect.point.x + (boxRect.extent.x / 2), boxRect.point.y + (boxRect.extent.y / 2));
-	renderBorderedCircle(center, radius, mProfile, currentState);
 }
 
 void GuiRadioCtrl::onAction()

+ 2 - 2
engine/source/gui/containers/guiRolloutCtrl.cc

@@ -344,8 +344,8 @@ void GuiRolloutCtrl::onRender(Point2I offset, const RectI &updateRect)
       // Draw Rollout From Skin
       if( !mIsExpanded )
          renderFixedBitmapBordersFilled( worldBounds, 1, mProfile );
-      else// Draw Border
-         renderSizableBitmapBordersFilledIndex( worldBounds, TopLeftHeader, mProfile );
+      //else// Draw Border
+         //renderSizableBitmapBordersFilledIndex( worldBounds, TopLeftHeader, mProfile );
 
       // Draw Caption ( Vertically Centered )
       ColorI currColor;

+ 10 - 177
engine/source/gui/containers/guiScrollCtrl.cc

@@ -814,29 +814,14 @@ void GuiScrollCtrl::onRender(Point2I offset, const RectI &updateRect)
 		return;
 	}
 
-	renderBorderedRect(ctrlRect, mProfile, NormalState);
+	renderUniversalRect(ctrlRect, mProfile, NormalState);
 
 	RectI fillRect = applyBorders(ctrlRect.point, ctrlRect.extent, NormalState, mProfile);
 	RectI contentRect = applyScrollBarSpacing(fillRect.point, fillRect.extent);
 	mChildArea.set(contentRect.point, contentRect.extent);
 
-	if (mProfile->mBitmapName == NULL || mProfile->constructBitmapArray() < 39)
-	{
-		renderVScrollBar(offset);
-		renderHScrollBar(offset);
-	}
-	else
-	{
-		if (mHasVScrollBar)
-			drawVScrollBar(offset);
-
-		if (mHasHScrollBar)
-			drawHScrollBar(offset);
-
-		//draw the scroll corner
-		if (mHasVScrollBar && mHasHScrollBar)
-			drawScrollCorner(offset);
-   }
+	renderVScrollBar(offset);
+	renderHScrollBar(offset);
 
 	if (contentRect.isValidRect())
 	{
@@ -890,7 +875,7 @@ void GuiScrollCtrl::renderBorderedRectWithArrow(RectI& bounds, GuiControlProfile
 		return;
 	}
 
-	renderBorderedRect(bounds, profile, state);
+	renderUniversalRect(bounds, profile, state);
 
 	RectI ctrlRect = applyMargins(bounds.point, bounds.extent, state, profile);
 	RectI fillRect = applyBorders(ctrlRect.point, ctrlRect.extent, state, profile);
@@ -938,13 +923,13 @@ void GuiScrollCtrl::renderVScrollBar(const Point2I& offset)
 				renderBorderedRectWithArrow(RectI(mUpArrowRect.point + offset, mUpArrowRect.extent), mArrowProfile, getRegionCurrentState(Region::UpArrow), GuiDirection::Up);
 				renderBorderedRectWithArrow(RectI(mDownArrowRect.point + offset, mDownArrowRect.extent), mArrowProfile, getRegionCurrentState(Region::DownArrow), GuiDirection::Down);
 			}
-			renderBorderedRect(RectI(mVTrackRect.point + offset, mVTrackRect.extent), mTrackProfile, GuiControlState::NormalState);
+			renderUniversalRect(RectI(mVTrackRect.point + offset, mVTrackRect.extent), mTrackProfile, GuiControlState::NormalState);
 
 			//The Thumb
 			GuiControlState thumbState = getRegionCurrentState(Region::VertThumb);
 			RectI vThumb = RectI(mVTrackRect.point.x + offset.x, mVTrackRect.point.y + mVThumbPos + offset.y, mScrollBarThickness, mVThumbSize);
 			RectI vThumbWithMargins = applyMargins(vThumb.point, vThumb.extent, thumbState, mThumbProfile);
-			renderBorderedRect(vThumbWithMargins, mThumbProfile, thumbState);
+			renderUniversalRect(vThumbWithMargins, mThumbProfile, thumbState);
 		}
 		else
 		{
@@ -953,7 +938,7 @@ void GuiScrollCtrl::renderVScrollBar(const Point2I& offset)
 				renderBorderedRectWithArrow(RectI(mUpArrowRect.point + offset, mUpArrowRect.extent), mArrowProfile, GuiControlState::DisabledState, GuiDirection::Up);
 				renderBorderedRectWithArrow(RectI(mDownArrowRect.point + offset, mDownArrowRect.extent), mArrowProfile, GuiControlState::DisabledState, GuiDirection::Down);
 			}
-			renderBorderedRect(RectI(mVTrackRect.point + offset, mVTrackRect.extent), mTrackProfile, GuiControlState::DisabledState);
+			renderUniversalRect(RectI(mVTrackRect.point + offset, mVTrackRect.extent), mTrackProfile, GuiControlState::DisabledState);
 		}
 	}
 }
@@ -969,13 +954,13 @@ void GuiScrollCtrl::renderHScrollBar(const Point2I& offset)
 				renderBorderedRectWithArrow(RectI(mLeftArrowRect.point + offset, mLeftArrowRect.extent), mArrowProfile, getRegionCurrentState(Region::LeftArrow), GuiDirection::Left);
 				renderBorderedRectWithArrow(RectI(mRightArrowRect.point + offset, mRightArrowRect.extent), mArrowProfile, getRegionCurrentState(Region::RightArrow), GuiDirection::Right);
 			}
-			renderBorderedRect(RectI(mHTrackRect.point + offset, mHTrackRect.extent), mTrackProfile, GuiControlState::NormalState);
+			renderUniversalRect(RectI(mHTrackRect.point + offset, mHTrackRect.extent), mTrackProfile, GuiControlState::NormalState);
 
 			//The Thumb
 			GuiControlState thumbState = getRegionCurrentState(Region::HorizThumb);
 			RectI hThumb = RectI(mHTrackRect.point.x + mHThumbPos + offset.x, mHTrackRect.point.y + offset.y, mHThumbSize, mScrollBarThickness);
 			RectI hThumbWithMargins = applyMargins(hThumb.point, hThumb.extent, thumbState, mThumbProfile);
-			renderBorderedRect(hThumbWithMargins, mThumbProfile, thumbState);
+			renderUniversalRect(hThumbWithMargins, mThumbProfile, thumbState);
 		}
 		else
 		{
@@ -984,7 +969,7 @@ void GuiScrollCtrl::renderHScrollBar(const Point2I& offset)
 				renderBorderedRectWithArrow(RectI(mLeftArrowRect.point + offset, mLeftArrowRect.extent), mArrowProfile, GuiControlState::DisabledState, GuiDirection::Left);
 				renderBorderedRectWithArrow(RectI(mRightArrowRect.point + offset, mRightArrowRect.extent), mArrowProfile, GuiControlState::DisabledState, GuiDirection::Right);
 			}
-			renderBorderedRect(RectI(mHTrackRect.point + offset, mHTrackRect.extent), mTrackProfile, GuiControlState::DisabledState);
+			renderUniversalRect(RectI(mHTrackRect.point + offset, mHTrackRect.extent), mTrackProfile, GuiControlState::DisabledState);
 		}
 	}
 }
@@ -1039,157 +1024,5 @@ void GuiScrollCtrl::renderChildControls(Point2I offset, RectI content, const Rec
 		}
 	}
 }
-
-void GuiScrollCtrl::drawVScrollBar(const Point2I &offset)
-{
-   Point2I pos = offset + mUpArrowRect.point;
-   S32 bitmap = (mVBarEnabled ? ((curHitRegion == UpArrow && mDepressed) ?
-         BmpStates * BmpUp + BmpHilite : BmpStates * BmpUp) : BmpStates * BmpUp + BmpDisabled);
-
-   dglClearBitmapModulation();
-   dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[bitmap]);
-
-   pos.y += mScrollBarThickness;
-   S32 end;
-   if (mVBarEnabled)
-      end = mVThumbPos + mChildArea.point.y + mDownArrowRect.extent.y;
-   else
-      end = mDownArrowRect.point.y + offset.y;
-
-   bitmap = (mVBarEnabled ? ((curHitRegion == DownPage && mDepressed) ?
-         BmpStates * BmpVPage + BmpHilite : BmpStates * BmpVPage) : BmpStates * BmpVPage + BmpDisabled);
-
-   if (end > pos.y)
-   {
-      dglClearBitmapModulation();
-      dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(mBitmapBounds[bitmap].extent.x, end - pos.y)), mBitmapBounds[bitmap]);
-   }
-
-   pos.y = end;
-   if (mVBarEnabled)
-   {
-      bool thumbSelected = (curHitRegion == VertThumb && mDepressed);
-      S32 ttop = (thumbSelected ? BmpStates * BmpVThumbTopCap + BmpHilite : BmpStates * BmpVThumbTopCap);
-      S32 tmid = (thumbSelected ? BmpStates * BmpVThumb + BmpHilite : BmpStates * BmpVThumb);
-      S32 tbot = (thumbSelected ? BmpStates * BmpVThumbBottomCap + BmpHilite : BmpStates * BmpVThumbBottomCap);
-
-      // draw the thumb
-      dglClearBitmapModulation();
-      dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[ttop]);
-      pos.y += mBitmapBounds[ttop].extent.y;
-      end = (mVThumbPos + mChildArea.point.y + mDownArrowRect.extent.y) + mVThumbSize - mBitmapBounds[tbot].extent.y;
-
-      if (end > pos.y)
-      {
-         dglClearBitmapModulation();
-         dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(mBitmapBounds[tmid].extent.x, end - pos.y)), mBitmapBounds[tmid]);
-      }
-
-      pos.y = end;
-      dglClearBitmapModulation();
-      dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[tbot]);
-      pos.y += mBitmapBounds[tbot].extent.y;
-      end = mVTrackRect.point.y + mVTrackRect.extent.y - 1 + offset.y;
-
-      bitmap = (curHitRegion == DownPage && mDepressed) ? BmpStates * BmpVPage + BmpHilite : BmpStates * BmpVPage;
-      if (end > pos.y)
-      {
-         dglClearBitmapModulation();
-         dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(mBitmapBounds[bitmap].extent.x, end - pos.y)), mBitmapBounds[bitmap]);
-      }
-
-      pos.y = end;
-   }
-
-   bitmap = (mVBarEnabled ? ((curHitRegion == DownArrow && mDepressed ) ?
-         BmpStates * BmpDown + BmpHilite : BmpStates * BmpDown) : BmpStates * BmpDown + BmpDisabled);
-
-   dglClearBitmapModulation();
-   dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[bitmap]);
-}
-
-void GuiScrollCtrl::drawHScrollBar(const Point2I &offset)
-{
-   S32 bitmap;
-
-   //draw the left arrow
-   bitmap = (mHBarEnabled ? ((curHitRegion == LeftArrow && mDepressed) ?
-            BmpStates * BmpLeft + BmpHilite : BmpStates * BmpLeft) : BmpStates * BmpLeft + BmpDisabled);
-
-   Point2I pos = offset;
-   pos += mLeftArrowRect.point;
-
-   dglClearBitmapModulation();
-   dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[bitmap]);
-
-   pos.x += mLeftArrowRect.extent.x;
-
-   //draw the left page
-   S32 end;
-   if (mHBarEnabled)
-      end = mHThumbPos + mChildArea.point.x + mDownArrowRect.extent.x;
-   else
-      end = mRightArrowRect.point.x + offset.x;
-
-   bitmap = (mHBarEnabled ? ((curHitRegion == LeftPage && mDepressed) ?
-            BmpStates * BmpHPage + BmpHilite : BmpStates * BmpHPage) : BmpStates * BmpHPage + BmpDisabled);
-
-   if (end > pos.x)
-   {
-      dglClearBitmapModulation();
-      dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(end - pos.x, mBitmapBounds[bitmap].extent.y)), mBitmapBounds[bitmap]);
-   }
-   pos.x = end;
-
-   //draw the thumb and the rightPage
-   if (mHBarEnabled)
-   {
-      bool thumbSelected = (curHitRegion == HorizThumb && mDepressed);
-      S32 ttop = (thumbSelected ? BmpStates * BmpHThumbLeftCap + BmpHilite : BmpStates * BmpHThumbLeftCap );
-      S32 tmid = (thumbSelected ? BmpStates * BmpHThumb + BmpHilite : BmpStates * BmpHThumb);
-      S32 tbot = (thumbSelected ? BmpStates * BmpHThumbRightCap + BmpHilite : BmpStates * BmpHThumbRightCap);
-
-      // draw the thumb
-      dglClearBitmapModulation();
-      dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[ttop]);
-      pos.x += mBitmapBounds[ttop].extent.x;
-      end = (mHThumbPos + mChildArea.point.x + mDownArrowRect.extent.x) + mHThumbSize - mBitmapBounds[tbot].extent.x;
-      if (end > pos.x)
-      {
-         dglClearBitmapModulation();
-         dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(end - pos.x, mBitmapBounds[tmid].extent.y)), mBitmapBounds[tmid]);
-      }
-
-      pos.x = end;
-      dglClearBitmapModulation();
-      dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[tbot]);
-      pos.x += mBitmapBounds[tbot].extent.x;
-      end = mHTrackRect.point.x + mHTrackRect.extent.x - 1 + offset.x;
-
-      bitmap = ((curHitRegion == RightPage && mDepressed) ? BmpStates * BmpHPage + BmpHilite : BmpStates * BmpHPage);
-
-      if (end > pos.x)
-      {
-         dglClearBitmapModulation();
-         dglDrawBitmapStretchSR(mTextureHandle, RectI(pos, Point2I(end - pos.x, mBitmapBounds[bitmap].extent.y)), mBitmapBounds[bitmap]);
-      }
-
-      pos.x = end;
-   }
-   bitmap = (mHBarEnabled ? ((curHitRegion == RightArrow && mDepressed) ?
-            BmpStates * BmpRight + BmpHilite : BmpStates * BmpRight) : BmpStates * BmpRight + BmpDisabled);
-
-   dglClearBitmapModulation();
-   dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[bitmap]);
-}
-
-void GuiScrollCtrl::drawScrollCorner(const Point2I &offset)
-{
-   Point2I pos = offset;
-   pos.x += mRightArrowRect.point.x + mRightArrowRect.extent.x;
-   pos.y += mRightArrowRect.point.y;
-   dglClearBitmapModulation();
-   dglDrawBitmapSR(mTextureHandle, pos, mBitmapBounds[BmpStates * BmpResize]);
-}
 #pragma endregion
 

+ 0 - 6
engine/source/gui/containers/guiScrollCtrl.h

@@ -166,9 +166,6 @@ public:
 
    void computeSizes();
 
-   // you can change the bitmap array dynamically.
-   void loadBitmapArray();
-
    void addObject(SimObject *obj);
    void resize(const Point2I &newPosition, const Point2I &newExtent);
    void childResized(GuiControl *child);
@@ -203,9 +200,6 @@ public:
    void renderBorderedRectWithArrow(RectI& bounds, GuiControlProfile* profile, GuiControlState state, GuiDirection direction);
    void renderVScrollBar(const Point2I& offset);
    void renderHScrollBar(const Point2I& offset);
-   virtual void drawVScrollBar(const Point2I &offset);
-   virtual void drawHScrollBar(const Point2I &offset);
-   virtual void drawScrollCorner(const Point2I &offset);
    virtual GuiControl* findHitControl(const Point2I &pt, S32 initialLayer = -1);
    virtual void renderChildControls(Point2I offset, RectI content, const RectI& updateRect);
 };

+ 2 - 2
engine/source/gui/containers/guiTabBookCtrl.cc

@@ -335,7 +335,7 @@ void GuiTabBookCtrl::onRender(Point2I offset, const RectI &updateRect)
 		return;
 	}
 
-	renderBorderedRect(ctrlRect, mProfile, NormalState);
+	renderUniversalRect(ctrlRect, mProfile, NormalState);
 	RectI fillRect = applyBorders(ctrlRect.point, ctrlRect.extent, NormalState, mProfile);
 	RectI contentRect = applyPadding(fillRect.point, fillRect.extent, NormalState, mProfile);
 	if (contentRect.isValidRect())
@@ -387,7 +387,7 @@ void GuiTabBookCtrl::renderTab( RectI tabRect, GuiTabPageCtrl *tab )
 	   return;
    }
 
-   renderBorderedRect(ctrlRect, mTabProfile, currentState);
+   renderUniversalRect(ctrlRect, mTabProfile, currentState);
 
    //Render Text
    dglSetBitmapModulation(mTabProfile->getFontColor(currentState));

+ 2 - 2
engine/source/gui/editor/guiMenuBar.cc

@@ -981,11 +981,11 @@ void GuiMenuBar::onRender(Point2I offset, const RectI &updateRect)
         highlightBounds.inset(1,1);
          if(walk == mouseDownMenu)
 		 {
-			renderBorderedRect(highlightBounds, mProfile, GuiControlState::HighlightState);
+			 renderUniversalRect(highlightBounds, mProfile, GuiControlState::HighlightState);
          }
 		 else if(walk == mouseOverMenu && mouseDownMenu == NULL)
 		 {
-			 renderBorderedRect(highlightBounds, mProfile, GuiControlState::NormalState);
+			 renderUniversalRect(highlightBounds, mProfile, GuiControlState::NormalState);
 		 }
 	  }
 

+ 2 - 2
engine/source/gui/guiControl.cc

@@ -464,7 +464,7 @@ void GuiControl::onRender(Point2I offset, const RectI &updateRect)
 		return;
 	}
 
-    renderBorderedRect(ctrlRect, mProfile, NormalState);
+	renderUniversalRect(ctrlRect, mProfile, NormalState);
 
 	//Render Text
 	dglSetBitmapModulation(mProfile->mFontColor);
@@ -696,7 +696,7 @@ bool GuiControl::renderTooltip(Point2I cursorPos, const char* tipText )
     dglSetClipRect(rect);
 
     // Draw body and border of the tool tip
-	renderBorderedRect(rect, mTooltipProfile, NormalState);
+	renderUniversalRect(rect, mTooltipProfile, NormalState);
 
     // Draw the text centered in the tool tip box
     dglSetBitmapModulation( mTooltipProfile->mFontColor );

+ 184 - 194
engine/source/gui/guiDefaultControlRender.cc

@@ -26,6 +26,58 @@
 #include "graphics/gColor.h"
 #include "math/mRect.h"
 
+// Renders a rect in one of three ways: ImageAsset, bitmap, or default render. ImageAsset and bitmap can use
+// nine frames per state or one frame per state. The default render is used as a fall back if neither are present.
+void renderUniversalRect(RectI &bounds, GuiControlProfile *profile, GuiControlState state, const ColorI &fillColor, const bool bUseFillColor)
+{
+	if (profile == NULL)
+	{
+		return;
+	}
+
+	U8 stateIndex = state;
+
+	//prepare
+	S32 bitmapFrameCount = 0;
+	S32 imageFrameCount = 0;
+	if (profile->mImageAsset != NULL && profile->mImageAsset->isAssetValid())
+	{
+		imageFrameCount = profile->mImageAsset->getFrameCount();
+	}
+	else if (profile->mBitmapName != NULL)
+	{
+		bitmapFrameCount = profile->constructBitmapArray();
+	}
+
+	if (imageFrameCount >= (9 * (stateIndex + 1)))
+	{
+		renderSizableBorderedImageAsset(bounds, stateIndex, profile->mImageAsset, imageFrameCount);
+	}
+	else if (imageFrameCount > stateIndex && imageFrameCount < 9)
+	{
+		renderStretchedImageAsset(bounds, stateIndex, profile);
+	}
+	else if (bitmapFrameCount >= (9 * (stateIndex + 1)))
+	{
+		renderSizableBorderedBitmap(bounds, stateIndex, profile->mTextureHandle, profile->mBitmapArrayRects.address(), bitmapFrameCount);
+	}
+	else if (bitmapFrameCount > stateIndex && bitmapFrameCount < 9)
+	{
+		renderStretchedBitmap(bounds, stateIndex, profile);
+	}
+	else
+	{
+		if (bUseFillColor)
+		{
+			renderBorderedRect(bounds, profile, state, fillColor);
+		}
+		else
+		{
+			renderBorderedRect(bounds, profile, state);
+		}
+	}
+}
+
 void renderBorderedRect(RectI &bounds, GuiControlProfile *profile, GuiControlState state)
 {
 	if(profile)
@@ -101,6 +153,16 @@ void renderBorderedRect(RectI &bounds, GuiControlProfile *profile, GuiControlSta
 	{
 		dglDrawQuadFill(p6, p2, p3, p7, bottomColor);
 	}
+
+	if (state > 3)
+	{
+		RectI checkRect = RectI(bounds);
+		checkRect.inset(3, 3);
+		if (checkRect.isValidRect())
+		{
+			renderBorderedRect(checkRect, profile, GuiControlState::SelectedState);
+		}
+	}
 }
 
 void renderBorderedCircle(Point2I &center, S32 radius, GuiControlProfile *profile, GuiControlState state)
@@ -119,169 +181,122 @@ void renderBorderedCircle(Point2I &center, S32 radius, GuiControlProfile *profil
 
 	//Draw the border
 	dglDrawCircle(center, (F32)radius, borderColor, (F32)borderSize);
+
+	if (state > 3 && radius >= 8)
+	{
+		dglDrawCircleFill(center, radius - 6, profile->getFillColor(GuiControlState::SelectedState));
+	}
 }
 
-// DAW: Render out the sizable bitmap borders based on a multiplier into the bitmap array
 // Based on the 'Skinnable GUI Controls in TGE' resource by Justin DuJardin
-void renderSizableBitmapBordersFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile)
+void renderSizableBorderedImageAsset(RectI &bounds, U8 frame, ImageAsset *imageAsset, S32 frameCount)
 {
-   S32 NumBitmaps = 9;
-   S32 startIndex = NumBitmaps * (baseMultiplier - 1);
+	S32 NumFrames = 9;
+	S32 i = NumFrames * frame;
 
-   renderSizableBitmapBordersFilledIndex(bounds, startIndex, profile);
+	if (frameCount >= (NumFrames + i))
+	{
+		const ImageAsset::FrameArea::PixelArea& pixelArea1 = imageAsset->getImageFrameArea((U32)i).mPixelArea;
+		const ImageAsset::FrameArea::PixelArea& pixelArea2 = imageAsset->getImageFrameArea((U32)i+1).mPixelArea;
+		const ImageAsset::FrameArea::PixelArea& pixelArea3 = imageAsset->getImageFrameArea((U32)i+2).mPixelArea;
+		const ImageAsset::FrameArea::PixelArea& pixelArea4 = imageAsset->getImageFrameArea((U32)i+3).mPixelArea;
+		const ImageAsset::FrameArea::PixelArea& pixelArea5 = imageAsset->getImageFrameArea((U32)i+4).mPixelArea;
+		const ImageAsset::FrameArea::PixelArea& pixelArea6 = imageAsset->getImageFrameArea((U32)i+5).mPixelArea;
+		const ImageAsset::FrameArea::PixelArea& pixelArea7 = imageAsset->getImageFrameArea((U32)i+6).mPixelArea;
+		const ImageAsset::FrameArea::PixelArea& pixelArea8 = imageAsset->getImageFrameArea((U32)i+7).mPixelArea;
+		const ImageAsset::FrameArea::PixelArea& pixelArea9 = imageAsset->getImageFrameArea((U32)i+8).mPixelArea;
+
+		renderSizableBorderedTexture(bounds, imageAsset->getImageTexture(), 
+			RectI(pixelArea1.mPixelOffset, Point2I(pixelArea1.mPixelWidth, pixelArea1.mPixelHeight)),
+			RectI(pixelArea2.mPixelOffset, Point2I(pixelArea2.mPixelWidth, pixelArea2.mPixelHeight)),
+			RectI(pixelArea3.mPixelOffset, Point2I(pixelArea3.mPixelWidth, pixelArea3.mPixelHeight)), 
+			RectI(pixelArea4.mPixelOffset, Point2I(pixelArea4.mPixelWidth, pixelArea4.mPixelHeight)), 
+			RectI(pixelArea5.mPixelOffset, Point2I(pixelArea5.mPixelWidth, pixelArea5.mPixelHeight)), 
+			RectI(pixelArea6.mPixelOffset, Point2I(pixelArea6.mPixelWidth, pixelArea6.mPixelHeight)), 
+			RectI(pixelArea7.mPixelOffset, Point2I(pixelArea7.mPixelWidth, pixelArea7.mPixelHeight)), 
+			RectI(pixelArea8.mPixelOffset, Point2I(pixelArea8.mPixelWidth, pixelArea8.mPixelHeight)), 
+			RectI(pixelArea9.mPixelOffset, Point2I(pixelArea9.mPixelWidth, pixelArea9.mPixelHeight)));
+	}
 }
 
-
-// DAW: Render out the sizable bitmap borders based on a multiplier into the bitmap array
-// Based on the 'Skinnable GUI Controls in TGE' resource by Justin DuJardin
-void renderSizableBitmapBordersFilledIndex(RectI &bounds, S32 startIndex, GuiControlProfile *profile)
+void renderSizableBorderedBitmap(RectI &bounds, U8 frame, TextureHandle &texture, RectI *bitmapBounds, S32 frameCount)
 {
-   // DAW: Indices into the bitmap array
-   S32 NumBitmaps = 9;
-   S32 BorderTopLeft =     startIndex;
-   S32 BorderTop =         1 + BorderTopLeft;
-   S32 BorderTopRight =    2 + BorderTopLeft;
-   S32 BorderLeft =        3 + BorderTopLeft;
-   S32 Fill =              4 + BorderTopLeft;
-   S32 BorderRight =       5 + BorderTopLeft;
-   S32 BorderBottomLeft =  6 + BorderTopLeft;
-   S32 BorderBottom =      7 + BorderTopLeft;
-   S32 BorderBottomRight = 8 + BorderTopLeft;
+   S32 NumFrames = 9;
+   S32 i = NumFrames * frame;
 
-   dglClearBitmapModulation();
-   if (profile->mBitmapArrayRects.size() >= (NumBitmaps + startIndex))
+   if (frameCount >= (NumFrames + i))
    {
-	   RectI destRect;
-	   RectI stretchRect;
-	   RectI* mBitmapBounds = profile->mBitmapArrayRects.address();
-
-	   // Draw all corners first.
-
-	   //top left border
-	   dglDrawBitmapSR(profile->mTextureHandle, Point2I(bounds.point.x, bounds.point.y), mBitmapBounds[BorderTopLeft]);
-	   //top right border
-	   dglDrawBitmapSR(profile->mTextureHandle, Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[BorderTopRight].extent.x, bounds.point.y), mBitmapBounds[BorderTopRight]);
-
-	   //bottom left border
-	   dglDrawBitmapSR(profile->mTextureHandle, Point2I(bounds.point.x, bounds.point.y + bounds.extent.y - mBitmapBounds[BorderBottomLeft].extent.y), mBitmapBounds[BorderBottomLeft]);
-	   //bottom right border
-	   dglDrawBitmapSR(profile->mTextureHandle, Point2I(
-		   bounds.point.x + bounds.extent.x - mBitmapBounds[BorderBottomRight].extent.x,
-		   bounds.point.y + bounds.extent.y - mBitmapBounds[BorderBottomRight].extent.y),
-		   mBitmapBounds[BorderBottomRight]);
-
-	   // End drawing corners
-
-	   // Begin drawing sides and top stretched borders
-
-	   //start with top line stretch
-	   destRect.point.x = bounds.point.x + mBitmapBounds[BorderTopLeft].extent.x;
-	   destRect.extent.x = bounds.extent.x - mBitmapBounds[BorderTopRight].extent.x - mBitmapBounds[BorderTopLeft].extent.x;
-	   destRect.extent.y = mBitmapBounds[BorderTop].extent.y;
-	   destRect.point.y = bounds.point.y;
-	   //stretch it
-	   stretchRect = mBitmapBounds[BorderTop];
-	   stretchRect.inset(1, 0);
-	   //draw it
-	   dglDrawBitmapStretchSR(profile->mTextureHandle, destRect, stretchRect);
-	   //bottom line stretch
-	   destRect.point.x = bounds.point.x + mBitmapBounds[BorderBottomLeft].extent.x;
-	   destRect.extent.x = bounds.extent.x - mBitmapBounds[BorderBottomRight].extent.x - mBitmapBounds[BorderBottomLeft].extent.x;
-	   destRect.extent.y = mBitmapBounds[BorderBottom].extent.y;
-	   destRect.point.y = bounds.point.y + bounds.extent.y - mBitmapBounds[BorderBottom].extent.y;
-	   //stretch it
-	   stretchRect = mBitmapBounds[BorderBottom];
-	   stretchRect.inset(1, 0);
-	   //draw it
-	   dglDrawBitmapStretchSR(profile->mTextureHandle, destRect, stretchRect);
-	   //left line stretch
-	   destRect.point.x = bounds.point.x;
-	   destRect.extent.x = mBitmapBounds[BorderLeft].extent.x;
-	   destRect.extent.y = bounds.extent.y - mBitmapBounds[BorderTopLeft].extent.y - mBitmapBounds[BorderBottomLeft].extent.y;
-	   destRect.point.y = bounds.point.y + mBitmapBounds[BorderTopLeft].extent.y;
-	   //stretch it
-	   stretchRect = mBitmapBounds[BorderLeft];
-	   stretchRect.inset(0, 1);
-	   //draw it
-	   dglDrawBitmapStretchSR(profile->mTextureHandle, destRect, stretchRect);
-	   //right line stretch
-	   destRect.point.x = bounds.point.x + bounds.extent.x - mBitmapBounds[BorderRight].extent.x;
-	   destRect.extent.x = mBitmapBounds[BorderRight].extent.x;
-	   destRect.extent.y = bounds.extent.y - mBitmapBounds[BorderTopRight].extent.y - mBitmapBounds[BorderBottomRight].extent.y;
-	   destRect.point.y = bounds.point.y + mBitmapBounds[BorderTopRight].extent.y;
-	   //stretch it
-	   stretchRect = mBitmapBounds[BorderRight];
-	   stretchRect.inset(0, 1);
-	   //draw it
-	   dglDrawBitmapStretchSR(profile->mTextureHandle, destRect, stretchRect);
-	   //fill stretch
-	   destRect.point.x = bounds.point.x + mBitmapBounds[BorderLeft].extent.x;
-	   destRect.extent.x = (bounds.extent.x) - mBitmapBounds[BorderLeft].extent.x - mBitmapBounds[BorderRight].extent.x;
-	   destRect.extent.y = bounds.extent.y - mBitmapBounds[BorderTop].extent.y - mBitmapBounds[BorderBottom].extent.y;
-	   destRect.point.y = bounds.point.y + mBitmapBounds[BorderTop].extent.y;
-	   //stretch it
-	   stretchRect = mBitmapBounds[Fill];
-	   stretchRect.inset(1, 1);
-	   //draw it
-	   dglDrawBitmapStretchSR(profile->mTextureHandle, destRect, stretchRect);
-
-	   // End drawing sides and top stretched borders
+	   renderSizableBorderedTexture(bounds, texture, bitmapBounds[i], bitmapBounds[i+1], bitmapBounds[i+2], bitmapBounds[i+3], bitmapBounds[i+4], bitmapBounds[i+5], bitmapBounds[i+6], bitmapBounds[i+7], bitmapBounds[i+8]);
    }
 }
 
-
-
-// DAW: Render out the fixed bitmap borders based on a multiplier into the bitmap array
-// It renders left and right caps, with a sizable fill area in the middle to reach
-// the x extent.  It does not stretch in the y direction.
-void renderFixedBitmapBordersFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile)
+void renderSizableBorderedTexture(RectI &bounds, TextureHandle &texture, RectI &TopLeft, RectI &Top, RectI &TopRight, RectI &Left, RectI &Fill, RectI &Right, RectI &BottomLeft, RectI &Bottom, RectI &BottomRight)
 {
-   // DAW: Indices into the bitmap array
-   S32 NumBitmaps = 3;
-   S32 BorderLeft =     NumBitmaps * baseMultiplier - NumBitmaps;
-   S32 Fill =              1 + BorderLeft;
-   S32 BorderRight =       2 + BorderLeft;
-
-   dglClearBitmapModulation();
-   if(profile->mBitmapArrayRects.size() >= (NumBitmaps * baseMultiplier))
-   {
-      RectI destRect;
-      RectI stretchRect;
-      RectI* mBitmapBounds = profile->mBitmapArrayRects.address();
-
-      // Draw all corners first.
-
-      //left border
-      dglDrawBitmapSR(profile->mTextureHandle,Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[BorderLeft]);
-      //right border
-      dglDrawBitmapSR(profile->mTextureHandle,Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[BorderRight].extent.x,bounds.point.y),mBitmapBounds[BorderRight]);
-
-      // End drawing corners
-
-      // Begin drawing fill
-
-      //fill stretch
-      destRect.point.x = bounds.point.x + mBitmapBounds[BorderLeft].extent.x;
-      destRect.extent.x = (bounds.extent.x) - mBitmapBounds[BorderLeft].extent.x - mBitmapBounds[BorderRight].extent.x;
-      destRect.extent.y = mBitmapBounds[Fill].extent.y;
-      destRect.point.y = bounds.point.y;
-      //stretch it
-      stretchRect = mBitmapBounds[Fill];
-      stretchRect.inset(1,0);
-      //draw it
-      dglDrawBitmapStretchSR(profile->mTextureHandle,destRect,stretchRect);
-
-      // End drawing fill
-   }
+	dglClearBitmapModulation();
+	RectI destRect;
+	RectI stretchRect;
+
+	//top corners
+	dglDrawBitmapSR(texture, bounds.point, TopLeft);
+	dglDrawBitmapSR(texture, Point2I(bounds.point.x + bounds.extent.x - TopRight.extent.x, bounds.point.y), TopRight);
+
+	//bottom corners
+	dglDrawBitmapSR(texture, Point2I(bounds.point.x, bounds.point.y + bounds.extent.y - BottomLeft.extent.y), BottomLeft);
+	dglDrawBitmapSR(texture, Point2I(bounds.point.x + bounds.extent.x - BottomRight.extent.x, bounds.point.y + bounds.extent.y - BottomRight.extent.y), BottomRight);
+
+	//top line stretch
+	destRect.point.x = bounds.point.x + TopLeft.extent.x;
+	destRect.extent.x = bounds.extent.x - TopRight.extent.x - TopLeft.extent.x;
+	destRect.extent.y = Top.extent.y;
+	destRect.point.y = bounds.point.y;
+	stretchRect = Top;
+	stretchRect.inset(1, 0);
+	dglDrawBitmapStretchSR(texture, destRect, stretchRect);
+
+	//bottom line stretch
+	destRect.point.x = bounds.point.x + BottomLeft.extent.x;
+	destRect.extent.x = bounds.extent.x - BottomRight.extent.x - BottomLeft.extent.x;
+	destRect.extent.y = Bottom.extent.y;
+	destRect.point.y = bounds.point.y + bounds.extent.y - Bottom.extent.y;
+	stretchRect = Bottom;
+	stretchRect.inset(1, 0);
+	dglDrawBitmapStretchSR(texture, destRect, stretchRect);
+
+	//left line stretch
+	destRect.point.x = bounds.point.x;
+	destRect.extent.x = Left.extent.x;
+	destRect.extent.y = bounds.extent.y - TopLeft.extent.y - BottomLeft.extent.y;
+	destRect.point.y = bounds.point.y + TopLeft.extent.y;
+	stretchRect = Left;
+	stretchRect.inset(0, 1);
+	dglDrawBitmapStretchSR(texture, destRect, stretchRect);
+
+	//right line stretch
+	destRect.point.x = bounds.point.x + bounds.extent.x - Right.extent.x;
+	destRect.extent.x = Right.extent.x;
+	destRect.extent.y = bounds.extent.y - TopRight.extent.y - BottomRight.extent.y;
+	destRect.point.y = bounds.point.y + TopRight.extent.y;
+	stretchRect = Right;
+	stretchRect.inset(0, 1);
+	dglDrawBitmapStretchSR(texture, destRect, stretchRect);
+
+	//fill stretch
+	destRect.point.x = bounds.point.x + Left.extent.x;
+	destRect.extent.x = (bounds.extent.x) - Left.extent.x - Right.extent.x;
+	destRect.extent.y = bounds.extent.y - Top.extent.y - Bottom.extent.y;
+	destRect.point.y = bounds.point.y + Top.extent.y;
+	stretchRect = Fill;
+	stretchRect.inset(1, 1);
+	dglDrawBitmapStretchSR(texture, destRect, stretchRect);
 }
 
-// DAW: Render out the fixed bitmap borders based on a multiplier into the bitmap array
+// Renders out the fixed bitmap borders based on a multiplier into the bitmap array.
 // It renders left and right caps, with a sizable fill area in the middle to reach
 // the x extent.  It does not stretch in the y direction.
-void renderFixedBitmapBordersFilledIndex(RectI &bounds, S32 startIndex, GuiControlProfile *profile)
+void renderFixedBitmapBordersFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile)
 {
-   // DAW: Indices into the bitmap array
-   S32 NumBitmaps = 3;
+	S32 NumBitmaps = 3;
+	S32 startIndex = NumBitmaps * (baseMultiplier - 1);
    S32 BorderLeft =     startIndex;
    S32 Fill =              1 + startIndex;
    S32 BorderRight =       2 + startIndex;
@@ -293,73 +308,48 @@ void renderFixedBitmapBordersFilledIndex(RectI &bounds, S32 startIndex, GuiContr
       RectI stretchRect;
       RectI* mBitmapBounds = profile->mBitmapArrayRects.address();
 
-      // Draw all corners first.
-
-      //left border
+      //draw left endcap
       dglDrawBitmapSR(profile->mTextureHandle,Point2I(bounds.point.x,bounds.point.y),mBitmapBounds[BorderLeft]);
-      //right border
+      //draw right endcap
       dglDrawBitmapSR(profile->mTextureHandle,Point2I(bounds.point.x + bounds.extent.x - mBitmapBounds[BorderRight].extent.x,bounds.point.y),mBitmapBounds[BorderRight]);
 
-      // End drawing corners
-
-      // Begin drawing fill
-
-      //fill stretch
+      //draw stretched content
       destRect.point.x = bounds.point.x + mBitmapBounds[BorderLeft].extent.x;
       destRect.extent.x = (bounds.extent.x) - mBitmapBounds[BorderLeft].extent.x - mBitmapBounds[BorderRight].extent.x;
-      destRect.extent.y = mBitmapBounds[Fill].extent.y;
+      destRect.extent.y = bounds.extent.y;
       destRect.point.y = bounds.point.y;
       //stretch it
       stretchRect = mBitmapBounds[Fill];
       stretchRect.inset(1,0);
       //draw it
       dglDrawBitmapStretchSR(profile->mTextureHandle,destRect,stretchRect);
-
-      // End drawing fill
    }
 }
 
-// DAW: Render out the fixed bitmap borders based on a multiplier into the bitmap array
-// It renders left and right caps, with a sizable fill area in the middle to reach
-// the x extent.  It does not stretch in the y direction.
-void renderFixedBitmapBordersStretchYFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile)
+// Renders out a stretched bitmap.
+void renderStretchedBitmap(RectI &bounds, U8 frame, GuiControlProfile *profile)
 {
-   // DAW: Indices into the bitmap array
-   S32 NumBitmaps = 3;
-   S32 BorderLeft =     NumBitmaps * baseMultiplier - NumBitmaps;
-   S32 Fill =              1 + BorderLeft;
-   S32 BorderRight =       2 + BorderLeft;
-
-   dglClearBitmapModulation();
-   if(profile->mBitmapArrayRects.size() >= (NumBitmaps * baseMultiplier))
-   {
-      RectI destRect;
-      RectI stretchRect;
-      RectI* mBitmapBounds = profile->mBitmapArrayRects.address();
-
-      // Draw all corners first.
-
-      //left border
-      dglDrawBitmapStretchSR(profile->mTextureHandle, RectI( bounds.point.x, bounds.point.y, mBitmapBounds[BorderLeft].extent.x, bounds.extent.y ), mBitmapBounds[BorderLeft] );
-      //right border
-      dglDrawBitmapStretchSR(profile->mTextureHandle, RectI(bounds.point.x + bounds.extent.x - mBitmapBounds[BorderRight].extent.x, bounds.point.y, mBitmapBounds[BorderRight].extent.x, bounds.extent.y ), mBitmapBounds[BorderRight] );
-
-      // End drawing corners
+	dglClearBitmapModulation();
+	if (profile->mBitmapArrayRects.size() > frame)
+	{
+		RectI* mBitmapBounds = profile->mBitmapArrayRects.address();
+		dglDrawBitmapStretchSR(profile->mTextureHandle, bounds, mBitmapBounds[frame]);
+	}
+}
 
-      // Begin drawing fill
+// Renders out a stretched image asset.
+void renderStretchedImageAsset(RectI &bounds, U8 frame, GuiControlProfile *profile)
+{
+	dglClearBitmapModulation();
+	ImageAsset *imageAsset = profile->mImageAsset;
 
-      //fill stretch
-      destRect.point.x = bounds.point.x + mBitmapBounds[BorderLeft].extent.x;
-      destRect.extent.x = (bounds.extent.x) - mBitmapBounds[BorderLeft].extent.x - mBitmapBounds[BorderRight].extent.x;
-      destRect.extent.y = bounds.extent.y;
-      destRect.point.y = bounds.point.y;
-      //stretch it
-      stretchRect = mBitmapBounds[Fill];
-      stretchRect.inset(1,0);
-      //draw it
-      dglDrawBitmapStretchSR(profile->mTextureHandle, destRect, stretchRect);
+	if (imageAsset != NULL && imageAsset->isAssetValid() && imageAsset->getFrameCount() > frame)
+	{
+		const ImageAsset::FrameArea::PixelArea& pixelArea = imageAsset->getImageFrameArea(frame).mPixelArea;
+		RectI srcRect(pixelArea.mPixelOffset, Point2I(pixelArea.mPixelWidth, pixelArea.mPixelHeight));
 
-      // End drawing fill
-   }
+		// Render image.
+		dglDrawBitmapStretchSR(imageAsset->getImageTexture(), bounds, srcRect);
+	}
 }
 

+ 7 - 5
engine/source/gui/guiDefaultControlRender.h

@@ -29,13 +29,15 @@
 
 class GuiControlProfile;
 
+void renderUniversalRect(RectI &bounds, GuiControlProfile *profile, GuiControlState state, const ColorI &fillColor = "White", const bool bUseFillColor = false);
 void renderBorderedRect(RectI &bounds, GuiControlProfile *profile, GuiControlState state);
 void renderBorderedRect(RectI &bounds, GuiControlProfile *profile, GuiControlState state, const ColorI &fillColor);
 void renderBorderedCircle(Point2I &center, S32 radius, GuiControlProfile *profile, GuiControlState state);
-void renderSizableBitmapBordersFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile); 
-void renderSizableBitmapBordersFilledIndex(RectI &bounds, S32 startIndex, GuiControlProfile *profile);
-void renderFixedBitmapBordersFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile); 
-void renderFixedBitmapBordersFilled(RectI &bounds, S32 startIndex, GuiControlProfile *profile);
-void renderFixedBitmapBordersStretchYFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile);
+void renderSizableBorderedImageAsset(RectI &bounds, U8 frame, ImageAsset *mImageAsset, S32 frameCount);
+void renderSizableBorderedBitmap(RectI &bounds, U8 frame, TextureHandle &texture, RectI *bitmapBounds, S32 frameCount);
+void renderSizableBorderedTexture(RectI &bounds, TextureHandle &texture, RectI &TopLeft, RectI &Top, RectI &TopRight, RectI &Left, RectI &Fill, RectI &Right, RectI &BottomLeft, RectI &Bottom, RectI &BottomRight);
+void renderFixedBitmapBordersFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile);
+void renderStretchedBitmap(RectI &bounds, U8 frame, GuiControlProfile *profile);
+void renderStretchedImageAsset(RectI &bounds, U8 frame, GuiControlProfile *profile);
 
 #endif

+ 4 - 4
engine/source/gui/guiPopUpCtrl.cc

@@ -839,7 +839,7 @@ void GuiPopUpMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
             index = 4; // inactive state images are indexes 4 and 5.
             //S32 l = r.point.x, r2 = r.point.x + r.extent.x - 1;
             //S32 t = r.point.y, b = r.point.y + r.extent.y - 1;
-            renderFixedBitmapBordersStretchYFilled(r, index, mProfile);
+			renderFixedBitmapBordersFilled(r, index, mProfile);
             return;
         }
     }
@@ -852,7 +852,7 @@ void GuiPopUpMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
       if(mProfile->mProfileForChildren && mProfile->mBitmapArrayRects.size())
       {
          // Render the fixed, filled in border
-         renderFixedBitmapBordersStretchYFilled(r, 3, mProfile);
+		  renderFixedBitmapBordersFilled(r, 3, mProfile);
          renderedBitmapIndex = 3;
       } 
       else
@@ -895,7 +895,7 @@ void GuiPopUpMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
          if(mProfile->mProfileForChildren && mProfile->mBitmapArrayRects.size())
          {
             // Render the fixed, filled in border
-            renderFixedBitmapBordersStretchYFilled(r, 2, mProfile);
+			 renderFixedBitmapBordersFilled(r, 2, mProfile);
             renderedBitmapIndex = 2;
 
          } else
@@ -927,7 +927,7 @@ void GuiPopUpMenuCtrl::onRender(Point2I offset, const RectI &updateRect)
          if(mProfile->mProfileForChildren && mProfile->mBitmapArrayRects.size())
          {
             // Render the fixed, filled in border
-            renderFixedBitmapBordersStretchYFilled(r, 1, mProfile);
+			 renderFixedBitmapBordersFilled(r, 1, mProfile);
             renderedBitmapIndex = 1;
 
          } else

+ 1 - 1
engine/source/gui/guiSliderCtrl.cc

@@ -440,7 +440,7 @@ void GuiSliderCtrl::onRender(Point2I offset, const RectI &updateRect)
 
         // draw the thumb
         thumb.point += pos;
-        renderBorderedRect(thumb, mProfile, NormalState);
+		renderUniversalRect(thumb, mProfile, NormalState);
     }
 
     if (mDisplayValue)

+ 2 - 2
engine/source/gui/guiTextEditCtrl.cc

@@ -251,7 +251,7 @@ void GuiTextEditCtrl::setText( const UTF8 *txt )
 	mProfile->incRefCount();
 	mFont = mProfile->mFont;
 
-	//Luma:	If the font isn't found, we want to decrement the profile usage and return now or we may crash!
+	//If the font isn't found, we want to decrement the profile usage and return now or we may crash!
 	if (mFont.isNull())
 	{
 		//decrement the profile referrence
@@ -1194,7 +1194,7 @@ void GuiTextEditCtrl::onRender(Point2I offset, const RectI & updateRect)
 		return;
 	}
 
-	renderBorderedRect(ctrlRect, mProfile, currentState);
+	renderUniversalRect(ctrlRect, mProfile, currentState);
 
 	//Render Text
 	dglSetBitmapModulation(mProfile->mFontColor);

+ 159 - 126
engine/source/gui/guiTypes.cc

@@ -57,7 +57,7 @@ void GuiCursor::initPersistFields()
 bool GuiCursor::onAdd()
 {
    if(!Parent::onAdd())
-      return false;
+	  return false;
 
    Sim::getGuiDataGroup()->addObject(this);
 
@@ -73,10 +73,10 @@ void GuiCursor::render(const Point2I &pos)
 {
    if (!mTextureHandle && mBitmapName && mBitmapName[0])
    {
-      mTextureHandle = TextureHandle(mBitmapName, TextureHandle::BitmapTexture);
-      if(!mTextureHandle)
-         return;
-      mExtent.set(mTextureHandle.getWidth(), mTextureHandle.getHeight());
+	  mTextureHandle = TextureHandle(mBitmapName, TextureHandle::BitmapTexture);
+	  if(!mTextureHandle)
+		 return;
+	  mExtent.set(mTextureHandle.getWidth(), mTextureHandle.getHeight());
    }
 
    // Render the cursor centered according to dimensions of texture
@@ -96,8 +96,7 @@ IMPLEMENT_CONOBJECT(GuiBorderProfile);
 
 GuiBorderProfile::GuiBorderProfile()
 {
-	S32 stateCount = static_cast<S32>(StateCount);
-	for(S32 i = 0; i < stateCount; i++)
+	for(S32 i = 0; i < 4; i++)
 	{
 		mMargin[i] = 0;
 		mBorder[i] = 0;
@@ -156,22 +155,22 @@ void GuiBorderProfile::onRemove()
 
 S32 GuiBorderProfile::getMargin(const GuiControlState state)
 {
-	return getMax(mMargin[static_cast<S32>(state)], 0);
+	return getMax(mMargin[getStateIndex(state)], 0);
 }
 
 S32 GuiBorderProfile::getBorder(const GuiControlState state)
 {
-	return getMax(mBorder[static_cast<S32>(state)], 0);
+	return getMax(mBorder[getStateIndex(state)], 0);
 }
 
 const ColorI& GuiBorderProfile::getBorderColor(const GuiControlState state)
 {
-	return mBorderColor[static_cast<S32>(state)];
+	return mBorderColor[getStateIndex(state)];
 }
 
 S32 GuiBorderProfile::getPadding(const GuiControlState state)
 {
-	return getMax(mPadding[static_cast<S32>(state)], 0);
+	return getMax(mPadding[getStateIndex(state)], 0);
 }
 
 //------------------------------------------------------------------------------
@@ -195,25 +194,25 @@ static EnumTable gVAlignTable(3, &vAlignEnums[0]);
 
 static EnumTable::Enums charsetEnums[]=
 {
-    { TGE_ANSI_CHARSET,         "ANSI" },
-    { TGE_SYMBOL_CHARSET,       "SYMBOL" },
-    { TGE_SHIFTJIS_CHARSET,     "SHIFTJIS" },
-    { TGE_HANGEUL_CHARSET,      "HANGEUL" },
-    { TGE_HANGUL_CHARSET,       "HANGUL" },
-    { TGE_GB2312_CHARSET,       "GB2312" },
-    { TGE_CHINESEBIG5_CHARSET,  "CHINESEBIG5" },
-    { TGE_OEM_CHARSET,          "OEM" },
-    { TGE_JOHAB_CHARSET,        "JOHAB" },
-    { TGE_HEBREW_CHARSET,       "HEBREW" },
-    { TGE_ARABIC_CHARSET,       "ARABIC" },
-    { TGE_GREEK_CHARSET,        "GREEK" },
-    { TGE_TURKISH_CHARSET,      "TURKISH" },
-    { TGE_VIETNAMESE_CHARSET,   "VIETNAMESE" },
-    { TGE_THAI_CHARSET,         "THAI" },
-    { TGE_EASTEUROPE_CHARSET,   "EASTEUROPE" },
-    { TGE_RUSSIAN_CHARSET,      "RUSSIAN" },
-    { TGE_MAC_CHARSET,          "MAC" },
-    { TGE_BALTIC_CHARSET,       "BALTIC" },
+	{ TGE_ANSI_CHARSET,         "ANSI" },
+	{ TGE_SYMBOL_CHARSET,       "SYMBOL" },
+	{ TGE_SHIFTJIS_CHARSET,     "SHIFTJIS" },
+	{ TGE_HANGEUL_CHARSET,      "HANGEUL" },
+	{ TGE_HANGUL_CHARSET,       "HANGUL" },
+	{ TGE_GB2312_CHARSET,       "GB2312" },
+	{ TGE_CHINESEBIG5_CHARSET,  "CHINESEBIG5" },
+	{ TGE_OEM_CHARSET,          "OEM" },
+	{ TGE_JOHAB_CHARSET,        "JOHAB" },
+	{ TGE_HEBREW_CHARSET,       "HEBREW" },
+	{ TGE_ARABIC_CHARSET,       "ARABIC" },
+	{ TGE_GREEK_CHARSET,        "GREEK" },
+	{ TGE_TURKISH_CHARSET,      "TURKISH" },
+	{ TGE_VIETNAMESE_CHARSET,   "VIETNAMESE" },
+	{ TGE_THAI_CHARSET,         "THAI" },
+	{ TGE_EASTEUROPE_CHARSET,   "EASTEUROPE" },
+	{ TGE_RUSSIAN_CHARSET,      "RUSSIAN" },
+	{ TGE_MAC_CHARSET,          "MAC" },
+	{ TGE_BALTIC_CHARSET,       "BALTIC" },
 };
 
 #define NUMCHARSETENUMS     (sizeof(charsetEnums) / sizeof(EnumTable::Enums))
@@ -226,14 +225,15 @@ GuiControlProfile::GuiControlProfile(void) :
    mFontColor(mFontColors[BaseColor]),
    mFontColorHL(mFontColors[ColorHL]),
    mFontColorNA(mFontColors[ColorNA]),
-   mFontColorSL(mFontColors[ColorSL])
+   mFontColorSL(mFontColors[ColorSL]),
+   mImageAssetID( StringTable->EmptyString )
 {
-    mRefCount = 0;
-    mBitmapArrayRects.clear();
-    mMouseOverSelected = false;
-    
-    mTabable       = false;
-    mCanKeyFocus   = false;
+	mRefCount = 0;
+	mBitmapArrayRects.clear();
+	mMouseOverSelected = false;
+	
+	mTabable       = false;
+	mCanKeyFocus   = false;
 	mUseInput      = true;
 
 	mBorderDefault = NULL;
@@ -241,22 +241,25 @@ GuiControlProfile::GuiControlProfile(void) :
 	mBorderRight = NULL;
 	mBorderTop = NULL;
 	mBorderBottom = NULL;
-    
-    // default font
-    mFontType      = StringTable->EmptyString;
-    mFontSize      = 12;
-    mFontCharset   = TGE_ANSI_CHARSET;
-    mFontColors[BaseColor].set(255,255,255,255);
-    
-    // default bitmap
-    mBitmapName    = NULL;
-    mTextOffset.set(0,0);
-    
-    mAlignment     = LeftAlign;
+	
+	// default font
+	mFontType      = StringTable->EmptyString;
+	mFontSize      = 12;
+	mFontCharset   = TGE_ANSI_CHARSET;
+	mFontColors[BaseColor].set(255,255,255,255);
+	
+	// default bitmap
+	mBitmapName    = NULL;
+	mTextOffset.set(0,0);
+
+	// default image asset
+	mImageAsset = NULL;
+	
+	mAlignment     = LeftAlign;
 	mVAlignment    = MiddleVAlign;
-    mReturnTab     = false;
-    mNumbersOnly   = false;
-    mProfileForChildren = NULL;
+	mReturnTab     = false;
+	mNumbersOnly   = false;
+	mProfileForChildren = NULL;
 
 	//fill color
 	mFillColor.set(0, 0, 0, 0);
@@ -309,6 +312,7 @@ void GuiControlProfile::initPersistFields()
    addField("cursorColor",   TypeColorI,     Offset(mCursorColor, GuiControlProfile));
 
    addField("bitmap",        TypeFilename,   Offset(mBitmapName, GuiControlProfile));
+   addProtectedField("imageAsset", TypeAssetId, Offset(mImageAssetID, GuiControlProfile), &setImageAsset, &getImageAsset, "The image asset ID used to render the control");
 
    addField("soundButtonDown", TypeAudioAssetPtr,  Offset(mSoundButtonDown, GuiControlProfile));
    addField("soundButtonOver", TypeAudioAssetPtr,  Offset(mSoundButtonOver, GuiControlProfile));
@@ -318,7 +322,7 @@ void GuiControlProfile::initPersistFields()
 bool GuiControlProfile::onAdd()
 {
    if(!Parent::onAdd())
-      return false;
+	  return false;
 
    Sim::getGuiDataGroup()->addObject(this);
 
@@ -328,22 +332,22 @@ bool GuiControlProfile::onAdd()
 S32 GuiControlProfile::constructBitmapArray()
 {
    if(mBitmapArrayRects.size())
-      return mBitmapArrayRects.size();
+	  return mBitmapArrayRects.size();
 
    GBitmap *bmp = mTextureHandle.getBitmap();
 
    // Make sure the texture exists.
    if( !bmp )
-      return 0;
+	  return 0;
   
    //get the separator color
    ColorI sepColor;
    if ( !bmp || !bmp->getColor( 0, 0, sepColor ) )
-    {
-      Con::errorf("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", mBitmapName, getName());
-      AssertFatal( false, avar("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", mBitmapName, getName()));
-      return 0;
-    }
+	{
+	  Con::errorf("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", mBitmapName, getName());
+	  AssertFatal( false, avar("Failed to create bitmap array from %s for profile %s - couldn't ascertain seperator color!", mBitmapName, getName()));
+	  return 0;
+	}
 
    //now loop through all the scroll pieces, and find the bounding rectangle for each piece in each state
    S32 curY = 0;
@@ -353,101 +357,126 @@ S32 GuiControlProfile::constructBitmapArray()
    mBitmapArrayRects.clear();
    while(curY < (S32)bmp->getHeight())
    {
-      // skip any sep colors
-      bmp->getColor( 0, curY, color);
-      if(color == sepColor)
-      {
-         curY++;
-         continue;
-      }
-      // ok, process left to right, grabbing bitmaps as we go...
-      S32 curX = 0;
-      while(curX < (S32)bmp->getWidth())
-      {
-         bmp->getColor(curX, curY, color);
-         if(color == sepColor)
-         {
-            curX++;
-            continue;
-         }
-         S32 startX = curX;
-         while(curX < (S32)bmp->getWidth())
-         {
-            bmp->getColor(curX, curY, color);
-            if(color == sepColor)
-               break;
-            curX++;
-         }
-         S32 stepY = curY;
-         while(stepY < (S32)bmp->getHeight())
-         {
-            bmp->getColor(startX, stepY, color);
-            if(color == sepColor)
-               break;
-            stepY++;
-         }
-         mBitmapArrayRects.push_back(RectI(startX, curY, curX - startX, stepY - curY));
-      }
-      // ok, now skip to the next separation color on column 0
-      while(curY < (S32)bmp->getHeight())
-      {
-         bmp->getColor(0, curY, color);
-         if(color == sepColor)
-            break;
-         curY++;
-      }
+	  // skip any sep colors
+	  bmp->getColor( 0, curY, color);
+	  if(color == sepColor)
+	  {
+		 curY++;
+		 continue;
+	  }
+	  // ok, process left to right, grabbing bitmaps as we go...
+	  S32 curX = 0;
+	  while(curX < (S32)bmp->getWidth())
+	  {
+		 bmp->getColor(curX, curY, color);
+		 if(color == sepColor)
+		 {
+			curX++;
+			continue;
+		 }
+		 S32 startX = curX;
+		 while(curX < (S32)bmp->getWidth())
+		 {
+			bmp->getColor(curX, curY, color);
+			if(color == sepColor)
+			   break;
+			curX++;
+		 }
+		 S32 stepY = curY;
+		 while(stepY < (S32)bmp->getHeight())
+		 {
+			bmp->getColor(startX, stepY, color);
+			if(color == sepColor)
+			   break;
+			stepY++;
+		 }
+		 mBitmapArrayRects.push_back(RectI(startX, curY, curX - startX, stepY - curY));
+	  }
+	  // ok, now skip to the next separation color on column 0
+	  while(curY < (S32)bmp->getHeight())
+	  {
+		 bmp->getColor(0, curY, color);
+		 if(color == sepColor)
+			break;
+		 curY++;
+	  }
    }
    return mBitmapArrayRects.size();
 }
 
 void GuiControlProfile::incRefCount()
 {
-   if(!mRefCount++)
-   {
-      sFontCacheDirectory = Con::getVariable("$GUI::fontCacheDirectory");
-
-      //verify the font
-      mFont = GFont::create(mFontType, mFontSize, sFontCacheDirectory);
-      if (mFont.isNull())
-         Con::errorf("Failed to load/create profile font (%s/%d)", mFontType, mFontSize);
-       
-      if ( mBitmapName != NULL && mBitmapName != StringTable->EmptyString )
-      {
-          mTextureHandle = TextureHandle(mBitmapName, TextureHandle::BitmapKeepTexture);
-          if (!(bool)mTextureHandle)
-             Con::errorf("Failed to load profile bitmap (%s)",mBitmapName);
-      }
-   }
+	if(!mRefCount++)
+	{
+		sFontCacheDirectory = Con::getVariable("$GUI::fontCacheDirectory");
+
+		//verify the font
+		mFont = GFont::create(mFontType, mFontSize, sFontCacheDirectory);
+		if (mFont.isNull())
+			Con::errorf("Failed to load/create profile font (%s/%d)", mFontType, mFontSize);
+
+		//Set the bitmap
+		if ( mBitmapName != NULL && mBitmapName != StringTable->EmptyString )
+		{
+			mTextureHandle = TextureHandle(mBitmapName, TextureHandle::BitmapKeepTexture);
+			if (!(bool)mTextureHandle)
+				Con::errorf("Failed to load profile bitmap (%s)",mBitmapName);
+		}
+
+		//set the image asset
+		if (mImageAssetID != NULL && mImageAssetID != StringTable->EmptyString)
+		{
+			mImageAsset = mImageAssetID;
+		}
+	}
 }
 
 void GuiControlProfile::decRefCount()
 {
    AssertFatal(mRefCount, "GuiControlProfile::decRefCount: zero ref count");
    if(!mRefCount)
-      return;
+	  return;
 
    if(!--mRefCount)
    {
-      mFont = NULL;
-      mTextureHandle = NULL;
+	  mFont = NULL;
+	  mTextureHandle = NULL;
+	  mImageAsset.clear();
    }
 }
 
+void GuiControlProfile::setImageAsset(const char* pImageAssetID)
+{
+	// Sanity!
+	AssertFatal(pImageAssetID != NULL, "Cannot use a NULL asset ID.");
+
+	// Fetch the asset ID
+	mImageAsset = StringTable->insert(pImageAssetID);
+
+	// Assign asset if this profile is being used.
+	if (mRefCount != 0)
+		mImageAsset = pImageAssetID;
+}
+
 const ColorI& GuiControlProfile::getFillColor(const GuiControlState state)
 {
 	switch (state)
 	{
 	default:
 	case NormalState:
+	case NormalStateOn:
 		return mFillColor;
 		break;
 	case HighlightState:
+	case HighlightStateOn:
 		return mFillColorHL;
 		break;
 	case SelectedState:
+	case SelectedStateOn:
 		return mFillColorSL;
 		break;
 	case DisabledState:
+	case DisabledStateOn:
 		return mFillColorNA;
 		break;
 	}
@@ -459,15 +488,19 @@ const ColorI& GuiControlProfile::getFontColor(const GuiControlState state)
 	{
 	default:
 	case NormalState:
+	case NormalStateOn:
 		return mFontColor;
 		break;
 	case HighlightState:
+	case HighlightStateOn:
 		return mFontColorHL;
 		break;
 	case SelectedState:
+	case SelectedStateOn:
 		return mFontColorSL;
 		break;
 	case DisabledState:
+	case DisabledStateOn:
 		return mFontColorNA;
 		break;
 	}
@@ -479,20 +512,20 @@ ConsoleSetType( TypeGuiProfile )
 {
    GuiControlProfile *profile = NULL;
    if(argc == 1)
-      Sim::findObject(argv[0], profile);
+	  Sim::findObject(argv[0], profile);
 
    AssertWarn(profile != NULL, avar("GuiControlProfile: requested gui profile (%s) does not exist.", argv[0]));
    if(!profile)
-      profile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiDefaultProfile"));
+	  profile = dynamic_cast<GuiControlProfile*>(Sim::findObject("GuiDefaultProfile"));
 
    AssertFatal(profile != NULL, avar("GuiControlProfile: unable to find specified profile (%s) and GuiDefaultProfile does not exist!", argv[0]));
 
    GuiControlProfile **obj = (GuiControlProfile **)dptr;
    if((*obj) == profile)
-      return;
+	  return;
 
    if(*obj)
-      (*obj)->decRefCount();
+	  (*obj)->decRefCount();
 
    *obj = profile;
    (*obj)->incRefCount();

+ 24 - 5
engine/source/gui/guiTypes.h

@@ -55,6 +55,10 @@
 #include "audio/AudioAsset.h"
 #endif
 
+#ifndef _IMAGE_ASSET_H_
+#include "2d/assets/ImageAsset.h"
+#endif
+
 #include "graphics/gFont.h"
 
 class GBitmap;
@@ -78,6 +82,10 @@ enum GuiControlState
 	HighlightState,				//Control is highlighted
 	SelectedState,				//Control has been selected
 	DisabledState,				//Control cannot be used
+	NormalStateOn,				//Used by controls like checkboxes to denote the normal state while checked
+	HighlightStateOn,			//The highlight state while on
+	SelectedStateOn,			//The selected state while on
+	DisabledStateOn,			//The disabled state while on
 	StateCount					//Not an actual state! Should always be at the end of the list.
 };
 
@@ -120,13 +128,14 @@ class GuiBorderProfile : public SimObject
 {
 private:
 	typedef SimObject Parent;
+	inline U8 getStateIndex(const GuiControlState state) { return state >= 4 ? state - 4 : state; }
 
 public:
-	S32 mMargin[static_cast<S32>(StateCount)];					//The distance between the edge and the start of the border. Margin is outside of the control.
-	S32 mBorder[static_cast<S32>(StateCount)];					//Width of the border.
-	ColorI mBorderColor[static_cast<S32>(StateCount)];			//The color of the border.
-	S32 mPadding[static_cast<S32>(StateCount)];					//The distance between the border and content of the control.
-	bool mUnderfill;											//True if the control's fill color should appear under the border.
+	S32 mMargin[static_cast<S32>(4)];					//The distance between the edge and the start of the border. Margin is outside of the control.
+	S32 mBorder[static_cast<S32>(4)];					//Width of the border.
+	ColorI mBorderColor[static_cast<S32>(4)];			//The color of the border.
+	S32 mPadding[static_cast<S32>(4)];					//The distance between the border and content of the control.
+	bool mUnderfill;									//True if the control's fill color should appear under the border.
 public:
 	DECLARE_CONOBJECT(GuiBorderProfile);
 	GuiBorderProfile();
@@ -218,6 +227,16 @@ public:
 
    Point2I mTextOffset;                            ///< Text offset for the control
 
+   // imageAsset members
+   StringTableEntry mImageAssetID;
+   AssetPtr<ImageAsset> mImageAsset;
+   void setImageAsset( const char* pImageAssetID );
+   inline StringTableEntry getImageAsset( void ) const { return mImageAssetID; }
+protected:
+	static bool setImageAsset(void* obj, const char* data) { static_cast<GuiControlProfile*>(obj)->setImageAsset(data); return false; }
+	static const char* getImageAsset(void* obj, const char* data) { return static_cast<GuiControlProfile*>(obj)->getImageAsset(); }
+
+public:
    // bitmap members
    StringTableEntry mBitmapName;                   ///< Bitmap file name for the bitmap of the control
    TextureHandle mTextureHandle;                   ///< Texture handle for the control

+ 0 - 3
toybox/Sandbox/1/assets/gui/ReplayBtn128x128Down.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="ReplayBtn128x128DownImage"
-    ImageFile="ReplayBtn128x128Down.png" />

BIN
toybox/Sandbox/1/assets/gui/ReplayBtn128x128Down.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/ReplayBtn128x128Hover.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="ReplayBtn128x128HoverImage"
-    ImageFile="ReplayBtn128x128Hover.png" />

BIN
toybox/Sandbox/1/assets/gui/ReplayBtn128x128Hover.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/ReplayBtn128x128Inactive.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="ReplayBtn128x128InactiveImage"
-    ImageFile="ReplayBtn128x128Inactive.png" />

BIN
toybox/Sandbox/1/assets/gui/ReplayBtn128x128Inactive.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/ReplayBtn128x128Up.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="ReplayBtn128x128UpImage"
-    ImageFile="ReplayBtn128x128Up.png" />

BIN
toybox/Sandbox/1/assets/gui/ReplayBtn128x128Up.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/mediumCancelDown.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="mediumCancelDown"
-    ImageFile="mediumCancelDown.png" />

BIN
toybox/Sandbox/1/assets/gui/mediumCancelDown.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/mediumCancelHover.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="mediumCancelHover"
-    ImageFile="mediumCancelHover.png" />

BIN
toybox/Sandbox/1/assets/gui/mediumCancelHover.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/mediumCancelInactive.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="mediumCancelInactive"
-    ImageFile="mediumCancelInactive" />

BIN
toybox/Sandbox/1/assets/gui/mediumCancelInactive.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/mediumCancelNormal.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="mediumCancelNormal"
-    ImageFile="mediumCancelNormal" />

BIN
toybox/Sandbox/1/assets/gui/mediumCancelNormal.png


+ 7 - 0
toybox/Sandbox/1/assets/gui/minusButton.asset.taml

@@ -0,0 +1,7 @@
+<ImageAsset
+    AssetName="minusButton"
+    ImageFile="minusButton"
+	CellCountX="1"
+	CellCountY="4"
+	CellWidth="22"
+	CellHeight="25" />

BIN
toybox/Sandbox/1/assets/gui/minusButton.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/minusButtonDown.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="minusButtonDown"
-    ImageFile="minusButtonDown.png" />

BIN
toybox/Sandbox/1/assets/gui/minusButtonDown.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/minusButtonHover.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="minusButtonHover"
-    ImageFile="minusButtonHover.png" />

BIN
toybox/Sandbox/1/assets/gui/minusButtonHover.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/minusButtonInactive.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="minusButtonInactive"
-    ImageFile="minusButtonInactive.png" />

BIN
toybox/Sandbox/1/assets/gui/minusButtonInactive.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/minusButtonNormal.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="minusButtonNormal"
-    ImageFile="minusButtonNormal.png" />

BIN
toybox/Sandbox/1/assets/gui/minusButtonNormal.png


+ 7 - 0
toybox/Sandbox/1/assets/gui/northArrow.asset.taml

@@ -0,0 +1,7 @@
+<ImageAsset
+    AssetName="northArrow"
+    ImageFile="northArrow"
+	CellCountX="1"
+	CellCountY="3"
+	CellWidth="69"
+	CellHeight="23" />

BIN
toybox/Sandbox/1/assets/gui/northArrow.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/northArrowDown.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="northArrowDown"
-    ImageFile="northArrowDown.png" />

BIN
toybox/Sandbox/1/assets/gui/northArrowDown.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/northArrowHover.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="northArrowHover"
-    ImageFile="northArrowHover.png" />

BIN
toybox/Sandbox/1/assets/gui/northArrowHover.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/northArrowNormal.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="northArrowNormal"
-    ImageFile="northArrowNormal" />

BIN
toybox/Sandbox/1/assets/gui/northArrowNormal.png


+ 7 - 0
toybox/Sandbox/1/assets/gui/plusButton.asset.taml

@@ -0,0 +1,7 @@
+<ImageAsset
+    AssetName="plusButton"
+    ImageFile="plusButton"
+	CellCountX="1"
+	CellCountY="4"
+	CellWidth="22"
+	CellHeight="25" />

BIN
toybox/Sandbox/1/assets/gui/plusButton.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/plusButtonDown.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="plusButtonDown"
-    ImageFile="plusButtonDown.png" />

BIN
toybox/Sandbox/1/assets/gui/plusButtonDown.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/plusButtonHover.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="plusButtonHover"
-    ImageFile="plusButtonHover.png" />

BIN
toybox/Sandbox/1/assets/gui/plusButtonHover.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/plusButtonInactive.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="plusButtonInactive"
-    ImageFile="plusButtonInactive.png" />

BIN
toybox/Sandbox/1/assets/gui/plusButtonInactive.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/plusButtonNormal.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="plusButtonNormal"
-    ImageFile="plusButtonNormal.png" />

BIN
toybox/Sandbox/1/assets/gui/plusButtonNormal.png


+ 7 - 0
toybox/Sandbox/1/assets/gui/southArrow.asset.taml

@@ -0,0 +1,7 @@
+<ImageAsset
+    AssetName="southArrow"
+    ImageFile="southArrow"
+	CellCountX="1"
+	CellCountY="3"
+	CellWidth="69"
+	CellHeight="23" />

BIN
toybox/Sandbox/1/assets/gui/southArrow.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/southArrowDown.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="southArrowDown"
-    ImageFile="southArrowDown.png" />

BIN
toybox/Sandbox/1/assets/gui/southArrowDown.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/southArrowHover.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="southArrowHover"
-    ImageFile="southArrowHover.png" />

BIN
toybox/Sandbox/1/assets/gui/southArrowHover.png


+ 0 - 3
toybox/Sandbox/1/assets/gui/southArrowNormal.asset.taml

@@ -1,3 +0,0 @@
-<ImageAsset
-    AssetName="southArrowNormal"
-    ImageFile="southArrowNormal" />

BIN
toybox/Sandbox/1/assets/gui/southArrowNormal.png


+ 16 - 39
toybox/Sandbox/1/gui/ToolboxDialog.gui.taml

@@ -221,12 +221,12 @@
             Profile="GuiSpinnerProfile"
             tooltipprofile="GuiToolTipProfile"
             hovertime="1000" />
-        <GuiImageButtonCtrl
+        <GuiButtonCtrl
             Name="CategoryDownButton"
             command="ToyCategorySelectList.previousCategory();"
             canSaveDynamicFields="0"
             isContainer="0"
-            Profile="GuiSpriteProfile"
+            Profile="GuiMinusButtonProfile"
             HorizSizing="relative"
             VertSizing="relative"
             Position="0 18"
@@ -236,19 +236,13 @@
             Visible="1"
             Active="1"
             hovertime="1000"
-            groupNum="-1"
-            buttonType="PushButton"
-            useMouseEvents="0"
-            NormalImage="@asset=Sandbox:minusButtonNormal"
-            HoverImage="@asset=Sandbox:minusButtonHover"
-            DownImage="@asset=Sandbox:minusButtonDown"
-            InactiveImage="@asset=Sandbox:minusButtonInactive" />
-        <GuiImageButtonCtrl
+            text="" />
+        <GuiButtonCtrl
             Name="CategoryUpButton"
             command="ToyCategorySelectList.nextCategory();"
             canSaveDynamicFields="0"
             isContainer="0"
-            Profile="GuiSpriteProfile"
+            Profile="GuiPlusButtonProfile"
             HorizSizing="relative"
             VertSizing="relative"
             Position="192 18"
@@ -257,57 +251,40 @@
             canSave="1"
             Visible="1"
             Active="1"
-            groupNum="-1"
-            buttonType="PushButton"
-            useMouseEvents="0"
-            NormalImage="@asset=Sandbox:plusButtonNormal"
-            HoverImage="@asset=Sandbox:plusButtonHover"
-            DownImage="@asset=Sandbox:plusButtonDown"
-            InactiveImage="@asset=Sandbox:plusButtonInactive" />
+            text="" />
 
 		<!-- Toy Selection -->
-		<GuiImageButtonCtrl
+		<GuiButtonCtrl
 			Name="PreviousToyButton"
 			canSaveDynamicFields="0"
 			command="ToyListScroller.scrollToPrevious();"
 			isContainer="0"
-			Profile="GuiSpriteProfile"
+			Profile="GuiNorthButtonProfile"
 			HorizSizing="relative"
 			VertSizing="relative"
-			Position="70 65"
+			Position="105 65"
 			Extent="69 23"
-			MinExtent="8 2"
+			MinExtent="12 4"
 			canSave="1"
 			Visible="1"
 			Active="1"
-			groupNum="-1"
-			buttonType="PushButton"
-			useMouseEvents="0"
-			NormalImage="@asset=Sandbox:northArrowNormal"
-			HoverImage="@asset=Sandbox:northArrowHover"
-			DownImage="@asset=Sandbox:northArrowDown" />
+			Text="" />
 
-		<GuiImageButtonCtrl
+		<GuiButtonCtrl
 			Name="NextToyButton"
 			command="ToyListScroller.scrollToNext();"
 			canSaveDynamicFields="0"
 			isContainer="0"
-			Profile="GuiSpriteProfile"
+			Profile="GuiSouthButtonProfile"
 			HorizSizing="relative"
 			VertSizing="relative"
-			Position="70 700"
+			Position="105 700"
 			Extent="69 23"
-			MinExtent="8 2"
+			MinExtent="12 4"
 			canSave="1"
 			Visible="1"
 			Active="1"
-			hovertime="1000"
-			groupNum="-1"
-			buttonType="PushButton"
-			useMouseEvents="0"
-			NormalImage="@asset=Sandbox:southArrowNormal"
-			HoverImage="@asset=Sandbox:southArrowHover"
-			DownImage="@asset=Sandbox:southArrowDown" />
+			Text="" />
 
 		<!-- Toy Selection Scrollbox -->
         <GuiControl

+ 33 - 1
toybox/Sandbox/1/gui/guiProfiles.cs

@@ -218,7 +218,7 @@ if (!isObject(GuiCheckBoxProfile)) new GuiControlProfile (GuiCheckBoxProfile : G
     fillColorNA = SetColorAlpha($color3, 100);
 
     fontColor = $color3;
-	fontColorHL = $color4;
+	fontColorHL = AdjustColorValue($color5, -10);
 	fontColorSL = $color5;
 	fontColorNA = SetColorAlpha($color3, 100);
     align = "left";
@@ -227,6 +227,7 @@ if (!isObject(GuiCheckBoxProfile)) new GuiControlProfile (GuiCheckBoxProfile : G
 	borderDefault = "GuiBrightBorderProfile";
 	borderRight = "GuiDarkBorderProfile";
 	borderBottom = "GuiDarkBorderProfile";
+	bitmap = "^Sandbox/gui/images/checkBox.png";
 };
 
 //-----------------------------------------------------------------------------
@@ -315,6 +316,7 @@ if(!isObject(GuiScrollProfile)) new GuiControlProfile (GuiScrollProfile)
 {
     fillColor = $color2;
     borderDefault = GuiDefaultBorderProfile;
+	//bitmap = "^Sandbox/gui/images/scrollBar.png";
 };
 
 //-----------------------------------------------------------------------------
@@ -354,6 +356,34 @@ if (!isObject(GuiButtonProfile)) new GuiControlProfile (GuiButtonProfile : GuiDe
 
 //-----------------------------------------------------------------------------
 
+if (!isObject(GuiNorthButtonProfile)) new GuiControlProfile (GuiNorthButtonProfile : GuiDefaultProfile)
+{
+    imageAsset = "Sandbox:northArrow";
+};
+
+//-----------------------------------------------------------------------------
+
+if (!isObject(GuiSouthButtonProfile)) new GuiControlProfile (GuiSouthButtonProfile : GuiDefaultProfile)
+{
+    imageAsset = "Sandbox:southArrow";
+};
+
+//-----------------------------------------------------------------------------
+
+if (!isObject(GuiPlusButtonProfile)) new GuiControlProfile (GuiPlusButtonProfile : GuiDefaultProfile)
+{
+    imageAsset = "Sandbox:plusButton";
+};
+
+//-----------------------------------------------------------------------------
+
+if (!isObject(GuiMinusButtonProfile)) new GuiControlProfile (GuiMinusButtonProfile : GuiDefaultProfile)
+{
+    imageAsset = "Sandbox:minusButton";
+};
+
+//-----------------------------------------------------------------------------
+
 if (!isObject(BlueButtonProfile)) new GuiControlProfile (BlueButtonProfile : GuiButtonProfile)
 {
     fontColor = "240 240 240 255";
@@ -428,6 +458,7 @@ if (!isObject(GuiSpinnerProfile)) new GuiControlProfile (GuiSpinnerProfile : Gui
     tab = false;
     canKeyFocus = true;
     returnTab = true;
+	bitmap = "^Sandbox/gui/images/textEdit_noSides.png";
 };
 
 //-----------------------------------------------------------------------------
@@ -435,6 +466,7 @@ if (!isObject(GuiSpinnerProfile)) new GuiControlProfile (GuiSpinnerProfile : Gui
 if (!isObject(GuiSunkenContainerProfile)) new GuiControlProfile (GuiSunkenContainerProfile : GuiSolidProfile)
 {
     fillColor = SetColorAlpha($color1, 150);
+	bitmap = "^Sandbox/gui/images/sunkenContainer.png";
 };
 
 if (!isObject(GuiHeaderProfile)) new GuiControlProfile (GuiHeaderProfile : GuiSolidProfile)

BIN
toybox/Sandbox/1/gui/images/checkBox.png


BIN
toybox/Sandbox/1/gui/images/checkBox2.png


BIN
toybox/Sandbox/1/gui/images/radioButton.png


BIN
toybox/Sandbox/1/gui/images/radioButton2.png


+ 16 - 38
toybox/Sandbox/1/scripts/customToolboxGui.cs

@@ -270,7 +270,7 @@ function addNumericOption( %label, %min, %max, %step, %callback, %startingValue,
 
     %spinnerPosition = "1" SPC Sandbox.customLabelSpacing;
 
-    %spinnerDown = new GuiImageButtonCtrl()
+    %spinnerDown = new GuiButtonCtrl()
     {
         Action = "decrease";
         Class = "SpinnerController";
@@ -279,23 +279,17 @@ function addNumericOption( %label, %min, %max, %step, %callback, %startingValue,
         VertSizing = "relative";
         canSaveDynamicFields = "0";
         isContainer = "0";
-        Profile = "GuiSpriteProfile";
+        Profile = "GuiMinusButtonProfile";
         Position = %spinnerPosition;
         Extent = Sandbox.spinnerExtent;
-        MinExtent = "8 2";
+        MinExtent = "22 25";
         canSave = "1";
         Visible = "1";
         Active = "1";
         hovertime = "1000";
         toolTipProfile = "GuiToolTipProfile";
         toolTip = %tooltipText;
-        groupNum = "-1";
-        buttonType = "PushButton";
-        useMouseEvents = "0";
-        NormalImage = "Sandbox:minusButtonNormal";
-        HoverImage = "Sandbox:minusButtonHover";
-        DownImage = "Sandbox:minusButtonDown";
-        InactiveImage = "Sandbox:minusButtonInactive";
+        text = "";
     };
 
     %controlPosition = (getWord(Sandbox.spinnerExtent, 0) + 1) SPC Sandbox.customLabelSpacing;
@@ -322,7 +316,7 @@ function addNumericOption( %label, %min, %max, %step, %callback, %startingValue,
 
     %spinnerPosition = (getWord(%textEdit.Extent, 0) + getWord(%textEdit.position, 0)) SPC Sandbox.customLabelSpacing;
 
-    %spinnerUp = new GuiImageButtonCtrl()
+    %spinnerUp = new GuiButtonCtrl()
     {
         Action = "increase";
         HorizSizing = "relative";
@@ -331,23 +325,17 @@ function addNumericOption( %label, %min, %max, %step, %callback, %startingValue,
         Step = %step;
         canSaveDynamicFields = "0";
         isContainer = "0";
-        Profile = "GuiSpriteProfile";
+        Profile = "GuiPlusButtonProfile";
         Position = %spinnerPosition;
         Extent = Sandbox.spinnerExtent;
-        MinExtent = "8 2";
+        MinExtent = "22 25";
         canSave = "1";
         Visible = "1";
         Active = "1";
         hovertime = "1000";
         toolTipProfile = "GuiToolTipProfile";
         toolTip = %tooltipText;
-        groupNum = "-1";
-        buttonType = "PushButton";
-        useMouseEvents = "0";
-        NormalImage = "Sandbox:plusButtonNormal";
-        HoverImage = "Sandbox:plusButtonHover";
-        DownImage = "Sandbox:plusButtonDown";
-        InactiveImage = "Sandbox:plusButtonInactive";
+        text = "";
     };
 
     %textEdit.validate = %textEdit @ ".updateToy();";
@@ -592,25 +580,20 @@ function addSelectionOption( %entries, %label, %maxDisplay, %callback, %shouldRe
     }
 
     // Create and add the up button
-    %upButton = new GuiImageButtonCtrl()
+    %upButton = new GuiButtonCtrl()
     {
         canSaveDynamicFields = "0";
         isContainer = "0";
-        Profile = "GuiSpriteProfile";
+        Profile = "GuiNorthButtonProfile";
         HorizSizing = "relative";
         VertSizing = "relative";
         Position = %buttonX SPC %upButtonY;
         Extent = "69 23";
-        MinExtent = "8 2";
+        MinExtent = "12 4";
         canSave = "1";
         Visible = "1";
         Active = "1";
-        groupNum = "-1";
-        buttonType = "PushButton";
-        useMouseEvents = "0";
-        NormalImage = "Sandbox:northArrowNormal";
-        HoverImage = "Sandbox:northArrowHover";
-        DownImage = "Sandbox:northArrowDown";
+		text = "";
         toolTipProfile = "GuiToolTipProfile";
         toolTip = %tooltipText;
     };
@@ -618,25 +601,20 @@ function addSelectionOption( %entries, %label, %maxDisplay, %callback, %shouldRe
     %upButton.command = %scrollControl @ ".scrollToPrevious();";
 
     // Create and add the down button
-    %downButton = new GuiImageButtonCtrl()
+    %downButton = new GuiButtonCtrl()
     {
         canSaveDynamicFields = "0";
         isContainer = "0";
-        Profile = "GuiSpriteProfile";
+        Profile = "GuiSouthButtonProfile";
         HorizSizing = "relative";
         VertSizing = "relative";
         Position = %buttonX SPC %downButtonY;
         Extent = "69 23";
-        MinExtent = "8 2";
+        MinExtent = "12 4";
         canSave = "1";
         Visible = "1";
         Active = "1";
-        groupNum = "-1";
-        buttonType = "PushButton";
-        useMouseEvents = "0";
-        NormalImage = "Sandbox:southArrowNormal";
-        HoverImage = "Sandbox:southArrowHover";
-        DownImage = "Sandbox:southArrowDown";
+        text = "";
         toolTipProfile = "GuiToolTipProfile";
         toolTip = %tooltipText;
     };