PageRenderTime 82ms CodeModel.GetById 40ms app.highlight 3ms RepoModel.GetById 38ms app.codeStats 0ms

/Scenes/UserInterfaces/Designs/BorderedTextControlDesign.cs

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