Example #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();
        }
Example #2
0
        public void AddHotZones(Redocker redock, HotZoneCollection collection)
        {
            RedockerContent redocker = redock as RedockerContent;

            // Allow the contained Zone a chance to expose HotZones
            foreach(Control c in this.Controls)
            {
                IHotZoneSource ag = c as IHotZoneSource;

                // Does this control expose an interface for its own HotZones?
                if (ag != null)
                    ag.AddHotZones(redock, collection);
            }
        }
        public void AddHotZones(Redocker redock, HotZoneCollection collection)
        {
            RedockerContent redocker = redock as RedockerContent;

            bool itself = false;
            bool nullZone = false;

            // We process differently for WindowContent to redock into itself!
            if ((redocker.WindowContent != null) && (redocker.WindowContent == this))
                itself = true;

            // We do not allow a Content to redock into its existing container
            if (itself && !_contents.Contains(redocker.Content))
                nullZone = true;

            Rectangle newSize = this.RectangleToScreen(this.ClientRectangle);
            Rectangle hotArea = _tabControl.RectangleToScreen(_tabControl.ClientRectangle);;

            // Find any caption detail and use that area as the hot area
            foreach(WindowDetail wd in _windowDetails)
            {
                WindowDetailCaption wdc = wd as WindowDetailCaption;

                if (wdc != null)
                {
                    hotArea = wdc.RectangleToScreen(wdc.ClientRectangle);
                    hotArea.Inflate(_hotAreaInflate, _hotAreaInflate);
                    break;
                }
            }

            if (nullZone)
                collection.Add(new HotZoneNull(hotArea));
            else
                collection.Add(new HotZoneTabbed(hotArea, newSize, this, itself));				
        }
Example #4
0
        protected void AddHotZoneWithIndex(HotZoneCollection collection, Rectangle zoneArea, int length, int index)
        {
            // Find hot area and new size for first docking position
            Rectangle hotArea = zoneArea;
            Rectangle newSize = zoneArea;

            if (_direction == Direction.Vertical)
            {
                hotArea.Height = _hotVectorBeforeControl;
                newSize.Height = length;
            }
            else
            {
                hotArea.Width = _hotVectorBeforeControl;
                newSize.Width = length;
            }

            collection.Add(new HotZoneSequence(hotArea, newSize, this, index));				
        }
Example #5
0
		public void AddHotZones(Redocker redock, HotZoneCollection collection)
        {
            RedockerContent redocker = redock as RedockerContent;

            // Allow all the Window objects a chance to add HotZones
            foreach(Window w in _windows)
            {
                IHotZoneSource ag = w as IHotZoneSource;

                // Does this control expose an interface for its own HotZones?
                if (ag != null)
                    ag.AddHotZones(redock, collection);
            }

            // Check for situations that need extra attention...
            //
            //  (1) Do not allow a WindowContent from a ZoneSequence to be redocked into the
            //      same ZoneSequence. As removing it will cause the Zone to be destroyed and
            //      so it cannot be added back again. Is not logical anyway.
            //
            //  (2) If the source is in this ZoneSequence we might need to adjust the insertion
            //      index because the item being removed will reduce the count for when the insert
            //		takes place.

            bool indexAdjustTest = false;
            WindowContent redockWC = redocker.WindowContent;

            if (_windows.Count == 1)
            {
                if (redockWC != null)
                    if (redockWC == _windows[0])
                        if ((redocker.Content == null) || (redockWC.Contents.Count == 1))
                            return;
            }
            else
            {
                if (_windows.Contains(redockWC))
                {
                    if ((redocker.Content == null) || (redockWC.Contents.Count == 1))
                        indexAdjustTest = true;
                }
            }

            // Find the Zone client area in screen coordinates
            Rectangle zoneArea = this.RectangleToScreen(this.ClientRectangle);

            int length;

            // Give a rough idea of the new window size
            if (_direction == Direction.Vertical)
                length = zoneArea.Height / (_windows.Count + 1);
            else
                length = zoneArea.Width / (_windows.Count + 1);

            AddHotZoneWithIndex(collection, zoneArea, length, 0);

            int addative = 0;		
            int count = _windows.Count;
			
            for(int index=1; index<count; index++)
            {
                // Grab the Window for this index
                WindowContent wc = _windows[index] as WindowContent;

                if (indexAdjustTest)
                {	
                    if (wc == redockWC)
                        --addative;
                }

                AddHotZoneWithIndex(collection,
                                    wc.RectangleToScreen(wc.ClientRectangle), 
                                    length, 
                                    index + addative);
            }

            if (_windows.Count > 0)
            {
                // Find hot area and new size for last docking position
                Rectangle lastArea = zoneArea;
                Rectangle lastSize = zoneArea;

                if (_direction == Direction.Vertical)
                {
                    lastArea.Y = lastArea.Bottom - _hotVectorBeforeControl;
                    lastArea.Height = _hotVectorBeforeControl;
                    lastSize.Y = lastSize.Bottom - length;
                    lastSize.Height = length;
                }
                else
                {
                    lastArea.X = lastArea.Right - _hotVectorBeforeControl;
                    lastArea.Width = _hotVectorBeforeControl;
                    lastSize.X = lastSize.Right - length;
                    lastSize.Width = length;
                }

                collection.Add(new HotZoneSequence(lastArea, lastSize, this, _windows.Count + addative));
            }
        }
        protected void GenerateHotZones()
        {
            // Need the client rectangle for the whole Form
            Rectangle formClient = _container.RectangleToScreen(_container.ClientRectangle);

            // Create a fresh collection for HotZones
            _hotZones = new HotZoneCollection();

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

            // Create lists of Controls which are docked against each edge
            ArrayList topList = new ArrayList();
            ArrayList leftList = new ArrayList();
            ArrayList rightList = new ArrayList();
            ArrayList bottomList = new ArrayList();
            ArrayList fillList = new ArrayList();

            PreProcessControlsCollection(topList, leftList, rightList, bottomList, fillList, outerIndex);

            int vectorH;
            int vectorV;

            // Find the vectors required for calculating new sizes
            VectorDependsOnSourceAndState(out vectorH, out vectorV);

            GenerateHotZonesForTop(topList, formClient, vectorV, outerIndex);
            GenerateHotZonesForLeft(leftList, formClient, vectorH, outerIndex);
            GenerateHotZonesForRight(rightList, formClient, vectorH, outerIndex);
            GenerateHotZonesForBottom(bottomList, formClient, vectorV, outerIndex);
            GenerateHotZonesForFill(fillList, outerIndex);
            GenerateHotZonesForFloating(SizeDependsOnSource());
        }