Browse Source

Gui Button Changes

This reduces the buttons from 10 to 4. It also changes callbacks from "Mouse" to "Touch" in places which may have broken many child controls. These will be fixed in future checkins. The sandbox will likely also be broken by this checkin as well. This also adds some circle drawing code which is used by the new radio button.
Peter Robinson 6 years ago
parent
commit
55273172eb
52 changed files with 995 additions and 2203 deletions
  1. 1 3
      engine/compilers/VisualStudio 2017/Torque 2D.vcxproj
  2. 3 9
      engine/compilers/VisualStudio 2017/Torque 2D.vcxproj.filters
  3. 1 14
      engine/compilers/Xcode/Torque2D.xcodeproj/project.pbxproj
  4. 0 5
      engine/compilers/emscripten/CMakeLists.txt
  5. 1 1
      engine/source/2d/gui/guiImageButtonCtrl.cc
  6. 7 7
      engine/source/2d/gui/guiSceneObjectCtrl.cc
  7. 84 0
      engine/source/graphics/dgl.cc
  8. 4 0
      engine/source/graphics/dgl.h
  9. 0 335
      engine/source/gui/buttons/guiBitmapButtonCtrl.cc
  10. 0 86
      engine/source/gui/buttons/guiBitmapButtonCtrl.h
  11. 0 58
      engine/source/gui/buttons/guiBorderButton.cc
  12. 0 383
      engine/source/gui/buttons/guiButtonBaseCtrl.cc
  13. 0 89
      engine/source/gui/buttons/guiButtonBaseCtrl.h
  14. 226 24
      engine/source/gui/buttons/guiButtonCtrl.cc
  15. 32 9
      engine/source/gui/buttons/guiButtonCtrl.h
  16. 96 150
      engine/source/gui/buttons/guiCheckBoxCtrl.cc
  17. 31 14
      engine/source/gui/buttons/guiCheckBoxCtrl.h
  18. 119 0
      engine/source/gui/buttons/guiCheckBoxCtrl_ScriptBinding.h
  19. 0 351
      engine/source/gui/buttons/guiIconButtonCtrl.cc
  20. 0 105
      engine/source/gui/buttons/guiIconButtonCtrl.h
  21. 116 1
      engine/source/gui/buttons/guiRadioCtrl.cc
  22. 9 5
      engine/source/gui/buttons/guiRadioCtrl.h
  23. 0 226
      engine/source/gui/buttons/guiToolboxButtonCtrl.cc
  24. 0 70
      engine/source/gui/buttons/guiToolboxButtonCtrl.h
  25. 1 1
      engine/source/gui/containers/guiDragAndDropCtrl.cc
  26. 1 1
      engine/source/gui/containers/guiFormCtrl.cc
  27. 3 3
      engine/source/gui/containers/guiScrollCtrl.cc
  28. 4 4
      engine/source/gui/containers/guiTabBookCtrl.cc
  29. 3 3
      engine/source/gui/containers/guiTabBookCtrl.h
  30. 1 1
      engine/source/gui/containers/guiWindowCtrl.cc
  31. 3 3
      engine/source/gui/editor/guiEditCtrl.cc
  32. 1 1
      engine/source/gui/editor/guiInspectorTypes.cc
  33. 2 2
      engine/source/gui/editor/guiMenuBar.cc
  34. 4 4
      engine/source/gui/editor/guiSeparatorCtrl.cc
  35. 1 1
      engine/source/gui/guiArrayCtrl.cc
  36. 19 19
      engine/source/gui/guiCanvas.cc
  37. 47 10
      engine/source/gui/guiControl.cc
  38. 14 6
      engine/source/gui/guiControl.h
  39. 28 0
      engine/source/gui/guiControl_ScriptBinding.h
  40. 99 165
      engine/source/gui/guiDefaultControlRender.cc
  41. 4 3
      engine/source/gui/guiDefaultControlRender.h
  42. 1 1
      engine/source/gui/guiListBoxCtrl.cc
  43. 2 2
      engine/source/gui/guiMessageVectorCtrl.cc
  44. 1 1
      engine/source/gui/guiPopUpCtrl.cc
  45. 3 3
      engine/source/gui/guiPopUpCtrlEx.cc
  46. 1 1
      engine/source/gui/guiSliderCtrl.cc
  47. 1 1
      engine/source/gui/guiTabPageCtrl.cc
  48. 1 1
      engine/source/gui/guiTextEditCtrl.cc
  49. 16 17
      engine/source/gui/guiTypes.cc
  50. 4 4
      engine/source/gui/guiTypes.h
  51. BIN
      toybox/Sandbox/1/gui/images/checkBox2.png
  52. BIN
      toybox/Sandbox/1/gui/images/radioButton2.png

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

@@ -620,13 +620,11 @@
     <ClCompile Include="..\..\source\string\stringUnit.cpp" />
     <ClCompile Include="..\..\source\string\unicode.cc" />
     <ClCompile Include="..\..\source\gui\buttons\guiBitmapButtonCtrl.cc" />
-    <ClCompile Include="..\..\source\gui\buttons\guiBorderButton.cc" />
     <ClCompile Include="..\..\source\gui\buttons\guiButtonBaseCtrl.cc" />
     <ClCompile Include="..\..\source\gui\buttons\guiButtonCtrl.cc" />
     <ClCompile Include="..\..\source\gui\buttons\guiCheckBoxCtrl.cc" />
     <ClCompile Include="..\..\source\gui\buttons\guiIconButtonCtrl.cc" />
     <ClCompile Include="..\..\source\gui\buttons\guiRadioCtrl.cc" />
-    <ClCompile Include="..\..\source\gui\buttons\guiToolboxButtonCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiAutoScrollCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiCtrlArrayCtrl.cc" />
     <ClCompile Include="..\..\source\gui\containers\guiDragAndDropCtrl.cc" />
@@ -893,6 +891,7 @@
     <ClInclude Include="..\..\source\graphics\TextureManager.h" />
     <ClInclude Include="..\..\source\graphics\TextureManager_ScriptBinding.h" />
     <ClInclude Include="..\..\source\graphics\TextureObject.h" />
+    <ClInclude Include="..\..\source\gui\buttons\guiCheckBoxCtrl_ScriptBinding.h" />
     <ClInclude Include="..\..\source\gui\containers\guiGridCtrl.h" />
     <ClInclude Include="..\..\source\gui\guiArrayCtrl.h" />
     <ClInclude Include="..\..\source\gui\guiBackgroundCtrl.h" />
@@ -1218,7 +1217,6 @@
     <ClInclude Include="..\..\source\gui\buttons\guiCheckBoxCtrl.h" />
     <ClInclude Include="..\..\source\gui\buttons\guiIconButtonCtrl.h" />
     <ClInclude Include="..\..\source\gui\buttons\guiRadioCtrl.h" />
-    <ClInclude Include="..\..\source\gui\buttons\guiToolboxButtonCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiAutoScrollCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiCtrlArrayCtrl.h" />
     <ClInclude Include="..\..\source\gui\containers\guiDragAndDropCtrl.h" />

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

@@ -453,9 +453,6 @@
     <ClCompile Include="..\..\source\gui\buttons\guiBitmapButtonCtrl.cc">
       <Filter>gui\buttons</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\source\gui\buttons\guiBorderButton.cc">
-      <Filter>gui\buttons</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\source\gui\buttons\guiButtonBaseCtrl.cc">
       <Filter>gui\buttons</Filter>
     </ClCompile>
@@ -471,9 +468,6 @@
     <ClCompile Include="..\..\source\gui\buttons\guiRadioCtrl.cc">
       <Filter>gui\buttons</Filter>
     </ClCompile>
-    <ClCompile Include="..\..\source\gui\buttons\guiToolboxButtonCtrl.cc">
-      <Filter>gui\buttons</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\source\gui\containers\guiAutoScrollCtrl.cc">
       <Filter>gui\containers</Filter>
     </ClCompile>
@@ -1722,9 +1716,6 @@
     <ClInclude Include="..\..\source\gui\buttons\guiRadioCtrl.h">
       <Filter>gui\buttons</Filter>
     </ClInclude>
-    <ClInclude Include="..\..\source\gui\buttons\guiToolboxButtonCtrl.h">
-      <Filter>gui\buttons</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\source\gui\containers\guiAutoScrollCtrl.h">
       <Filter>gui\containers</Filter>
     </ClInclude>
@@ -3180,6 +3171,9 @@
     <ClInclude Include="..\..\source\platform\tmm_off.h" />
     <ClInclude Include="..\..\source\platform\tmm_on.h" />
     <ClInclude Include="..\..\source\platform\typetraits.h" />
+    <ClInclude Include="..\..\source\gui\buttons\guiCheckBoxCtrl_ScriptBinding.h">
+      <Filter>gui\buttons</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <CustomBuild Include="..\..\source\math\mMath_ASM.asm">

+ 1 - 14
engine/compilers/Xcode/Torque2D.xcodeproj/project.pbxproj

@@ -305,14 +305,9 @@
 		86D76FFB165687060046D71F /* TextureDictionary.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FD016518D4600D96ADF /* TextureDictionary.cc */; };
 		86D76FFC165687060046D71F /* TextureHandle.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FD216518D4600D96ADF /* TextureHandle.cc */; };
 		86D76FFD165687060046D71F /* TextureManager.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FD416518D4600D96ADF /* TextureManager.cc */; };
-		86D76FFE165687060046D71F /* guiBitmapButtonCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FD916518D4600D96ADF /* guiBitmapButtonCtrl.cc */; };
-		86D76FFF165687060046D71F /* guiBorderButton.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FDB16518D4600D96ADF /* guiBorderButton.cc */; };
-		86D77000165687060046D71F /* guiButtonBaseCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FDC16518D4600D96ADF /* guiButtonBaseCtrl.cc */; };
 		86D77001165687060046D71F /* guiButtonCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FDE16518D4600D96ADF /* guiButtonCtrl.cc */; };
 		86D77002165687060046D71F /* guiCheckBoxCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FE016518D4600D96ADF /* guiCheckBoxCtrl.cc */; };
-		86D77003165687060046D71F /* guiIconButtonCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FE216518D4600D96ADF /* guiIconButtonCtrl.cc */; };
 		86D77004165687060046D71F /* guiRadioCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FE416518D4600D96ADF /* guiRadioCtrl.cc */; };
-		86D77005165687060046D71F /* guiToolboxButtonCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FE616518D4600D96ADF /* guiToolboxButtonCtrl.cc */; };
 		86D77006165687060046D71F /* guiAutoScrollCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FE916518D4600D96ADF /* guiAutoScrollCtrl.cc */; };
 		86D77007165687060046D71F /* guiCtrlArrayCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FEB16518D4600D96ADF /* guiCtrlArrayCtrl.cc */; };
 		86D77008165687060046D71F /* guiDragAndDropCtrl.cc in Sources */ = {isa = PBXBuildFile; fileRef = 86BC7FED16518D4600D96ADF /* guiDragAndDropCtrl.cc */; };
@@ -1080,21 +1075,13 @@
 		86BC7FD416518D4600D96ADF /* TextureManager.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextureManager.cc; sourceTree = "<group>"; };
 		86BC7FD516518D4600D96ADF /* TextureManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextureManager.h; sourceTree = "<group>"; };
 		86BC7FD616518D4600D96ADF /* TextureObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextureObject.h; sourceTree = "<group>"; };
-		86BC7FD916518D4600D96ADF /* guiBitmapButtonCtrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiBitmapButtonCtrl.cc; sourceTree = "<group>"; };
-		86BC7FDA16518D4600D96ADF /* guiBitmapButtonCtrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guiBitmapButtonCtrl.h; sourceTree = "<group>"; };
-		86BC7FDB16518D4600D96ADF /* guiBorderButton.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiBorderButton.cc; sourceTree = "<group>"; };
-		86BC7FDC16518D4600D96ADF /* guiButtonBaseCtrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiButtonBaseCtrl.cc; sourceTree = "<group>"; };
-		86BC7FDD16518D4600D96ADF /* guiButtonBaseCtrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guiButtonBaseCtrl.h; sourceTree = "<group>"; };
 		86BC7FDE16518D4600D96ADF /* guiButtonCtrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiButtonCtrl.cc; sourceTree = "<group>"; };
 		86BC7FDF16518D4600D96ADF /* guiButtonCtrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guiButtonCtrl.h; sourceTree = "<group>"; };
 		86BC7FE016518D4600D96ADF /* guiCheckBoxCtrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiCheckBoxCtrl.cc; sourceTree = "<group>"; };
 		86BC7FE116518D4600D96ADF /* guiCheckBoxCtrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guiCheckBoxCtrl.h; sourceTree = "<group>"; };
-		86BC7FE216518D4600D96ADF /* guiIconButtonCtrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiIconButtonCtrl.cc; sourceTree = "<group>"; };
-		86BC7FE316518D4600D96ADF /* guiIconButtonCtrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guiIconButtonCtrl.h; sourceTree = "<group>"; };
+		86BC7FE116518D4600D96ADF /* guiCheckBoxCtrl_ScriptBinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guiCheckBoxCtrl_ScriptBinding.h; sourceTree = "<group>"; };
 		86BC7FE416518D4600D96ADF /* guiRadioCtrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiRadioCtrl.cc; sourceTree = "<group>"; };
 		86BC7FE516518D4600D96ADF /* guiRadioCtrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guiRadioCtrl.h; sourceTree = "<group>"; };
-		86BC7FE616518D4600D96ADF /* guiToolboxButtonCtrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiToolboxButtonCtrl.cc; sourceTree = "<group>"; };
-		86BC7FE716518D4600D96ADF /* guiToolboxButtonCtrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guiToolboxButtonCtrl.h; sourceTree = "<group>"; };
 		86BC7FE916518D4600D96ADF /* guiAutoScrollCtrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiAutoScrollCtrl.cc; sourceTree = "<group>"; };
 		86BC7FEA16518D4600D96ADF /* guiAutoScrollCtrl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = guiAutoScrollCtrl.h; sourceTree = "<group>"; };
 		86BC7FEB16518D4600D96ADF /* guiCtrlArrayCtrl.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = guiCtrlArrayCtrl.cc; sourceTree = "<group>"; };

+ 0 - 5
engine/compilers/emscripten/CMakeLists.txt

@@ -278,14 +278,9 @@ SET(T2D_SRCS
 	../../source/graphics/TextureDictionary.cc
 	../../source/graphics/TextureHandle.cc
 	../../source/graphics/TextureManager.cc
-	../../source/gui/buttons/guiBitmapButtonCtrl.cc
-	../../source/gui/buttons/guiBorderButton.cc
-	../../source/gui/buttons/guiButtonBaseCtrl.cc
 	../../source/gui/buttons/guiButtonCtrl.cc
 	../../source/gui/buttons/guiCheckBoxCtrl.cc
-	../../source/gui/buttons/guiIconButtonCtrl.cc
 	../../source/gui/buttons/guiRadioCtrl.cc
-	../../source/gui/buttons/guiToolboxButtonCtrl.cc
 	../../source/gui/containers/guiAutoScrollCtrl.cc
 	../../source/gui/containers/guiCtrlArrayCtrl.cc
 	../../source/gui/containers/guiDragAndDropCtrl.cc

+ 1 - 1
engine/source/2d/gui/guiImageButtonCtrl.cc

@@ -210,7 +210,7 @@ void GuiImageButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
         if ( mMouseOver )
             state = HOVER;
 
-        if ( mDepressed || mStateOn )
+        if ( mDepressed )
             state = DOWN;
     }
     else

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

@@ -46,8 +46,8 @@ GuiSceneObjectCtrl::GuiSceneObjectCtrl(void)
 
    mCaption = StringTable->EmptyString;
 
-   mStateOn = false;
-   mButtonType = ButtonTypeRadio;
+   //mStateOn = false;
+   //mButtonType = ButtonTypeRadio;
 
    // Set-up private batcher.
    mBatchRenderer.setDebugStats( &mDebugStats );
@@ -190,28 +190,28 @@ void GuiSceneObjectCtrl::onMouseUp(const GuiEvent &event)
    if( mDepressed && ( event.mouseClickCount % 2 ) == 0 )
          Con::executef( this, 2, "onDoubleClick" );    
 
-   Parent::onMouseUp( event );
+   Parent::onTouchUp( event );
 }
 
 void GuiSceneObjectCtrl::onMouseLeave( const GuiEvent &event )
 {
    Con::executef( this, 2, "onMouseLeave" );
 
-   Parent::onMouseLeave( event );
+   Parent::onTouchLeave( event );
 }
 
 void GuiSceneObjectCtrl::onMouseEnter( const GuiEvent &event )
 {
    Con::executef( this, 2, "onMouseEnter" );
 
-   Parent::onMouseEnter( event );
+   Parent::onTouchEnter( event );
 }
 
 void GuiSceneObjectCtrl::onMouseDragged( const GuiEvent &event )
 {
    Con::executef( this, 2, "onMouseDragged" );
 
-   Parent::onMouseDragged( event );
+   Parent::onTouchDragged( event );
 }
 
 // -----------------------------------------------------------------------------
@@ -226,7 +226,7 @@ void GuiSceneObjectCtrl::onRender(Point2I offset, const RectI& updateRect)
    // Draw Background
    if( mProfile->mOpaque )
    {
-      if( mDepressed || mStateOn )
+      if( mDepressed )
       {
          if( mHasTexture )
             renderSizableBitmapBordersFilled( ctrlRect, 3, mProfile );

+ 84 - 0
engine/source/graphics/dgl.cc

@@ -36,6 +36,8 @@
 #include "dglMac_ScriptBinding.h"
 #include "dgl_ScriptBinding.h"
 
+#include <vector>
+
 namespace {
 
 ColorI sg_bitmapModulation(255, 255, 255, 255);
@@ -1133,6 +1135,88 @@ void dglSolidCube(const Point3F & extent, const Point3F & center)
 #endif
 }
 
+//Draws an unfilled circle with line segments.
+//Circle drawing code was modified from this source with gratitude. It is in the public domain.
+//http://slabode.exofire.net/circle_draw.shtml
+void dglDrawCircle(const Point2I &center, const F32 radius, const ColorI &color, const F32 &lineWidth)
+{
+	F32 adjustedRadius = radius - (lineWidth/2);
+	const S32 num_segments = (const S32)round(10 * sqrtf(adjustedRadius));
+	F32 theta = 2 * 3.1415926f / F32(num_segments);
+	F32 c = cosf(theta);//precalculate the sine and cosine
+	F32 s = sinf(theta);
+	F32 t;
+
+	F32 x = adjustedRadius;//we start at angle = 0 
+	F32 y = 0;
+
+	glEnable(GL_BLEND);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glDisable(GL_TEXTURE_2D);
+
+	glLineWidth(lineWidth);
+
+	glColor4ub(color.red, color.green, color.blue, color.alpha);
+
+	vector<GLfloat> verts;
+	for (int ii = 0; ii < num_segments; ii++)
+	{
+		verts.push_back(GLfloat(x + center.x));
+		verts.push_back(GLfloat(y + center.y));
+
+		//apply the rotation matrix
+		t = x;
+		x = c * x - s * y;
+		y = s * t + c * y;
+	}
+	verts.push_back(GLfloat(verts[0]));
+	verts.push_back(GLfloat(verts[1]));
+
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glVertexPointer(2, GL_FLOAT, 0, verts.data());
+	glDrawArrays(GL_LINE_LOOP, 0, num_segments + 1);//draw last two
+	glDisableClientState(GL_VERTEX_ARRAY);
+}
+
+void dglDrawCircleFill(const Point2I &center, const F32 radius, const ColorI &color)
+{
+	const S32 num_segments = (const S32)round(10 * sqrtf(radius));
+	F32 theta = 2 * 3.1415926f / F32(num_segments);
+	F32 c = cosf(theta);//precalculate the sine and cosine
+	F32 s = sinf(theta);
+	F32 t;
+
+	F32 x = radius;//we start at angle = 0 
+	F32 y = 0;
+
+	glEnable(GL_BLEND);
+	glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+	glDisable(GL_TEXTURE_2D);
+
+	glColor4ub(color.red, color.green, color.blue, color.alpha);
+
+	vector<GLfloat> verts;
+	verts.push_back(GLfloat(center.x));
+	verts.push_back(GLfloat(center.y));
+	for (int ii = 0; ii < num_segments; ii++)
+	{
+		verts.push_back(GLfloat(x + center.x));
+		verts.push_back(GLfloat(y + center.y));
+
+		//apply the rotation matrix
+		t = x;
+		x = c * x - s * y;
+		y = s * t + c * y;
+	}
+	verts.push_back(GLfloat(verts[2]));
+	verts.push_back(GLfloat(verts[3]));
+
+	glEnableClientState(GL_VERTEX_ARRAY);
+	glVertexPointer(2, GL_FLOAT, 0, verts.data());
+	glDrawArrays(GL_TRIANGLE_FAN, 0, num_segments+2);
+	glDisableClientState(GL_VERTEX_ARRAY);
+}
+
 void dglSetClipRect(const RectI &clipRect)
 {
    glMatrixMode(GL_PROJECTION);

+ 4 - 0
engine/source/graphics/dgl.h

@@ -195,6 +195,10 @@ void dglDrawBillboard( const Point3F &position, F32 width, F32 spinAngle );
 void dglWireCube(const Point3F &extent, const Point3F &center);
 /// Draws a solid cube around "center" with size "extent"
 void dglSolidCube(const Point3F &extent, const Point3F & enter);
+/// Draws an unfilled circle using line segments
+void dglDrawCircle(const Point2I &center, const F32 radius, const ColorI &color, const F32 &lineWidth = 1.0f);
+/// Draws a filled circle
+void dglDrawCircleFill(const Point2I &center, const F32 radius, const ColorI &color);
 /// @}
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //
 // Matrix functions

+ 0 - 335
engine/source/gui/buttons/guiBitmapButtonCtrl.cc

@@ -1,335 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-#include "console/console.h"
-#include "graphics/dgl.h"
-#include "console/consoleTypes.h"
-#include "platform/platformAudio.h"
-#include "gui/guiCanvas.h"
-#include "gui/guiDefaultControlRender.h"
-#include "gui/buttons/guiBitmapButtonCtrl.h"
-
-IMPLEMENT_CONOBJECT(GuiBitmapButtonCtrl);
-
-GuiBitmapButtonCtrl::GuiBitmapButtonCtrl()
-{
-   mBitmapName = StringTable->EmptyString;
-   mBitmapNormal = StringTable->EmptyString;
-   mBitmapHilight = StringTable->EmptyString;
-   mBitmapDepressed = StringTable->EmptyString;
-   mBitmapInactive = StringTable->EmptyString;
-
-   mIsLegacyVersion = true;
-
-   mBounds.extent.set(140, 30);
-}
-
-void GuiBitmapButtonCtrl::initPersistFields()
-{
-   Parent::initPersistFields();
-
-   addField("isLegacyVersion", TypeBool, Offset(mIsLegacyVersion, GuiBitmapButtonCtrl), "Determines if this is a legacy version of the control (only uses bitmap field)");
-   addField("bitmap", TypeFilename, Offset(mBitmapName, GuiBitmapButtonCtrl), "Base name for the bitmaps used in the button states.\n For example, you would only put \"button\""
-                                                                              " to load button_n.png, button_d.png, button_h.png and button_i.png");
-   addField("bitmapNormal", TypeFilename, Offset(mBitmapNormal, GuiBitmapButtonCtrl), "Name of texture used for the normal button state");
-   addField("bitmapHilight", TypeFilename, Offset(mBitmapHilight, GuiBitmapButtonCtrl), "Name of texture used for the hilight/hover button state");
-   addField("bitmapDepressed", TypeFilename, Offset(mBitmapDepressed, GuiBitmapButtonCtrl), "Name of texture used for the depressed button state");
-   addField("bitmapInactive", TypeFilename, Offset(mBitmapInactive, GuiBitmapButtonCtrl), "Name of texture used for the inactive button state");
-}
-
-bool GuiBitmapButtonCtrl::onWake()
-{
-   if (! Parent::onWake())
-      return false;
-
-   if(mIsLegacyVersion)
-   {
-       setBitmap(mBitmapName);
-   }
-   else
-   {
-       setBitmap(mBitmapNormal, NORMAL);
-       setBitmap(mBitmapHilight, HILIGHT);
-       setBitmap(mBitmapDepressed, DEPRESSED);
-       setBitmap(mBitmapInactive, INACTIVE);
-   }
-   
-   return true;
-}
-
-void GuiBitmapButtonCtrl::onSleep()
-{
-   mTextureNormal = NULL;
-   mTextureHilight = NULL;
-   mTextureDepressed = NULL;
-   mTextureInactive = NULL;
-
-   Parent::onSleep();
-}
-
-ConsoleMethod( GuiBitmapButtonCtrl, setBitmap, void, 3, 3, "(filepath name) Loads a bitmap from a given file\n"
-              "@return No return value.")
-{
-   object->setBitmap(argv[2]);
-}
-
-ConsoleMethod( GuiBitmapButtonCtrl, setBitmapNormal, void, 3, 3, "(filepath name) Loads a bitmap from a given file for the \"up\" state\n"
-              "@return No return value.")
-{
-   object->setBitmap(argv[2], NORMAL);
-}
-ConsoleMethod( GuiBitmapButtonCtrl, setBitmapHilight, void, 3, 3, "(filepath name) Loads a bitmap from a given file for the \"down\" state\n"
-              "@return No return value.")
-{
-   object->setBitmap(argv[2], HILIGHT);
-}
-ConsoleMethod( GuiBitmapButtonCtrl, setBitmapDepressed, void, 3, 3, "(filepath name) Loads a bitmap from a given file for the \"hover\" state\n"
-              "@return No return value.")
-{
-   object->setBitmap(argv[2], DEPRESSED);
-}
-ConsoleMethod( GuiBitmapButtonCtrl, setBitmapInactive, void, 3, 3, "(filepath name) Loads a bitmap from a given file for the \"inactive\" state\n"
-              "@return No return value.")
-{
-   object->setBitmap(argv[2], INACTIVE);
-}
-
-void GuiBitmapButtonCtrl::inspectPostApply()
-{
-   // if the extent is set to (0,0) in the gui editor and appy hit, this control will
-   // set it's extent to be exactly the size of the normal bitmap (if present)
-   Parent::inspectPostApply();
-
-   if ((mBounds.extent.x == 0) && (mBounds.extent.y == 0) && mTextureNormal)
-   {
-      TextureObject *texture = (TextureObject *) mTextureNormal;
-      mBounds.extent.x = texture->getBitmapWidth();
-      mBounds.extent.y = texture->getBitmapHeight();
-   }
-}
-
-void GuiBitmapButtonCtrl::setBitmap(const char *name)
-{
-   mBitmapName = StringTable->insert(name);
-
-   if(!isAwake())
-       return;
-
-   if (*mBitmapName)
-   {
-      char buffer[1024];
-      char *p;
-      dStrcpy(buffer, name);
-      p = buffer + dStrlen(buffer);
-
-      mTextureNormal = TextureHandle(buffer, TextureHandle::BitmapTexture, true);
-      if (!mTextureNormal)
-      {
-         dStrcpy(p, "_n");
-         mTextureNormal = TextureHandle(buffer, TextureHandle::BitmapTexture, true);
-      }
-      dStrcpy(p, "_h");
-      mTextureHilight = TextureHandle(buffer, TextureHandle::BitmapTexture, true);
-      if (!mTextureHilight)
-         mTextureHilight = mTextureNormal;
-      dStrcpy(p, "_d");
-      mTextureDepressed = TextureHandle(buffer, TextureHandle::BitmapTexture, true);
-      if (!mTextureDepressed)
-         mTextureDepressed = mTextureHilight;
-      dStrcpy(p, "_i");
-      mTextureInactive = TextureHandle(buffer, TextureHandle::BitmapTexture, true);
-      if (!mTextureInactive)
-         mTextureInactive = mTextureNormal;
-   }
-   else
-   {
-      mTextureNormal = NULL;
-      mTextureHilight = NULL;
-      mTextureDepressed = NULL;
-      mTextureInactive = NULL;
-   }
-   setUpdate();
-}
-
-void GuiBitmapButtonCtrl::setBitmap(const char *name, ButtonState state)
-{
-   if(!isAwake() && *name)
-       return;
-   
-   StringTableEntry temporaryName = StringTable->insert(name);
-   
-   if (*temporaryName)
-   {
-       char buffer[1024];
-       char *p;
-       dStrcpy(buffer, name);
-       p = buffer + dStrlen(buffer);
-
-       switch (state)
-       {
-          case NORMAL:
-              mBitmapNormal = temporaryName;
-              mTextureNormal = TextureHandle(buffer, TextureHandle::BitmapTexture, true);
-              break;
-          case HILIGHT:
-              mBitmapHilight = temporaryName;
-              mTextureHilight = TextureHandle(buffer, TextureHandle::BitmapTexture, true);
-              break;
-          case DEPRESSED:
-              mBitmapDepressed = temporaryName;
-              mTextureDepressed = TextureHandle(buffer, TextureHandle::BitmapTexture, true);
-              break;
-          case INACTIVE:
-              mBitmapInactive = temporaryName;
-              mTextureInactive = TextureHandle(buffer, TextureHandle::BitmapTexture, true);
-              break;
-       }
-   }
-   else
-   {
-       switch (state)
-       {
-          case NORMAL:
-              mTextureNormal = NULL;
-              break;
-          case HILIGHT:
-              mTextureHilight = NULL;
-              break;
-          case DEPRESSED:
-              mTextureDepressed = NULL;
-              break;
-          case INACTIVE:
-              mTextureInactive = NULL;
-              break;
-       } 
-   }
-
-   setUpdate();
-}
-
-//-------------------------------------
-void GuiBitmapButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
-{
-   ButtonState state = NORMAL;
-
-   if (mActive)
-   {
-      if (mMouseOver)
-          state = HILIGHT;
-
-      if (mDepressed || mStateOn)
-          state = DEPRESSED;
-   }
-   else
-      state = INACTIVE;
-
-   switch (state)
-   {
-      case NORMAL:
-          renderButton(mTextureNormal, offset, updateRect);
-          break;
-      case HILIGHT:
-          renderButton(mTextureHilight ? mTextureHilight : mTextureNormal, offset, updateRect);
-          break;
-      case DEPRESSED:
-          renderButton(mTextureDepressed, offset, updateRect);
-          break;
-      case INACTIVE:
-          renderButton(mTextureInactive ? mTextureInactive : mTextureNormal, offset, updateRect);
-          break;
-   }
-}
-
-//------------------------------------------------------------------------------
-
-void GuiBitmapButtonCtrl::renderButton(TextureHandle &texture, Point2I &offset, const RectI& updateRect)
-{
-   if (texture)
-   {
-      RectI rect(offset, mBounds.extent);
-      dglClearBitmapModulation();
-      dglDrawBitmapStretch(texture, rect);
-      renderChildControls( offset, updateRect);
-   }
-   else
-      Parent::onRender(offset, updateRect);
-}
-
-//------------------------------------------------------------------------------
-IMPLEMENT_CONOBJECT(GuiBitmapButtonTextCtrl);
-
-void GuiBitmapButtonTextCtrl::onRender(Point2I offset, const RectI& updateRect)
-{
-   enum {
-      NORMAL,
-      HILIGHT,
-      DEPRESSED,
-      INACTIVE
-   } state = NORMAL;
-
-   if (mActive)
-   {
-      if (mMouseOver) state = HILIGHT;
-      if (mDepressed || mStateOn) state = DEPRESSED;
-   }
-   else
-      state = INACTIVE;
-
-   TextureHandle texture;
-
-   switch (state)
-   {
-      case NORMAL:
-         texture = mTextureNormal;
-         break;
-      case HILIGHT:
-         texture = mTextureHilight;
-         break;
-      case DEPRESSED:
-         texture = mTextureDepressed;
-         break;
-      case INACTIVE:
-         texture = mTextureInactive;
-         if(!texture)
-            texture = mTextureNormal;
-         break;
-   }
-   if (texture)
-   {
-      RectI rect(offset, mBounds.extent);
-      dglClearBitmapModulation();
-      dglDrawBitmapStretch(texture, rect);
-
-      Point2I textPos = offset;
-      if(mDepressed)
-         textPos += Point2I(1,1);
-
-      // Make sure we take the profile's textOffset into account.
-      textPos += mProfile->mTextOffset;
-
-      dglSetBitmapModulation( mProfile->mFontColor );
-      renderJustifiedText(textPos, mBounds.extent, mButtonText);
-
-      renderChildControls( offset, updateRect);
-   }
-   else
-      Parent::onRender(offset, updateRect);
-}

+ 0 - 86
engine/source/gui/buttons/guiBitmapButtonCtrl.h

@@ -1,86 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#ifndef _GUIBITMAPBUTTON_H_
-#define _GUIBITMAPBUTTON_H_
-
-#ifndef _GUIBUTTONCTRL_H_
-#include "gui/buttons/guiButtonCtrl.h"
-#endif
-#ifndef _TEXTURE_MANAGER_H_
-#include "graphics/TextureManager.h"
-#endif
-
-enum ButtonState
-{
-    NORMAL,
-    HILIGHT,
-    DEPRESSED,
-    INACTIVE
-};
-
-class GuiBitmapButtonCtrl : public GuiButtonCtrl
-{
-private:
-   typedef GuiButtonCtrl Parent;
-
-protected:
-   StringTableEntry mBitmapName;
-   StringTableEntry mBitmapNormal;
-   StringTableEntry mBitmapHilight;
-   StringTableEntry mBitmapDepressed;
-   StringTableEntry mBitmapInactive;
-   bool mIsLegacyVersion;
-
-   TextureHandle mTextureNormal;
-   TextureHandle mTextureHilight;
-   TextureHandle mTextureDepressed;
-   TextureHandle mTextureInactive;
-
-   void renderButton(TextureHandle &texture, Point2I &offset, const RectI& updateRect);
-
-public:
-   DECLARE_CONOBJECT(GuiBitmapButtonCtrl);
-   GuiBitmapButtonCtrl();
-
-   static void initPersistFields();
-
-   //Parent methods
-   bool onWake();
-   void onSleep();
-   void inspectPostApply();
-
-   void setBitmap(const char *name, ButtonState state);
-   void setBitmap(const char *name);
-
-   void onRender(Point2I offset, const RectI &updateRect);
-};
-
-class GuiBitmapButtonTextCtrl : public GuiBitmapButtonCtrl
-{
-   typedef GuiBitmapButtonCtrl Parent;
-public:
-   DECLARE_CONOBJECT(GuiBitmapButtonTextCtrl);
-   void onRender(Point2I offset, const RectI &updateRect);
-};
-
-#endif //_GUI_BITMAP_BUTTON_CTRL_H

+ 0 - 58
engine/source/gui/buttons/guiBorderButton.cc

@@ -1,58 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#include "graphics/dgl.h"
-#include "gui/guiCanvas.h"
-#include "gui/buttons/guiButtonBaseCtrl.h"
-
-
-class GuiBorderButtonCtrl : public GuiButtonBaseCtrl
-{
-   typedef GuiButtonBaseCtrl Parent;
-
-protected:
-public:
-   DECLARE_CONOBJECT(GuiBorderButtonCtrl);
-
-   void onRender(Point2I offset, const RectI &updateRect);
-};
-
-IMPLEMENT_CONOBJECT(GuiBorderButtonCtrl);
-
-void GuiBorderButtonCtrl::onRender(Point2I offset, const RectI &updateRect)
-{
-   RectI bounds(offset, mBounds.extent);
-   if(mActive && mMouseOver)
-   {
-      bounds.inset(2,2);
-      dglDrawRect(bounds, mProfile->mFontColorHL);
-      bounds.inset(-2,-2);
-   }
-   if(mActive && (mStateOn || mDepressed))
-   {
-      dglDrawRect(bounds, mProfile->mFontColorHL);
-      bounds.inset(1,1);
-      dglDrawRect(bounds, mProfile->mFontColorHL);
-   }
-   renderChildControls(offset, updateRect);
-}
-

+ 0 - 383
engine/source/gui/buttons/guiButtonBaseCtrl.cc

@@ -1,383 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#include "console/console.h"
-#include "graphics/dgl.h"
-#include "console/consoleTypes.h"
-#include "platform/platformAudio.h"
-#include "gui/guiCanvas.h"
-#include "gui/buttons/guiButtonBaseCtrl.h"
-#include "gui/language/lang.h"
-
-IMPLEMENT_CONOBJECT(GuiButtonBaseCtrl);
-
-GuiButtonBaseCtrl::GuiButtonBaseCtrl()
-{
-   mDepressed = false;
-   mMouseOver = false;
-   mActive = true;
-   mButtonText = StringTable->insert("Button");
-   mButtonTextID = StringTable->EmptyString;
-   mStateOn = false;
-    mRadioGroup = -1;
-   mButtonType = ButtonTypePush;
-   mUseMouseEvents = false;
-}
-
-bool GuiButtonBaseCtrl::onWake()
-{
-   if(!Parent::onWake())
-      return false;
-
-   // is we have a script variable, make sure we're in sync
-   if ( mConsoleVariable[0] )
-    mStateOn = Con::getBoolVariable( mConsoleVariable );
-   if(mButtonTextID && *mButtonTextID != 0)
-       setTextID(mButtonTextID);
-
-   return true;
-}
-
-ConsoleMethod( GuiButtonBaseCtrl, performClick, void, 2, 2, "() - simulates a button click from script." )
-{
-   object->onAction();
-}
-
-ConsoleMethod( GuiButtonBaseCtrl, setText, void, 3, 3, "(string text) - Sets the text of the button to the string." )
-{
-   object->setText( argv[2] );
-}
-
-ConsoleMethod( GuiButtonBaseCtrl, setTextID, void, 3, 3, "(string id) - Sets the text of the button to the localized string." )
-{
-    object->setTextID(argv[2]);
-}
-ConsoleMethod( GuiButtonBaseCtrl, getText, const char *, 2, 2, "() - returns the text of the button.\n" 
-              "@return The text member of the button as a char string")
-{
-   return object->getText( );
-}
-ConsoleMethod( GuiButtonBaseCtrl, setStateOn, void, 3, 3, "(bool isStateOn) - sets the state on member and updates siblings of the same group." )
-{
-   object->setStateOn(dAtob(argv[2]));
-}
-
-ConsoleMethod(GuiButtonBaseCtrl, getStateOn, bool, 2, 2, "(bool getStateOn) - gets whether the state of the button is currently 'on'" )
-{
-   return object->getStateOn();
-}
-
-
-static EnumTable::Enums buttonTypeEnums[] = 
-{
-   { GuiButtonBaseCtrl::ButtonTypePush, "PushButton" },
-   { GuiButtonBaseCtrl::ButtonTypeCheck, "ToggleButton" },
-   { GuiButtonBaseCtrl::ButtonTypeRadio, "RadioButton" },
-};
-      
-static EnumTable gButtonTypeTable(3, &buttonTypeEnums[0]); 
-      
-      
-
-void GuiButtonBaseCtrl::initPersistFields()
-{
-   Parent::initPersistFields();
-   addGroup("GuiButtonBaseCtrl");		
-   addField("text", TypeCaseString, Offset(mButtonText, GuiButtonBaseCtrl));
-   addField("textID", TypeString, Offset(mButtonTextID, GuiButtonBaseCtrl));
-   addField("groupNum", TypeS32, Offset(mRadioGroup, GuiButtonBaseCtrl));
-   addField("buttonType", TypeEnum, Offset(mButtonType, GuiButtonBaseCtrl), 1, &gButtonTypeTable);
-   addField("useMouseEvents", TypeBool, Offset(mUseMouseEvents, GuiButtonBaseCtrl));
-   endGroup("GuiButtonBaseCtrl");		
-}
-
-void GuiButtonBaseCtrl::setText(const char *text)
-{
-   mButtonText = StringTable->insert(text);
-}
-
-void GuiButtonBaseCtrl::setStateOn( bool bStateOn )
-{
-   if(!mActive)
-      return;
-
-   if(mButtonType == ButtonTypeCheck)
-   {
-      mStateOn = bStateOn;
-   }
-   else if(mButtonType == ButtonTypeRadio)
-   {
-      messageSiblings(mRadioGroup);
-      mStateOn = bStateOn;
-   }		
-   setUpdate();
-}
-
-void GuiButtonBaseCtrl::setTextID(const char *id)
-{
-    S32 n = Con::getIntVariable(id, -1);
-    if(n != -1)
-    {
-        mButtonTextID = StringTable->insert(id);
-        setTextID(n);
-    }
-}
-void GuiButtonBaseCtrl::setTextID(S32 id)
-{
-    const UTF8 *str = getGUIString(id);
-    if(str)
-        setText((const char*)str);
-    //mButtonTextID = id;
-}
-const char *GuiButtonBaseCtrl::getText()
-{
-   return mButtonText;
-}
-
-//---------------------------------------------------------------------------
-void GuiButtonBaseCtrl::acceleratorKeyPress(U32)
-{
-   if (! mActive)
-      return;
-
-   //set the bool
-   mDepressed = true;
-
-   if (mProfile->mTabable)
-      setFirstResponder();
-}
-
-//---------------------------------------------------------------------------
-void GuiButtonBaseCtrl::acceleratorKeyRelease(U32)
-{
-   if (! mActive)
-      return;
-
-   if (mDepressed)
-   {
-      //set the bool
-      mDepressed = false;
-      //perform the action
-      onAction();
-   }
-
-   //update
-   setUpdate();
-}
-
-void GuiButtonBaseCtrl::onMouseDown(const GuiEvent &event)
-{
-   if (! mActive)
-      return;
-
-   if (mProfile->mCanKeyFocus)
-      setFirstResponder();
-
-   if (mProfile->mSoundButtonDown)
-   {
-      AUDIOHANDLE handle = alxCreateSource(mProfile->mSoundButtonDown);
-      alxPlay(handle);
-   }
-
-   //lock the mouse
-   mouseLock();
-   mDepressed = true;
-
-   //update
-   setUpdate();
-}
-
-void GuiButtonBaseCtrl::onMouseEnter(const GuiEvent &event)
-{
-   setUpdate();
-
-   if(mUseMouseEvents)
-      Con::executef( this, 1, "onMouseEnter" );
-
-   if(isMouseLocked())
-   {
-      mDepressed = true;
-      mMouseOver = true;
-   }
-   else
-   {
-      if ( mActive && mProfile->mSoundButtonOver )
-      {
-         AUDIOHANDLE handle = alxCreateSource(mProfile->mSoundButtonOver);
-         alxPlay(handle);
-      }
-      mMouseOver = true;
-   }
-}
-
-//Luma: Some fixes from the forums, Dave Calabrese
-//http://www.garagegames.com/community/forums/viewthread/93467/1#comment-669559
-void GuiButtonBaseCtrl::onMouseLeave(const GuiEvent &)  
-{  
-    if(isMouseLocked())  
-        mDepressed = false;  
-      
-    mouseUnlock();  
-    setUpdate();  
-  
-   if(mUseMouseEvents)  
-      Con::executef( this, 1, "onMouseLeave" );  
-  
-   mMouseOver = false;  
-}  
-
-void GuiButtonBaseCtrl::onMouseUp(const GuiEvent &event)
-{
-   if (! mActive)
-      return;
-
-   mouseUnlock();
-
-   setUpdate();
-
-   //if we released the mouse within this control, perform the action
-   if (mDepressed)
-      onAction();
-
-   // Execute callback
-   if (mUseMouseEvents)
-   {
-       char buf[3][32];
-       dSprintf(buf[0], 32, "%d", event.modifier);
-       dSprintf(buf[1], 32, "%d %d", event.mousePoint.x, event.mousePoint.y);
-       dSprintf(buf[2], 32, "%d", event.mouseClickCount);
-       Con::executef(this, 4, "onMouseUp", buf[0], buf[1], buf[2]);
-   }
-
-   mDepressed = false;
-}
-
-void GuiButtonBaseCtrl::onRightMouseUp(const GuiEvent &event)
-{
-   Con::executef( this, 2, "onRightClick" );
-
-   Parent::onRightMouseUp( event );
-}
-
-//--------------------------------------------------------------------------
-bool GuiButtonBaseCtrl::onKeyDown(const GuiEvent &event)
-{
-   //if the control is a dead end, kill the event
-   if (!mActive)
-      return true;
-
-   //see if the key down is a return or space or not
-   if ((event.keyCode == KEY_RETURN || event.keyCode == KEY_SPACE)
-       && event.modifier == 0)
-   {
-       if ( mProfile->mSoundButtonDown )
-       {
-          AUDIOHANDLE handle = alxCreateSource( mProfile->mSoundButtonDown );
-          alxPlay( handle );
-       }
-      return true;
-   }
-   //otherwise, pass the event to it's parent
-   return Parent::onKeyDown(event);
-}
-
-//--------------------------------------------------------------------------
-bool GuiButtonBaseCtrl::onKeyUp(const GuiEvent &event)
-{
-   //if the control is a dead end, kill the event
-   if (!mActive)
-      return true;
-
-   //see if the key down is a return or space or not
-   if (mDepressed &&
-      (event.keyCode == KEY_RETURN || event.keyCode == KEY_SPACE) &&
-      event.modifier == 0)
-   {
-      onAction();
-      return true;
-   }
-
-   //otherwise, pass the event to it's parent
-   return Parent::onKeyUp(event);
-}
-
-//---------------------------------------------------------------------------
-void GuiButtonBaseCtrl::setScriptValue(const char *value)
-{
-    mStateOn = dAtob(value);
-
-    // Update the console variable:
-    if ( mConsoleVariable[0] )
-        Con::setBoolVariable( mConsoleVariable, mStateOn );
-
-   setUpdate();
-}
-
-//---------------------------------------------------------------------------
-const char *GuiButtonBaseCtrl::getScriptValue()
-{
-    return mStateOn ? "1" : "0";
-}
-
-//---------------------------------------------------------------------------
-void GuiButtonBaseCtrl::onAction()
-{
-    if(!mActive)
-        return;
-
-    if(mButtonType == ButtonTypeCheck)
-    {
-        mStateOn = mStateOn ? false : true;
-
-        // Update the console variable:
-        if ( mConsoleVariable[0] )
-            Con::setBoolVariable( mConsoleVariable, mStateOn );
-        // Execute the console command (if any). Unnecessary. Parent does this already.
-        //if( mConsoleCommand[0] )
-        //   Con::evaluate( mConsoleCommand, false );
-
-    }
-    else if(mButtonType == ButtonTypeRadio)
-    {
-        mStateOn = true;
-        messageSiblings(mRadioGroup);
-    }		
-    setUpdate();
-
-
-    // Provide and onClick script callback.
-    if( isMethod("onClick") )
-       Con::executef( this, 2, "onClick" );
-
-    Parent::onAction();
-}
-
-//---------------------------------------------------------------------------
-void GuiButtonBaseCtrl::onMessage( GuiControl *sender, S32 msg )
-{
-    Parent::onMessage(sender, msg);
-    if( mRadioGroup == msg && mButtonType == ButtonTypeRadio )
-    {
-        setUpdate();
-        mStateOn = ( sender == this );
-    }
-}

+ 0 - 89
engine/source/gui/buttons/guiButtonBaseCtrl.h

@@ -1,89 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#ifndef _GUIBUTTONBASECTRL_H_
-#define _GUIBUTTONBASECTRL_H_
-
-#ifndef _GUICONTROL_H_
-#include "gui/guiControl.h"
-#endif
-
-// all the button functionality is moving into buttonBase
-// thus, all subclasses will just be rendering classes,
-// and radios and check boxes can be done using pushbuttons
-// or bitmap buttons.
-
-class GuiButtonBaseCtrl : public GuiControl
-{
-   typedef GuiControl Parent;
-
-protected:
-   StringTableEntry mButtonText;
-   StringTableEntry mButtonTextID;
-   bool mDepressed;
-   bool mMouseOver;
-   bool mStateOn;
-   S32 mButtonType;
-   S32 mRadioGroup;
-   bool mUseMouseEvents;
-public:
-   enum {
-      ButtonTypePush,
-      ButtonTypeCheck,
-      ButtonTypeRadio,
-   };
-
-   GuiButtonBaseCtrl();
-   bool onWake();
-
-   DECLARE_CONOBJECT(GuiButtonBaseCtrl);
-   static void initPersistFields();
-
-   void setText(const char *text);
-   void setTextID(S32 id);
-   void setTextID(const char *id);
-   const char *getText();
-   bool getStateOn(void)	{ return mStateOn; }
-   void setStateOn( bool bStateOn );
-
-   void acceleratorKeyPress(U32 index);
-   void acceleratorKeyRelease(U32 index);
-
-   void onMouseDown(const GuiEvent &);
-   void onMouseUp(const GuiEvent &);
-   void onRightMouseUp(const GuiEvent &);
-
-   void onMouseEnter(const GuiEvent &);
-   void onMouseLeave(const GuiEvent &);
-
-   bool onKeyDown(const GuiEvent &event);
-   bool onKeyUp(const GuiEvent &event);
-
-   void setScriptValue(const char *value);
-   const char *getScriptValue();
-
-   void onMessage(GuiControl *,S32 msg);
-   void onAction();
-
-};
-
-#endif

+ 226 - 24
engine/source/gui/buttons/guiButtonCtrl.cc

@@ -32,8 +32,12 @@ IMPLEMENT_CONOBJECT(GuiButtonCtrl);
 
 GuiButtonCtrl::GuiButtonCtrl()
 {
-   mBounds.extent.set(140, 30);
-   mButtonText = StringTable->EmptyString;
+	mDepressed = false;
+	mMouseOver = false;
+	mActive = true;
+	mBounds.extent.set(140, 30);
+	mText = StringTable->insert("Button");
+	mTextID = StringTable->EmptyString;
 }
 
 bool GuiButtonCtrl::onWake()
@@ -41,51 +45,231 @@ bool GuiButtonCtrl::onWake()
    if( !Parent::onWake() )
       return false;
 
-   // Button Theme?
-   if( mProfile->constructBitmapArray() >= 36 )
-      mHasTheme = true;
-   else
-      mHasTheme = false;
-
    return true;
 
 }
-//--------------------------------------------------------------------------
+
+void GuiButtonCtrl::acceleratorKeyPress(U32)
+{
+	if (!mActive)
+		return;
+
+	//set the bool
+	mDepressed = true;
+
+	if (mProfile->mTabable)
+		setFirstResponder();
+
+	//update
+	setUpdate();
+}
+
+void GuiButtonCtrl::acceleratorKeyRelease(U32)
+{
+	if (!mActive)
+		return;
+
+	if (mDepressed)
+	{
+		//set the bool
+		mDepressed = false;
+		//perform the action
+		onAction();
+	}
+
+	//update
+	setUpdate();
+}
+
+void GuiButtonCtrl::onTouchEnter(const GuiEvent &event)
+{
+	if (!mActive)
+		return;
+
+	mMouseOver = true;
+
+	if (isMouseLocked())
+	{
+		mDepressed = true;
+	}
+	else if (mActive && mProfile->mSoundButtonOver)
+	{
+		AUDIOHANDLE handle = alxCreateSource(mProfile->mSoundButtonOver);
+		alxPlay(handle);
+	}
+
+	Con::executef(this, 1, "onTouchEnter");
+
+	//update
+	setUpdate();
+}
+
+void GuiButtonCtrl::onTouchLeave(const GuiEvent &)
+{
+	if (!mActive)
+		return;
+
+	if (isMouseLocked())
+		mDepressed = false;
+
+	mouseUnlock();
+	mMouseOver = false;
+
+	Con::executef(this, 1, "onTouchLeave");
+
+	//update
+	setUpdate();
+}
+
+void GuiButtonCtrl::onTouchDown(const GuiEvent &event)
+{
+	if (!mActive)
+		return;
+
+	mDepressed = true;
+
+	if (mProfile->mCanKeyFocus)
+		setFirstResponder();
+
+	if (mProfile->mSoundButtonDown)
+	{
+		AUDIOHANDLE handle = alxCreateSource(mProfile->mSoundButtonDown);
+		alxPlay(handle);
+	}
+
+	//lock the mouse
+	mouseLock();
+
+	// Execute callback
+	char buf[3][32];
+	dSprintf(buf[0], 32, "%d", event.modifier);
+	dSprintf(buf[1], 32, "%d %d", event.mousePoint.x, event.mousePoint.y);
+	dSprintf(buf[2], 32, "%d", event.mouseClickCount);
+	Con::executef(this, 4, "onTouchDown", buf[0], buf[1], buf[2]);
+
+	//update
+	setUpdate();
+}
+
+void GuiButtonCtrl::onTouchUp(const GuiEvent &event)
+{
+	if (!mActive)
+		return;
+
+	mouseUnlock();
+
+	//if we released the mouse within this control, perform the action
+	if (mDepressed)
+		onAction();
+
+	// Execute callback
+	char buf[3][32];
+	dSprintf(buf[0], 32, "%d", event.modifier);
+	dSprintf(buf[1], 32, "%d %d", event.mousePoint.x, event.mousePoint.y);
+	dSprintf(buf[2], 32, "%d", event.mouseClickCount);
+	Con::executef(this, 4, "onTouchUp", buf[0], buf[1], buf[2]);
+
+	mDepressed = false;
+
+	//update
+	setUpdate();
+}
+
+void GuiButtonCtrl::onRightMouseUp(const GuiEvent &event)
+{
+	if (!mActive)
+		return;
+
+	Con::executef(this, 1, "onRightClick");
+
+	Parent::onRightMouseUp(event);
+}
+
+bool GuiButtonCtrl::onKeyDown(const GuiEvent &event)
+{
+	if (!mActive)
+		return true;
+
+	//see if the key down is a return or space or not
+	if ((event.keyCode == KEY_RETURN || event.keyCode == KEY_SPACE)
+		&& event.modifier == 0)
+	{
+		if (mProfile->mSoundButtonDown)
+		{
+			AUDIOHANDLE handle = alxCreateSource(mProfile->mSoundButtonDown);
+			alxPlay(handle);
+		}
+		return true;
+	}
+	//otherwise, pass the event to it's parent
+	return Parent::onKeyDown(event);
+}
+
+bool GuiButtonCtrl::onKeyUp(const GuiEvent &event)
+{
+	if (!mActive)
+		return true;
+
+	//see if the key down is a return or space or not
+	if (mDepressed &&
+		(event.keyCode == KEY_RETURN || event.keyCode == KEY_SPACE) &&
+		event.modifier == 0)
+	{
+		onAction();
+		return true;
+	}
+
+	//otherwise, pass the event to it's parent
+	return Parent::onKeyUp(event);
+}
+
+void GuiButtonCtrl::onAction()
+{
+	if (!mActive)
+		return;
+
+	setUpdate();
+
+	if (isMethod("onClick"))
+		Con::executef(this, 2, "onClick");
+
+	Parent::onAction();
+}
 
 void GuiButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
 {
-	GuiControlState currentState = GuiControlState::normal;
+	GuiControlState currentState = GuiControlState::NormalState;
 	if (!mActive)
 	{
-		currentState = GuiControlState::disabled;
+		currentState = GuiControlState::DisabledState;
 	}
-	else if (mDepressed || mStateOn)
+	else if (mDepressed)
 	{
-		currentState = GuiControlState::selected;
+		currentState = GuiControlState::SelectedState;
 	}
 	else if(mMouseOver)
 	{
-		currentState = GuiControlState::highlight;
+		currentState = GuiControlState::HighlightState;
 	}
 
 	RectI boundsRect(offset, mBounds.extent);
 
-	if( !mHasTheme )
-	{
-		renderBorderedRect(boundsRect, mProfile, currentState);
-	}
-   else if( mHasTheme )
+   if(mProfile->mBitmapName != NULL && mProfile->constructBitmapArray() >= 36)
    {
       S32 indexMultiplier = 1;
-      if ( currentState == selected) 
-         indexMultiplier = 3;
-      else if ( currentState == highlight )
+      if ( currentState == HighlightState)
          indexMultiplier = 2;
-      else if ( currentState == disabled )
+      else if ( currentState == SelectedState )
+         indexMultiplier = 3;
+      else if ( currentState == DisabledState )
          indexMultiplier = 4;
 
       renderSizableBitmapBordersFilled( boundsRect, indexMultiplier, mProfile );
    }
+	else
+   {
+	   renderBorderedRect(boundsRect, mProfile, currentState);
+   }
 
 	//Get the border profiles
 	GuiBorderProfile *leftProfile = (mProfile->mBorderLeft) ? mProfile->mBorderLeft : mProfile->mBorderDefault;
@@ -104,9 +288,27 @@ void GuiButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
 	ColorI fontColor = mProfile->getFontColor(currentState);
 
    dglSetBitmapModulation( fontColor );
-   renderJustifiedText(innerRect.point, innerRect.extent, mButtonText);
+   renderJustifiedText(innerRect.point, innerRect.extent, mText);
 
    //render the children
    renderChildControls( offset, updateRect);
 }
 
+void GuiButtonCtrl::setScriptValue(const char *value)
+{
+	// Update the console variable:
+	if (mConsoleVariable[0])
+		Con::setVariable(mConsoleVariable, value);
+
+	setUpdate();
+}
+
+const char *GuiButtonCtrl::getScriptValue()
+{
+	return StringTable->EmptyString;
+}
+
+void GuiButtonCtrl::onMessage(GuiControl *sender, S32 msg)
+{
+	Parent::onMessage(sender, msg);
+}

+ 32 - 9
engine/source/gui/buttons/guiButtonCtrl.h

@@ -23,20 +23,43 @@
 #ifndef _GUIBUTTONCTRL_H_
 #define _GUIBUTTONCTRL_H_
 
-#ifndef _GUIBUTTONBASECTRL_H_
-#include "gui/buttons/guiButtonBaseCtrl.h"
+#ifndef _GUICONTROL_H_
+#include "gui/guiControl.h"
 #endif
 
-class GuiButtonCtrl : public GuiButtonBaseCtrl
+class GuiButtonCtrl : public GuiControl
 {
-   typedef GuiButtonBaseCtrl Parent;
+   typedef GuiControl Parent;
 protected:
-   bool mHasTheme;
+	bool mDepressed;
+	bool mMouseOver;
+	bool mHasTheme;
 public:
-   DECLARE_CONOBJECT(GuiButtonCtrl);
-   GuiButtonCtrl();
-   bool onWake();
-   void onRender(Point2I offset, const RectI &updateRect);
+	GuiButtonCtrl();
+	bool onWake();
+
+	DECLARE_CONOBJECT(GuiButtonCtrl);
+
+	void acceleratorKeyPress(U32 index);
+	void acceleratorKeyRelease(U32 index);
+
+	void onTouchDown(const GuiEvent &);
+	void onTouchUp(const GuiEvent &);
+	void onRightMouseUp(const GuiEvent &);
+
+	void onTouchEnter(const GuiEvent &);
+	void onTouchLeave(const GuiEvent &);
+
+	bool onKeyDown(const GuiEvent &event);
+	bool onKeyUp(const GuiEvent &event);
+
+	virtual void setScriptValue(const char *value);
+	virtual const char *getScriptValue();
+
+	virtual void onMessage(GuiControl *, S32 msg);
+	virtual void onAction();
+   
+	virtual void onRender(Point2I offset, const RectI &updateRect);
 };
 
 #endif //_GUI_BUTTON_CTRL_H

+ 96 - 150
engine/source/gui/buttons/guiCheckBoxCtrl.cc

@@ -25,6 +25,9 @@
 #include "gui/guiCanvas.h"
 #include "gui/buttons/guiCheckBoxCtrl.h"
 #include "console/consoleTypes.h"
+#include "gui/guiDefaultControlRender.h"
+
+#include "guiCheckBoxCtrl_ScriptBinding.h"
 
 IMPLEMENT_CONOBJECT(GuiCheckBoxCtrl);
 
@@ -32,10 +35,11 @@ IMPLEMENT_CONOBJECT(GuiCheckBoxCtrl);
 GuiCheckBoxCtrl::GuiCheckBoxCtrl()
 {
    mBounds.extent.set(140, 30);
-    mStateOn = false;
-   mIndent = 0;
-   mButtonType = ButtonTypeCheck;
-   mUseInactiveState = false;
+   mStateOn = false;
+   mBoxOffset.set(0,7);
+   mBoxExtent.set(16, 16);
+   mTextOffset.set(22, 7);
+   mTextExtent.set(mBounds.extent.x - mTextOffset.x, mBounds.extent.y - mTextOffset.y);
 }
 
 //---------------------------------------------------------------------------
@@ -43,8 +47,11 @@ GuiCheckBoxCtrl::GuiCheckBoxCtrl()
 void GuiCheckBoxCtrl::initPersistFields()
 {
    Parent::initPersistFields();
-
-   addField("useInactiveState", TypeBool, Offset(mUseInactiveState, GuiCheckBoxCtrl));
+   addField("stateOn", TypeBool, Offset(mStateOn, GuiCheckBoxCtrl));
+   addField("boxOffset", TypePoint2I, Offset(mBoxOffset, GuiCheckBoxCtrl));
+   addField("boxExtent", TypePoint2I, Offset(mBoxExtent, GuiCheckBoxCtrl));
+   addField("textOffset", TypePoint2I, Offset(mTextOffset, GuiCheckBoxCtrl));
+   addField("textExtent", TypePoint2I, Offset(mTextExtent, GuiCheckBoxCtrl));
 }
 
 bool GuiCheckBoxCtrl::onWake()
@@ -52,171 +59,110 @@ bool GuiCheckBoxCtrl::onWake()
    if(!Parent::onWake())
       return false;
 
-   // make sure there is a bitmap array for this control type
-   // if it is declared as such in the control
-   mProfile->constructBitmapArray();
-
    return true;
 }
 
-void GuiCheckBoxCtrl::onMouseDown(const GuiEvent& event)
+void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
 {
-   if (!mUseInactiveState)
-      return Parent::onMouseDown(event);
-
-   if (mProfile->mCanKeyFocus)
-      setFirstResponder();
-
-   if (mProfile->mSoundButtonDown)
-   {
-      AUDIOHANDLE handle = alxCreateSource(mProfile->mSoundButtonDown);
-      alxPlay(handle);
-   }
-
-   //lock the mouse
-   mouseLock();
-   mDepressed = true;
+	GuiControlState currentState = GuiControlState::NormalState;
+	if (!mActive)
+	{
+		currentState = GuiControlState::DisabledState;
+	}
+	else if (mDepressed || mStateOn)
+	{
+		currentState = GuiControlState::SelectedState;
+	}
+	else if (mMouseOver)
+	{
+		currentState = GuiControlState::HighlightState;
+	}
+
+	RectI boundsRect(offset, mBounds.extent);
+	RectI boxRect(offset + mBoxOffset, mBoxExtent);
+
+	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
+		renderBorderedRect(boxRect, mProfile, currentState);
+	}
+   
+    if(mText[0] != '\0')
+    {
+		ColorI fontColor = mProfile->getFontColor(currentState);
+		dglSetBitmapModulation( fontColor );
+
+		Point2I textArea = mTextExtent;
+		if ((textArea.x + mTextOffset.x) > mBounds.extent.x)
+		{
+			textArea.x = mBounds.extent.x;
+		}
+		if ((textArea.y + mTextOffset.y) > mBounds.extent.y)
+		{
+			textArea.y = mBounds.extent.y;
+		}
+
+		renderJustifiedText(Point2I(offset.x + mTextOffset.x, offset.y + mTextOffset.y), textArea, mText);
+    }
 
-   //update
-   setUpdate();
+   //render the children
+   renderChildControls(offset, updateRect);
 }
 
-void GuiCheckBoxCtrl::onMouseUp(const GuiEvent& event)
+void GuiCheckBoxCtrl::onAction()
 {
-   if (!mUseInactiveState)
-      return Parent::onMouseUp(event);
-
-   mouseUnlock();
+	if (!mActive)
+		return;
 
-   setUpdate();
+	mStateOn = !mStateOn;
 
-   //if we released the mouse within this control, perform the action
-   if (mDepressed)
-      onAction();
-
-   mDepressed = false;
+	Parent::onAction();
 }
 
-void GuiCheckBoxCtrl::onAction()
+void GuiCheckBoxCtrl::setStateOn(bool bStateOn)
 {
-   if (!mUseInactiveState)
-      return Parent::onAction();
-
-   if(mButtonType == ButtonTypeCheck)
-   {
-      if (!mActive)
-      {
-         mActive = true;
-         mStateOn = true;
-      }
-      else if (mStateOn)
-         mStateOn = false;
-      else if (!mStateOn)
-         mActive = false;
-
-      // Update the console variable:
-      if ( mConsoleVariable[0] )
-         Con::setBoolVariable( mConsoleVariable, mStateOn );
-      // Execute the console command (if any)
-      if( mConsoleCommand[0] )
-         Con::evaluate( mConsoleCommand, false );
-    }
-   setUpdate();
+	if (!mActive)
+		return;
 
-   // Provide and onClick script callback.
-   if( isMethod("onClick") )
-      Con::executef( this, 2, "onClick" );
+	mStateOn = bStateOn;
+	
+	setUpdate();
 }
 
-//---------------------------------------------------------------------------
-void GuiCheckBoxCtrl::onRender(Point2I offset, const RectI &updateRect)
+void GuiCheckBoxCtrl::setScriptValue(const char *value)
 {
-   ColorI backColor = mActive ? mProfile->mFillColor : mProfile->mFillColorNA;
-   ColorI fontColor = mMouseOver ? mProfile->mFontColorHL : mProfile->mFontColor;
-    ColorI insideBorderColor = mProfile->mFillColor;//isFirstResponder() ? mProfile->mBorderColorHL : mProfile->mBorderColor;
-
-   // just draw the check box and the text:
-   S32 xOffset = 0;
-    dglClearBitmapModulation();
-   if(mProfile->mBitmapArrayRects.size() >= 4)
-   {
-       // if size >= 4 then the inactive state images should be present
-      S32 index = mStateOn;
-      if(!mActive)
-         index = 4; // inactive state images are indexes 4 and 5.
-      else if(mDepressed)
-         index += 2;
-      xOffset = mProfile->mBitmapArrayRects[0].extent.x + 2 + mIndent;
-      S32 y = (mBounds.extent.y - mProfile->mBitmapArrayRects[0].extent.y) / 2;
-      dglDrawBitmapSR(mProfile->mTextureHandle, offset + Point2I(mIndent, y), mProfile->mBitmapArrayRects[index]);
-   }
-   
-    if(mButtonText[0] != '\0')
-    {
-       dglSetBitmapModulation( fontColor );
-      renderJustifiedText(Point2I(offset.x + xOffset, offset.y),
-                          Point2I(mBounds.extent.x - mBounds.extent.y, mBounds.extent.y),
-                          mButtonText);
-    }
-   //render the children
-   renderChildControls(offset, updateRect);
-}
+	mStateOn = dAtob(value);
 
-ConsoleMethod(GuiCheckBoxCtrl, setStateOn, void, 3, 3, "(state) Sets the control as active and updates siblings of the same group."
-              "@param state This argument may be a boolean value or an integer."
-              "state < 0: Parent::setStateOn(false), obj::setActive(false)\n"
-              "state == 0 (or false): Parent::setStateOn(false), obj::setActive(true)\n"
-              "state > 0 (or true): Parent::setStateOn(true), obj::setActive(true)")
-{
-   if (dStricmp(argv[2], "true") == 0)
-      object->setStateOn(1);
-   else if (dStricmp(argv[2], "false") == 0)
-      object->setStateOn(0);
-   else
-      object->setStateOn(dAtoi(argv[2]));
+	setUpdate();
 }
 
-void GuiCheckBoxCtrl::setStateOn(S32 state)
+const char *GuiCheckBoxCtrl::getScriptValue()
 {
-   if (mUseInactiveState)
-   {
-      if (state < 0)
-      {
-         setActive(false);
-         Parent::setStateOn(false);
-      }
-      else if (state == 0)
-      {
-         setActive(true);
-         Parent::setStateOn(false);
-      }
-      else if (state > 0)
-      {
-         setActive(true);
-         Parent::setStateOn(true);
-      }
-   }
-   else
-      Parent::setStateOn((bool)state);
+	return mStateOn ? "1" : "0";
 }
 
-const char* GuiCheckBoxCtrl::getScriptValue()
+void GuiCheckBoxCtrl::onMessage(GuiControl *sender, S32 msg)
 {
-   if (mUseInactiveState)
-   {
-      if (isActive())
-         if (mStateOn)
-            return "1";
-         else
-            return "0";
-      else
-         return "-1";
-   }
-   else
-      return Parent::getScriptValue();
-}
-
-//---------------------------------------------------------------------------
-// EOF //
-
-
+	Parent::onMessage(sender, msg);
+}

+ 31 - 14
engine/source/gui/buttons/guiCheckBoxCtrl.h

@@ -23,32 +23,49 @@
 #ifndef _GUICHECKBOXCTRL_H_
 #define _GUICHECKBOXCTRL_H_
 
-#ifndef _GUIBUTTONBASECTRL_H_
-#include "gui/buttons/guiButtonBaseCtrl.h"
+#ifndef _GUIBUTTONCTRL_H_
+#include "gui/buttons/guiButtonCtrl.h"
 #endif
 
-class GuiCheckBoxCtrl : public GuiButtonBaseCtrl
+class GuiCheckBoxCtrl : public GuiButtonCtrl
 {
-   typedef GuiButtonBaseCtrl Parent;
-
-   bool mUseInactiveState;
+   typedef GuiButtonCtrl Parent;
 
 protected:
+	bool mStateOn;
+	Point2I mBoxOffset;
+	Point2I mBoxExtent;
+	Point2I mTextOffset;
+	Point2I mTextExtent;
+	
 public:
-   S32 mIndent;
    DECLARE_CONOBJECT(GuiCheckBoxCtrl);
    GuiCheckBoxCtrl();
 
-   void setStateOn(S32 state);
-   virtual const char* getScriptValue();
+   bool onWake();
+   static void initPersistFields();
+
+   bool getStateOn(void) { return mStateOn; }
+   void setStateOn(bool bStateOn);
+
+   const Point2I&   getBoxOffset() { return mBoxOffset; } 
+   const Point2I&   getBoxExtent() { return mBoxExtent; }
+
+   void setBoxOffset(const Point2I &newOffset) { mBoxOffset = newOffset; }
+   void setBoxExtent(const Point2I &newExtent) { mBoxExtent = newExtent; }
+
+   const Point2I&   getTextOffset() { return mTextOffset; }
+   const Point2I&   getTextExtent() { return mTextExtent; }
+
+   void setTextOffset(const Point2I &newOffset) { mTextOffset = newOffset; }
+   void setTextExtent(const Point2I &newExtent) { mTextExtent = newExtent; }
 
-   virtual void onMouseDown(const GuiEvent& event);
-   virtual void onMouseUp(const GuiEvent& event);
-   virtual void onAction();
    void onRender(Point2I offset, const RectI &updateRect);
-   bool onWake();
+   void setScriptValue(const char *value);
+   const char *getScriptValue();
 
-   static void initPersistFields();
+   void onMessage(GuiControl *, S32 msg);
+   void onAction();
 };
 
 #endif //_GUI_CHECKBOX_CTRL_H

+ 119 - 0
engine/source/gui/buttons/guiCheckBoxCtrl_ScriptBinding.h

@@ -0,0 +1,119 @@
+//-----------------------------------------------------------------------------
+// Copyright (c) 2013 GarageGames, LLC
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to
+// deal in the Software without restriction, including without limitation the
+// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+// sell copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
+// IN THE SOFTWARE.
+//-----------------------------------------------------------------------------
+
+ConsoleMethodGroupBeginWithDocs(GuiCheckBoxCtrl, GuiControl)
+
+/*! Sets the state to on if true or off if false.
+	@param isStateOn True if the control is on, false if off.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, setStateOn, ConsoleVoid, 3, 3, (isStateOn))
+{
+	object->setStateOn(dAtob(argv[2]));
+}
+
+/*! Gets the current state of the control.
+	@return Returns true if on and false if off.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, getStateOn, ConsoleBool, 2, 2, ())
+{
+	return object->getStateOn();
+}
+
+/*! Sets the amount the button is offset from the top left corner of the control.
+	@param offset The amount to offset the button.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, setBoxOffset, ConsoleVoid, 3, 3, (offset))
+{
+	Point2I kPoint(dAtoi(argv[2]), dAtoi(argv[3]));
+	object->setBoxOffset(kPoint);
+}
+
+/*! Sets the size of the button within the control proper.
+	@param extent The size to render the button.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, setBoxExtent, ConsoleVoid, 3, 3, (extent))
+{
+	Point2I kPoint(dAtoi(argv[2]), dAtoi(argv[3]));
+	object->setBoxExtent(kPoint);
+}
+
+/*! Sets the amount the text is offset from the top left corner of the control.
+	@param offset The amount to offset the text.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, setTextOffset, ConsoleVoid, 3, 3, (offset))
+{
+	Point2I kPoint(dAtoi(argv[2]), dAtoi(argv[3]));
+	object->setTextOffset(kPoint);
+}
+
+/*! Sets the size of the area the text will be rendered in within the control proper.
+	@param extent The area available to render the text in.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, setTextExtent, ConsoleVoid, 3, 3, (extent))
+{
+	Point2I kPoint(dAtoi(argv[2]), dAtoi(argv[3]));
+	object->setTextExtent(kPoint);
+}
+
+/*! Get the offset that the button will be rendered from the top left corner of the control.
+	@return The offset as a string with space-separated integers.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, getBoxOffset, ConsoleString, 2, 2, (...))
+{
+	char *retBuffer = Con::getReturnBuffer(64);
+	const Point2I &ext = object->getBoxOffset();
+	dSprintf(retBuffer, 64, "%d %d", ext.x, ext.y);
+	return retBuffer;
+}
+
+/*! Get the area that the button will be rendered to within the control.
+	@return The width and height of the button as a string with space-separated integers.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, getBoxExtent, ConsoleString, 2, 2, (...))
+{
+	char *retBuffer = Con::getReturnBuffer(64);
+	const Point2I &ext = object->getBoxExtent();
+	dSprintf(retBuffer, 64, "%d %d", ext.x, ext.y);
+	return retBuffer;
+}
+
+/*! Get the offset that the text area will be from the top left corner of the control.
+	@return The offset of the text area as a string with space-separated integers.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, getTextOffset, ConsoleString, 2, 2, (...))
+{
+	char *retBuffer = Con::getReturnBuffer(64);
+	const Point2I &ext = object->getTextOffset();
+	dSprintf(retBuffer, 64, "%d %d", ext.x, ext.y);
+	return retBuffer;
+}
+
+/*! Get the area that the text will be rendered to within the control.
+	@return The width and height of the text area as a string with space-separated integers.
+*/
+ConsoleMethodWithDocs(GuiCheckBoxCtrl, getTextExtent, ConsoleString, 2, 2, (...))
+{
+	char *retBuffer = Con::getReturnBuffer(64);
+	const Point2I &ext = object->getTextExtent();
+	dSprintf(retBuffer, 64, "%d %d", ext.x, ext.y);
+	return retBuffer;
+}

+ 0 - 351
engine/source/gui/buttons/guiIconButtonCtrl.cc

@@ -1,351 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-
-//-------------------------------------
-//
-// Icon Button Control
-// Draws the bitmap within a special button control.  Only a single bitmap is used and the
-// button will be drawn in a highlighted mode when the mouse hovers over it or when it
-// has been clicked.
-//
-// Use mTextLocation to choose where within the button the text will be drawn, if at all.
-// Use mTextMargin to set the text away from the button sides or from the bitmap.
-// Use mButtonMargin to set everything away from the button sides.
-// Use mErrorBitmapName to set the name of a bitmap to draw if the main bitmap cannot be found.
-// Use mFitBitmapToButton to force the bitmap to fill the entire button extent.  Usually used
-// with no button text defined.
-//
-// if the extent is set to (0,0) in the gui editor and appy hit, this control will
-// set it's extent to be exactly the size of the normal bitmap (if present)
-//
-
-
-#include "console/console.h"
-#include "graphics/dgl.h"
-#include "console/consoleTypes.h"
-#include "platform/platformAudio.h"
-#include "gui/guiCanvas.h"
-#include "gui/guiDefaultControlRender.h"
-#include "gui/buttons/guiIconButtonCtrl.h"
-
-static ColorI colorWhite(255,255,255);
-static ColorI colorBlack(0,0,0);
-
-IMPLEMENT_CONOBJECT(GuiIconButtonCtrl);
-
-//-------------------------------------
-GuiIconButtonCtrl::GuiIconButtonCtrl()
-{
-   mBitmapName = StringTable->EmptyString;
-   mTextLocation = TextLocLeft;
-   mIconLocation = IconLocLeft;
-   mTextMargin = 4;
-   mButtonMargin.set(4,4);
-
-   mFitBitmapToButton = false;
-
-   mErrorBitmapName = StringTable->EmptyString;
-   mErrorTextureHandle = NULL;
-
-   mBounds.extent.set(140, 30);
-}
-
-static EnumTable::Enums textLocEnums[] = 
-{
-   { GuiIconButtonCtrl::TextLocNone, "None" },
-   { GuiIconButtonCtrl::TextLocBottom, "Bottom" },
-   { GuiIconButtonCtrl::TextLocRight, "Right" },
-   { GuiIconButtonCtrl::TextLocTop, "Top" },
-   { GuiIconButtonCtrl::TextLocLeft, "Left" },
-   { GuiIconButtonCtrl::TextLocCenter, "Center" },
-};
-
-static EnumTable gTextLocTable(6, &textLocEnums[0]); 
-
-
-static EnumTable::Enums iconLocEnums[] = 
-{
-   { GuiIconButtonCtrl::IconLocLeft, "Left" },
-   { GuiIconButtonCtrl::IconLocRight, "Right" },
-   { GuiIconButtonCtrl::IconLocNone, "None" },
-};
-static EnumTable gIconLocTable(3, &iconLocEnums[0]); 
-
-
-//-------------------------------------
-void GuiIconButtonCtrl::initPersistFields()
-{
-   Parent::initPersistFields();
-   addField("buttonMargin", TypePoint2I,    Offset(mButtonMargin, GuiIconButtonCtrl));
-   addField("iconBitmap", TypeFilename,   Offset(mBitmapName, GuiIconButtonCtrl));
-   addField("iconLocation", TypeEnum, Offset(mIconLocation, GuiIconButtonCtrl), 1, &gIconLocTable);
-   addField("sizeIconToButton", TypeBool,   Offset(mFitBitmapToButton, GuiIconButtonCtrl));
-   addField("textLocation", TypeEnum, Offset(mTextLocation, GuiIconButtonCtrl), 1, &gTextLocTable);
-   addField("textMargin", TypeS32,    Offset(mTextMargin, GuiIconButtonCtrl));   
-
-}
-
-
-//-------------------------------------
-bool GuiIconButtonCtrl::onWake()
-{
-   if (! Parent::onWake())
-      return false;
-   setActive(true);
-
-   setBitmap(mBitmapName);
-
-   if( mProfile )
-      mProfile->constructBitmapArray();
-
-   return true;
-}
-
-
-//-------------------------------------
-void GuiIconButtonCtrl::onSleep()
-{
-   mTextureNormal = NULL;
-   Parent::onSleep();
-}
-
-
-//-------------------------------------
-
-ConsoleMethod( GuiIconButtonCtrl, setBitmap, void, 3, 3, "(filepath name) Loads bitmap from file\n"
-              "@param name The path of the desired bitmap file\n"
-              "@return No Return Value.")
-{
-   char* argBuffer = Con::getArgBuffer( 512 );
-   Platform::makeFullPathName( argv[2], argBuffer, 512 );
-   object->setBitmap( argBuffer );
-}
-
-//-------------------------------------
-void GuiIconButtonCtrl::inspectPostApply()
-{
-   // if the extent is set to (0,0) in the gui editor and appy hit, this control will
-   // set it's extent to be exactly the size of the normal bitmap (if present)
-   Parent::inspectPostApply();
-
-   if ((mBounds.extent.x == 0) && (mBounds.extent.y == 0) && mTextureNormal)
-   {
-      TextureObject *texture = (TextureObject *) mTextureNormal;
-      mBounds.extent.x = texture->getBitmapWidth() + 4;
-      mBounds.extent.y = texture->getBitmapHeight() + 4;
-   }
-}
-
-
-//-------------------------------------
-void GuiIconButtonCtrl::setBitmap(const char *name)
-{
-   mBitmapName = StringTable->insert(name);
-   if(!isAwake())
-      return;
-
-   if (*mBitmapName)
-   {
-      mTextureNormal = TextureHandle(name, TextureHandle::BitmapTexture, true);
-   }
-   else
-   {
-      mTextureNormal = NULL;
-   }
-   setUpdate();
-}   
-
-//-------------------------------------
-void GuiIconButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
-{
-   renderButton( offset, updateRect);
-}
-
-//------------------------------------------------------------------------------
-
-void GuiIconButtonCtrl::renderButton( Point2I &offset, const RectI& updateRect )
-{
-   bool highlight = mMouseOver;
-   bool depressed = mDepressed;
-
-   ColorI fontColor;
-
-   if (!mActive)
-       fontColor = mProfile->mFontColorNA;
-   else
-   {
-       if (highlight)
-           fontColor = mProfile->mFontColorHL;
-       else if (mStateOn)
-           fontColor = mProfile->mFontColorSL;
-       else
-           fontColor = mProfile->mFontColor;
-   }
-
-   ColorI backColor   = mActive ? mProfile->mFillColor : mProfile->mFillColorNA; 
-   ColorI borderColor = mProfile->mFillColor;//mActive ? mProfile->mBorderColor : mProfile->mBorderColorNA;
-
-   RectI boundsRect(offset, mBounds.extent);
-
-   if (mDepressed || mStateOn)
-   {
-      // If there is a bitmap array then render using it.  Otherwise use a standard
-      // fill.
-      if( mProfile->mBitmapArrayRects.size() )
-         renderBitmapArray(boundsRect, statePressed);
-      else
-         renderBorderedRect(boundsRect, mProfile, normal);
-   }
-   else if(mMouseOver && mActive)
-   {
-      // If there is a bitmap array then render using it.  Otherwise use a standard
-      // fill.
-      if(mProfile->mBitmapArrayRects.size())
-         renderBitmapArray(boundsRect, stateMouseOver);
-      else
-         renderBorderedRect(boundsRect, mProfile, GuiControlState::highlight);
-   }
-   else
-   {
-      // If there is a bitmap array then render using it.  Otherwise use a standard
-      // fill.
-      if(mProfile->mBitmapArrayRects.size())
-      {
-         if(mActive)
-            renderBitmapArray(boundsRect, stateNormal);
-         else
-            renderBitmapArray(boundsRect, stateDisabled);
-      }
-      else
-      {
-         dglDrawRectFill(boundsRect, mProfile->mFillColorNA);
-         dglDrawRect(boundsRect, mProfile->mFillColorNA);//mBorderColorNA);
-      }
-   }
-
-   Point2I textPos = offset;
-   if(depressed)
-      textPos += Point2I(1,1);
-
-   // Render the icon
-   if ( mTextureNormal && mIconLocation != GuiIconButtonCtrl::IconLocNone )
-   {
-      // Render the normal bitmap
-      dglClearBitmapModulation();
-      TextureObject *texture = (TextureObject *) mTextureNormal;
-
-      // Maintain the bitmap size or fill the button?
-      if(!mFitBitmapToButton)
-      {
-         RectI iconRect(offset + mButtonMargin, Point2I(texture->getBitmapWidth(),texture->getBitmapHeight()));
-         Point2I textureSize( texture->getBitmapWidth(), texture->getBitmapHeight() );
-
-         if( mIconLocation == IconLocRight )         
-            iconRect.set( offset + mBounds.extent - ( mButtonMargin + textureSize ), textureSize  );
-         else if( mIconLocation == IconLocLeft )
-            iconRect.set(offset + mButtonMargin, textureSize );
-
-         dglDrawBitmapStretch(texture, iconRect);
-
-      } 
-      else
-      {
-         RectI rect(offset + mButtonMargin, mBounds.extent - (mButtonMargin * 2) );        
-         dglDrawBitmapStretch(texture, rect);
-      }
-
-   }
-
-   // Render text
-   if(mTextLocation != TextLocNone)
-   {
-      dglSetBitmapModulation( fontColor );
-      S32 textWidth = mProfile->mFont->getStrWidth(mButtonText);
-
-      if(mTextLocation == TextLocRight)
-      {
-
-         Point2I start( mTextMargin, (mBounds.extent.y-mProfile->mFont->getHeight())/2 );
-         if( mTextureNormal && mIconLocation != GuiIconButtonCtrl::IconLocNone )
-         {
-            TextureObject *texture = (TextureObject *) mTextureNormal;
-            start.x = texture->getBitmapWidth() + mButtonMargin.x + mTextMargin;
-         }
-
-         dglDrawText( mProfile->mFont, start + offset, mButtonText, mProfile->mFontColors );
-
-      }
-
-      if(mTextLocation == TextLocCenter)
-      {
-         Point2I start;
-         if( mTextureNormal && mIconLocation != GuiIconButtonCtrl::IconLocNone )
-         {
-            TextureObject *texObject = (TextureObject *) mTextureNormal;
-            start.set( ( (mBounds.extent.x - textWidth - texObject->getBitmapWidth())/2) + texObject->getBitmapWidth(), (mBounds.extent.y-mProfile->mFont->getHeight())/2 );
-         }
-         else
-            start.set( (mBounds.extent.x - textWidth)/2, (mBounds.extent.y-mProfile->mFont->getHeight())/2 );
-         dglSetBitmapModulation( fontColor );
-         dglDrawText( mProfile->mFont, start + offset, mButtonText, mProfile->mFontColors );
-
-      }
-   }
-
-   renderChildControls( offset, updateRect);
-}
-
-// Draw the bitmap array's borders according to the button's state.
-void GuiIconButtonCtrl::renderBitmapArray(RectI &bounds, S32 state)
-{
-   switch(state)
-   {
-   case stateNormal:
-     /* if(mProfile->mBorder == -2)
-         renderSizableBitmapBordersFilled(bounds, 1, mProfile);
-      else*/
-         renderFixedBitmapBordersFilled(bounds, 1, mProfile);
-      break;
-
-   case stateMouseOver:
-      /*if(mProfile->mBorder == -2)
-         renderSizableBitmapBordersFilled(bounds, 2, mProfile);
-      else*/
-         renderFixedBitmapBordersFilled(bounds, 2, mProfile);
-      break;
-
-   case statePressed:
-      /*if(mProfile->mBorder == -2)
-         renderSizableBitmapBordersFilled(bounds, 3, mProfile);
-      else*/
-         renderFixedBitmapBordersFilled(bounds, 3, mProfile);
-      break;
-
-   case stateDisabled:
-      /*if(mProfile->mBorder == -2)
-         renderSizableBitmapBordersFilled(bounds, 4, mProfile);
-      else*/
-         renderFixedBitmapBordersFilled(bounds, 4, mProfile);
-      break;
-   }
-}

+ 0 - 105
engine/source/gui/buttons/guiIconButtonCtrl.h

@@ -1,105 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#ifndef _GUIICONBUTTON_H_
-#define _GUIICONBUTTON_H_
-
-#ifndef _GUIBUTTONCTRL_H_
-#include "gui/buttons/guiButtonCtrl.h"
-#endif
-#ifndef _TEXTURE_MANAGER_H_
-#include "graphics/TextureManager.h"
-#endif
-
-///-------------------------------------
-/// Icon Button Control
-/// Draws the bitmap within a normal button control.
-///
-/// if the extent is set to (0,0) in the gui editor and apply hit, this control will
-/// set it's extent to be exactly the size of the normal bitmap (if present)
-///
-class GuiIconButtonCtrl : public GuiButtonCtrl
-{
-private:
-   typedef GuiButtonCtrl Parent;
-
-protected:
-   StringTableEntry  mBitmapName;
-   TextureHandle     mTextureNormal;
-   S32               mIconLocation;
-   S32               mTextLocation;
-   S32               mTextMargin;
-   Point2I           mButtonMargin;
-   bool              mFitBitmapToButton; // Make the bitmap fill the button extent
-
-   // DAW: Optional bitmap to be displayed when the proper bitmap cannot be found
-   StringTableEntry mErrorBitmapName;
-   TextureHandle mErrorTextureHandle;
-
-   void renderButton( Point2I &offset, const RectI& updateRect);
-
-   enum 
-   {
-      stateNormal,
-      stateMouseOver,
-      statePressed,
-      stateDisabled,
-   };
-
-   void renderBitmapArray(RectI &bounds, S32 state);
-
-public:   
-   enum {
-      TextLocNone,
-      TextLocBottom,
-      TextLocRight,
-      TextLocTop,
-      TextLocLeft,
-      TextLocCenter,
-   };
-
-   enum {
-      IconLocLeft,
-      IconLocRight,
-      IconLocNone,
-   };
-
-
-   DECLARE_CONOBJECT(GuiIconButtonCtrl);
-   GuiIconButtonCtrl();
-
-   static void initPersistFields();
-
-   //Parent methods
-   bool onWake();
-   void onSleep();
-   void inspectPostApply();
-
-   void setBitmap(const char *name);
-
-   // DAW: Used to set the optional error bitmap
-   void setErrorBitmap(const char *name);
-
-   void onRender(Point2I offset, const RectI &updateRect);
-};
-
-#endif //_GUIICONBUTTON_H_

+ 116 - 1
engine/source/gui/buttons/guiRadioCtrl.cc

@@ -25,11 +25,126 @@
 #include "gui/guiCanvas.h"
 #include "gui/buttons/guiRadioCtrl.h"
 #include "console/consoleTypes.h"
+#include "gui/guiDefaultControlRender.h"
 
 //---------------------------------------------------------------------------
 IMPLEMENT_CONOBJECT(GuiRadioCtrl);
 
 GuiRadioCtrl::GuiRadioCtrl()
 {
-   mButtonType = ButtonTypeRadio;
 }
+
+
+void GuiRadioCtrl::initPersistFields()
+{
+	Parent::initPersistFields();
+	addField("groupNum", TypeS32, Offset(mRadioGroup, GuiRadioCtrl));
+}
+
+void GuiRadioCtrl::onRender(Point2I offset, const RectI &updateRect)
+{
+	GuiControlState currentState = GuiControlState::NormalState;
+	if (!mActive)
+	{
+		currentState = GuiControlState::DisabledState;
+	}
+	else if (mDepressed || mStateOn)
+	{
+		currentState = GuiControlState::SelectedState;
+	}
+	else if (mMouseOver)
+	{
+		currentState = GuiControlState::HighlightState;
+	}
+
+	RectI boundsRect(offset, mBounds.extent);
+	RectI boxRect(offset + mBoxOffset, mBoxExtent);
+
+	if (mProfile->mBitmapName != NULL && mProfile->constructBitmapArray() >= 6)
+	{
+		//Use the bitmap to create the radio button
+		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 radio button
+		S32 radius = mBoxExtent.x;
+		if (mBoxExtent.y < radius)
+		{
+			radius = mBoxExtent.y;
+		}
+		radius = (S32)round(radius/2);
+		Point2I center = Point2I(offset.x + mBoxOffset.x + (mBoxExtent.x/2), offset.y + mBoxOffset.y + (mBoxExtent.y / 2));
+		renderBorderedCircle(center, radius, mProfile, currentState);
+	}
+
+	if (mText[0] != '\0')
+	{
+		ColorI fontColor = mProfile->getFontColor(currentState);
+		dglSetBitmapModulation(fontColor);
+
+		Point2I textArea = mTextExtent;
+		if ((textArea.x + mTextOffset.x) > mBounds.extent.x)
+		{
+			textArea.x = mBounds.extent.x;
+		}
+		if ((textArea.y + mTextOffset.y) > mBounds.extent.y)
+		{
+			textArea.y = mBounds.extent.y;
+		}
+
+		renderJustifiedText(Point2I(offset.x + mTextOffset.x, offset.y + mTextOffset.y), textArea, mText);
+	}
+
+	//render the children
+	renderChildControls(offset, updateRect);
+}
+
+void GuiRadioCtrl::onAction()
+{
+	if (!mActive)
+		return;
+
+	mStateOn = false;
+
+	Parent::onAction();
+
+	messageSiblings(mRadioGroup);
+}
+
+void GuiRadioCtrl::setStateOn(bool bStateOn)
+{
+	if (!mActive)
+		return;
+
+	mStateOn = true;
+	messageSiblings(mRadioGroup);
+
+	setUpdate();
+}
+
+void GuiRadioCtrl::onMessage(GuiControl *sender, S32 msg)
+{
+	Parent::onMessage(sender, msg);
+	if (mRadioGroup == msg)
+	{
+		mStateOn = (sender == this);
+		setUpdate();
+	}
+}

+ 9 - 5
engine/source/gui/buttons/guiRadioCtrl.h

@@ -23,21 +23,25 @@
 #ifndef _GUIRADIOCTRL_H_
 #define _GUIRADIOCTRL_H_
 
-#ifndef _GUICHECKBOXCTRLL_H_
+#ifndef _GUICHECKBOXCTRL_H_
 #include "gui/buttons/guiCheckBoxCtrl.h"
 #endif
 
-// the radio button renders exactly the same as the check box
-// the only difference is it sends messages to its siblings to
-// turn themselves off.
-
 class GuiRadioCtrl : public GuiCheckBoxCtrl
 {
    typedef GuiCheckBoxCtrl Parent;
 
+protected:
+	S32 mRadioGroup;
+
 public:
    DECLARE_CONOBJECT(GuiRadioCtrl);
    GuiRadioCtrl();
+   static void initPersistFields();
+   void onRender(Point2I offset, const RectI &updateRect);
+   void setStateOn(bool bStateOn);
+   void onAction();
+   void onMessage(GuiControl *, S32 msg);
 };
 
 #endif //_GUI_RADIO_CTRL_H

+ 0 - 226
engine/source/gui/buttons/guiToolboxButtonCtrl.cc

@@ -1,226 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#include "console/console.h"
-#include "graphics/dgl.h"
-#include "console/consoleTypes.h"
-#include "platform/platformAudio.h"
-#include "gui/guiCanvas.h"
-#include "gui/guiDefaultControlRender.h"
-#include "gui/buttons/guiToolboxButtonCtrl.h"
-
-IMPLEMENT_CONOBJECT(GuiToolboxButtonCtrl);
-
-//-------------------------------------
-GuiToolboxButtonCtrl::GuiToolboxButtonCtrl()
-{
-   mNormalBitmapName = StringTable->EmptyString;
-   mLoweredBitmapName = StringTable->insert("sceneeditor/client/images/buttondown");
-   mHoverBitmapName = StringTable->insert("sceneeditor/client/images/buttonup");
-   mMinExtent.set( 16, 16 );
-   mBounds.extent.set(48, 48);
-   mButtonType = ButtonTypeRadio;
-   mTipHoverTime = 100;
-   
-}
-
-
-//-------------------------------------
-void GuiToolboxButtonCtrl::initPersistFields()
-{
-   Parent::initPersistFields();
-   addField("normalBitmap", TypeFilename, Offset(mNormalBitmapName, GuiToolboxButtonCtrl));
-   addField("loweredBitmap", TypeFilename, Offset(mLoweredBitmapName, GuiToolboxButtonCtrl));
-   addField("hoverBitmap", TypeFilename, Offset(mHoverBitmapName, GuiToolboxButtonCtrl));
-}
-
-
-//-------------------------------------
-bool GuiToolboxButtonCtrl::onWake()
-{
-   if (! Parent::onWake())
-      return false;
-
-   setActive( true );
-   
-   setNormalBitmap( mNormalBitmapName );
-   setLoweredBitmap( mLoweredBitmapName );
-   setHoverBitmap( mHoverBitmapName );
-
-   return true;
-}
-
-
-//-------------------------------------
-void GuiToolboxButtonCtrl::onSleep()
-{
-   mTextureNormal = NULL;
-   mTextureLowered = NULL;
-   mTextureHover = NULL;
-   Parent::onSleep();
-}
-
-
-//-------------------------------------
-
-ConsoleMethod( GuiToolboxButtonCtrl, setNormalBitmap, void, 3, 3, "( filepath name ) Sets the bitmap that shows when the button is active"
-                          "@param name The path of the desired bitmap file\n"
-              "@return No Return Value.")
-{
-   object->setNormalBitmap(argv[2]);
-}
-
-ConsoleMethod( GuiToolboxButtonCtrl, setLoweredBitmap, void, 3, 3, "( filepath name ) Sets the bitmap that shows when the button is disabled"
-                          "@param name The path of the desired bitmap file\n"
-              "@return No Return Value.")
-{
-   object->setLoweredBitmap(argv[2]);
-}
-
-ConsoleMethod( GuiToolboxButtonCtrl, setHoverBitmap, void, 3, 3, "( filepath name ) Sets the bitmap that shows when the button is disabled"
-              "@param name The path of the desired bitmap file\n"
-              "@return No Return Value.")
-{
-   object->setHoverBitmap(argv[2]);
-}
-
-//-------------------------------------
-void GuiToolboxButtonCtrl::inspectPostApply()
-{
-   // if the extent is set to (0,0) in the gui editor and appy hit, this control will
-   // set it's extent to be exactly the size of the normal bitmap (if present)
-   Parent::inspectPostApply();
-
-   if ((mBounds.extent.x == 0) && (mBounds.extent.y == 0) && mTextureNormal)
-   {
-      TextureObject *texture = (TextureObject *) mTextureNormal;
-      mBounds.extent.x = texture->getBitmapWidth();
-      mBounds.extent.y = texture->getBitmapHeight();
-   }
-}
-
-
-//-------------------------------------
-void GuiToolboxButtonCtrl::setNormalBitmap( StringTableEntry bitmapName )
-{
-   mNormalBitmapName = StringTable->insert( bitmapName );
-   
-   if(!isAwake())
-      return;
-
-   if ( *mNormalBitmapName )
-      mTextureNormal = TextureHandle( mNormalBitmapName, TextureHandle::BitmapTexture, true );
-   else
-      mTextureNormal = NULL;
-   
-   setUpdate();
-}   
-
-void GuiToolboxButtonCtrl::setLoweredBitmap( StringTableEntry bitmapName )
-{
-   mLoweredBitmapName = StringTable->insert( bitmapName );
-   
-   if(!isAwake())
-      return;
-
-   if ( *mLoweredBitmapName )
-      mTextureLowered = TextureHandle( mLoweredBitmapName, TextureHandle::BitmapTexture, true );
-   else
-      mTextureLowered = NULL;
-   
-   setUpdate();
-}   
-
-void GuiToolboxButtonCtrl::setHoverBitmap( StringTableEntry bitmapName )
-{
-   mHoverBitmapName = StringTable->insert( bitmapName );
-
-   if(!isAwake())
-      return;
-
-   if ( *mHoverBitmapName )
-      mTextureHover = TextureHandle( mHoverBitmapName, TextureHandle::BitmapTexture, true );
-   else
-      mTextureHover = NULL;
-
-   setUpdate();
-}   
-
-
-
-//-------------------------------------
-void GuiToolboxButtonCtrl::onRender(Point2I offset, const RectI& updateRect)
-{
-   // Only render the state rect (hover/down) if we're active
-   if (mActive)
-   {
-      RectI r(offset, mBounds.extent);
-      if ( mDepressed  || mStateOn )
-         renderStateRect( mTextureLowered , r );
-      else if (mMouseOver) 
-         renderStateRect( mTextureHover , r );    
-   }
-
-   // Now render the image
-   if( mTextureNormal )
-   {
-      renderButton( mTextureNormal, offset, updateRect );
-      return;
-   }
-
-   Point2I textPos = offset;
-   if( mDepressed )
-      textPos += Point2I(1,1);
-
-   // Make sure we take the profile's textOffset into account.
-   textPos += mProfile->mTextOffset;
-
-   dglSetBitmapModulation( mProfile->mFontColor );
-   renderJustifiedText(textPos, mBounds.extent, mButtonText);
-
-}
-
-void GuiToolboxButtonCtrl::renderStateRect( TextureHandle &texture, const RectI& rect )
-{
-   if (texture)
-   {
-      dglClearBitmapModulation();
-      dglDrawBitmapStretch( texture, rect );
-   }
-}
-
-//------------------------------------------------------------------------------
-
-void GuiToolboxButtonCtrl::renderButton(TextureHandle &texture, Point2I &offset, const RectI& updateRect)
-{
-   if (texture)
-   {
-      Point2I finalOffset = offset;
-
-      finalOffset.x += ( ( mBounds.extent.x / 2 ) - ( texture.getWidth() / 2 ) );
-      finalOffset.y += ( ( mBounds.extent.y / 2 ) - ( texture.getHeight() / 2 ) );
-
-      dglClearBitmapModulation();
-      dglDrawBitmap(texture, finalOffset);
-      renderChildControls( offset, updateRect);
-   }
-}

+ 0 - 70
engine/source/gui/buttons/guiToolboxButtonCtrl.h

@@ -1,70 +0,0 @@
-//-----------------------------------------------------------------------------
-// Copyright (c) 2013 GarageGames, LLC
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to
-// deal in the Software without restriction, including without limitation the
-// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-// sell copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
-// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
-// IN THE SOFTWARE.
-//-----------------------------------------------------------------------------
-
-#ifndef _GUITOOLBOXBUTTON_H_
-#define _GUITOOLBOXBUTTON_H_
-
-#ifndef _GUIBUTTONCTRL_H_
-#include "gui/buttons/guiButtonCtrl.h"
-#endif
-#ifndef _TEXTURE_MANAGER_H_
-#include "graphics/TextureManager.h"
-#endif
-
-class GuiToolboxButtonCtrl : public GuiButtonCtrl
-{
-private:
-   typedef GuiButtonCtrl Parent;
-
-protected:
-   StringTableEntry mNormalBitmapName;
-   StringTableEntry mLoweredBitmapName;
-   StringTableEntry mHoverBitmapName;
-
-   TextureHandle mTextureNormal;
-   TextureHandle mTextureLowered;
-   TextureHandle mTextureHover;
-
-   void renderButton(TextureHandle &texture, Point2I &offset, const RectI& updateRect);
-   void renderStateRect( TextureHandle &texture, const RectI& rect );
-
-public:   
-   DECLARE_CONOBJECT(GuiToolboxButtonCtrl);
-   GuiToolboxButtonCtrl();
-
-   static void initPersistFields();
-
-   //Parent methods
-   bool onWake();
-   void onSleep();
-   void inspectPostApply();
-
-   void setNormalBitmap( StringTableEntry bitmapName );
-   void setLoweredBitmap( StringTableEntry bitmapName );
-   void setHoverBitmap( StringTableEntry bitmapName );
-   
-
-   void onRender(Point2I offset, const RectI &updateRect);
-};
-
-
-#endif //_GUITOOLBOXBUTTON_H_

+ 1 - 1
engine/source/gui/containers/guiDragAndDropCtrl.cc

@@ -52,7 +52,7 @@ void GuiDragAndDropControl::startDragging(Point2I offset)
    if (canvas->getMouseLockedControl())
    {
       GuiEvent event;
-      canvas->getMouseLockedControl()->onMouseLeave(event);
+      canvas->getMouseLockedControl()->onTouchLeave(event);
       canvas->mouseUnlock(canvas->getMouseLockedControl());
    }
    canvas->mouseLock(this);

+ 1 - 1
engine/source/gui/containers/guiFormCtrl.cc

@@ -422,7 +422,7 @@ void GuiFormCtrl::onMouseDown(const GuiEvent &event)
 
       GuiControl *ctrl = findHitControl(localClick);
       if (ctrl && ctrl != this)
-         ctrl->onMouseDown(event);
+         ctrl->onTouchDown(event);
 
    }
 

+ 3 - 3
engine/source/gui/containers/guiScrollCtrl.cc

@@ -631,7 +631,7 @@ bool GuiScrollCtrl::onMouseWheelUp(const GuiEvent &event)
    for ( itr = begin(); itr != end(); itr++ )
    {
       GuiControl* grandKid = static_cast<GuiControl*>( *itr );
-      grandKid->onMouseMove( event );
+      grandKid->onTouchMove( event );
    }
 
    // If no scrolling happened (already at the top), pass it on to the parent.
@@ -655,7 +655,7 @@ bool GuiScrollCtrl::onMouseWheelDown(const GuiEvent &event)
    for ( itr = begin(); itr != end(); itr++ )
    {
       GuiControl* grandKid = static_cast<GuiControl *>( *itr );
-      grandKid->onMouseMove( event );
+      grandKid->onTouchMove( event );
    }
 
    // If no scrolling happened (already at the bottom), pass it on to the parent.
@@ -796,7 +796,7 @@ void GuiScrollCtrl::onRender(Point2I offset, const RectI &updateRect)
 {
    RectI r(offset.x, offset.y, mBounds.extent.x, mBounds.extent.y);
 
-   renderBorderedRect(r, mProfile, normal);
+   renderBorderedRect(r, mProfile, NormalState);
 
    // draw scroll bars
    if (mHasVScrollBar)

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

@@ -219,7 +219,7 @@ void GuiTabBookCtrl::childResized(GuiControl *child)
    child->resize( mPageRect.point, mPageRect.extent );
 }
 
-void GuiTabBookCtrl::onMouseDown(const GuiEvent &event)
+void GuiTabBookCtrl::onTouchDown(const GuiEvent &event)
 {
     Point2I localMouse = globalToLocalCoord( event.mousePoint );
     if( mTabRect.pointInRect( localMouse ) )
@@ -230,7 +230,7 @@ void GuiTabBookCtrl::onMouseDown(const GuiEvent &event)
     }
 }
 
-void GuiTabBookCtrl::onMouseMove(const GuiEvent &event)
+void GuiTabBookCtrl::onTouchMove(const GuiEvent &event)
 {
 
    Point2I localMouse = globalToLocalCoord( event.mousePoint );
@@ -243,10 +243,10 @@ void GuiTabBookCtrl::onMouseMove(const GuiEvent &event)
       else if ( !tab )
          mHoverTab = NULL;
    }
-   Parent::onMouseMove( event );
+   Parent::onTouchMove( event );
 }
 
-void GuiTabBookCtrl::onMouseLeave( const GuiEvent &event )
+void GuiTabBookCtrl::onTouchLeave( const GuiEvent &event )
 {
    mHoverTab = NULL;
 }

+ 3 - 3
engine/source/gui/containers/guiTabBookCtrl.h

@@ -241,9 +241,9 @@ private:
 
    /// @name Mouse Events
    /// @{
-   void onMouseDown(const GuiEvent &event);
-   void onMouseMove(const GuiEvent &event);
-   void onMouseLeave(const GuiEvent &event);
+   void onTouchDown(const GuiEvent &event);
+   void onTouchMove(const GuiEvent &event);
+   void onTouchLeave(const GuiEvent &event);
    virtual bool onMouseDownEditor(const GuiEvent &event, Point2I offset);
    /// @}
 };

+ 1 - 1
engine/source/gui/containers/guiWindowCtrl.cc

@@ -248,7 +248,7 @@ void GuiWindowCtrl::onMouseDown(const GuiEvent &event)
 
       GuiControl *ctrl = findHitControl(localPoint);
       if (ctrl && ctrl != this)
-         ctrl->onMouseDown(event);
+         ctrl->onTouchDown(event);
 
    }
 }

+ 3 - 3
engine/source/gui/editor/guiEditCtrl.cc

@@ -675,7 +675,7 @@ void GuiEditCtrl::onMouseDown(const GuiEvent &event)
 {
    if (! mActive)
    {
-      Parent::onMouseDown(event);
+      Parent::onTouchDown(event);
       return;
    }
    if(!mContentControl)
@@ -834,7 +834,7 @@ void GuiEditCtrl::onMouseUp(const GuiEvent &event)
 {
    if (! mActive || !mContentControl || !mCurrentAddSet )
    {
-      Parent::onMouseUp(event);
+      Parent::onTouchUp(event);
       return;
    }
 
@@ -895,7 +895,7 @@ void GuiEditCtrl::onMouseDragged(const GuiEvent &event)
 {
    if (! mActive || !mContentControl || !mCurrentAddSet)
    {
-      Parent::onMouseDragged(event);
+      Parent::onTouchDragged(event);
       return;
    }
 

+ 1 - 1
engine/source/gui/editor/guiInspectorTypes.cc

@@ -107,7 +107,7 @@ GuiControl* GuiInspectorTypeCheckBox::constructEditControl()
    retCtrl->setField( "profile", "InspectorTypeCheckboxProfile" );
    retCtrl->setField( "text", "" );
 
-   check->mIndent = 4;
+   //check->mIndent = 4;
 
    retCtrl->setScriptValue( getData() );
 

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

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

+ 4 - 4
engine/source/gui/editor/guiSeparatorCtrl.cc

@@ -78,7 +78,7 @@ void GuiSeparatorCtrl::onRender(Point2I offset, const RectI &updateRect)
       if(mTextLeftMargin > 0)
       {
          RectI rect(Point2I(posx,seppos),Point2I(mTextLeftMargin,2));
-         renderBorderedRect(rect, mProfile, GuiControlState::highlight);
+         renderBorderedRect(rect, mProfile, GuiControlState::HighlightState);
          posx += mTextLeftMargin;
       }
 
@@ -87,7 +87,7 @@ void GuiSeparatorCtrl::onRender(Point2I offset, const RectI &updateRect)
       //posx += mProfile->mFont->getStrWidth(mText);
 
       RectI rect(Point2I(posx,seppos),Point2I(mBounds.extent.x - posx + offset.x,2));
-	  renderBorderedRect(rect, mProfile, GuiControlState::highlight);
+	  renderBorderedRect(rect, mProfile, GuiControlState::HighlightState);
 
    } else
    {
@@ -95,13 +95,13 @@ void GuiSeparatorCtrl::onRender(Point2I offset, const RectI &updateRect)
       {
          S32 seppos = mBounds.extent.y / 2 + offset.y; 
          RectI rect(Point2I(offset.x + mMargin ,seppos),Point2I(mBounds.extent.x - (mMargin * 2),2));
-		 renderBorderedRect(rect, mProfile, GuiControlState::normal);
+		 renderBorderedRect(rect, mProfile, GuiControlState::NormalState);
       }
       else
       {
          S32 seppos = mBounds.extent.x / 2 + offset.x; 
          RectI rect(Point2I(seppos, offset.y + mMargin),Point2I(2, mBounds.extent.y - (mMargin * 2)));
-		 renderBorderedRect(rect, mProfile, GuiControlState::normal);
+		 renderBorderedRect(rect, mProfile, GuiControlState::NormalState);
       }
    }
 

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

@@ -283,7 +283,7 @@ void GuiArrayCtrl::onMouseDown(const GuiEvent &event)
       return;
 
    //let the guiControl method take care of the rest
-   Parent::onMouseDown(event);
+   Parent::onTouchDown(event);
 
    Point2I pt = globalToLocalCoord(event.mousePoint);
    pt.x -= mHeaderDim.x; pt.y -= mHeaderDim.y;

+ 19 - 19
engine/source/gui/guiCanvas.cc

@@ -557,7 +557,7 @@ void GuiCanvas::rootMouseDown(const GuiEvent &event)
 
    //pass the event to the mouse locked control
    if (bool(mMouseCapturedControl))
-      mMouseCapturedControl->onMouseDown(event);
+      mMouseCapturedControl->onTouchDown(event);
 
    //else pass it to whoever is underneath the cursor
    else
@@ -575,7 +575,7 @@ void GuiCanvas::rootMouseDown(const GuiEvent &event)
             continue;
          else
          {
-            controlHit->onMouseDown(event);
+            controlHit->onTouchDown(event);
             break;
          }
       }
@@ -596,12 +596,12 @@ void GuiCanvas::findMouseControl(const GuiEvent &event)
    {
       if (bool(mMouseControl))
       {
-         mMouseControl->onMouseLeave(event);
+         mMouseControl->onTouchLeave(event);
          hoverControlStart = Platform::getRealMilliseconds();
          hoverPositionSet = false;
       }
       mMouseControl = controlHit;
-      mMouseControl->onMouseEnter(event);
+      mMouseControl->onTouchEnter(event);
    }
 }
 
@@ -628,7 +628,7 @@ void GuiCanvas::rootScreenTouchDown(const GuiEvent &event)
                 {  
                     if(mMouseCapturedControl != controlHit)  
                     {  
-                        mMouseCapturedControl->onMouseLeave(event);  
+                        mMouseCapturedControl->onTouchLeave(event);  
                     }  
                 }  
             }  
@@ -638,7 +638,7 @@ void GuiCanvas::rootScreenTouchDown(const GuiEvent &event)
                 continue;  
             else  
             {  
-                controlHit->onMouseDown(event);  
+                controlHit->onTouchDown(event);  
                 break;  
             }  
         }  
@@ -665,7 +665,7 @@ void GuiCanvas::rootScreenTouchUp(const GuiEvent &event)
             continue;
         else
         {
-            controlHit->onMouseUp(event);
+            controlHit->onTouchUp(event);
             break;
         }
     }
@@ -678,14 +678,14 @@ void GuiCanvas::rootScreenTouchMove(const GuiEvent &event)
    {
       checkLockMouseMove(event);
       if(!mMouseCapturedControl.isNull())
-            mMouseCapturedControl->onMouseDragged(event);
+            mMouseCapturedControl->onTouchDragged(event);
    }
    else
    {
       findMouseControl(event);
       if(bool(mMouseControl))
       {
-          mMouseControl->onMouseDragged(event);		  
+          mMouseControl->onTouchDragged(event);		  
       }
    }
 }
@@ -704,12 +704,12 @@ void GuiCanvas::rootMouseUp(const GuiEvent &event)
 
    //pass the event to the mouse locked control
    if (bool(mMouseCapturedControl))
-      mMouseCapturedControl->onMouseUp(event);
+      mMouseCapturedControl->onTouchUp(event);
    else
    {
       findMouseControl(event);
       if(bool(mMouseControl))
-         mMouseControl->onMouseUp(event);
+         mMouseControl->onTouchUp(event);
    }
 }
 
@@ -719,9 +719,9 @@ void GuiCanvas::checkLockMouseMove(const GuiEvent &event)
    if(controlHit != mMouseControl)
    {
       if(mMouseControl == mMouseCapturedControl)
-         mMouseCapturedControl->onMouseLeave(event);
+         mMouseCapturedControl->onTouchLeave(event);
       else if(controlHit == mMouseCapturedControl)
-         mMouseCapturedControl->onMouseEnter(event);
+         mMouseCapturedControl->onTouchEnter(event);
       mMouseControl = controlHit;
    }
 }
@@ -733,7 +733,7 @@ void GuiCanvas::rootMouseDragged(const GuiEvent &event)
    {
       checkLockMouseMove(event);
       if(!mMouseCapturedControl.isNull())
-            mMouseCapturedControl->onMouseDragged(event);
+            mMouseCapturedControl->onTouchDragged(event);
        //Luma: Mouse dragged calls mouse Moved on iPhone
 #if defined(TORQUE_OS_IOS) || defined(TORQUE_OS_ANDROID)
        mMouseCapturedControl->onMouseMove(event);
@@ -744,7 +744,7 @@ void GuiCanvas::rootMouseDragged(const GuiEvent &event)
       findMouseControl(event);
       if(bool(mMouseControl))
       {
-          mMouseControl->onMouseDragged(event);
+          mMouseControl->onTouchDragged(event);
 #if defined(TORQUE_OS_IOS) || defined(TORQUE_OS_ANDROID)
           mMouseControl->onMouseMove(event);
 #endif //TORQUE_OS_IOS
@@ -759,13 +759,13 @@ void GuiCanvas::rootMouseMove(const GuiEvent &event)
    {
       checkLockMouseMove(event);
       if(mMouseCapturedControl != NULL)
-        mMouseCapturedControl->onMouseMove(event);
+        mMouseCapturedControl->onTouchMove(event);
    }
    else
    {
       findMouseControl(event);
       if(bool(mMouseControl))
-         mMouseControl->onMouseMove(event);
+         mMouseControl->onTouchMove(event);
    }
 }
 
@@ -1112,7 +1112,7 @@ void GuiCanvas::mouseLock(GuiControl *lockingControl)
       evt.mousePoint.x = S32(cursorPt.x);
       evt.mousePoint.y = S32(cursorPt.y);
 
-      mMouseControl->onMouseLeave(evt);
+      mMouseControl->onTouchLeave(evt);
    }
 }
 
@@ -1131,7 +1131,7 @@ void GuiCanvas::mouseUnlock(GuiControl *lockingControl)
       mMouseControl = controlHit;
       mMouseControlClicked = false;
       if(bool(mMouseControl))
-         mMouseControl->onMouseEnter(evt);
+         mMouseControl->onTouchEnter(evt);
    }
    mMouseCapturedControl = NULL;
 }

+ 47 - 10
engine/source/gui/guiControl.cc

@@ -58,7 +58,7 @@ GuiControl::GuiControl()
 {
    mLayer = 0;
    mBounds.set(0, 0, 64, 64);
-   mMinExtent.set(8, 2);			// MM: Reduced to 8x2 so GuiControl can be used as a separator.
+   mMinExtent.set(8, 2);			// Set to 8x2 so GuiControl can be used as a separator.
 
    mProfile = NULL;
 
@@ -67,6 +67,8 @@ GuiControl::GuiControl()
    mAltConsoleCommand   = StringTable->EmptyString;
    mAcceleratorKey      = StringTable->EmptyString;
    mLangTableName       = StringTable->EmptyString;
+   mText                = StringTable->EmptyString;
+   mTextID              = StringTable->EmptyString;
 
    mLangTable           = NULL;
    mFirstResponder      = NULL;
@@ -181,6 +183,11 @@ void GuiControl::initPersistFields()
    addGroup("Localization");
    addField("langTableMod",      TypeString,		Offset(mLangTableName, GuiControl));
    endGroup("Localization");
+
+   addGroup("Text");
+   addField("text", TypeCaseString, Offset(mText, GuiControl));
+   addField("textID", TypeString, Offset(mTextID, GuiControl));
+   endGroup("Text");
 }
 
 // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- //
@@ -446,7 +453,7 @@ void GuiControl::onRender(Point2I offset, const RectI &updateRect)
 {
     RectI ctrlRect(offset, mBounds.extent);
 
-    renderBorderedRect(ctrlRect, mProfile, normal);
+    renderBorderedRect(ctrlRect, mProfile, NormalState);
 
 	dglSetBitmapModulation(mProfile->mFontColor);
     renderChildControls(offset, updateRect);
@@ -588,7 +595,7 @@ bool GuiControl::renderTooltip(Point2I cursorPos, const char* tipText )
     dglSetClipRect(rect);
 
     // Draw body and border of the tool tip
-	renderBorderedRect(rect, mTooltipProfile, normal);
+	renderBorderedRect(rect, mTooltipProfile, NormalState);
 
     // Draw the text centered in the tool tip box
     dglSetBitmapModulation( mTooltipProfile->mFontColor );
@@ -685,6 +692,11 @@ void GuiControl::awaken()
          AssertFatal(0, "GuiControl::awaken: failed onWake");
          deleteObject();
       }
+	  else
+	  {
+		  if (mTextID && *mTextID != 0)
+			  setTextID(mTextID);
+	  }
    }
 }
 
@@ -1085,15 +1097,15 @@ bool GuiControl::onInputEvent(const InputEvent &event)
    return( false );
 }
 
-void GuiControl::onMouseUp(const GuiEvent &event)
+void GuiControl::onTouchUp(const GuiEvent &event)
 {
 }
 
-void GuiControl::onMouseDown(const GuiEvent &event)
+void GuiControl::onTouchDown(const GuiEvent &event)
 {
 }
 
-void GuiControl::onMouseMove(const GuiEvent &event)
+void GuiControl::onTouchMove(const GuiEvent &event)
 {
    //if this control is a dead end, make sure the event stops here
    if ( !mVisible || !mAwake )
@@ -1102,18 +1114,18 @@ void GuiControl::onMouseMove(const GuiEvent &event)
    //pass the event to the parent
    GuiControl *parent = getParent();
    if ( parent )
-      parent->onMouseMove( event );
+      parent->onTouchMove( event );
 }
 
-void GuiControl::onMouseDragged(const GuiEvent &event)
+void GuiControl::onTouchDragged(const GuiEvent &event)
 {
 }
 
-void GuiControl::onMouseEnter(const GuiEvent &)
+void GuiControl::onTouchEnter(const GuiEvent &)
 {
 }
 
-void GuiControl::onMouseLeave(const GuiEvent &)
+void GuiControl::onTouchLeave(const GuiEvent &)
 {
 }
 
@@ -1561,3 +1573,28 @@ const char* GuiControl::execAltConsoleCallback()
    }
    return "";
 }
+
+void GuiControl::setText(const char *text)
+{
+	mText = StringTable->insert(text);
+}
+
+void GuiControl::setTextID(const char *id)
+{
+	S32 n = Con::getIntVariable(id, -1);
+	if (n != -1)
+	{
+		mTextID = StringTable->insert(id);
+		setTextID(n);
+	}
+}
+void GuiControl::setTextID(S32 id)
+{
+	const UTF8 *str = getGUIString(id);
+	if (str)
+		setText((const char*)str);
+}
+const char *GuiControl::getText()
+{
+	return mText;
+}

+ 14 - 6
engine/source/gui/guiControl.h

@@ -167,6 +167,9 @@ protected:
 
     StringTableEntry	mTooltip;
 
+	StringTableEntry    mText;
+	StringTableEntry    mTextID;
+
     /// @}
 
     /// @name Console
@@ -264,6 +267,11 @@ public:
     const S32        getTop() { return mBounds.point.y; } ///< Returns the Y position of the control
     const S32        getWidth() { return mBounds.extent.x; } ///< Returns the width of the control
     const S32        getHeight() { return mBounds.extent.y; } ///< Returns the height of the control
+	
+	void             setText(const char *text);
+	void             setTextID(S32 id);
+	void             setTextID(const char *id);
+	const char*      getText();
 
     /// @}
 
@@ -480,12 +488,12 @@ public:
     /// These functions are called when the input event which is
     /// in the name of the function occurs.
     /// @{
-    virtual void onMouseUp(const GuiEvent &event);
-    virtual void onMouseDown(const GuiEvent &event);
-    virtual void onMouseMove(const GuiEvent &event);
-    virtual void onMouseDragged(const GuiEvent &event);
-    virtual void onMouseEnter(const GuiEvent &event);
-    virtual void onMouseLeave(const GuiEvent &event);
+    virtual void onTouchUp(const GuiEvent &event);
+    virtual void onTouchDown(const GuiEvent &event);
+    virtual void onTouchMove(const GuiEvent &event);
+    virtual void onTouchDragged(const GuiEvent &event);
+    virtual void onTouchEnter(const GuiEvent &event);
+    virtual void onTouchLeave(const GuiEvent &event);
 
     virtual bool onMouseWheelUp(const GuiEvent &event);
     virtual bool onMouseWheelDown(const GuiEvent &event);

+ 28 - 0
engine/source/gui/guiControl_ScriptBinding.h

@@ -308,4 +308,32 @@ ConsoleMethodWithDocs(GuiControl, setFirstResponder, ConsoleVoid, 2, 2, ())
    object->setFirstResponder();
 }
 
+/*! Simulates a click on the control.
+*/
+ConsoleMethodWithDocs(GuiControl, performClick, ConsoleVoid, 2, 2, ())
+{
+	object->onAction();
+}
+
+/*! Sets the text of the control to the string.
+*/
+ConsoleMethodWithDocs(GuiControl, setText, ConsoleVoid, 3, 3, (text))
+{
+	object->setText(argv[2]);
+}
+
+/*! Sets the text of the control to the localized string.
+*/
+ConsoleMethodWithDocs(GuiControl, setTextID, ConsoleVoid, 3, 3, (id))
+{
+	object->setTextID(argv[2]);
+}
+
+/*! returns the text of the control.
+*/
+ConsoleMethodWithDocs(GuiControl, getText, ConsoleString, 2, 2, ())
+{
+	return object->getText();
+}
+
 ConsoleMethodGroupEndWithDocs(GuiControl)

+ 99 - 165
engine/source/gui/guiDefaultControlRender.cc

@@ -90,101 +90,35 @@ void renderBorderedRect(RectI &bounds, GuiControlProfile *profile, GuiControlSta
 	}
 }
 
-// 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 renderBorderedCircle(Point2I &center, S32 radius, GuiControlProfile *profile, GuiControlState state)
 {
-   // DAW: Indices into the bitmap array
-   S32 NumBitmaps = 9;
-   S32 BorderTopLeft =     NumBitmaps * baseMultiplier - NumBitmaps;
-   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;
-
-   dglClearBitmapModulation();
-   if(profile->mBitmapArrayRects.size() >= (NumBitmaps * baseMultiplier))
-   {
-      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]);
+	//Get the border profiles
+	GuiBorderProfile *borderProfile = profile->mBorderDefault;
 
-      //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]);
+	//Get the colors
+	ColorI fillColor = profile->getFillColor(state);
+	ColorI borderColor = (profile->mBorderDefault) ? profile->mBorderDefault->getBorderColor(state) : ColorI();
+	S32 borderSize = (profile->mBorderDefault) ? profile->mBorderDefault->getBorder(state) : 0;
 
-      // End drawing corners
+	//Draw the fill
+	if (profile->mOpaque)
+	{
+		S32 fillRadius = (profile->mBorderDefault && profile->mBorderDefault->mUnderfill) ? radius : radius - borderSize;
+		dglDrawCircleFill(center, fillRadius, fillColor);
+	}
 
-      // Begin drawing sides and top stretched borders
+	//Draw the border
+	dglDrawCircle(center, radius, borderColor, borderSize);
+}
 
-      //start with top line stretch
-      destRect.point.x = bounds.point.x + mBitmapBounds[BorderTopRight].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[BorderBottomRight].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);
-      //left 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);
+// 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)
+{
+   S32 NumBitmaps = 9;
+   S32 startIndex = NumBitmaps * (baseMultiplier - 1);
 
-      // End drawing sides and top stretched borders
-   }
+   renderSizableBitmapBordersFilledIndex(bounds, startIndex, profile);
 }
 
 
@@ -205,83 +139,83 @@ void renderSizableBitmapBordersFilledIndex(RectI &bounds, S32 startIndex, GuiCon
    S32 BorderBottomRight = 8 + BorderTopLeft;
 
    dglClearBitmapModulation();
-   if(profile->mBitmapArrayRects.size() >= (startIndex + NumBitmaps))
+   if (profile->mBitmapArrayRects.size() >= (NumBitmaps + startIndex))
    {
-      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);
-      //left 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
+	   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
    }
 }
 

+ 4 - 3
engine/source/gui/guiDefaultControlRender.h

@@ -30,10 +30,11 @@
 class GuiControlProfile;
 
 void renderBorderedRect(RectI &bounds, GuiControlProfile *profile, GuiControlState state);
-void renderSizableBitmapBordersFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile); // DAW: Added
+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); // DAW: Added
+void renderFixedBitmapBordersFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile); 
 void renderFixedBitmapBordersFilled(RectI &bounds, S32 startIndex, GuiControlProfile *profile);
-void renderFixedBitmapBordersStretchYFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile); // DAW: Added
+void renderFixedBitmapBordersStretchYFilled(RectI &bounds, S32 baseMultiplier, GuiControlProfile *profile);
 
 #endif

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

@@ -764,7 +764,7 @@ void GuiListBoxCtrl::drawBox(const Point2I &box, S32 size, ColorI &outlineColor,
 
 void GuiListBoxCtrl::onMouseDragged(const GuiEvent &event)
 {
-   Parent::onMouseDragged(event);
+   Parent::onTouchDragged(event);
 
    if(isMethod("onMouseDragged"))
       Con::executef(this, 1, "onMouseDragged");

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

@@ -785,7 +785,7 @@ void GuiMessageVectorCtrl::findSpecialFromCoord(const Point2I& point, S32* speci
 
 void GuiMessageVectorCtrl::onMouseDown(const GuiEvent& event)
 {
-   Parent::onMouseDown(event);
+   Parent::onTouchDown(event);
    mouseUnlock();
 
    mMouseDown = true;
@@ -797,7 +797,7 @@ void GuiMessageVectorCtrl::onMouseDown(const GuiEvent& event)
 
 void GuiMessageVectorCtrl::onMouseUp(const GuiEvent& event)
 {
-   Parent::onMouseUp(event);
+   Parent::onTouchUp(event);
    mouseUnlock();
 
    // Is this an up from a dragged click?

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

@@ -182,7 +182,7 @@ void GuiPopupTextListCtrl::onMouseUp(const GuiEvent &event)
 {
    Parent::onMouseDown(event);
    mPopUpCtrl->closePopUp();
-   Parent::onMouseUp(event);
+   Parent::onTouchUp(event);
 }
 
 //------------------------------------------------------------------------------

+ 3 - 3
engine/source/gui/guiPopUpCtrlEx.cc

@@ -199,9 +199,9 @@ void GuiPopupTextListCtrlEx::onMouseUp(const GuiEvent &event)
          return;
    }
 
-   Parent::onMouseDown(event);
+   Parent::onTouchDown(event);
    mPopUpCtrl->closePopUp();
-   Parent::onMouseUp(event);
+   Parent::onTouchUp(event);
 }
 
 void GuiPopupTextListCtrlEx::onMouseMove( const GuiEvent &event )
@@ -222,7 +222,7 @@ void GuiPopupTextListCtrlEx::onMouseMove( const GuiEvent &event )
       Con::executef( mPopUpCtrl, 2, "onHotTrackItem", Con::getIntArg(-1) );
 
    // Call Parent
-   Parent::onMouseMove(event);
+   Parent::onTouchMove(event);
 }
 
 //------------------------------------------------------------------------------

+ 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, normal);
+        renderBorderedRect(thumb, mProfile, NormalState);
     }
 
     if (mDisplayValue)

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

@@ -70,7 +70,7 @@ void GuiTabPageCtrl::onMouseDown(const GuiEvent &event)
    GuiControl *ctrl = findHitControl(localPoint);
    if (ctrl && ctrl != this)
    {
-      ctrl->onMouseDown(event);
+      ctrl->onTouchDown(event);
    }
 }
 

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

@@ -392,7 +392,7 @@ void GuiTextEditCtrl::onMouseDragged( const GuiEvent &event )
       mBlockStart = mBlockEnd = 0;
 
    //let the parent get the event
-   Parent::onMouseDragged(event);
+   Parent::onTouchDragged(event);
 
    // Notify Script.
     if( isMethod("onMouseDragged") )

+ 16 - 17
engine/source/gui/guiTypes.cc

@@ -149,16 +149,16 @@ const ColorI& GuiBorderProfile::getBorderColor(const GuiControlState state)
 	switch (state)
 	{
 	default:
-	case normal:
+	case NormalState:
 		return mBorderColor;
 		break;
-	case highlight:
+	case HighlightState:
 		return mBorderColorHL;
 		break;
-	case selected:
+	case SelectedState:
 		return mBorderColorSL;
 		break;
-	case disabled:
+	case DisabledState:
 		return mBorderColorNA;
 		break;
 	}
@@ -169,16 +169,16 @@ S32 GuiBorderProfile::getBorder(const GuiControlState state)
 	switch (state)
 	{
 	default:
-	case normal:
+	case NormalState:
 		return mBorder;
 		break;
-	case highlight:
+	case HighlightState:
 		return mBorderHL;
 		break;
-	case selected:
+	case SelectedState:
 		return mBorderSL;
 		break;
-	case disabled:
+	case DisabledState:
 		return mBorderNA;
 		break;
 	}
@@ -285,7 +285,6 @@ GuiControlProfile::GuiControlProfile(void) :
          mFontColors[i] = def->mFontColors[i];
 
       // default bitmap
-      mBitmapName    = def->mBitmapName;
       mTextOffset    = def->mTextOffset;
 
       //used by GuiTextCtrl
@@ -475,16 +474,16 @@ const ColorI& GuiControlProfile::getFillColor(const GuiControlState state)
 	switch (state)
 	{
 	default:
-	case normal:
+	case NormalState:
 		return mFillColor;
 		break;
-	case highlight:
+	case HighlightState:
 		return mFillColorHL;
 		break;
-	case selected:
+	case SelectedState:
 		return mFillColorSL;
 		break;
-	case disabled:
+	case DisabledState:
 		return mFillColorNA;
 		break;
 	}
@@ -495,16 +494,16 @@ const ColorI& GuiControlProfile::getFontColor(const GuiControlState state)
 	switch (state)
 	{
 	default:
-	case normal:
+	case NormalState:
 		return mFontColor;
 		break;
-	case highlight:
+	case HighlightState:
 		return mFontColorHL;
 		break;
-	case selected:
+	case SelectedState:
 		return mFontColorSL;
 		break;
-	case disabled:
+	case DisabledState:
 		return mFontColorNA;
 		break;
 	}

+ 4 - 4
engine/source/gui/guiTypes.h

@@ -70,10 +70,10 @@ struct GuiEvent
 
 enum GuiControlState
 {
-	normal = 0,				//Control renders with default look
-	highlight,				//Control is highlighted
-	selected,				//Control has been selected
-	disabled				//Control cannot be used
+	NormalState = 0,				//Control renders with default look
+	HighlightState,				//Control is highlighted
+	SelectedState,				//Control has been selected
+	DisabledState				//Control cannot be used
 };
 
 class GuiCursor : public SimObject

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


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