PageRenderTime 43ms CodeModel.GetById 12ms RepoModel.GetById 1ms app.codeStats 0ms

/Scenes/UserInterfaces/Designs/BorderedTextControlDesign.cs

#
C# | 64 lines | 29 code | 4 blank | 31 comment | 0 complexity | a87b46f7b581392f3b089a63ace26c05 MD5 | raw file
Possible License(s): Apache-2.0
  1. using Delta.Rendering.Basics.Materials;
  2. using Delta.Utilities.Datatypes;
  3. namespace Delta.Scenes.UserInterfaces.Designs
  4. {
  5. /// <summary>
  6. /// Bordered text control design
  7. /// </summary>
  8. public class BorderedTextControlDesign : TextControlDesign, IBorderedDesign
  9. {
  10. #region BorderWidth (Public)
  11. /// <summary>
  12. /// The width of the border which will be used for drawing the control.
  13. /// </summary>
  14. /// <returns>Float</returns>
  15. public float BorderWidth
  16. {
  17. get;
  18. set;
  19. }
  20. #endregion
  21. #region Constructors
  22. /// <summary>
  23. /// Create bordered design
  24. /// </summary>
  25. public BorderedTextControlDesign()
  26. {
  27. BorderWidth = BorderedControlDesign.DefaultBorderWidth;
  28. }
  29. #endregion
  30. #region DrawControl (Public)
  31. /// <summary>
  32. /// Draw control
  33. /// </summary>
  34. /// <param name="control">Control</param>
  35. /// <param name="drawArea">Draw area</param>
  36. public override void DrawControl(BaseControl control, Rectangle drawArea)
  37. {
  38. Material2DColored currentStyle = GetControlStyle(control);
  39. BorderedControlDesign.DrawStyleBordered(this, control, currentStyle,
  40. drawArea);
  41. //Label textControl = control as Label;
  42. //if (textControl != null)
  43. //{
  44. // // We only need to draw text if there is one
  45. // if (String.IsNullOrEmpty(textControl.Text) == false)
  46. // {
  47. // // Always draw the text even if the control is disabled
  48. // // Note: If the control is invisible, the draw won't be called anyway
  49. // DrawText(textControl);
  50. // } // if
  51. //} // if
  52. //else
  53. //{
  54. // throw new InvalidOperationException("The given control '" + control +
  55. // "' is no control with text, use a non-text control design instead.");
  56. //} // else
  57. }
  58. #endregion
  59. }
  60. }