protected override GuiElement DoFindElement(Point point) { GuiElement result = null; if (point.X >= (DrawPosition.X + Offset.X) && point.X < (DrawPosition.X + Offset.X + RenderSize.Width) && point.Y >= (DrawPosition.Y + Offset.Y) && point.Y < (DrawPosition.Y + Offset.Y + RenderSize.Height)) { GuiElement subElement = fDockPanel.FindElement(point); if (subElement != null) { result = subElement; } } return(result); }
protected override GuiElement DoFindElement(Point point) { GuiElement result = null; if (point.X >= (DrawPosition.X + Offset.X) && point.X < (DrawPosition.X + Offset.X + RenderSize.Width) && point.Y >= (DrawPosition.Y + Offset.Y) && point.Y < (DrawPosition.Y + Offset.Y + RenderSize.Height)) { foreach (var child in Childs) { GuiElement subElement = child.Control.FindElement(point); if (subElement != null) { result = subElement; break; } } } return(result); }
private void BuildDockPanelWithHeaders() { GuiElement selectedControl = null; List <GuiStackChild> headers = new List <GuiStackChild>(); if (Childs != null && Childs.Count > 0) { selectedControl = Childs[fSelectedIndex].Control; foreach (var child in Childs) { headers.Add(new GuiStackChild() { Control = child.Header }); child.Header.OnClick += Header_OnClick;// TODO remove later... } } fDockPanel = new GuiDockPanel() { LastChildFill = true, Childs = new List <GuiDockChild>() { new GuiDockChild() { Control = new GuiStackPanel() { Orientation = GuiStackPanelOrientation.Horizontal, Childs = headers }, Dock = GuiDock.Top }, new GuiDockChild() { Control = selectedControl } } }; fDockPanel.Parent = this; }
protected override GuiElement DoFindElement(Point point) { GuiElement result = null; int outerX0 = point.X + Offset.X; int outerY0 = point.Y + Offset.Y; int innerX0 = outerX0 + Border.Left; int innerY0 = outerY0 + Border.Top; int outerWidth = RenderSize.Width; int outerHeight = RenderSize.Height; int innerWidth = outerWidth - Border.Width; int innerHeigth = outerHeight - Border.Height; Rectangle topRect = new Rectangle(outerX0, outerY0, outerWidth - Border.Right, Border.Top); Rectangle bottomRect = new Rectangle(innerX0, outerY0 + innerHeigth + Border.Top, outerWidth, Border.Bottom); Rectangle leftRect = new Rectangle(outerX0, innerY0, Border.Left, outerHeight); Rectangle rightRect = new Rectangle(outerX0 + innerWidth + Border.Left, outerY0, Border.Right, outerHeight - Border.Bottom); if (point.X >= (DrawPosition.X + Offset.X + Border.Left) && point.X < (DrawPosition.X + Offset.X + RenderSize.Width - Border.Right) && point.Y >= (DrawPosition.Y + Offset.Y + Border.Top) && point.Y < (DrawPosition.Y + Offset.Y + RenderSize.Height - Border.Bottom)) { result = Content; if (result != null) { Point subPoint = new Point(point.X, point.Y); GuiElement subElement = Content.FindElement(subPoint); if (subElement != null) { result = subElement; } } } return(result); }