Exemple #1
0
        public override ControlStyleBuilderInfoList GetThemeDesignedControls(System.Windows.Forms.Control previewSurface)
        {
            RadPanelBar pane = new RadPanelBar();

            pane.GroupStyle = PanelBarStyles.OutlookNavPane;

            RadPanelBarGroupElement group  = new RadPanelBarGroupElement();
            RadPanelBarGroupElement group1 = new RadPanelBarGroupElement();
            RadPanelBarGroupElement group2 = new RadPanelBarGroupElement();
            RadPanelBarGroupElement group3 = new RadPanelBarGroupElement();

            pane.Items.Add(group);
            pane.Items.Add(group1);
            pane.Items.Add(group2);
            pane.Items.Add(group3);
            pane.Size = new Size(200, 220);

            OutlookStyle outlookStyle = pane.PanelBarElement.CurrentStyle as OutlookStyle;

            if (outlookStyle != null)
            {
                outlookStyle.ShowFewerButtons();
                outlookStyle.ShowFewerButtons();
            }

            ControlStyleBuilderInfoList controlStyleBuilderInfoList   = new ControlStyleBuilderInfoList();
            ControlStyleBuilderInfo     designControlStyleBuilderInfo = new ControlStyleBuilderInfo(pane, pane.RootElement);

            designControlStyleBuilderInfo.MainElementClassName = typeof(RadPanelBarElement).FullName;
            controlStyleBuilderInfoList.Add(designControlStyleBuilderInfo);
            return(controlStyleBuilderInfoList);
        }
Exemple #2
0
        private void RefreshItemsControlWidth()
        {
            if (this.itemsControl != null && this.panelBar != null)
            {
                RadPanelBar panelBar = this.panelBar.ElementTree.Control as RadPanelBar;

                if (panelBar != null)
                {
                    this.itemsControl.Width = panelBar.Width;
                }
            }
        }
Exemple #3
0
        private void RadPanelBarElement_PanelBarGroupCollapsed(object sender, PanelBarGroupEventArgs args)
        {
            if (this.Children.Count > 0 && this.ElementTree != null)
            {
                RadPanelBar panelBar = this.ElementTree.Control as RadPanelBar;

                if (panelBar != null && this.PanelBarStyle != PanelBarStyles.ExplorerBarStyle && this.PanelBarStyle != PanelBarStyles.VisualStudio2005ToolBox)
                {
                    panelBar.vScrollBar.Value       = 0;
                    this.Children[0].PositionOffset = new SizeF(
                        this.Children[0].PositionOffset.Width,
                        0);
                }
            }
        }
Exemple #4
0
        private bool ShouldUpdateScrollBar(RadPanelBar panelBar)
        {
            bool updateScrolling = false;

            if (!this.RightToLeft)
            {
                if (panelBar.Width - panelBar.vScrollBar.Width != panelBar.vScrollBar.Location.Y)
                {
                    return(true);
                }
            }

            if (this.groupStates.Count != this.Items.Count)
            {
                return(true);
            }

            if (groupStates.Count > 0)
            {
                for (int i = 0; i < groupStates.Count; i++)
                {
                    if (i >= this.Items.Count)
                    {
                        updateScrolling = true;
                        break;
                    }

                    RadPanelBarGroupElement group = this.Items[i] as RadPanelBarGroupElement;
                    if (groupStates[i] != group.Expanded)
                    {
                        updateScrolling = true;
                        break;
                    }
                }
            }
            else
            {
                updateScrolling = true;
            }

            if (panelBar.Height != height && height > 0)
            {
                updateScrolling = true;
            }
            return(updateScrolling);
        }
Exemple #5
0
        internal void SetStyle()
        {
            RadPanelBar panelBar = null;

            if (this.ElementTree != null)
            {
                panelBar = this.ElementTree.Control as RadPanelBar;
            }


            if (this.currentStyle != null)
            {
                this.currentStyle.GetBaseLayout().ArrangeModified -= new EventHandler(RadPanelBarElement_ArrangeModified);

                currentStyle.UnWireEvents();
            }

            this.Children.Clear();

            PanelBarStyleBase style = null;

            switch (PanelBarStyle)
            {
            case PanelBarStyles.ListBar:
                style = new ListBarStyle(this);
                break;

            case PanelBarStyles.ExplorerBarStyle:
                style = new ExplorerBarStyle(this);
                break;

            case PanelBarStyles.OutlookNavPane:
                style = new OutlookStyle(this, this.contentPanel, this.itemsControl);
                break;

            case PanelBarStyles.VisualStudio2005ToolBox:
                style = new VS2005Style(this);
                break;
            }

            bool styleChanged = false;

            if (this.currentStyle != null)
            {
                styleChanged = this.currentStyle.GetType() != style.GetType();
            }

            this.currentStyle = style;

            style.CreateChildren();

            if (panelBar != null && panelBar.CanScroll)
            {
                this.Children[0].PositionOffset = SizeF.Empty;
                panelBar.vScrollBar.Value       = 0;
                panelBar.vScrollBar.Visible     = false;
                this.groupStates.Clear();
            }

            style.WireEvents();

            RadPanelBarGroupElement selectedGroup = null;

            foreach (RadPanelBarGroupElement group in this.Items)
            {
                if (group.EnableHostControlMode)
                {
                    if (group.ContentPanelSize != null)
                    {
                        group.ApplyContentSize(group.ContentPanelSize.Value);
                    }

                    group.ResetContentPanelProperties();
                    this.currentStyle.SyncHostedPanels(new RadPanelBarGroupElement[] { group }, true);
                }
                else
                {
                    this.currentStyle.SyncHostedPanels(new RadPanelBarGroupElement[] { group }, false);
                }

                if (group.Selected && this.itemsControl != null)
                {
                    selectedGroup = group;
                }
            }

            if (styleChanged)
            {
                ResetGroupsOnStyleChanged(selectedGroup);
            }

            //this.currentStyle.UpdateGroupsUI();

            this.OnLoad();

            if (this.PanelBarStyle == PanelBarStyles.ListBar || this.PanelBarStyle == PanelBarStyles.OutlookNavPane)
            {
                return;
            }

            this.currentStyle.GetBaseLayout().ArrangeModified += new EventHandler(RadPanelBarElement_ArrangeModified);
        }
Exemple #6
0
        private void RadPanelBarElement_ArrangeModified(object sender, EventArgs e)
        {
            // ScrollBar logic
            if (this.ElementTree != null && this.ElementTree.Control is RadPanelBar && this.Items.Count > 0)
            {
                RadPanelBar panelBar        = this.ElementTree.Control as RadPanelBar;
                bool        updateScrolling = this.ShouldUpdateScrollBar(panelBar);

                if (!updateScrolling)
                {
                    return;
                }

                groupStates.Clear();

                if (!panelBar.CanScroll)
                {
                    this.Children[0].MaxSize = Size.Empty;
                    return;
                }

                if (panelBar.Width <= 0 || panelBar.Height <= 0)
                {
                    return;
                }

                if (panelBar.GroupStyle == PanelBarStyles.OutlookNavPane || panelBar.GroupStyle == PanelBarStyles.ListBar)
                {
                    panelBar.vScrollBar.Size  = Size.Empty;
                    panelBar.vScrollBar.Value = 0;
                    return;
                }

                int calculatedHeight = this.Items[this.Items.Count - 1].ControlBoundingRectangle.Bottom - (int)this.Children[0].PositionOffset.Height;

                bool isExplorerBar = this.PanelBarStyle == PanelBarStyles.ExplorerBarStyle && this.NumberOfColumns > 1;
                int  currentHeight = 0;

                if (isExplorerBar)
                {
                    int column    = 0;
                    int newHeight = 0;
                    foreach (RadPanelBarGroupElement group in this.Items)
                    {
                        currentHeight = Math.Max(group.ControlBoundingRectangle.Height + this.SpacingBetweenGroups, currentHeight);
                        column++;

                        if (column >= this.NumberOfColumns)
                        {
                            column        = 0;
                            newHeight    += currentHeight;
                            currentHeight = 0;
                        }
                    }

                    if (column > 0)
                    {
                        newHeight += currentHeight;
                    }

                    calculatedHeight = newHeight;
                }


                if (calculatedHeight > 4 + this.ElementTree.Control.Size.Height)
                {
                    int   y       = panelBar.vScrollBar.Value;
                    SizeF tmpSize = this.Children[0].PositionOffset;

                    if (!panelBar.vScrollBar.Visible)
                    {
                        this.Children[0].PositionOffset = SizeF.Empty;
                        panelBar.vScrollBar.Value       = 0;
                        panelBar.vScrollBar.Visible     = true;
                    }

                    int largeChange = panelBar.Size.Height / 2;
                    panelBar.vScrollBar.LargeChange = largeChange;

                    int calculatedItemsHeight = this.TopOffset + this.BorderThickness.Vertical;
                    foreach (RadPanelBarGroupElement group in this.Items)
                    {
                        groupStates.Add(group.Expanded);
                        calculatedItemsHeight += group.ControlBoundingRectangle.Height + this.SpacingBetweenGroups;
                    }

                    height = panelBar.Height;

                    int maximum = calculatedItemsHeight - panelBar.Size.Height + largeChange;

                    if (isExplorerBar)
                    {
                        maximum = calculatedHeight - panelBar.Size.Height + largeChange;
                    }

                    panelBar.vScrollBar.Maximum = maximum;


                    panelBar.vScrollBar.Size = new Size(17, panelBar.Size.Height - 2);

                    if (!this.RightToLeft)
                    {
                        panelBar.vScrollBar.Location = new Point(panelBar.Size.Width - 17, 1);
                    }
                    else
                    {
                        panelBar.vScrollBar.Location = new Point(0, 1);
                    }

                    this.Children[0].MaxSize = new Size(panelBar.Size.Width - panelBar.vScrollBar.Size.Width, 0);
                    if (y + largeChange >= maximum + 10)
                    {
                        y = maximum - largeChange;
                    }

                    panelBar.vScrollBar.Value = y;


                    this.Children[0].PositionOffset = new SizeF(
                        this.Children[0].PositionOffset.Width,
                        -panelBar.vScrollBar.Value);
                }
                else
                {
                    this.Children[0].MaxSize        = Size.Empty;
                    panelBar.vScrollBar.Visible     = false;
                    this.Children[0].PositionOffset = SizeF.Empty;
                    panelBar.vScrollBar.Value       = 0;
                }
            }
        }