/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
- using Delta.Rendering.Basics.Materials;
- using Delta.Utilities.Datatypes;
-
- namespace Delta.Scenes.UserInterfaces.Designs
- {
- /// <summary>
- /// Bordered text control design
- /// </summary>
- public class BorderedTextControlDesign : TextControlDesign, IBorderedDesign
- {
- #region BorderWidth (Public)
- /// <summary>
- /// The width of the border which will be used for drawing the control.
- /// </summary>
- /// <returns>Float</returns>
- public float BorderWidth
- {
- get;
- set;
- }
- #endregion
-
- #region Constructors
- /// <summary>
- /// Create bordered design
- /// </summary>
- public BorderedTextControlDesign()
- {
- BorderWidth = BorderedControlDesign.DefaultBorderWidth;
- }
- #endregion
-
- #region DrawControl (Public)
- /// <summary>
- /// Draw control
- /// </summary>
- /// <param name="control">Control</param>
- /// <param name="drawArea">Draw area</param>
- public override void DrawControl(BaseControl control, Rectangle drawArea)
- {
- Material2DColored currentStyle = GetControlStyle(control);
- BorderedControlDesign.DrawStyleBordered(this, control, currentStyle,
- drawArea);
-
- //Label textControl = control as Label;
- //if (textControl != null)
- //{
- // // We only need to draw text if there is one
- // if (String.IsNullOrEmpty(textControl.Text) == false)
- // {
- // // Always draw the text even if the control is disabled
- // // Note: If the control is invisible, the draw won't be called anyway
- // DrawText(textControl);
- // } // if
- //} // if
- //else
- //{
- // throw new InvalidOperationException("The given control '" + control +
- // "' is no control with text, use a non-text control design instead.");
- //} // else
- }
- #endregion
- }
- }