private void GenerateTabbedHotAreas(ArrayList controlList, bool suppress)
        {
            // Check each control in turn
            foreach (Control c in controlList)
            {
                ZoneSequence zs = c as ZoneSequence;

                // Look for zone sequences
                if (zs != null)
                {
                    // Find index within the list of child controls
                    int controlIndex = Container.Controls.IndexOf(c);

                    // Only interested in controls associated with docking
                    if (controlIndex < _outerIndex)
                    {
                        // Process all children, looking for tabbed content
                        foreach (Control zc in zs.Controls)
                        {
                            WindowContentTabbed wct = zc as WindowContentTabbed;

                            // Only interested in providing indicators for the WCT
                            if (wct != null)
                            {
                                // Not allowed to redock a content back to itself
                                bool disallowTabbed = (WindowContent != null) && (WindowContent == wct);

                                // Generate new hot area for the tabbed content window
                                _hotAreas.Add(new HotAreaTabbed(Squares, this, _dockingManager, zs, wct, disallowTabbed, suppress));
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        /// <summary>
        /// Initializes a new instance of the HotZoneTabbed class.
        /// </summary>
        /// <param name="hotArea">Screen area that is hot.</param>
        /// <param name="newSize">New size of hot zone.</param>
        /// <param name="wct">Tabbed content instance.</param>
        /// <param name="itself">Being moved within itself.</param>
        public HotZoneTabbed(Rectangle hotArea, Rectangle newSize, WindowContentTabbed wct, bool itself)
            : base(hotArea, newSize)
        {
            // Remember state
            _wct    = wct;
            _itself = itself;

            // Instead of a single rectangle for the dragging indicator we want to provide
            // two rectangles. One for the main area and another to show a tab extending
            // below it. This ensures the user can tell that it will be added as a new tab
            // page of the control.

            int tabHeight = _tabPageHeight;

            // Make sure the tab rectangle does not extend past end of control
            if (newSize.Height < (tabHeight + DragWidth))
            {
                tabHeight = newSize.Height - DragWidth * 3;
            }

            // Create the tab page extension
            _tabRect = new Rectangle(newSize.X + _tabPageLeft,
                                     newSize.Bottom - tabHeight - DragWidth,
                                     _tabPageWidth,
                                     tabHeight + DragWidth);

            // Make sure tab rectangle does not draw off right side of control
            if (_tabRect.Right > newSize.Right)
            {
                _tabRect.Width -= _tabRect.Right - newSize.Right;
            }

            // We want the intersection between the top left and top right corners to be displayed
            _tabRectTL = new Rectangle(_tabRect.X, _tabRect.Y, DragWidth, DragWidth);
            _tabRectTR = new Rectangle(_tabRect.Right - DragWidth, _tabRect.Y, DragWidth, DragWidth);

            // Reduce the main area by the height of the above item
            NewSize = new Rectangle(newSize.Left, newSize.Top, newSize.Width, newSize.Height - tabHeight);
        }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the TabStub class.
        /// </summary>
        /// <param name="style">Visual style for drawing.</param>
        /// <param name="stubsShowAll">Initial stubs value.</param>
        private TabStub(VisualStyle style, bool stubsShowAll)
        {
            // Default state
            _wct                = null;
            _style              = style;
            _hoverOver          = -1;
            _hoverItem          = -1;
            _selectedIndex      = -1;
            _defaultFont        = true;
            _defaultColor       = true;
            _stubsShowAll       = stubsShowAll;
            _edge               = Edge.None;
            _drawTabs           = new ArrayList();
            _tabPages           = new TabPageCollection();
            _colorDetails       = new ColorDetails();
            _colorDetails.Style = _style;
            base.Font           = new Font(SystemInformation.MenuFont, FontStyle.Regular);

            // Hookup to collection events
            _tabPages.Cleared  += new CollectionClear(OnClearedPages);
            _tabPages.Inserted += new CollectionChange(OnInsertedPage);
            _tabPages.Removing += new CollectionChange(OnRemovingPage);
            _tabPages.Removed  += new CollectionChange(OnRemovedPage);

            // Need notification when the MenuFont is changed
            Microsoft.Win32.SystemEvents.UserPreferenceChanged += new
                                                                  UserPreferenceChangedEventHandler(OnPreferenceChanged);

            // Default default colors
            DefineBackColor(SystemColors.Control);

            // Create the Timer for handling hovering over items
            _hoverTimer          = new Timer();
            _hoverTimer.Interval = _hoverInterval;
            _hoverTimer.Tick    += new EventHandler(OnTimerExpire);
        }
Exemple #4
0
        /// <summary>
        /// Initialize a new instance of the HotAreaTabbed class.
        /// </summary>
        /// <param name="squares">Squares or diamonds.</param>
        /// <param name="redocker">Reference to the redocker.</param>
        /// <param name="manager">Reference to docking manager.</param>
        /// <param name="zs">Sequence containing the tabbed content.</param>
        /// <param name="wct">Tabbed content instance.</param>
        /// <param name="disallowTabbed">Allow to drop in tabbed area.</param>
        /// <param name="suppress">Suppress indicators if match found.</param>
        public HotAreaTabbed(bool squares,
                             RedockerContent redocker,
                             DockingManager manager,
                             ZoneSequence zs,
                             WindowContentTabbed wct,
                             bool disallowTabbed,
                             bool suppress)
            : base(manager)
        {
            // Remember initial values
            _wct            = wct;
            _zs             = zs;
            _squares        = squares;
            _suppress       = suppress;
            _disallowTabbed = disallowTabbed;

            // Not currently inside the hot area
            _hotInside      = false;
            _disallowInsert = false;

            // Calculate the tabbed rectangle in screen coordinates
            _tabbedRect = wct.RectangleToScreen(wct.ClientRectangle);

            // 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 (_zs.Windows.Count == 1)
            {
                if (redocker.WindowContent != null)
                {
                    if (redocker.WindowContent == _zs.Windows[0])
                    {
                        if ((redocker.Content == null) || (redocker.WindowContent.Contents.Count == 1))
                        {
                            _disallowInsert = true;
                        }
                    }
                }
            }
            else
            {
                if (_zs.Windows.Contains(redockWC))
                {
                    if ((redocker.Content == null) || (redocker.WindowContent.Contents.Count == 1))
                    {
                        indexAdjustTest = true;
                    }
                }
            }

            // Create the left/top and right/bottom hot zones
            if (!_disallowInsert)
            {
                Rectangle zoneRectLT = zs.RectangleToScreen(zs.ClientRectangle);
                Rectangle tabbedRect = zs.Windows[0].RectangleToScreen(zs.Windows[0].ClientRectangle);

                // Adjust the rectangle to give rough idea of new size
                if (zs.Direction == LayoutDirection.Vertical)
                {
                    zoneRectLT.X      = tabbedRect.X;
                    zoneRectLT.Width  = tabbedRect.Width;
                    zoneRectLT.Height = zoneRectLT.Height / (zs.Windows.Count + 1);
                }
                else
                {
                    zoneRectLT.Y      = tabbedRect.Y;
                    zoneRectLT.Height = tabbedRect.Height;
                    zoneRectLT.Width  = zoneRectLT.Width / (zs.Windows.Count + 1);
                }

                // Store the rectangle for use with the RB as well
                Rectangle zoneRectRB = zoneRectLT;

                // Find our current index as starting point for insertion
                int indexLT = zs.Windows.IndexOf(wct);

                // The RB is inserted after the current position
                int indexRB = indexLT + 1;

                // If inserting after the first window
                if (indexLT > 0)
                {
                    // Move the indicator position to overlap the previous position
                    if (zs.Direction == LayoutDirection.Vertical)
                    {
                        zoneRectLT.Y += zs.Windows[indexLT].Top - (zoneRectLT.Height / 2);
                    }
                    else
                    {
                        zoneRectLT.X += zs.Windows[indexLT].Left - (zoneRectLT.Width / 2);
                    }
                }

                // Do we need to check if the removed WC is before the insert point?
                if (indexAdjustTest)
                {
                    // If the source window content is before the target then the
                    // index needs decreasing to ensure its removal is accounted for
                    if (zs.Windows.IndexOf(redocker.WindowContent) < indexLT)
                    {
                        indexLT--;
                    }
                }

                // Create the actual hot zone
                _hotLT = new HotZoneSequence(zoneRectLT, zoneRectLT, zs, indexLT);

                // If inserting before the last window
                if (indexRB < zs.Windows.Count)
                {
                    // Move the indicator position to overlap the next position
                    if (zs.Direction == LayoutDirection.Vertical)
                    {
                        zoneRectRB.Y += zs.Windows[indexRB - 1].Bottom - (zoneRectRB.Height / 2);
                    }
                    else
                    {
                        zoneRectRB.X += zs.Windows[indexRB - 1].Right - (zoneRectRB.Width / 2);
                    }
                }
                else
                {
                    // Move the indicator position to the end of our position
                    if (zs.Direction == LayoutDirection.Vertical)
                    {
                        zoneRectRB.Y += zs.Windows[indexRB - 1].Bottom - zoneRectRB.Height;
                    }
                    else
                    {
                        zoneRectRB.X += zs.Windows[indexRB - 1].Right - zoneRectRB.Width;
                    }
                }

                // Do we need to check if the removed WC is before the insert point?
                if (indexAdjustTest)
                {
                    // If the source window content is before the target then the
                    // index needs decreasing to ensure its removal is accounted for
                    if (zs.Windows.IndexOf(redocker.WindowContent) < indexRB)
                    {
                        indexRB--;
                    }
                }

                // Create the actual hot zone
                _hotRB = new HotZoneSequence(zoneRectRB, zoneRectRB, zs, indexRB);
            }

            // Create the insert into middle hot zone
            if (!_disallowTabbed)
            {
                _hotMiddle = new HotZoneTabbed(_tabbedRect, _tabbedRect, wct, false);
            }
        }