예제 #1
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            float finalHeight = 0;

            RadPanelBarElement panelBar = (RadPanelBarElement)this.Parent;

            float y = 0;
            float x = 1;

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];

                PointF groupLocation = new PointF(x, y);

                SizeF groupSize = new SizeF(
                    availableSize.Width - 2,
                    availableSize.Height);

                RectangleF groupBounds = new RectangleF(groupLocation, groupSize);

                group.Measure(groupBounds.Size);

                finalHeight += y;
            }

            this.OnMeasureModified(EventArgs.Empty);

            return(availableSize);
        }
예제 #2
0
        /// <summary>
        /// Increases the number of outlook panel buttons, if panelbar view style is OutlookBar
        /// </summary>
        public void ShowMoreButtons()
        {
            for (int i = 0; i < this.panelBar.Items.Count; i++)
            {
                RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.panelBar.Items[i];
                if (group.Visibility == ElementVisibility.Collapsed)
                {
                    group.Visibility = ElementVisibility.Visible;
                    this.RemoveToggleButton(group);
                    break;
                }
            }

            if (this.panelBarOverFlow.Items.Count == this.panelBar.Items.Count)
            {
                this.showFewerButtonsMenuItem.Enabled = false;
            }
            else
            {
                this.showFewerButtonsMenuItem.Enabled = true;
            }

            if (this.panelBarOverFlow.Items.Count == 0)
            {
                this.showMoreButtonsMenuItem.Enabled = false;
            }
            else
            {
                this.showMoreButtonsMenuItem.Enabled = true;
            }
        }
예제 #3
0
        protected internal override void UpdateGroupsUI()
        {
            if (this.panelBar.Items.Count > 0)
            {
                bool selectedGroups = false;

                RadPanelBarGroupElement selectedGroup = null;



                foreach (RadPanelBarGroupElement group in this.panelBar.Items)
                {
                    group.ShowCaptionButton(false);
                    if (group.Selected)
                    {
                        selectedGroups     = true;
                        selectedGroup      = group;
                        this.selectedGroup = group;
                    }

                    group.CollapseChildren(false);
                    group.horizontalLayout.StretchHorizontally    = true;
                    group.verticalLayout.StretchHorizontally      = true;
                    group.verticalLayout.StretchVertically        = true;
                    group.verticalGroupLayout.StretchHorizontally = true;
                    group.verticalGroupLayout.StretchVertically   = true;
                    group.StretchVertically   = true;
                    group.StretchHorizontally = true;
                    group.GetCaptionElement().captionOffset = 0;
                }

                for (int i = this.panelBar.Items.Count - 1; i > -1; i--)
                {
                    RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.panelBar.Items[i];

                    if (group.Visibility == ElementVisibility.Collapsed)
                    {
                        InsertToggleButton(group);
                    }
                }

                if (selectedGroups)
                {
                    if (this.contentPanel != null)
                    {
                        this.contentPanel.Visible = true;
                    }

                    if (selectedGroup != null)
                    {
                        this.captionElement.Text = selectedGroup.Caption;
                        MoveContent(selectedGroup);
                        //           DoSelect(new RadPanelBarGroupElement[] { selectedGroup });
                    }

                    this.contentPanelHost.Visibility = ElementVisibility.Visible;
                    this.itemsControl.ShowChildren();
                }
            }
        }
예제 #4
0
        protected override System.Drawing.SizeF ArrangeOverride(System.Drawing.SizeF finalSize)
        {
            //base.ArrangeOverride(finalSize);
            float finalHeight = 0;

            RadPanelBarElement panelBar = (RadPanelBarElement)this.Parent;

            if (panelBar == null)
            {
                return(base.ArrangeOverride(finalSize));
            }

            float y       = panelBar.TopOffset;
            float x       = 1 + panelBar.LeftOffset;
            int   counter = 0;

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];

                PointF groupLocation = new PointF(x, y);

                SizeF groupSize = new SizeF(
                    (finalSize.Width - 2 - panelBar.LeftOffset - panelBar.RightOffset - ((panelBar.NumberOfColumns - 1) * panelBar.SpacingBetweenColumns)) / panelBar.NumberOfColumns,
                    group.DesiredSize.Height);


                if (counter >= panelBar.NumberOfColumns)
                {
                    x       = 1 + panelBar.LeftOffset;
                    counter = 0;

                    float maxHeight = 0;
                    for (int j = i - panelBar.NumberOfColumns; j < i; j++)
                    {
                        RadPanelBarGroupElement searchingGroup = (RadPanelBarGroupElement)this.Children[j];

                        maxHeight = Math.Max(maxHeight, searchingGroup.DesiredSize.Height - 1);
                    }

                    y            += maxHeight + panelBar.SpacingBetweenGroups;
                    groupLocation = new PointF(x, y);
                    x            += groupSize.Width + panelBar.SpacingBetweenColumns;
                }
                else
                {
                    x += groupSize.Width + panelBar.SpacingBetweenColumns;
                }

                RectangleF groupBounds = new RectangleF(groupLocation, groupSize);

                group.Arrange(groupBounds);

                finalHeight += y;
                counter++;
            }

            this.OnArrangeModified(EventArgs.Empty);
            return(finalSize);           // new SizeF(finalSize.Width, Math.Max(finalSize.Height, finalHeight));
        }
예제 #5
0
        protected override void DoExpand(RadPanelBarGroupElement[] groups)
        {
            PanelBarGroupCancelEventArgs groupCancelArgs = new PanelBarGroupCancelEventArgs(groups[0], false);

            this.panelBar.CallPanelBarGroupExpanding(groupCancelArgs);

            if (groupCancelArgs.Cancel)
            {
                return;
            }

            this.panelBar.BeginUpdate();
            for (int i = 0; i < groups.Length; i++)
            {
                RadPanelBarGroupElement group = groups[i];
                group.Expanded = true;
                group.Expand(true);
            }

            this.panelBar.EndUpdate();

            PanelBarGroupEventArgs groupArgs = new PanelBarGroupEventArgs(groups[0]);


            UpdateGroupsUI();
            this.panelBar.CallPanelBarGroupExpanded(groupArgs);


            return;
        }
예제 #6
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);
        }
예제 #7
0
        protected override System.Drawing.SizeF ArrangeOverride(System.Drawing.SizeF finalSize)
        {
            //base.ArrangeOverride(finalSize);
            float finalHeight = 0;

            RadPanelBarElement panelBar = (RadPanelBarElement)this.Parent;

            float y = 0;
            float x = 1;

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];

                PointF groupLocation = new PointF(x, y);

                SizeF groupSize = new SizeF(
                    finalSize.Width - 2,
                    group.DesiredSize.Height);

                y += group.DesiredSize.Height - 1;

                RectangleF groupBounds = new RectangleF(groupLocation, groupSize);

                group.Arrange(groupBounds);

                finalHeight += y;
            }

            this.OnArrangeModified(EventArgs.Empty);
            return(finalSize);
        }
예제 #8
0
 private void RemoveToggleButton(RadPanelBarGroupElement group)
 {
     foreach (RadAssociatedToggleButton button in this.panelBarOverFlow.Items)
     {
         if (button.group.Equals(group))
         {
             this.panelBarOverFlow.Items.Remove(button);
             break;
         }
     }
 }
예제 #9
0
 private void Items_ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
 {
     if (this.panelBar.CurrentStyle is ExplorerBarStyle)
     {
         RadPanelBarGroupElement group = target as RadPanelBarGroupElement;
         if (target != null)
         {
             target.RadPropertyChanged += new RadPropertyChangedEventHandler(target_RadPropertyChanged);
             group.ShowCaptionButton(true);
             UpdateGroupsUI();
         }
     }
 }
예제 #10
0
 public OverFlowAssociatedButton(RadPanelBarGroupElement group)
 {
     this.group        = group;
     this.groupCaption = group.Caption;
     this.SetImage();
     if (!this.group.Selected)
     {
         PerformMutualExclusion();
     }
     else
     {
         this.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
     }
 }
예제 #11
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);
        }
예제 #12
0
        private void MoveContent(RadPanelBarGroupElement group)
        {
            if (this.selectedGroup != null && this.selectedGroup.IsDisposed)
            {
                this.itemsControl.ItemsControlElement.GetBoxLayout().Children.Clear();
                return;
            }

            if (group != null)
            {
                if (group.EnableHostControlMode)
                {
                    if (this.panelBar.GetContentPanel() == null || !this.panelBar.GetContentPanel().Equals(group.ContentPanel))
                    {
                        this.panelBar.SetContentPanel(group.ContentPanel);
                        if (group.verticalGroupLayout.Children.Contains(group.ContentPanelHost))
                        {
                            group.verticalGroupLayout.Children.Remove(group.ContentPanelHost);
                        }
                    }

                    this.itemsControl.HideChildren();

                    if (this.selectedGroup != null && !this.selectedGroup.Equals(group))
                    {
                        this.selectedGroup.Items.Owner = this.selectedGroup.verticalGroupLayout;
                        this.selectedGroup.CollapseChildren(false);
                    }
                }
                else
                {
                    this.panelBar.SetContentPanel(null);
                    if (this.selectedGroup != null && !this.selectedGroup.Equals(group))
                    {
                        this.selectedGroup.Items.Owner = this.selectedGroup.verticalGroupLayout;
                        this.selectedGroup.CollapseChildren(false);
                    }

                    group.Items.Owner = this.itemsControl.ItemsControlElement.GetBoxLayout();
                    group.CollapseChildren(true);
                    this.panelBar.SetItemsControl(this.itemsControl);
                    this.itemsControl.ShowChildren();
                }
            }
        }
예제 #13
0
        private void Items_ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
        {
            RadPanelBarGroupElement group = target as RadPanelBarGroupElement;

            if (target != null)
            {
                group.ShowCaptionButton(false);
                group.CollapseChildren(false);
                group.horizontalLayout.StretchHorizontally    = true;
                group.verticalLayout.StretchHorizontally      = true;
                group.verticalLayout.StretchVertically        = true;
                group.verticalGroupLayout.StretchHorizontally = true;
                group.verticalGroupLayout.StretchVertically   = true;
                group.StretchVertically   = true;
                group.StretchHorizontally = true;
                //	UpdateGroupsUI();
            }
        }
예제 #14
0
        private void Items_ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
        {
            if (target != null)
            {
                if (this.panelBar.CurrentStyle is ListBarStyle)
                {
                    RadPanelBarGroupElement group = (RadPanelBarGroupElement)target;

                    group.horizontalLayout.StretchHorizontally    = true;
                    group.verticalLayout.StretchHorizontally      = true;
                    group.verticalLayout.StretchVertically        = true;
                    group.verticalGroupLayout.StretchHorizontally = true;
                    group.verticalGroupLayout.StretchVertically   = true;
                    group.StretchVertically   = true;
                    group.StretchHorizontally = true;
                }
            }
        }
예제 #15
0
        private void RearrangeGroupCollection()
        {
            this.panelBarElement.SuspendLayout();
            this.visibleItems.Clear();
            this.hiddenItems.Clear();

            for (int i = 0; i < this.checkedListBox1.Items.Count; i++)
            {
                RadPanelBarGroupElement group = GetGroupByCaption(this.checkedListBox1.Items[i]);

                CheckState isChecked = this.checkedListBox1.GetItemCheckState(i);
                if (isChecked == CheckState.Checked)
                {
                    visibleItems.Add(group);
                }
                else
                {
                    hiddenItems.Add(group);
                }
            }

            this.panelBarElement.Items.Clear();
            this.panelBarElement.hiddenGroupsList.Clear();

            foreach (RadPanelBarGroupElement group in visibleItems)
            {
                group.Items.Owner = group.verticalGroupLayout;
                this.panelBarElement.Items.Add(group);

                group.ShowCaptionButton(false);
            }

            foreach (RadPanelBarGroupElement group in hiddenItems)
            {
                group.Items.Owner = group.verticalGroupLayout;
                group.Selected    = false;
                this.panelBarElement.hiddenGroupsList.Add(group);
                group.ShowCaptionButton(false);
            }

            (this.panelBarElement.CurrentStyle as OutlookStyle).collapsingSteps.Clear();
            this.panelBarElement.SetStyle();
            this.panelBarElement.ResumeLayout(true);
        }
예제 #16
0
        protected override System.Drawing.SizeF ArrangeOverride(System.Drawing.SizeF finalSize)
        {
            float y            = 0;
            float groupsHeight = 0;

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];
                groupsHeight += group.CaptionHeight - 1;
            }

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];
                PointF groupLocation          = new PointF(1, y);
                SizeF  groupSize = new SizeF(
                    finalSize.Width - 2,
                    group.CaptionHeight - 1);



                if (group.Expanded)
                {
                    float preferredHeight = 0;
                    for (int j = 0; j < group.Items.Count; j++)
                    {
                        preferredHeight += group.Items[j].DesiredSize.Height;
                    }

                    groupSize = new SizeF(
                        finalSize.Width - 2,
                        finalSize.Height - groupsHeight + group.CaptionHeight - 3);
                }

                RectangleF groupBounds = new RectangleF(groupLocation, groupSize);
                group.Arrange(groupBounds);
                y += groupSize.Height;
            }

            this.OnArrangeModified(EventArgs.Empty);
            return(finalSize);
        }
예제 #17
0
        private void ResetGroupsOnStyleChanged(RadPanelBarGroupElement selectedGroup)
        {
            for (int i = 0; i < this.Items.Count; i++)
            {
                RadPanelBarGroupElement group = this.Items[i] as RadPanelBarGroupElement;
                group.Selected = false;
                group.Expanded = false;
            }

            if (selectedGroup != null)
            {
                selectedGroup.Items.Owner = selectedGroup.verticalGroupLayout;
            }

            if (this.currentStyle is OutlookStyle && this.Items.Count > 0)
            {
                RadPanelBarGroupElement group = this.Items[0] as RadPanelBarGroupElement;
                group.Selected = true;
            }
        }
예제 #18
0
 private void Items_ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
 {
     if (this.panelBar.CurrentStyle is VS2005Style)
     {
         RadPanelBarGroupElement group = target as RadPanelBarGroupElement;
         if (target != null)
         {
             target.RadPropertyChanged += new RadPropertyChangedEventHandler(target_RadPropertyChanged);
             group.ShowCaptionButton(true);
             UpdateGroupsUI();
             group.horizontalLayout.StretchHorizontally    = true;
             group.verticalLayout.StretchHorizontally      = true;
             group.verticalLayout.StretchVertically        = true;
             group.verticalGroupLayout.StretchHorizontally = true;
             group.verticalGroupLayout.StretchVertically   = true;
             group.StretchVertically   = true;
             group.StretchHorizontally = true;
         }
     }
 }
예제 #19
0
 public RadPanelBarCaptionButton(RadPanelBarGroupElement owner)
 {
     this.owner = owner;
 }
예제 #20
0
        protected override void PaintImage(Telerik.WinControls.Paint.IGraphics graphics)
        {
            if (this.ElementState != ElementState.Loaded || !this.AllowImageAlignment)
            {
                base.PaintImage(graphics);
                return;
            }
            ImageList associatedImageList = this.ElementTree.ComponentTreeHandler.ImageList;

            if (associatedImageList != null && this.ImageIndex > -1 && this.ImageIndex < associatedImageList.Images.Count)
            {
                RadPanelBarGroupElement group = this.GetGroupElement();
                if (group != null)
                {
                    if (group.GetPanelBarElement() != null)
                    {
                        if (group.GetPanelBarElement().ElementTree != null)
                        {
                            if (this.Image == null)
                            {
                                this.Image = associatedImageList.Images[this.ImageIndex];
                            }
                        }
                    }
                }
            }
            else
            {
                if (associatedImageList != null && !String.IsNullOrEmpty(this.ImageKey))
                {
                    RadPanelBarGroupElement group = this.GetGroupElement();
                    if (group != null)
                    {
                        if (group.GetPanelBarElement() != null)
                        {
                            if (group.GetPanelBarElement().ElementTree != null)
                            {
                                if (this.Image == null)
                                {
                                    this.Image = associatedImageList.Images[this.ImageKey];
                                }
                            }
                        }
                    }
                }
            }

            int offset = InitialOffset + captionOffset;

            if (this.Image == null)
            {
                return;
            }

            if (this.ElementTree.Control.RightToLeft == System.Windows.Forms.RightToLeft.Yes)
            {
                offset = this.Size.Width - InitialOffset - captionOffset - Image.Size.Width;
            }

            switch (this.ImageAlignment)
            {
            case ContentAlignment.BottomLeft:
                graphics.DrawBitmap(this.Image, offset, (this.Size.Height - this.Image.Height));
                break;

            case ContentAlignment.BottomCenter:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) / 2, (this.Size.Height - this.Image.Height));
                break;

            case ContentAlignment.BottomRight:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) - offset, (this.Size.Height - this.Image.Height));
                break;

            case ContentAlignment.MiddleLeft:
                graphics.DrawBitmap(this.Image, offset, (this.Size.Height - this.Image.Height) / 2);
                break;

            case ContentAlignment.MiddleRight:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) - offset, (this.Size.Height - this.Image.Height) / 2);
                break;

            case ContentAlignment.MiddleCenter:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) / 2, (this.Size.Height - this.Image.Height) / 2);
                break;

            case ContentAlignment.TopLeft:
                graphics.DrawBitmap(this.Image, offset, 0);
                break;

            case ContentAlignment.TopCenter:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) / 2, 0);
                break;

            case ContentAlignment.TopRight:
                graphics.DrawBitmap(this.Image, (this.Size.Width - this.Image.Width) - offset, 0);
                break;
            }
        }
예제 #21
0
 public PanelBarGroupEventArgs(RadPanelBarGroupElement group)
 {
     this.group = group;
 }
예제 #22
0
 public void InitializeChild(List <GroupItem> gitems)
 {
     base.SuspendLayout();
     if (gitems != null)
     {
         foreach (GroupItem item in gitems)
         {
             if (item.visable)
             {
                 RadPanelBarGroupElement element = new RadPanelBarGroupElement();
                 //RadPageViewElement element = RadPageViewElement.
                 if (this.GetSetting().ShowGroupTtile)
                 {
                     element.Caption = item.name;
                     element.Font    = new Font(this.Font.Name, this.GetSetting().GroupTitleFontSize);
                 }
                 else
                 {
                     element.Caption = "";
                 }
                 element.ContentPanel.SuspendLayout();
                 element.ContentPanel.BackColor        = Color.FromArgb(0xf8, 0xf8, 0xf8);
                 element.ContentPanel.CausesValidation = true;
                 element.EnableHostControlMode         = true;
                 int num = 0;
                 foreach (ToolItem item2 in item.ToolItems)
                 {
                     string    tip;
                     RadButton radButton;
                     if (item2.visable)
                     {
                         radButton = new RadButton();
                         radButton.BeginInit();
                         element.ContentPanel.Controls.Add(radButton);
                         radButton.AllowShowFocusCues = true;
                         radButton.ForeColor          = Color.Black;
                         radButton.Location           = new Point(this.GetSetting().SetButtonSize *(num % 4), 12 + (this.GetSetting().SetButtonSize *(num / 4)));
                         num++;
                         radButton.Margin = new Padding(5, 5, 5, 5);
                         radButton.Name   = item2.name;
                         radButton.RootElement.ForeColor = Color.Black;
                         radButton.Size = new Size(this.GetSetting().SetButtonSize - 2, this.GetSetting().SetButtonSize - 2);
                         radButton.Text = item2.text;
                         string path = SystemHelper.ResourceDir + item2.image;
                         if (File.Exists(path))
                         {
                             radButton.Image = DocScanner.ImgUtils.ImageHelper.LoadSizedImage(path, this.GetSetting().SetButtonSize - 5, this.GetSetting().SetButtonSize - 5, "");
                             radButton.SmallImageScalingSize = new Size(this.GetSetting().SetButtonSize - 2, this.GetSetting().SetButtonSize - 2);
                             radButton.Text = "";
                         }
                         radButton.MouseClick      += new MouseEventHandler(this.radButton_MouseClick);
                         radButton.Tag              = item2.action;
                         radButton.ShowItemToolTips = true;
                         tip = item2.tip;
                         radButton.ToolTipTextNeeded += (sender, e) => this._tip.Show(tip, radButton);
                         radButton.EndInit();
                     }
                 }
                 element.ContentPanel.ResumeLayout();
                 base.Items.Add(element);
             }
         }
         foreach (RadPanelBarGroupElement element2 in base.Items)
         {
             element2.Expanded            = true;
             element2.StretchHorizontally = true;
         }
     }
     base.ResumeLayout();
 }
예제 #23
0
        private void InsertToggleButton(RadPanelBarGroupElement group)
        {
            RadAssociatedToggleButton toggleButton = new RadAssociatedToggleButton(group);

            int index = this.panelBar.Items.IndexOf(group);

            if (group == null)
            {
                return;
            }

            if (group.horizontalLayout == null)
            {
                return;
            }

            if (group.horizontalLayout == null)
            {
                return;
            }

            if (group.horizontalLayout.Children.Count == 0)
            {
                return;
            }


            Bitmap bmp = null;

            if ((group.horizontalLayout.Children[0] as RadPanelBarVisualElement).Image != null)
            {
                bmp = new Bitmap((group.horizontalLayout.Children[0] as RadPanelBarVisualElement).Image, 16, 16);
            }
            toggleButton.Image = bmp;



            if (toggleButton.Image == null)
            {
                toggleButton.Image = new Bitmap(16, 16);


                Assembly currentAssembly = Assembly.GetExecutingAssembly();
                string[] s = currentAssembly.GetManifestResourceNames();
                string   p = "";
                foreach (string str in s)
                {
                    if (str.EndsWith("2Telerik.bmp"))
                    {
                        p = str;
                    }
                }
                if (p != "")
                {
                    toggleButton.Image = Image.FromStream(Telerik.WinControls.TelerikHelper.GetStreamFromResource(currentAssembly, p));
                }
            }

            //set ToolTip text for toggle button
            if (group.ToolTipText != null && group.ToolTipText != String.Empty)
            {
                toggleButton.ToolTipText = group.ToolTipText;
            }
            else if (group.Caption != null && group.Caption != String.Empty)
            {
                toggleButton.ToolTipText = group.Caption;
            }

            int indx = this.panelBar.Items.Count - 1 - index;

            if (indx < this.panelBarOverFlow.Items.Count)
            {
                this.panelBarOverFlow.Items.Insert(indx, toggleButton);
            }
            else
            {
                this.panelBarOverFlow.Items.Add(toggleButton);
            }

            toggleButton.ToggleStateChanged += new StateChangedEventHandler(toggleButton_ToggleStateChanged);

            if (group.Selected)
            {
                toggleButton.ToggleState = Telerik.WinControls.Enumerations.ToggleState.On;
            }
        }
예제 #24
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            float finalHeight = 0;

            RadPanelBarElement panelBar = (RadPanelBarElement)this.Parent;

            if (panelBar == null)
            {
                return(base.MeasureOverride(availableSize));
            }

            base.MeasureOverride(availableSize);

            float y       = panelBar.TopOffset;
            float x       = 1 + panelBar.LeftOffset;
            int   counter = 0;

            for (int i = 0; i < this.Children.Count; i++)
            {
                RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];

                PointF groupLocation = new PointF(x, y);


                SizeF groupSize = new SizeF(
                    (availableSize.Width - 2 - panelBar.LeftOffset - panelBar.RightOffset - ((panelBar.NumberOfColumns - 1) * panelBar.SpacingBetweenColumns)) / panelBar.NumberOfColumns,
                    availableSize.Height);


                //	group.Measure(availableSize);

                if (counter >= panelBar.NumberOfColumns)
                {
                    x       = 1 + panelBar.LeftOffset;
                    counter = 0;

                    float maxHeight = 0;
                    for (int j = i - panelBar.NumberOfColumns; j < i; j++)
                    {
                        RadPanelBarGroupElement searchingGroup = (RadPanelBarGroupElement)this.Children[j];

                        maxHeight = Math.Max(maxHeight, searchingGroup.DesiredSize.Height);
                    }


                    y            += maxHeight + panelBar.SpacingBetweenGroups;
                    groupLocation = new PointF(x, y);
                }
                else
                {
                    x += groupSize.Width + panelBar.SpacingBetweenColumns;
                }

                int captionSize = (int)group.GetCaptionElement().DesiredSize.Height;

                RectangleF groupBounds = new RectangleF(groupLocation, groupSize);
                group.Measure(groupBounds.Size);

                if (group.ContentPanel.Height + captionSize > groupBounds.Height)
                {
                    double calculatedHeight = captionSize + group.ContentPanel.Height;

                    groupBounds = new RectangleF(groupLocation, new SizeF(groupSize.Width, (float)calculatedHeight));
                    group.Measure(groupBounds.Size);
                }


                finalHeight += group.DesiredSize.Height;
                counter++;
            }

            this.OnMeasureModified(EventArgs.Empty);


            return(new SizeF(availableSize.Width, finalHeight));
        }
예제 #25
0
 public RadAssociatedMenuItem(RadPanelBarGroupElement group)
 {
     this.group = group;
 }
예제 #26
0
 public RadAssociatedToggleButton(RadPanelBarGroupElement group)
 {
     this.group   = group;
     this.Enabled = group.Enabled;
 }
예제 #27
0
        protected override System.Drawing.SizeF ArrangeOverride(System.Drawing.SizeF finalSize)
        {
            //   base.ArrangeOverride(finalSize);
            float y            = 0;
            float groupsHeight = 0;

            SizeF captionSize = new SizeF(
                finalSize.Width - 2,
                this.captionElement.DesiredSize.Height);

            this.captionElement.Arrange(new RectangleF(1, 1, captionSize.Width, captionSize.Height));

            for (int i = 0; i < this.Children.Count; i++)
            {
                if (this.Children[i] is RadPanelBarGroupElement)
                {
                    RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];

                    if (group.Visibility == ElementVisibility.Visible)
                    {
                        groupsHeight += group.CaptionHeight - 1;
                    }
                }
            }

            RectangleF hostBounds = new RectangleF(0, 1 + captionSize.Height, finalSize.Width - 2,
                                                   finalSize.Height - groupsHeight - this.panelBarOverFlow.DesiredSize.Height - captionSize.Height - 8);

            this.host.Arrange(hostBounds);

            groupsHeight += 8;
            y            += finalSize.Height - groupsHeight - this.panelBarOverFlow.DesiredSize.Height;
            this.grip.Arrange(new RectangleF(1, y, finalSize.Width - 2, 8));

            y += 8;

            for (int i = 0; i < this.Children.Count; i++)
            {
                if (this.Children[i] is RadPanelBarGroupElement)
                {
                    RadPanelBarGroupElement group = (RadPanelBarGroupElement)this.Children[i];

                    if (group.Visibility == ElementVisibility.Visible)
                    {
                        PointF groupLocation = new PointF(1, y);
                        SizeF  groupSize     = new SizeF(
                            finalSize.Width - 2,
                            group.CaptionHeight - 1);

                        RectangleF groupBounds = new RectangleF(groupLocation, groupSize);
                        group.Arrange(groupBounds);
                        y += groupSize.Height;
                    }
                }
            }

            this.panelBarOverFlow.Arrange(new RectangleF(1, y, finalSize.Width - 2, this.panelBarOverFlow.DesiredSize.Height));



            this.OnArrangeModified(EventArgs.Empty);
            return(finalSize);
        }
예제 #28
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);
        }
 public PanelBarGroupCancelEventArgs(RadPanelBarGroupElement group, bool cancel)
     : base(group)
 {
     this.cancel = cancel;
 }