Esempio n. 1
0
        protected void InternalConstruct(Control callingControl, 
                                         Source source, 
                                         Content c, 
                                         WindowContent wc, 
                                         FloatingForm ff,
                                         DockingManager dm,
                                         Point offset)
        {
            // Store the starting state
            _callingControl = callingControl;
            _source = source;
            _content = c;
            _windowContent = wc;
            _dockingManager = dm;
            _container = _dockingManager.Container;
            _floatingForm = ff;
            _hotZones = null;
            _currentHotZone = null;
            _insideRect = new Rectangle();
            _outsideRect = new Rectangle();
            _offset = offset;

            // Begin tracking straight away
            EnterTrackingMode();
        }
Esempio n. 2
0
        public WindowContent AddContentWithState(Content c, State newState)
        {
            // Validate the incoming Content instance is a valid reference
            // and is a current instance within our internal collection
            if ((c == null) || !_contents.Contains(c))
                return null;

            // Do not generate hiding/hidden/shown events
            _surpressVisibleEvents++;

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

            // Is the window already part of a WindowContent?
            if (c.ParentWindowContent != null)
            {
                // If it used to be in a floating mode, then record state change
                if (c.ParentWindowContent.ParentZone.State == State.Floating)
                    c.ContentLeavesFloating();

                // Remove the Content from its current WindowContent
                c.ParentWindowContent.Contents.Remove(c);
            }

            // Create a new Window instance appropriate for hosting a Content object
            Window w = CreateWindowForContent(c);

            ContainerControl destination = null;

            if (newState != State.Floating)
            {
                destination = _container;
                destination.SuspendLayout();
            }

            // Create a new Zone capable of hosting a WindowContent
            Zone z = CreateZoneForContent(newState, destination);

            if (newState == State.Floating)
            {
                // Content is not in the docked state
                c.Docked = false;

                // destination a new floating form
                destination = new FloatingForm(this, z);//, new ContextHandler(OnShowContextMenu));

                // Define its location
                destination.Location = c.DisplayLocation;

                // ...and its size, add the height of the caption bar to the requested content size
                destination.Size = new Size(c.FloatingSize.Width,
                                            c.FloatingSize.Height + SystemInformation.ToolWindowCaptionHeight);
            }

            // Add the Window to the Zone
            z.Windows.Add(w);

            if (newState != State.Floating)
            {
                // Set the Zone to be the least important of our Zones
                ReorderZoneToInnerMost(z);

                UpdateInsideFill();

                destination.ResumeLayout();
            }
            else
                destination.Show();

            // Enable generation hiding/hidden/shown events
            _surpressVisibleEvents--;

            // Generate event to indicate content is now visible
            OnContentShown(c);

            return w as WindowContent;
        }
Esempio n. 3
0
        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.RawContent:
                    {
                        // Perform State specific Restore actions
                        redock.Content.ContentBecomesFloating();

                        // 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.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.Location = new Point(_drawRect.Left, _drawRect.Top);
            floating.Size = new Size(_drawRect.Width, _drawRect.Height);

            // Show it!
            floating.Show();

            return true;
        }
Esempio n. 4
0
 public RedockerContent(FloatingForm ff, Point offset)
 {
     InternalConstruct(ff, Source.FloatingForm, null, null, ff, ff.DockingManager, offset);
 }