Exemple #1
0
        private void PrepareRibbonBarForCompositionState()
        {
            RadRibbonBar ribbonBar = this.RibbonBar;

            if (ribbonBar == null)
            {
                return;
            }

            if (oldRadRibbonBarElementSettings == null)
            {
                oldRadRibbonBarElementSettings = new List <object>();
            }

            if (this.CompositionEffectsEnabled)
            {
                if (this.oldRadRibbonBarElementSettings.Count == 0)
                {
                    this.oldRadRibbonBarElementSettings.Add(ribbonBar.RibbonBarElement.CaptionFill.Visibility);
                    this.oldRadRibbonBarElementSettings.Add(ribbonBar.RootElement.BackColor);
                    this.oldRadRibbonBarElementSettings.Add(ribbonBar.RibbonBarElement.RibbonCaption.SystemButtons.Visibility);
                    this.oldRadRibbonBarElementSettings.Add(ribbonBar.QuickAccessToolBarHeight);
                    this.oldRadRibbonBarElementSettings.Add(ribbonBar.RibbonBarElement.RibbonCaption.SystemButtons.Margin);
                }

                ribbonBar.RibbonBarElement.RibbonCaption.SystemButtons.Margin =
                    Padding.Add(ribbonBar.RibbonBarElement.RibbonCaption.SystemButtons.Margin, new Padding(20, 0, 0, 0));
                ribbonBar.RibbonBarElement.CaptionFill.Visibility = ElementVisibility.Hidden;
                ribbonBar.RootElement.BackColor = Color.Transparent;
                ribbonBar.RibbonBarElement.RibbonCaption.SystemButtons.Visibility = ElementVisibility.Hidden;
                ribbonBar.QuickAccessToolBarHeight = 27;

                if (Environment.OSVersion.Version.Major == 6 && Environment.OSVersion.Version.Minor == 1)
                {
                    ribbonBar.RibbonBarElement.RibbonTabStripHolder.Children[0].PositionOffset = new Size(0, 3);
                }
                else
                {
                    ribbonBar.RibbonBarElement.RibbonTabStripHolder.Children[0].PositionOffset = new Size(0, 1);
                }
            }
            else
            {
                if (this.oldRadRibbonBarElementSettings.Count > 0)
                {
                    ribbonBar.RibbonBarElement.CaptionFill.Visibility = (ElementVisibility)this.oldRadRibbonBarElementSettings[0];
                    ribbonBar.RootElement.BackColor = (Color)this.oldRadRibbonBarElementSettings[1];
                    ribbonBar.RibbonBarElement.RibbonCaption.SystemButtons.Visibility = (ElementVisibility)this.oldRadRibbonBarElementSettings[2];
                    ribbonBar.QuickAccessToolBarHeight = (int)this.oldRadRibbonBarElementSettings[3];
                    ribbonBar.RibbonBarElement.RibbonCaption.SystemButtons.Margin = (Padding)oldRadRibbonBarElementSettings[4];
                    ribbonBar.RibbonBarElement.RibbonTabStripHolder.Children[0].PositionOffset = new Size(0, 0);
                }
            }
        }
Exemple #2
0
 private bool ContextualGroupsNotContainsThisTab(RadRibbonBar parentRibbon, RadPageViewItem tabItem)
 {
     foreach (ContextualTabGroup group in parentRibbon.ContextualTabGroups)
     {
         if (group.TabItems.Contains(tabItem))
         {
             return(false);
         }
     }
     return(true);
 }
        private void PrepareDropDownItems()
        {
            this.UnwireEvents();

            foreach (RadItem item in this.Items)
            {
                if (item is RadToolStripSeparatorItem)
                {
                    continue;
                }
                RadMenuAssociatedItem menuItem = new RadMenuAssociatedItem(item);
                menuItem.Text = item.Text;

                if (!(bool)item.GetValue(IsCollapsedByUserProperty))
                {
                    menuItem.IsChecked = true;
                }
                else
                {
                    menuItem.IsChecked = false;
                }

                menuItem.Click += OnMenuItemShowHideItem_Click;
                this.overFlowButton.MinSize = new Size(this.overFlowButton.MinSize.Width,
                                                       Math.Max(this.overFlowButton.MinSize.Height, item.Size.Height));
                this.overFlowButton.Items.Add(menuItem);
            }

            this.overFlowButton.Items.Add(new RadMenuSeparatorItem());

            this.toolbarPositionMenuItem.Text =
                this.ribbonBarElement.QuickAccessToolbarBelowRibbon ? this.ribbonBarElement.LocalizationSettings.ShowQuickAccessMenuAboveItemText :
                this.ribbonBarElement.LocalizationSettings.ShowQuickAccessMenuBelowItemText;

            this.overFlowButton.Items.Add(this.toolbarPositionMenuItem);
            this.overFlowButton.Items.Add(this.minimizeRibonMenuItem);

            RadRibbonBar ribbon = this.ParentRibbonBar.ElementTree.Control as RadRibbonBar;

            if (ribbon != null)
            {
                if (ribbon.Expanded)
                {
                    this.minimizeRibonMenuItem.Text = this.ribbonBarElement.LocalizationSettings.MinimizeRibbonItemText;
                }
                else
                {
                    this.minimizeRibonMenuItem.Text = this.ribbonBarElement.LocalizationSettings.MaximizeRibbonItemText;
                }
            }

            this.toolbarPositionMenuItem.Click += new EventHandler(OnMenuItemQuickAccessPosition_Click);
            this.minimizeRibonMenuItem.Click   += new EventHandler(OnMinimizeItem_Click);
        }
        private void OnMinimizeItem_Click(object sender, EventArgs e)
        {
            if (this.ParentRibbonBar.ElementTree != null)
            {
                RadRibbonBar ribbon = (RadRibbonBar)this.ParentRibbonBar.ElementTree.Control;

                if (ribbon.CommandTabs.Count > 0)
                {
                    ribbon.Expanded = !ribbon.Expanded;
                }
            }
        }
Exemple #5
0
 internal bool ProcessArrowKeys(Keys keyData)
 {
     if (this.owner.owner != null && this.owner.owner.ElementTree.Control != null)
     {
         RadRibbonBar control = this.owner.owner.ElementTree.Control as RadRibbonBar;
         if (this.IsKeyMapActive && control != null && control.EnableKeyboardNavigation && (keyData == Keys.Right || keyData == Keys.Left || (keyData == Keys.Up || keyData == Keys.Down)))
         {
             this.ResetKeyMapInternal();
             return(true);
         }
     }
     return(false);
 }
Exemple #6
0
        private void InitializeRibbon()
        {
            foreach (Control control in this.Form.Controls)
            {
                if (control is RadRibbonBar)
                {
                    this.radRibbonBar = control as RadRibbonBar;

                    this.radRibbonBar.CompositionEnabled = this.CompositionEffectsEnabled;

                    break;
                }
            }
        }
Exemple #7
0
        private void PaintClientAreaShadow(IGraphics graphics, Color color)
        {
            RadRibbonBar ribbonBar = this.GetRibbonBar();

            if (ribbonBar == null)
            {
                return;
            }
            int height = ribbonBar.RibbonBarElement.RibbonCaption.ControlBoundingRectangle.Height;

            graphics.DrawLine(color, 3, height + 1, 3, this.ControlBoundingRectangle.Height - 4);
            graphics.DrawLine(color, 4, this.ControlBoundingRectangle.Height - 4, this.ControlBoundingRectangle.Width - 5, this.ControlBoundingRectangle.Height - 4);
            graphics.DrawLine(color, this.ControlBoundingRectangle.Width - 4, height + 1, this.ControlBoundingRectangle.Width - 4, this.ControlBoundingRectangle.Height - 4);
        }
Exemple #8
0
        private void OnMinimizeItem_Click(object sender, EventArgs e)
        {
            if (this.ParentRibbonBar.ElementTree == null)
            {
                return;
            }
            RadRibbonBar control = (RadRibbonBar)this.ParentRibbonBar.ElementTree.Control;

            if (control.CommandTabs.Count <= 0)
            {
                return;
            }
            control.Expanded = !control.Expanded;
        }
Exemple #9
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if (this.owner != null && this.owner.ElementTree.Control != null)
     {
         RadRibbonBar control = this.owner.ElementTree.Control as RadRibbonBar;
         if (control != null && !control.EnableKeyboardNavigation)
         {
             return(base.ProcessCmdKey(ref msg, keyData));
         }
     }
     if (!((RadRibbonBarBackstageView.RibbonBackstageViewInputBehavior) this.Behavior).ProcessArrowKeys(keyData))
     {
         return(base.ProcessCmdKey(ref msg, keyData));
     }
     return(true);
 }
Exemple #10
0
 private RadRibbonBar GetRibbonBar()
 {
     if (this.ribbonBar != null)
     {
         return(this.ribbonBar);
     }
     foreach (Control control in (ArrangedElementCollection)this.ElementTree.Control.Controls)
     {
         if (control is RadRibbonBar)
         {
             RadRibbonBar radRibbonBar = control as RadRibbonBar;
             radRibbonBar.RibbonBarElement.CaptionFill.PropertyChanged += new PropertyChangedEventHandler(this.CaptionFill_PropertyChanged);
             return(this.ribbonBar = radRibbonBar);
         }
     }
     return((RadRibbonBar)null);
 }
        protected override void PaintElement(Telerik.WinControls.Paint.IGraphics graphics, float angle, SizeF scale)
        {
            RadRibbonBar parentRibbon = this.ElementTree.Control as RadRibbonBar;

            if (parentRibbon != null)
            {
                if (parentRibbon.CompositionEnabled && !this.IsDesignMode &&
                    this.TabItems.Count > 0 && this.ControlBoundingRectangle.Size != Size.Empty)
                {
                    if (this.captionText.Visibility == ElementVisibility.Visible)
                    {
                        this.captionText.SetDefaultValueOverride(RadElement.VisibilityProperty, ElementVisibility.Hidden);
                    }

                    Color foreColor = Color.Black;

                    Form parentForm = parentRibbon.FindForm();

                    if (parentForm != null &&
                        parentForm.WindowState == FormWindowState.Maximized)
                    {
                        foreColor = Color.White;
                    }

                    GraphicsPath graphicsPath = new GraphicsPath();

                    graphicsPath.AddString(
                        this.captionText.Text,
                        this.Font.FontFamily,
                        (int)this.Font.Style,
                        (this.Font.Size / 72) * 96,
                        this.captionText.BoundingRectangle,
                        this.captionText.CreateStringFormat());
                    graphics.FillPath(foreColor, graphicsPath);
                }
            }
            else
            {
                if (this.captionText.Visibility == ElementVisibility.Hidden)
                {
                    this.captionText.SetDefaultValueOverride(RadElement.VisibilityProperty, ElementVisibility.Visible);
                }
            }
        }
        private RadRibbonBar GetRibbonBar()
        {
            if (this.ribbonBar != null)
            {
                return(this.ribbonBar);
            }

            foreach (Control control in this.ElementTree.Control.Controls)
            {
                if (control is RadRibbonBar)
                {
                    RadRibbonBar ribbon = control as RadRibbonBar;
                    ribbon.RibbonBarElement.CaptionFill.PropertyChanged += this.CaptionFill_PropertyChanged;
                    return(this.ribbonBar = ribbon);
                }
            }

            return(null);
        }
        private void commandTabs_ItemsChanged(RadItemCollection changed, RadItem target, ItemsChangeOperation operation)
        {
            if (operation == ItemsChangeOperation.Inserted && target != null)
            {
                target.RadPropertyChanged += new RadPropertyChangedEventHandler(tabStrip_RadPropertyChanged);

                if (this.IsInValidState(true))
                {
                    RadRibbonBar ribbonBar = (this.ElementTree.Control as RadRibbonBar);

                    if (ribbonBar != null)
                    {
                        ribbonBar.RibbonBarElement.RibbonCaption.CaptionLayout.InvalidateMeasure();
                        ribbonBar.RibbonBarElement.RibbonCaption.CaptionLayout.InvalidateArrange();
                        ribbonBar.RibbonBarElement.RibbonCaption.CaptionLayout.UpdateLayout();
                    }
                }
            }
            else if (operation == ItemsChangeOperation.Removed)
            {
                target.RadPropertyChanged -= new RadPropertyChangedEventHandler(tabStrip_RadPropertyChanged);

                if (this.IsInValidState(true))
                {
                    RadRibbonBar ribbonBar = (this.ElementTree.Control as RadRibbonBar);

                    if (ribbonBar != null)
                    {
                        ribbonBar.RibbonBarElement.RibbonCaption.CaptionLayout.InvalidateMeasure();
                        ribbonBar.RibbonBarElement.RibbonCaption.CaptionLayout.InvalidateArrange();
                        ribbonBar.RibbonBarElement.RibbonCaption.CaptionLayout.UpdateLayout();
                    }
                }
            }
            else if (operation == ItemsChangeOperation.Clearing)
            {
                foreach (RadItem item in this.tabItems)
                {
                    item.RadPropertyChanged -= new RadPropertyChangedEventHandler(tabStrip_RadPropertyChanged);
                }
            }
        }
Exemple #14
0
        private void PrepareDropDownItems()
        {
            this.UnwireEvents();
            foreach (RadItem associatedItem in (RadItemCollection)this.Items)
            {
                if (!(associatedItem is CommandBarSeparator))
                {
                    RadMenuAssociatedItem menuAssociatedItem = new RadMenuAssociatedItem(associatedItem);
                    menuAssociatedItem.Text = associatedItem.Text;
                    if (!(bool)associatedItem.GetValue(RadQuickAccessToolBar.IsCollapsedByUserProperty))
                    {
                        menuAssociatedItem.IsChecked = true;
                    }
                    else
                    {
                        menuAssociatedItem.IsChecked = false;
                    }
                    menuAssociatedItem.Click += new EventHandler(this.OnMenuItemShowHideItem_Click);
                    this.overFlowButton.Items.Add((RadItem)menuAssociatedItem);
                }
            }
            this.overFlowButton.Items.Add((RadItem) new RadMenuSeparatorItem());
            this.toolbarPositionMenuItem.Text = this.ParentRibbonBar.QuickAccessToolbarBelowRibbon ? this.ParentRibbonBar.LocalizationSettings.ShowQuickAccessMenuAboveItemText : this.ParentRibbonBar.LocalizationSettings.ShowQuickAccessMenuBelowItemText;
            this.overFlowButton.Items.Add((RadItem)this.toolbarPositionMenuItem);
            this.overFlowButton.Items.Add((RadItem)this.minimizeRibonMenuItem);
            RadRibbonBar control = this.ParentRibbonBar.ElementTree.Control as RadRibbonBar;

            if (control != null)
            {
                if (control.Expanded)
                {
                    this.minimizeRibonMenuItem.Text = this.ParentRibbonBar.LocalizationSettings.MinimizeRibbonItemText;
                }
                else
                {
                    this.minimizeRibonMenuItem.Text = this.ParentRibbonBar.LocalizationSettings.MaximizeRibbonItemText;
                }
            }
            this.toolbarPositionMenuItem.Click += new EventHandler(this.OnMenuItemQuickAccessPosition_Click);
            this.minimizeRibonMenuItem.Click   += new EventHandler(this.OnMinimizeItem_Click);
        }
Exemple #15
0
        private void PaintTitleBarExtensions(IGraphics graphics)
        {
            RadRibbonBar ribbonBar = this.GetRibbonBar();

            if (ribbonBar == null || ribbonBar.RibbonBarElement.Children.Count <= 5)
            {
                return;
            }
            FillPrimitive   captionFill   = ribbonBar.RibbonBarElement.CaptionFill;
            BorderPrimitive captionBorder = ribbonBar.RibbonBarElement.CaptionBorder;

            if (captionFill != null)
            {
                this.PaintExtensionsFill(graphics, captionFill);
            }
            if (captionBorder == null || captionBorder.Visibility != ElementVisibility.Visible)
            {
                return;
            }
            this.PaintExtensionsBorders(graphics, captionFill, captionBorder);
        }
Exemple #16
0
 public override bool CanClosePopup(RadPopupCloseReason reason)
 {
     if (this.OwnerElement != null && this.OwnerElement.IsInValidState(true))
     {
         RadRibbonBar control = this.OwnerElement.ElementTree.Control as RadRibbonBar;
         if (control != null && control.IsDesignMode)
         {
             Point screen = control.Parent.PointToScreen(control.Location);
             if (new Rectangle(screen, control.Size).Contains(Control.MousePosition))
             {
                 Point location = screen;
                 location.Offset(control.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Location);
                 return(!new Rectangle(location, control.RibbonBarElement.ApplicationButtonElement.ControlBoundingRectangle.Size).Contains(Control.MousePosition));
             }
         }
     }
     if (this.OwnerElement != null && this.OwnerElement.IsInValidState(true) && (this.OwnerElement.ElementTree.Control is RadApplicationMenu && (this.OwnerElement.ElementTree.Control as RadApplicationMenu).IsDesignMode) && new Rectangle(this.OwnerElement.ElementTree.Control.Parent.PointToScreen(this.OwnerElement.ElementTree.Control.Location), this.OwnerElement.ElementTree.Control.Size).Contains(Control.MousePosition))
     {
         return(false);
     }
     return(base.CanClosePopup(reason));
 }
Exemple #17
0
        private void FillAvaibleTabs(RadRibbonBar parentRibbon)
        {
            RadPageViewItem item;

            this.ribbonBarTabs = new RadItemCollection();
            foreach (RadItem tabItem in parentRibbon.RibbonBarElement.TabStripElement.Items)
            {
                this.ribbonBarTabs.Add(tabItem);
            }

            for (int i = 0; i < ribbonBarTabs.Count; ++i)
            {
                item = (RadPageViewItem)ribbonBarTabs[i];

                if (this.ContextualGroupsNotContainsThisTab(parentRibbon, item) && !(bool)item.GetValue(RadItem.IsAddNewItemProperty))
                {
                    RadListBoxItem listItem = new RadListBoxItem(item.Text);
                    listItem.Tag = item;
                    this.radListBoxAvaibleTabs.Items.Add(listItem);
                }
            }
        }
Exemple #18
0
        private void AdjustGalleryAfterPopUpClose()
        {
            if (this.ElementTree == null || this.ElementTree.Control == null)
            {
                return;
            }
            RadRibbonBar control = this.ElementTree.Control as RadRibbonBar;

            Application.DoEvents();
            if (control != null)
            {
                control.RibbonBarElement.InvalidateMeasure();
                control.RibbonBarElement.InvalidateArrange();
                control.RibbonBarElement.UpdateLayout();
                control.Invalidate();
            }
            this.InvalidateMeasure();
            this.InvalidateArrange();
            this.inribbonItemsLayoutPanel.InvalidateMeasure();
            this.inribbonItemsLayoutPanel.InvalidateArrange();
            Application.DoEvents();
        }
 private void FillAvaibleTabs(RadRibbonBar parentRibbon)
 {
     this.ribbonBarTabs = new RadItemCollection();
     foreach (RadItem radItem in (IEnumerable <RadPageViewItem>)parentRibbon.RibbonBarElement.TabStripElement.Items)
     {
         RibbonTab ribbonTab = radItem as RibbonTab;
         if (ribbonTab != null && ribbonTab.CanBeAddedToContextualGroup)
         {
             this.ribbonBarTabs.Add(radItem);
         }
     }
     for (int index = 0; index < this.ribbonBarTabs.Count; ++index)
     {
         RadPageViewItem ribbonBarTab = (RadPageViewItem)this.ribbonBarTabs[index];
         if (this.ContextualGroupsNotContainsThisTab(parentRibbon, ribbonBarTab) && !(bool)ribbonBarTab.GetValue(RadItem.IsAddNewItemProperty))
         {
             this.radListBoxAvaibleTabs.Items.Add(new RadListDataItem(ribbonBarTab.Text)
             {
                 Tag = (object)ribbonBarTab
             });
         }
     }
 }
Exemple #20
0
        protected override SizeF MeasureOverride(SizeF availableSize)
        {
            base.MeasureOverride(availableSize);
            SizeF empty          = SizeF.Empty;
            SizeF availableSize1 = availableSize;

            this.systemButtons.Measure(availableSize);
            availableSize1.Width -= this.systemButtons.DesiredSize.Width;
            RadRibbonBar control = this.ElementTree.Control as RadRibbonBar;

            if (control != null && control.CompositionEnabled)
            {
                availableSize1.Width -= 25f;
            }
            this.ribbonTextAndContextGroupPanel.Measure(availableSize1);
            empty.Width  = this.systemButtons.DesiredSize.Width + this.ribbonTextAndContextGroupPanel.DesiredSize.Width;
            empty.Height = Math.Max(this.systemButtons.DesiredSize.Height, this.ribbonTextAndContextGroupPanel.DesiredSize.Height);
            if (!float.IsInfinity(availableSize.Width))
            {
                empty.Width = availableSize.Width;
            }
            return(empty);
        }
        public override ControlStyleBuilderInfoList GetThemeDesignedControls(System.Windows.Forms.Control previewSurface)
        {
            RadRibbonForm radRibbonFormPreview = new RadRibbonForm();

            radRibbonFormPreview.Size = new Size(320, 240);
            RadRibbonBar ribbonbar = new RadRibbonBar();

            ribbonbar.Dock    = System.Windows.Forms.DockStyle.Top;
            ribbonbar.Enabled = false;
            radRibbonFormPreview.Controls.Add(ribbonbar);

            radRibbonFormPreview.Text = "RadRibbonForm";

            radRibbonFormPreview.Anchor =
                System.Windows.Forms.AnchorStyles.Bottom
                | System.Windows.Forms.AnchorStyles.Left
                | System.Windows.Forms.AnchorStyles.Right
                | System.Windows.Forms.AnchorStyles.Top;
            radRibbonFormPreview.AllowAero = false;

            RadRibbonForm radRibbonFormStructure = new RadRibbonForm();

            radRibbonFormStructure.AutoSize = true;

            radRibbonFormStructure.Text = "RadRibbonForm";
            radRibbonFormStructure.Size = new Size(320, 240);

            ControlStyleBuilderInfoList res = new ControlStyleBuilderInfoList();

            ControlStyleBuilderInfo designed = new ControlStyleBuilderInfo(radRibbonFormPreview, radRibbonFormStructure.RootElement);

            designed.MainElementClassName = radRibbonFormStructure.FormElement.GetThemeEffectiveType().FullName;

            res.Add(designed);

            return(res);
        }
 private void FillListBoxeses(RadRibbonBar parentRibbon)
 {
     this.FillAssociatedTabs();
     this.FillAvaibleTabs(parentRibbon);
 }
Exemple #23
0
 public ContextulTabGroupsEditor(RadItemCollection collection, RadRibbonBar parentRibbon)
 {
     InitializeComponent();
     this.InitCollection(collection);
     this.FillListBoxeses(parentRibbon);
 }
Exemple #24
0
 public RadRibbonBarAccessibleObject(RadRibbonBar owner)
     : base(owner)
 {
     this.ribbonBar = owner;
 }