//public void ShowDockWindow<T>() where T : DockWindow
        //{
        //	var w = FindWindow<T>();
        //	if( w != null && w.KryptonPage != null )
        //		w.KryptonPage.Show();
        //}

        public WorkspaceController(Control ownerControl, EditorForm editorForm)
        {
            this.ownerControl = ownerControl;
            this.editorForm   = editorForm;

            this.dockableWorkspaceControl = ownerControl.Controls.OfType <KryptonDockableWorkspace>().First();

            dockingManager = new KryptonDockingManager();

            var dockingWorkspace = new KryptonDockingWorkspace("DockingWorkspace", "Filler", dockableWorkspaceControl);

            dockingManager.Add(dockingWorkspace);

            if (this is WorkspaceControllerForForm)
            {
                var controlElement = new KryptonDockingControl("DockingControl", ownerControl, dockingWorkspace);
                dockingManager.Add(controlElement);
            }

            var floatingElement = new KryptonDockingFloating("DockingFloating", editorForm);

            dockingManager.Add(floatingElement);

            dockingManager.PageLoading         += DockingManager_PageLoading;
            dockingManager.PageSaving          += DockingManager_PageSaving;
            dockingManager.RecreateLoadingPage += DockingManager_RecreateLoadingPage;

            dockingManager.OrphanedPages    += DockingManager_OrphanedPages;
            dockingManager.PageCloseRequest += DockingManager_PageCloseRequest;

            dockableWorkspaceControl.WorkspaceCellAdding  += DockableWorkspace_WorkspaceCellAdding;
            dockableWorkspaceControl.WorkspaceCellRemoved += DockableWorkspace_WorkspaceCellRemoved;
            dockableWorkspaceControl.CellPageInserting    += DockableWorkspaceControl_CellPageInserting;
        }
Example #2
0
        /// <summary>
        /// Initialize a new instance of the DragTargetControlEdge class.
        /// </summary>
        /// <param name="screenRect">Rectangle for screen area.</param>
        /// <param name="hotRect">Rectangle for hot area.</param>
        /// <param name="drawRect">Rectangle for draw area.</param>
        /// <param name="hint">Target hint which should be one of the edges.</param>
        /// <param name="controlElement">Workspace instance that contains cell.</param>
        /// <param name="allowFlags">Only drop pages that have one of these flags defined.</param>
        /// <param name="outsideEdge">Add to the outside edge (otherwise the inner edge).</param>
        public DragTargetControlEdge(Rectangle screenRect,
                                     Rectangle hotRect,
                                     Rectangle drawRect,
                                     DragTargetHint hint,
                                     KryptonDockingControl controlElement,
                                     KryptonPageFlags allowFlags,
                                     bool outsideEdge)
            : base(screenRect, hotRect, drawRect, hint, allowFlags)
        {
            ControlElement = controlElement;
            _outsideEdge   = outsideEdge;

            // Find the orientation by looking for a matching hint (we need to exclude flags from the hint enum)
            switch (hint & DragTargetHint.ExcludeFlags)
            {
            case DragTargetHint.Transfer:
            case DragTargetHint.EdgeLeft:
                Edge = VisualOrientation.Left;
                break;

            case DragTargetHint.EdgeRight:
                Edge = VisualOrientation.Right;
                break;

            case DragTargetHint.EdgeTop:
                Edge = VisualOrientation.Top;
                break;

            case DragTargetHint.EdgeBottom:
                Edge = VisualOrientation.Bottom;
                break;

            default:
                Debug.Assert(false);
                throw new ArgumentOutOfRangeException(nameof(hint), @"Hint must be an edge value.");
            }
        }