Ejemplo n.º 1
0
        /// <summary>
        /// Add the collection of hot zones.
        /// </summary>
        /// <param name="redock">Reference to a redocker instance.</param>
        /// <param name="collection">Collection of hot zones.</param>
        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));
            }
        }
Ejemplo n.º 2
0
        private void GenerateHotZonesForLeft(ArrayList leftList, Rectangle formClient, int vector, int outerIndex)
        {
            foreach (Control c in leftList)
            {
                bool ignoreType = (c is AutoHidePanel);

                int controlIndex = Container.Controls.IndexOf(c);

                if (!ignoreType && (controlIndex < outerIndex))
                {
                    // Grab the screen rectangle of the Control being processed
                    Rectangle hotArea = c.RectangleToScreen(c.ClientRectangle);

                    // Create the rectangle for the hot area
                    hotArea.Width = _hotVectorBeforeControl;

                    // Create the rectangle for the insertion indicator
                    Rectangle newSize = new Rectangle(hotArea.X, hotArea.Y, vector, hotArea.Height);

                    hotArea.X += _hotVectorFromEdge;

                    // Create the new HotZone used to reposition a docking content/windowcontent
                    _hotZones.Add(new HotZoneReposition(hotArea, newSize, State.DockLeft, controlIndex));

                    IHotZoneSource ag = c as IHotZoneSource;

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

            // Grab the screen rectangle of the Control being processed
            Rectangle fullArea = _outsideRect;

            // Create the rectangle for the hot area
            fullArea.Width = _hotVectorFromEdge;

            // Create the rectangle for the insertion indicator
            Rectangle fillSize = new Rectangle(fullArea.X, fullArea.Y, vector, fullArea.Height);

            _hotZones.Add(new HotZoneReposition(fullArea, fillSize, State.DockLeft, false));

            // If performing our own InsideFill then do not dock at inner positions
            if (!DockingManager.InsideFill)
            {
                // Create the HotArea at the left side of the inner rectangle
                Rectangle innerHotArea = new Rectangle(_insideRect.X, _insideRect.Y, _hotVectorBeforeControl, _insideRect.Height);

                // Create the rectangle for tgqhe insertion indicator
                Rectangle innerNewSize = new Rectangle(innerHotArea.X, innerHotArea.Y, vector, innerHotArea.Height);

                // Create a HotZone for docking to the Left at the innermost position
                _hotZones.Add(new HotZoneReposition(innerHotArea, innerNewSize, State.DockLeft, true));
            }
        }