コード例 #1
0
ファイル: ContainerNode.cs プロジェクト: teast/TileWindow
        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);
        }
コード例 #2
0
        public override Node AddWindow(IntPtr hWnd, ValidateHwndParams validation = null)
        {
            if (MyFocusNode != null)
            {
                if (MyFocusNode.Style == NodeStyle.Floating)
                {
                    foreach (var child in Childs)
                    {
                        if (child.CanHaveChilds && typeof(ContainerNode).IsInstanceOfType(child))
                        {
                            return(child.AddWindow(hWnd, validation));
                        }
                    }

                    throw new Exception($"{nameof(FixedContainerNode)}.{nameof(AddWindow)} Unable to find a child node capable of storing nodes. Not possible to add hwnd: {hWnd}");
                }

                return(MyFocusNode.AddWindow(hWnd, validation));
            }

            throw new Exception($"{nameof(FixedContainerNode)}.{nameof(AddWindow)} was called with no MyFocusNode... what to do???");
        }
コード例 #3
0
ファイル: NodeTests.cs プロジェクト: teast/TileWindow
 public override Node AddWindow(IntPtr hWnd, ValidateHwndParams validation = null)
 {
     throw new NotImplementedException();
 }