Exemple #1
0
        public override Node AddWindow(IntPtr hWnd, ValidateHwndParams validation = null)
        {
            int?index     = null;
            var focusNode = Desktop.FocusTracker.MyLastFocusNode(this);

            if (focusNode != null)
            {
                if (focusNode.CanHaveChilds)
                {
                    return(focusNode.AddWindow(hWnd, validation));
                }

                index = Childs.IndexOf(focusNode) + 1;
            }

            var node = windowTracker.CreateNode(hWnd, validation);

            if (node == null)
            {
                return(null);
            }

            if (node.Style == NodeStyle.Floating)
            {
                if (Parent?.AddNodes(node) ?? false)
                {
                    return(node);
                }
                else
                {
                    return(null);
                }
            }

            InsertChildAt(node, index);
            RecalcDeltaWithHeight();
            if (!TryUpdateChildRect(0, Childs.Count, out RECT newRect))
            {
                base.UpdateRect(newRect);
                RecalcDeltaWithHeight();
                OnRequestRectChange(this, new RequestRectChangeEventArg(this, Rect, newRect));
            }

            return(node);
        }