Ejemplo n.º 1
0
        /// <summary>
        /// Initialize a new instance of the KryptonDockingFloatingWindow class.
        /// </summary>
        /// <param name="name">Initial name of the element.</param>
        /// <param name="owner">Reference to form that owns the floating windows.</param>
        /// <param name="floatspace">Reference to form that will own all the floating window.</param>
        /// <param name="useMinimiseBox">Allow window to be minimised.</param>
        public KryptonDockingFloatingWindow(string name, Form owner, KryptonDockingFloatspace floatspace, bool useMinimiseBox)
            : base(name)
        {
            if (owner == null)
            {
                throw new ArgumentNullException(nameof(owner));
            }

            FloatspaceElement           = floatspace ?? throw new ArgumentNullException(nameof(floatspace));
            FloatspaceElement.Disposed += OnDockingFloatspaceDisposed;

            // Create the actual window control and hook into events
            FloatingWindow = new KryptonFloatingWindow(owner, floatspace.FloatspaceControl, useMinimiseBox);
            FloatingWindow.WindowCloseClicked    += OnFloatingWindowCloseClicked;
            FloatingWindow.WindowCaptionDragging += OnFloatingWindowCaptionDragging;
            FloatingWindow.Disposed += OnFloatingWindowDisposed;

            // Create and add a control we use to obscure the floating window client area during multi-part operations
            _obscure = new ObscureControl
            {
                Anchor  = (AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Bottom),
                Visible = false
            };
            FloatingWindow.Controls.Add(_obscure);

            // Add the floatspace as the only child of this collection
            InternalAdd(floatspace);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Initialize a new instance of the DragTargetNull class.
 /// </summary>
 /// <param name="manager">Reference to docking manager.</param>
 /// <param name="floatingWindow">Reference to window being dragged.</param>
 /// <param name="pages">Reference to collection of pages to drag.</param>
 public DockingDragTargetProvider(KryptonDockingManager manager,
                                  KryptonFloatingWindow floatingWindow,
                                  KryptonPageCollection pages)
 {
     _manager        = manager;
     _floatingWindow = floatingWindow;
     _pages          = pages;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Propagates a request for drag targets down the hierarchy of docking elements.
        /// </summary>
        /// <param name="floatingWindow">Reference to window being dragged.</param>
        /// <param name="dragData">Set of pages being dragged.</param>
        /// <param name="targets">Collection of drag targets.</param>
        public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                                  PageDragEndData dragData,
                                                  DragTargetList targets)
        {
            // Create list of the pages that are allowed to be dropped into this navigator
            KryptonPageCollection pages = new();

            foreach (KryptonPage page in dragData.Pages.Where(static page => page.AreFlagsSet(KryptonPageFlags.DockingAllowNavigator)))
Ejemplo n.º 4
0
 /// <summary>
 /// Propagates a request for drag targets down the hierarchy of docking elements.
 /// </summary>
 /// <param name="floatingWindow">Reference to window being dragged.</param>
 /// <param name="dragData">Set of pages being dragged.</param>
 /// <param name="targets">Collection of drag targets.</param>
 public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                           PageDragEndData dragData,
                                           DragTargetList targets)
 {
     // Can only generate targets for a floating window that is actually visible and not the one being dragged
     if (FloatingWindow.Visible && (floatingWindow != FloatingWindow))
     {
         base.PropogateDragTargets(floatingWindow, dragData, targets);
     }
 }
Ejemplo n.º 5
0
        private static KryptonFloatingWindow FindFWindow(KryptonPage p)
        {
            KryptonFloatingWindow kfw = null;

            foreach (var item in kFWList)
            {
                if (item.Contains(p))
                {
                    kfw = item;
                }
                else
                {
                    continue;
                }
            }
            return(kfw);
        }
        /// <summary>
        /// Propagates a request for drag targets down the hierarchy of docking elements.
        /// </summary>
        /// <param name="floatingWindow">Reference to window being dragged.</param>
        /// <param name="dragData">Set of pages being dragged.</param>
        /// <param name="targets">Collection of drag targets.</param>
        public override void PropogateDragTargets(KryptonFloatingWindow floatingWindow,
                                                  PageDragEndData dragData,
                                                  DragTargetList targets)
        {
            // Create list of the pages that are allowed to be dropped into this workspace
            KryptonPageCollection pages = new();

            foreach (KryptonPage page in dragData.Pages)
            {
                if (page.AreFlagsSet(KryptonPageFlags.DockingAllowWorkspace))
                {
                    pages.Add(page);
                }
            }

            // Do we have any pages left for dragging?
            if (pages.Count > 0)
            {
                DragTargetList workspaceTargets = DockableWorkspaceControl.GenerateDragTargets(new PageDragEndData(this, pages), KryptonPageFlags.DockingAllowWorkspace);
                targets.AddRange(workspaceTargets.ToArray());
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Initialize a new instance of the FloatingWindowEventArgs class.
 /// </summary>
 /// <param name="floatingWindow">Reference to floating window instance.</param>
 /// <param name="element">Reference to docking floating winodw element that is managing the floating window.</param>
 public FloatingWindowEventArgs(KryptonFloatingWindow floatingWindow,
                                KryptonDockingFloatingWindow element)
 {
     FloatingWindow        = floatingWindow;
     FloatingWindowElement = element;
 }
Ejemplo n.º 8
0
        private KryptonPage MainFormNodeChaned(NodeInfo ninfo)
        {
            KryptonWorkspaceCell cell = kDWorkspaceContent.FirstVisibleCell();

            try
            {
                if (cell == null)
                {
                    cell = new KryptonWorkspaceCell();
                    kDWorkspaceContent.Root.Children.Add(cell);
                }

                #region 基于菜单表 要重写
                //新增 判断如果不存在则新增
                if (!_pageDic.ContainsKey(ninfo.NodeName) && kDWorkspaceContent.PageForUniqueName(ninfo.NodeName) == null)
                {
                    KryptonPage pageTmp = OpenForm(ninfo);
                    if (pageTmp != null)
                    {
                        cell.Pages.Add(pageTmp);
                        cell.SelectedPage = pageTmp;
                        cell.Focus();
                    }
                    return(pageTmp);
                }
                else if (_pageDic.ContainsKey(ninfo.NodeName) && kDWorkspaceContent.PageForUniqueName(ninfo.NodeName) != null)
                {
                    KryptonFloatingWindow kfw = FindFWindow(_pageDic[ninfo.NodeName]);
                    if (kfw == null)
                    {
                        //如果这个page已经存在那么就要把它找出来 不在FloatWindow里的情况
                        cell = kDWorkspaceContent.CellForUniqueName(ninfo.NodeName);
                        kDWorkspaceContent.ActiveCell = cell;
                        cell.SelectedPage             = _pageDic[ninfo.NodeName];
                        return(cell.SelectedPage);
                    }
                    else
                    {
                        kfw.Activate();
                        KryptonFloatspace kfs = kfw.FloatspaceControl;
                        kfs.SeparatorStyle = ComponentFactory.Krypton.Toolkit.SeparatorStyle.HighProfile;
                        Form f = kfw.FindForm();
                        cell              = kfs.CellForUniqueName(ninfo.NodeName);
                        kfs.ActiveCell    = cell;
                        cell.SelectedPage = _pageDic[ninfo.NodeName];
                        cell.Focus();
                        return(cell.SelectedPage);
                    }
                }
                else if (kDWorkspaceContent.PageForUniqueName(ninfo.NodeName) != null)
                {
                    KryptonPage pageTmp = kDWorkspaceContent.PageForUniqueName(ninfo.NodeName);
                    kDWorkspaceContent.ClosePage(pageTmp);
                    bool a = pageTmp.Visible;
                    //其他特殊情况
                    pageTmp = OpenForm(ninfo);

                    cell.Pages.Add(pageTmp);
                    cell.SelectedPage = pageTmp;
                    cell.Focus();
                    return(cell.SelectedPage);
                }
                return(null);

                #endregion
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }