Esempio n. 1
0
        private void GenerateFloatingHotAreas()
        {
            ContainerControl main = _dockingManager.Container;

            // Double check we have a defined container
            if (main != null)
            {
                Form mainForm = main.FindForm();

                // Double check we are part of a larger Form
                if (mainForm != null)
                {
                    foreach (Form f in mainForm.OwnedForms)
                    {
                        // Cannot redock entire Floating form onto itself
                        if ((f is FloatingForm) && (f != FloatingForm))
                        {
                            // Cast to correct type
                            FloatingForm ff = f as FloatingForm;

                            // Create a list with just the zone inside it
                            ArrayList controlList = new ArrayList();
                            controlList.Add(ff.Zone);

                            // Generate the hot areas for the contents of the zone
                            GenerateTabbedHotAreas(controlList, true);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Perform a restore using provided docking manager.
        /// </summary>
        /// <param name="dm">Reference to source.</param>
        public override void PerformRestore(DockingManager dm)
        {
            // Grab a list of all floating forms
            Form[] owned = dm.Container.FindForm().OwnedForms;

            FloatingForm target = null;

            // Find the match to one of our best friends
            foreach (Form f in owned)
            {
                FloatingForm ff = f as FloatingForm;

                if (ff != null)
                {
                    if (ZoneHelper.ContentNames(ff.Zone).Contains(_best))
                    {
                        target = ff;
                        break;
                    }
                }
            }

            // If no friends then try associates as second best option
            if (target == null)
            {
                // Find the match to one of our best friends
                foreach (Form f in owned)
                {
                    FloatingForm ff = f as FloatingForm;

                    if (ff != null)
                    {
                        if (ZoneHelper.ContentNames(ff.Zone).Contains(_associates))
                        {
                            target = ff;
                            break;
                        }
                    }
                }
            }

            // If we found a friend/associate, then restore to it
            if (target != null)
            {
                // We should have a child and be able to restore to its Zone
                Child.PerformRestore(target.Zone);
            }
            else
            {
                // Restore its location/size
                Content.DisplayLocation = _location;
                Content.DisplaySize     = _size;

                // Use the docking manage method to create us a new Floating Window at correct size/location
                dm.AddContentWithState(Content, State.Floating);
            }
        }
        /// <summary>
        /// Perform initialization.
        /// </summary>
        /// <param name="squares">Show squares or diamonds.</param>
        /// <param name="callingControl">Calling control instance.</param>
        /// <param name="source">Type of source.</param>
        /// <param name="c">Source content.</param>
        /// <param name="wc">WindowContent that contains content.</param>
        /// <param name="ff">Floating form source.</param>
        /// <param name="dm">DockingManager instance.</param>
        /// <param name="offset">Screen offset.</param>
        protected override void InternalConstruct(bool squares,
                                                  Control callingControl,
                                                  Source source,
                                                  Content c,
                                                  WindowContent wc,
                                                  FloatingForm ff,
                                                  DockingManager dm,
                                                  Point offset)
        {
            // Create the outline specific feedback indicator
            DragFeedback = new DragFeedbackOutline();

            // Carry on with internal setup
            base.InternalConstruct(squares, callingControl, source, c, wc, ff, dm, offset);
        }
Esempio n. 4
0
        /// <summary>
        /// Perform initialization.
        /// </summary>
        /// <param name="squares">Show squares or diamonds.</param>
        /// <param name="callingControl">Calling control instance.</param>
        /// <param name="source">Type of source.</param>
        /// <param name="c">Source content.</param>
        /// <param name="wc">WindowContent that contains content.</param>
        /// <param name="ff">Floating form source.</param>
        /// <param name="dm">DockingManager instance.</param>
        /// <param name="offset">Screen offset.</param>
        protected override void InternalConstruct(bool squares,
                                                  Control callingControl,
                                                  Source source,
                                                  Content c,
                                                  WindowContent wc,
                                                  FloatingForm ff,
                                                  DockingManager dm,
                                                  Point offset)
        {
            // Initialize zone specific details
            _hotZones       = null;
            _currentHotZone = null;

            // Let base class store information
            base.InternalConstruct(squares, callingControl, source, c, wc, ff, dm, offset);
        }
Esempio n. 5
0
        /// <summary>
        /// Create appropriate redocker for type of feedback.
        /// </summary>
        /// <param name="feedbackStyle">Feedback style requested.</param>
        /// <param name="ff">Floating form source.</param>
        /// <param name="offset">Screen offset.</param>
        /// <returns>Redocker instance.</returns>
        public static RedockerContent CreateRedocker(DragFeedbackStyle feedbackStyle,
                                                     FloatingForm ff,
                                                     Point offset)
        {
            switch (feedbackStyle)
            {
            case DragFeedbackStyle.Squares:
                return(new RedockerContentAreas(true, ff, offset));

            case DragFeedbackStyle.Diamonds:
                return(new RedockerContentAreas(false, ff, offset));

            case DragFeedbackStyle.Solid:
                return(new RedockerContentSolid(false, ff, offset));

            case DragFeedbackStyle.Outline:
            default:
                return(new RedockerContentOutline(false, ff, offset));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Perform initialization.
        /// </summary>
        /// <param name="squares">Show squares or diamonds.</param>
        /// <param name="callingControl">Calling control instance.</param>
        /// <param name="source">Type of source.</param>
        /// <param name="c">Source content.</param>
        /// <param name="wc">WindowContent that contains content.</param>
        /// <param name="ff">Floating form source.</param>
        /// <param name="dm">DockingManager instance.</param>
        /// <param name="offset">Screen offset.</param>
        protected virtual void InternalConstruct(bool squares,
                                                 Control callingControl,
                                                 Source source,
                                                 Content c,
                                                 WindowContent wc,
                                                 FloatingForm ff,
                                                 DockingManager dm,
                                                 Point offset)
        {
            // Store the starting state
            _squares        = squares;
            _insideRect     = new Rectangle();
            _outsideRect    = new Rectangle();
            _callingControl = callingControl;
            _source         = source;
            _content        = c;
            _windowContent  = wc;
            _dockingManager = dm;
            _container      = _dockingManager.Container;
            _floatingForm   = ff;
            _offset         = offset;

            // We do not allow docking in front of the outer index entry
            _outerIndex = FindOuterIndex();

            // Create lists of Controls which are docked against each edge
            _topList    = new ArrayList();
            _leftList   = new ArrayList();
            _rightList  = new ArrayList();
            _bottomList = new ArrayList();
            _fillList   = new ArrayList();

            PreProcessControlsCollection();

            // Find the vectors required for calculating new sizes
            VectorDependsOnSourceAndState();

            // Begin tracking straight away
            EnterTrackingMode();
        }
 /// <summary>
 /// Initializes a new instance of the RedockerContentOutline class.
 /// </summary>
 /// <param name="squares">Show squares or diamonds.</param>
 /// <param name="ff">Floating form source.</param>
 /// <param name="offset">Screen offset.</param>
 public RedockerContentOutline(bool squares, FloatingForm ff, Point offset)
     : base(squares, ff, offset)
 {
 }
Esempio n. 8
0
        /// <summary>
        /// Apply the hot zone change.
        /// </summary>
        /// <param name="screenPos">Screen position when change applied.</param>
        /// <param name="parent">Parent redocker instance.</param>
        /// <returns>true is successful; otherwise false.</returns>
        public override bool ApplyChange(Point screenPos, Redocker parent)
        {
            // Should always be the appropriate type
            RedockerContent redock = parent as RedockerContent;

            DockingManager dockingManager = redock.DockingManager;

            Zone newZone = null;

            // Manageing Zones should remove display AutoHide windows
            dockingManager.RemoveShowingAutoHideWindows();

            switch (redock.DockingSource)
            {
            case RedockerContent.Source.WindowContent:
                // Perform State specific Restore actions
                foreach (Content c in redock.WindowContent.Contents)
                {
                    c.ContentBecomesFloating();
                }

                // Remove WindowContent from old Zone
                if (redock.WindowContent.ParentZone != null)
                {
                    redock.WindowContent.ParentZone.Windows.Remove(redock.WindowContent);
                }

                // We need to create a Zone for containing the transfered content
                newZone = dockingManager.CreateZoneForContent(State.Floating);

                // Add into new Zone
                newZone.Windows.Add(redock.WindowContent);
                break;

            case RedockerContent.Source.ContentInsideWindow:
            {
                // Perform State specific Restore actions
                redock.Content.ContentBecomesFloating();

                // Remove Content from existing WindowContent
                if (redock.Content.ParentWindowContent != null)
                {
                    redock.Content.ParentWindowContent.Contents.Remove(redock.Content);
                }

                // Create a new Window to host Content
                Window w = dockingManager.CreateWindowForContent(redock.Content);

                // We need to create a Zone for containing the transfered content
                newZone = dockingManager.CreateZoneForContent(State.Floating);

                // Add into Zone
                newZone.Windows.Add(w);
            }
            break;

            case RedockerContent.Source.FloatingForm:
                redock.FloatingForm.Location = new Point(screenPos.X - _offset.X,
                                                         screenPos.Y - _offset.Y);

                return(false);
            }

            dockingManager.UpdateInsideFill();

            // Create a new floating form
            FloatingForm floating = new FloatingForm(redock.DockingManager, newZone,
                                                     new ContextHandler(dockingManager.OnShowContextMenu));

            // Find screen location/size
            _drawRect = new Rectangle(screenPos.X, screenPos.Y, NewSize.Width, NewSize.Height);

            // Adjust for mouse starting position relative to source control
            _drawRect.X -= _offset.X;
            _drawRect.Y -= _offset.Y;

            // Define its location/size
            floating.SetBounds(_drawRect.Left, _drawRect.Top, _drawRect.Width, _drawRect.Height);

            // Show it!
            floating.RequestShow();

            return(true);
        }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the RedockerContent class.
 /// </summary>
 /// <param name="squares">Show squares or diamonds.</param>
 /// <param name="ff">Floating form source.</param>
 /// <param name="offset">Screen offset.</param>
 public RedockerContent(bool squares, FloatingForm ff, Point offset)
 {
     InternalConstruct(squares, ff, Source.FloatingForm, null, null, ff, ff.DockingManager, offset);
 }