예제 #1
0
        internal override void SetOwnerPanel(RibbonPanel ownerPanel)
        {
            base.SetOwnerPanel(ownerPanel);

            _dropDownItems.SetOwnerPanel(ownerPanel);
        }
예제 #2
0
 public RibbonPanelRenderEventArgs(Ribbon owner, Graphics g, Rectangle clip, RibbonPanel panel, Control canvas)
     : base(owner, g, clip)
 {
     Panel  = panel;
     Canvas = canvas;
 }
예제 #3
0
        /// <summary>
        /// Updates the regions of the panels and its contents
        /// </summary>
        internal void UpdatePanelsRegions()
        {
            if (Panels.Count == 0)
            {
                return;
            }

            bool dMode = Site != null && Site.DesignMode;

            if (!dMode)
            {
                _offset = 0;
            }

            int curRight  = TabContentBounds.Left + Owner.PanelPadding.Left + _offset;
            int panelsTop = TabContentBounds.Top + Owner.PanelPadding.Top;

            using (Graphics g = Owner.CreateGraphics())
            {
                //Check all at full size
                foreach (RibbonPanel panel in Panels)
                {
                    RibbonElementSizeMode sMode = panel.FlowsTo == RibbonPanelFlowDirection.Right ? RibbonElementSizeMode.Medium : RibbonElementSizeMode.Large;
                    //Set the bounds of the panel to let it know it's height
                    panel.SetBounds(new Rectangle(0, 0, 1, TabContentBounds.Height - Owner.PanelPadding.Vertical));

                    ///Size of the panel
                    Size size = panel.MeasureSize(this, new RibbonElementMeasureSizeEventArgs(g, sMode));

                    ///Creates the bounds of the panel
                    Rectangle bounds = new Rectangle(
                        curRight, panelsTop,
                        size.Width, size.Height);

                    ///Set the bouns of the panel
                    panel.SetBounds(bounds);

                    ///Let the panel know what size we have decided for it
                    panel.SetSizeMode(sMode);

                    ///Update curLeft
                    curRight = bounds.Right + 1 + Owner.PanelSpacing;
                }


                if (!dMode)
                {
                    while (curRight > TabContentBounds.Right && !AllPanelsOverflow())
                    {
                        #region Down grade the larger panel one position

                        RibbonPanel larger = GetLargerPanel();

                        if (larger.SizeMode == RibbonElementSizeMode.Large)
                        {
                            larger.SetSizeMode(RibbonElementSizeMode.Medium);
                        }
                        else if (larger.SizeMode == RibbonElementSizeMode.Medium)
                        {
                            larger.SetSizeMode(RibbonElementSizeMode.Compact);
                        }
                        else if (larger.SizeMode == RibbonElementSizeMode.Compact)
                        {
                            larger.SetSizeMode(RibbonElementSizeMode.Overflow);
                        }

                        Size size = larger.MeasureSize(this, new RibbonElementMeasureSizeEventArgs(g, larger.SizeMode));

                        larger.SetBounds(new Rectangle(larger.Bounds.Location, new Size(size.Width + Owner.PanelMargin.Horizontal, size.Height)));

                        #endregion

                        ///Reset x-axis reminder
                        curRight = TabContentBounds.Left + Owner.PanelPadding.Left;

                        ///Re-arrange location because of the new bounds
                        foreach (RibbonPanel panel in Panels)
                        {
                            Size s = panel.Bounds.Size;
                            panel.SetBounds(new Rectangle(new Point(curRight, panelsTop), s));
                            curRight += panel.Bounds.Width + 1 + Owner.PanelSpacing;
                        }
                    }
                }

                ///Update regions of all panels
                foreach (RibbonPanel panel in Panels)
                {
                    panel.UpdateItemsRegions(g, panel.SizeMode);
                }
            }

            UpdateScrollBounds();
        }
예제 #4
0
 /// <summary>
 /// Sets the value of the OwnerPanel property
 /// </summary>
 /// <param name="ownerPanel">RibbonPanel where this item is located</param>
 internal virtual void SetOwnerPanel(RibbonPanel ownerPanel)
 {
     _ownerPanel = ownerPanel;
 }