// ///////////////////////////////////////////////////////////////////////////////// /// <summary> /// Construct a Control instance from the given template. /// </summary> /// <param name="template"></param> protected Control(ControlTemplate template) : base(template) { ScreenPosition = template.UpperLeftPos; HasKeyboardFocus = false; CanHaveKeyboardFocus = true; IsActive = true; this.HasFrame = true; this.TooltipText = template.Tooltip; this.HilightWhenMouseOver = false; this.IsActive = template.IsActiveInitially; }
// ///////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////// /// <summary> /// Layout helper - Aligns this control to the specified direction of the spcecified /// control template. This provides a means to specify control positions relative to /// previously created templates. /// </summary> /// <param name="toDirection"></param> /// <param name="ofControl"></param> /// <param name="padding"></param> public void AlignTo(LayoutDirection toDirection, ControlTemplate ofControl,int padding = 0) { switch (toDirection) { case LayoutDirection.North: AlignNorth(ofControl.CalculateRect(), padding); break; case LayoutDirection.NorthEast: AlignNorthEast(ofControl.CalculateRect(), padding); break; case LayoutDirection.East: AlignEast(ofControl.CalculateRect(), padding); break; case LayoutDirection.SouthEast: AlignSouthEast(ofControl.CalculateRect(), padding); break; case LayoutDirection.South: AlignSouth(ofControl.CalculateRect(), padding); break; case LayoutDirection.SouthWest: AlignSouthWest(ofControl.CalculateRect(), padding); break; case LayoutDirection.West: AlignWest(ofControl.CalculateRect(), padding); break; case LayoutDirection.NorthWest: AlignNorthWest(ofControl.CalculateRect(), padding); break; } }
// ///////////////////////////////////////////////////////////////////////////////// // ///////////////////////////////////////////////////////////////////////////////// // UNDONE: Implement /// <summary> /// Not implemented. /// </summary> /// <param name="template1"></param> /// <param name="template2"></param> public void AlignBetween(ControlTemplate template1, ControlTemplate template2) { }