/// <summary>
        /// Initialize a new instance of the KryptonDockingEdgeAutoHidden class.
        /// </summary>
        /// <param name="name">Initial name of the element.</param>
        /// <param name="control">Reference to control that is being managed.</param>
        /// <param name="edge">Docking edge being managed.</param>
        public KryptonDockingEdgeAutoHidden(string name, Control control, DockingEdge edge)
            : base(name)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            _control = control;
            _edge = edge;
            _panelEventFired = false;

            // Create and add the panel used to host auto hidden groups
            _panel = new KryptonAutoHiddenPanel(edge);
            _panel.AutoSize = true;
            _panel.AutoSizeMode = AutoSizeMode.GrowAndShrink;
            _panel.Dock = DockingHelper.DockStyleFromDockEdge(edge, false);
            _panel.Disposed += new EventHandler(OnPanelDisposed);

            // Create the panel that slides into/out of view to show selected auto host entry
            _slidePanel = new KryptonAutoHiddenSlidePanel(control, edge, _panel);
            _slidePanel.SplitterMoveRect += new EventHandler<SplitterMoveRectMenuArgs>(OnSlidePanelSeparatorMoveRect);
            _slidePanel.SplitterMoved += new SplitterEventHandler(OnSlidePanelSeparatorMoved);
            _slidePanel.SplitterMoving += new SplitterCancelEventHandler(OnSlidePanelSeparatorMoving);
            _slidePanel.PageCloseClicked += new EventHandler<UniqueNameEventArgs>(OnSlidePanelPageCloseClicked);
            _slidePanel.PageAutoHiddenClicked += new EventHandler<UniqueNameEventArgs>(OnSlidePanelPageAutoHiddenClicked);
            _slidePanel.PageDropDownClicked += new EventHandler<CancelDropDownEventArgs>(OnSlidePanelPageDropDownClicked);
            _slidePanel.AutoHiddenShowingStateChanged += new EventHandler<AutoHiddenShowingStateEventArgs>(OnSlidePanelAutoHiddenShowingStateChanged);
            _slidePanel.Disposed += new EventHandler(OnSlidePanelDisposed);

            Control.Controls.Add(_panel);
        }
 /// <summary>
 /// Initialize a new instance of the KryptonDockspaceSeparator class.
 /// </summary>
 /// <param name="edge">Docking edge the separator is against.</param>
 /// <param name="opposite">Should the separator be docked against the opposite edge.</param>
 public KryptonDockspaceSeparator(DockingEdge edge, bool opposite)
 {
     // Setup docking specific settings for the separator
     Dock = DockingHelper.DockStyleFromDockEdge(edge, opposite);
     Orientation = DockingHelper.OrientationFromDockEdge(edge);
     SeparatorStyle = SeparatorStyle.LowProfile;
 }
        /// <summary>
        /// Initialize a new instance of the KryptonAutoHiddenSlidePanel class.
        /// </summary>
        /// <param name="control">Reference to control that is being managed.</param>
        /// <param name="edge">Docking edge being managed.</param>
        /// <param name="panel">Reference to auto hidden panel for this edge.</param>
        public KryptonAutoHiddenSlidePanel(Control control, DockingEdge edge, KryptonAutoHiddenPanel panel)
        {
            _control = control;
            _edge = edge;
            _panel = panel;
            _state = DockingAutoHiddenShowState.Hidden;
            _checkMakeHidden = new EventHandler(OnCheckMakeHidden);

            // We need to a timer to automate sliding in and out
            _slideTimer = new Timer();
            _slideTimer.Interval = SLIDE_INTERVAL;
            _slideTimer.Tick += new EventHandler(OnSlideTimerTick);

            // Timer used to delay between notification of need to slide inwards and performing actual slide
            _dismissTimer = new Timer();
            _dismissTimer.Interval = DISMISS_INTERVAL;
            _dismissTimer.Tick += new EventHandler(OnDismissTimerTick);
            _dismissRunning = false;

            // Create inner panel that holds the actual dockspace and separator
            _dockspaceSlide = new KryptonDockspaceSlide();
            _dockspaceSlide.Dock = DockStyle.Fill;
            _dockspaceSlide.AutoHiddenHost = true;
            _dockspaceSlide.PageCloseClicked += new EventHandler<UniqueNameEventArgs>(OnDockspacePageCloseClicked);
            _dockspaceSlide.PageAutoHiddenClicked += new EventHandler<UniqueNameEventArgs>(OnDockspacePageAutoHiddenClicked);
            _dockspaceSlide.PageDropDownClicked += new EventHandler<CancelDropDownEventArgs>(OnDockspacePageDropDownClicked);

            _separator = new KryptonDockspaceSeparator(edge, true);
            _separator.SplitterMoving += new SplitterCancelEventHandler(OnDockspaceSeparatorMoving);
            _separator.SplitterMoved += new SplitterEventHandler(OnDockspaceSeparatorMoved);
            _separator.SplitterMoveRect += new EventHandler<SplitterMoveRectMenuArgs>(OnDockspaceSeparatorMoveRect);

            _inner = new KryptonPanel();
            _inner.Controls.AddRange(new Control[] { _dockspaceSlide, _separator });
            Controls.Add(_inner);

            // Do not show ourself until we are needed
            Visible = false;

            // Add a Button that is not showing and used to push focus away from the dockspace
            _dummyTarget = new Button();
            _dummyTarget.Location = new Point(-200, -200);
            _dummyTarget.Size = new Size(100, 100);
            Controls.Add(_dummyTarget);

            // Add ourself into the target control for docking
            control.SizeChanged += new EventHandler(OnControlSizeChanged);
            control.Controls.Add(this);

            // Need to peek at windows messages so we can determine if mouse is over the slide out panel
            Application.AddMessageFilter(this);
        }
Example #4
0
        /// <summary>
        /// Initialize a new instance of the KryptonDockingEdge class.
        /// </summary>
        /// <param name="name">Initial name of the element.</param>
        /// <param name="control">Reference to control that is being managed.</param>
        /// <param name="edge">Docking edge being managed.</param>
        public KryptonDockingEdge(string name, Control control, DockingEdge edge)
            : base(name)
        {
            if (control == null)
                throw new ArgumentNullException("control");

            _control = control;
            _edge = edge;

            // Auto create elements for handling standard docked content and auto hidden content
            InternalAdd(new KryptonDockingEdgeAutoHidden("AutoHidden", control, edge));
            InternalAdd(new KryptonDockingEdgeDocked("Docked", control, edge));
        }
        /// <summary>
        /// Initialize a new instance of the KryptonDockingAutoHiddenGroup class.
        /// </summary>
        /// <param name="name">Initial name of the element.</param>
        /// <param name="edge">Docking edge being managed.</param>
        public KryptonDockingAutoHiddenGroup(string name, DockingEdge edge)
            : base(name)
        {
            _edge = edge;

            // Create a control that will draw tabs for auto hidden pages
            _autoHiddenGroup = new KryptonAutoHiddenGroup(edge);
            _autoHiddenGroup.StoringPage += new EventHandler<UniqueNameEventArgs>(OnAutoHiddenGroupStoringPage);
            _autoHiddenGroup.TabClicked += new EventHandler<KryptonPageEventArgs>(OnAutoHiddenGroupTabClicked);
            _autoHiddenGroup.TabMouseHoverStart += new EventHandler<KryptonPageEventArgs>(OnAutoHiddenGroupHoverStart);
            _autoHiddenGroup.TabMouseHoverEnd += new EventHandler(OnAutoHiddenGroupHoverEnd);
            _autoHiddenGroup.TabVisibleCountChanged += new EventHandler(OnAutoHiddenGroupTabVisibleCountChanged);
            _autoHiddenGroup.Disposed += new EventHandler(OnAutoHiddenGroupDisposed);
        }
Example #6
0
 /// <summary>
 /// Initialize a new instance of the KryptonDockingDockspace class.
 /// </summary>
 /// <param name="name">Initial name of the element.</param>
 /// <param name="edge">Docking edge this dockspace is against.</param>
 /// <param name="size">Initial size of the dockspace.</param>
 public KryptonDockingDockspace(string name, DockingEdge edge, Size size)
     : base(name, "Docked")
 {
     // Create a new dockspace that will be a host for docking pages
     SpaceControl = new KryptonDockspace();
     DockspaceControl.Size = size;
     DockspaceControl.Dock = DockingHelper.DockStyleFromDockEdge(edge, false);
     DockspaceControl.CellCountChanged += new EventHandler(OnDockspaceCellCountChanged);
     DockspaceControl.CellVisibleCountChanged += new EventHandler(OnDockspaceCellVisibleCountChanged);
     DockspaceControl.CellPageInserting += new EventHandler<KryptonPageEventArgs>(OnSpaceCellPageInserting);
     DockspaceControl.PageCloseClicked += new EventHandler<UniqueNameEventArgs>(OnDockspacePageCloseClicked);
     DockspaceControl.PageAutoHiddenClicked += new EventHandler<UniqueNameEventArgs>(OnDockspacePageAutoHiddenClicked);
     DockspaceControl.PagesDoubleClicked += new EventHandler<UniqueNamesEventArgs>(OnDockspacePagesDoubleClicked);
     DockspaceControl.PageDropDownClicked += new EventHandler<CancelDropDownEventArgs>(OnDockspaceDropDownClicked);
     DockspaceControl.BeforePageDrag += new EventHandler<PageDragCancelEventArgs>(OnDockspaceBeforePageDrag);
 }
Example #7
0
 /// <summary>
 /// Convert from DockEdge to DockStyle enumeration value.
 /// </summary>
 /// <param name="edge">DockEdge value to convert.</param>
 /// <param name="opposite">Should the separator be docked against the opposite edge.</param>
 /// <returns>DockStyle value.</returns>
 public static DockStyle DockStyleFromDockEdge(DockingEdge edge, bool opposite)
 {
     switch (edge)
     {
         case DockingEdge.Top:
             return (opposite ? DockStyle.Bottom : DockStyle.Top);
         case DockingEdge.Bottom:
             return (opposite ? DockStyle.Top : DockStyle.Bottom);
         case DockingEdge.Left:
             return (opposite ? DockStyle.Right : DockStyle.Left);
         case DockingEdge.Right:
             return (opposite ? DockStyle.Left : DockStyle.Right);
         default:
             // Should never happen!
             Debug.Assert(false);
             return DockStyle.Top;
     }
 }
 /// <summary>
 /// Initialize a new instance of the KryptonAutoHiddenPanel class.
 /// </summary>
 /// <param name="edge">Docking edge being managed.</param>
 public KryptonAutoHiddenPanel(DockingEdge edge)
 {
     // Add extra padding between the child items and the side facing inwards
     switch (edge)
     {
         case DockingEdge.Left:
             Padding = new Padding(0, 0, EXTRA_PADDING, 0);
             break;
         case DockingEdge.Right:
             Padding = new Padding(EXTRA_PADDING, 0, 0, 0);
             break;
         case DockingEdge.Top:
             Padding = new Padding(0, 0, 0, EXTRA_PADDING);
             break;
         case DockingEdge.Bottom:
             Padding = new Padding(0, EXTRA_PADDING, 0, 0);
             break;
     }
 }
        /// <summary>
        /// Initialize a new instance of the KryptonAutoHiddenGroup class.
        /// </summary>
        public KryptonAutoHiddenGroup(DockingEdge edge)
        {
            // Define appropriate appearance/behavior for an auto hidden group
            AutoSize = true;
            AutoSizeMode = AutoSizeMode.GrowAndShrink;
            AllowTabFocus = false;
            AllowTabSelect = false;
            Bar.TabBorderStyle = TabBorderStyle.DockEqual;
            Bar.TabStyle = TabStyle.DockAutoHidden;
            Bar.BarFirstItemInset = 3;
            Bar.BarLastItemInset = 12;
            Bar.BarMinimumHeight = 0;
            Button.ButtonDisplayLogic = ButtonDisplayLogic.None;
            Button.CloseButtonDisplay = ButtonDisplay.Hide;
            NavigatorMode = NavigatorMode.BarTabOnly;

            // Edge dependant values
            switch (edge)
            {
                case DockingEdge.Left:
                    Bar.BarOrientation = VisualOrientation.Right;
                    Bar.ItemOrientation = ButtonOrientation.FixedRight;
                    Dock = DockStyle.Top;
                    break;
                case DockingEdge.Right:
                    Bar.BarOrientation = VisualOrientation.Left;
                    Bar.ItemOrientation = ButtonOrientation.FixedRight;
                    Dock = DockStyle.Top;
                    break;
                case DockingEdge.Top:
                    Bar.BarOrientation = VisualOrientation.Bottom;
                    Bar.ItemOrientation = ButtonOrientation.FixedTop;
                    Dock = DockStyle.Left;
                    break;
                case DockingEdge.Bottom:
                    Bar.BarOrientation = VisualOrientation.Top;
                    Bar.ItemOrientation = ButtonOrientation.FixedTop;
                    Dock = DockStyle.Left;
                    break;
            }
        }
Example #10
0
 /// <summary>
 /// Convert the DockEdge to Orientation enumeration value.
 /// </summary>
 /// <param name="edge">DockEdge value to convert.</param>
 /// <returns>Orientation value.</returns>
 public static Orientation OrientationFromDockEdge(DockingEdge edge)
 {
     switch (edge)
     {
         case DockingEdge.Left:
         case DockingEdge.Right:
             return Orientation.Vertical;
         default:
             return Orientation.Horizontal;
     }
 }
Example #11
0
        /// <summary>
        /// Add set of pages docked against a specified edge of the specified control.
        /// </summary>
        /// <param name="path">Path for finding the target KryptonDockingControl.</param>
        /// <param name="edge">Target edge within the KryptonDockingControl.</param>
        /// <param name="pages">Array of pages to be added as docked.</param>
        /// <param name="stackPages">Extra arrays of pages to be added in a stacked manner.</param>
        /// <returns>KryptonDockingDockspace reference.</returns>
        public virtual KryptonDockingDockspace AddDockspace(string path, 
            DockingEdge edge,
            KryptonPage[] pages,
            params KryptonPage[][] stackPages)
        {
            // Cannot add a null array
            if (pages == null)
                throw new ArgumentNullException("pages");

            // Array must contain some values
            if (pages.Length == 0)
                throw new ArgumentException("pages cannot be zero length");

            // Cannot action a null page reference
            foreach (KryptonPage page in pages)
                if (page == null)
                    throw new ArgumentNullException("pages array contains a null page reference");

            // Resolve the given path to the expected docking control element
            KryptonDockingControl control = ResolvePath(path) as KryptonDockingControl;
            if (control == null)
                throw new ArgumentException("Path does not resolve to a KryptonDockingControl");

            // Find the requested target edge
            KryptonDockingEdge edgeElement = control[edge.ToString()] as KryptonDockingEdge;
            if (edgeElement == null)
                throw new ArgumentException("KryptonDockingControl does not have the requested edge.");

            // Find the docked edge
            KryptonDockingEdgeDocked edgeDocked = edgeElement["Docked"] as KryptonDockingEdgeDocked;
            if (edgeDocked == null)
                throw new ArgumentException("KryptonDockingControl edge does not have a docked element.");

            KryptonDockingDockspace dockspace = null;
            using (DockingMultiUpdate update = new DockingMultiUpdate(this))
            {
                // Create a new dockspace and add the provided array of pages
                dockspace = edgeDocked.AppendDockspace();
                dockspace.Append(pages);

                // If we have extra pages then we need to add a stack of tabbed cells
                if ((stackPages != null) && (stackPages.Length > 0))
                {
                    // For each array of pages...
                    foreach (KryptonPage[] pageArray in stackPages)
                        if ((pageArray != null) && (pageArray.Length > 0))
                        {
                            // We need a new cell with all the pages from the array
                            KryptonWorkspaceCell cell = new KryptonWorkspaceCell();
                            cell.Pages.AddRange(pageArray);

                            // Add into the root collection so the cells appear in a stack
                            dockspace.DockspaceControl.Root.Children.Add(cell);
                        }

                    // Set the correct direction for the stacking of cells at the root
                    switch (edge)
                    {
                        case DockingEdge.Left:
                        case DockingEdge.Right:
                            dockspace.DockspaceControl.Root.Orientation = Orientation.Vertical;
                            break;
                        case DockingEdge.Top:
                        case DockingEdge.Bottom:
                            dockspace.DockspaceControl.Root.Orientation = Orientation.Horizontal;
                            break;
                    }
                }
            }

            return dockspace;
        }
Example #12
0
        /// <summary>
        /// Add set of pages as a new auto hidden group to the specified edge of the specified control.
        /// </summary>
        /// <param name="path">Path for finding the target KryptonDockingControl.</param>
        /// <param name="edge">Target edge within the KryptonDockingControl.</param>
        /// <param name="pages">Array of pages to be added as an auto hidden group.</param>
        /// <param name="extraPages">Extra arrays of pages to be added as extra groups.</param>
        /// <returns>KryptonDockingAutoHiddenGroup reference.</returns>
        public virtual KryptonDockingAutoHiddenGroup AddAutoHiddenGroup(string path, 
            DockingEdge edge,
            KryptonPage[] pages,
            params KryptonPage[][] extraPages)
        {
            // Cannot add a null array
            if (pages == null)
                throw new ArgumentNullException("pages");

            // Array must contain some values
            if (pages.Length == 0)
                throw new ArgumentException("pages cannot be zero length");

            // Cannot action a null page reference
            foreach (KryptonPage page in pages)
                if (page == null)
                    throw new ArgumentNullException("pages array contains a null page reference");

            // Resolve the given path to the expected docking control element
            KryptonDockingControl control = ResolvePath(path) as KryptonDockingControl;
            if (control == null)
                throw new ArgumentException("Path does not resolve to a KryptonDockingControl");

            // Find the requested target edge
            KryptonDockingEdge edgeElement = control[edge.ToString()] as KryptonDockingEdge;
            if (edgeElement == null)
                throw new ArgumentException("KryptonDockingControl does not have the requested edge.");

            // Find the auto hidden edge
            KryptonDockingEdgeAutoHidden edgeAutoHidden = edgeElement["AutoHidden"] as KryptonDockingEdgeAutoHidden;
            if (edgeAutoHidden == null)
                throw new ArgumentException("KryptonDockingControl edge does not have an auto hidden element.");

            KryptonDockingAutoHiddenGroup autoHiddenGroup = null;
            using (DockingMultiUpdate update = new DockingMultiUpdate(this))
            {
                // Create a new auto hidden group and add the provided array of pages
                autoHiddenGroup = edgeAutoHidden.AppendAutoHiddenGroup();
                autoHiddenGroup.Append(pages);

                // If we have extra pages then we need to add extra auto hidden groups
                if ((extraPages != null) && (extraPages.Length > 0))
                {
                    // For each array of pages...
                    foreach (KryptonPage[] pageArray in extraPages)
                        if ((pageArray != null) && (pageArray.Length > 0))
                        {
                            // Create a new auto hidden group and add the provided array of pages
                            KryptonDockingAutoHiddenGroup extraAutoHiddenGroup = edgeAutoHidden.AppendAutoHiddenGroup();
                            extraAutoHiddenGroup.Append(pageArray);
                        }
                }
            }

            return autoHiddenGroup;
        }