Inheritance: ComponentFactory.Krypton.Toolkit.KryptonSeparator
Example #1
0
        /// <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 = OnCheckMakeHidden;

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

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

            // Create inner panel that holds the actual dockspace and separator
            _dockspaceSlide = new KryptonDockspaceSlide
            {
                Dock           = DockStyle.Fill,
                AutoHiddenHost = true
            };
            _dockspaceSlide.PageCloseClicked      += OnDockspacePageCloseClicked;
            _dockspaceSlide.PageAutoHiddenClicked += OnDockspacePageAutoHiddenClicked;
            _dockspaceSlide.PageDropDownClicked   += OnDockspacePageDropDownClicked;

            SeparatorControl = new KryptonDockspaceSeparator(edge, true);
            SeparatorControl.SplitterMoving   += OnDockspaceSeparatorMoving;
            SeparatorControl.SplitterMoved    += OnDockspaceSeparatorMoved;
            SeparatorControl.SplitterMoveRect += OnDockspaceSeparatorMoveRect;

            _inner = new KryptonPanel();
            _inner.Controls.AddRange(new Control[] { _dockspaceSlide, SeparatorControl });
            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
            {
                Location = new Point(-200, -200),
                Size     = new Size(100, 100)
            };
            Controls.Add(_dummyTarget);

            // Add ourself into the target control for docking
            control.SizeChanged += 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 #2
0
        private void OnDockspaceSeparatorMoved(object sender, SplitterEventArgs e)
        {
            // Cast to correct type and grab associated dockspace element
            KryptonDockspaceSeparator separatorControl = (KryptonDockspaceSeparator)sender;
            KryptonDockingDockspace   dockspaceElement = _lookupSeparator[separatorControl];

            // Update with delta change
            switch (Edge)
            {
            case DockingEdge.Left:
                dockspaceElement.DockspaceControl.Width += e.SplitX;
                break;

            case DockingEdge.Right:
                dockspaceElement.DockspaceControl.Width -= e.SplitX;
                break;

            case DockingEdge.Top:
                dockspaceElement.DockspaceControl.Height += e.SplitY;
                break;

            case DockingEdge.Bottom:
                dockspaceElement.DockspaceControl.Height -= e.SplitY;
                break;
            }

            if (_update)
            {
                // Inform our owning control that the update has ended, allowing the client area to be drawn
                KryptonDockingControl c = GetParentType(typeof(KryptonDockingControl)) as KryptonDockingControl;
                c.PropogateAction(DockingPropogateAction.EndUpdate, (string[])null);
                _update = false;
            }
        }
        private void OnDockspaceSeparatorMoveRect(object sender, SplitterMoveRectMenuArgs e)
        {
            // Cast to correct type and grab associated dockspace element
            KryptonDockspaceSeparator separatorControl = (KryptonDockspaceSeparator)sender;
            KryptonDockingDockspace   dockspaceElement = _lookupSeparator[separatorControl];

            // Events are generated from the parent docking manager
            KryptonDockingManager dockingManager = DockingManager;

            if (dockingManager != null)
            {
                // Allow the movement rectangle to be modified by event handlers
                DockspaceSeparatorResizeEventArgs dockspaceResizeRectArgs = new DockspaceSeparatorResizeEventArgs(separatorControl, dockspaceElement, FindMovementRect(dockspaceElement, e.MoveRect));
                dockingManager.RaiseDockspaceSeparatorResize(dockspaceResizeRectArgs);
                e.MoveRect = dockspaceResizeRectArgs.ResizeRect;
            }

            KryptonDockingControl c = GetParentType(typeof(KryptonDockingControl)) as KryptonDockingControl;

            if (c != null)
            {
                // Inform our owning control that an update is starting, this will prevent drawing of the control area
                c.PropogateAction(DockingPropogateAction.StartUpdate, (string[])null);
                _update = true;
            }
        }
Example #4
0
        private void OnDockingDockspaceHasVisibleCells(object sender, EventArgs e)
        {
            // Cast to correct type and grab associated separator control
            KryptonDockingDockspace   dockspaceElement = (KryptonDockingDockspace)sender;
            KryptonDockspaceSeparator separatorControl = _lookupDockspace[dockspaceElement];

            // Now have a visible cell so we show the controls
            dockspaceElement.DockspaceControl.Visible = true;
            separatorControl.Visible = true;
        }
Example #5
0
        private KryptonDockingDockspace CreateAndInsertDockspace(int index, string name, Size size)
        {
            // Create a dockspace separator do the dockspace can be resized
            KryptonDockspaceSeparator separatorControl = new KryptonDockspaceSeparator(Edge, false);

            separatorControl.SplitterMoveRect += OnDockspaceSeparatorMoveRect;
            separatorControl.SplitterMoved    += OnDockspaceSeparatorMoved;
            separatorControl.SplitterNotMoved += OnDockspaceSeparatorNotMoved;
            separatorControl.Disposed         += OnDockspaceSeparatorDisposed;

            // Create and add the dockspace to the collection
            KryptonDockingDockspace dockspaceElement = new KryptonDockingDockspace(name, Edge, size);

            dockspaceElement.HasVisibleCells   += OnDockingDockspaceHasVisibleCells;
            dockspaceElement.HasNoVisibleCells += OnDockingDockspaceHasNoVisibleCells;
            dockspaceElement.Disposed          += OnDockingDockspaceDisposed;
            InternalInsert(index, dockspaceElement);

            // Create lookup associations
            _lookupSeparator.Add(separatorControl, dockspaceElement);
            _lookupDockspace.Add(dockspaceElement, separatorControl);

            // Events are generated from the parent docking manager
            KryptonDockingManager dockingManager = DockingManager;

            if (dockingManager != null)
            {
                // Allow the dockspace and dockspace separator to be customized by event handlers
                DockspaceEventArgs          spaceArgs     = new DockspaceEventArgs(dockspaceElement.DockspaceControl, dockspaceElement);
                DockspaceSeparatorEventArgs separatorArgs = new DockspaceSeparatorEventArgs(separatorControl, dockspaceElement);
                dockingManager.RaiseDockspaceAdding(spaceArgs);
                dockingManager.RaiseDockspaceSeparatorAdding(separatorArgs);
            }

            if (index == 0)
            {
                InsertAtOuterMost(separatorControl);
                InsertAtOuterMost(dockspaceElement.DockspaceControl);
            }
            else if (index == (Count - 1))
            {
                InsertAtInnerMost(dockspaceElement.DockspaceControl);
                InsertAtInnerMost(separatorControl);
            }
            else
            {
                KryptonDockingDockspace target = this[index + 1] as KryptonDockingDockspace;
                InsertAfter(dockspaceElement.DockspaceControl, target.DockspaceControl);
                InsertAfter(separatorControl, target.DockspaceControl);
            }

            return(dockspaceElement);
        }
Example #6
0
        private void OnSlidePanelSeparatorMoveRect(object sender, SplitterMoveRectMenuArgs e)
        {
            // Cast to correct type and grab associated dockspace control
            KryptonDockspaceSeparator separatorControl = (KryptonDockspaceSeparator)sender;
            KryptonDockspace          dockspaceControl = _slidePanel.DockspaceControl;
            KryptonPage page = _slidePanel.Page;

            // Events are generated from the parent docking manager
            KryptonDockingManager dockingManager = DockingManager;

            if (dockingManager != null)
            {
                // Allow the movement rectangle to be modified by event handlers
                AutoHiddenSeparatorResizeEventArgs autoHiddenSeparatorResizeRectArgs = new AutoHiddenSeparatorResizeEventArgs(separatorControl, dockspaceControl, page, FindMovementRect(e.MoveRect));
                dockingManager.RaiseAutoHiddenSeparatorResize(autoHiddenSeparatorResizeRectArgs);
                e.MoveRect = autoHiddenSeparatorResizeRectArgs.ResizeRect;
            }
        }
Example #7
0
        private void OnDockspaceSeparatorDisposed(object sender, EventArgs e)
        {
            // Unhook from events so the control can be garbage collected
            KryptonDockspaceSeparator separatorControl = (KryptonDockspaceSeparator)sender;

            separatorControl.SplitterMoveRect -= OnDockspaceSeparatorMoveRect;
            separatorControl.SplitterMoved    -= OnDockspaceSeparatorMoved;
            separatorControl.SplitterNotMoved -= OnDockspaceSeparatorNotMoved;
            separatorControl.Disposed         -= OnDockspaceSeparatorDisposed;

            // Events are generated from the parent docking manager
            KryptonDockingManager dockingManager = DockingManager;

            if (dockingManager != null)
            {
                // Allow the dockspace and dockspace separator to be customized by event handlers
                DockspaceSeparatorEventArgs separatorArgs = new DockspaceSeparatorEventArgs(separatorControl, _lookupSeparator[separatorControl]);
                dockingManager.RaiseDockspaceSeparatorRemoved(separatorArgs);
            }

            // Remove lookup association
            _lookupSeparator.Remove(separatorControl);
        }
Example #8
0
        private void OnDockingDockspaceDisposed(object sender, EventArgs e)
        {
            // Cast to correct type and unhook event handlers so garbage collection can occur
            KryptonDockingDockspace dockspaceElement = (KryptonDockingDockspace)sender;

            dockspaceElement.HasVisibleCells   -= OnDockingDockspaceHasVisibleCells;
            dockspaceElement.HasNoVisibleCells -= OnDockingDockspaceHasNoVisibleCells;
            dockspaceElement.Disposed          -= OnDockingDockspaceDisposed;

            // Remove the element from our child collection as it is no longer valid
            InternalRemove(dockspaceElement);

            // Ensure the matching separator is also disposed
            KryptonDockspaceSeparator separatorControl = _lookupDockspace[dockspaceElement];

            if (!separatorControl.IsDisposed)
            {
                separatorControl.Dispose();
            }

            // Remove lookup association
            _lookupDockspace.Remove(dockspaceElement);
        }
        /// <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);
        }