public void ShowPopup(RadRibbonBarElement owner) { if (owner == null || !owner.IsInValidState(true)) { return; } Point empty = Point.Empty; empty.X = owner.ElementTree.Control.Location.X; empty.Y = owner.ElementTree.Control.Location.Y; this.ThemeName = (owner.ElementTree.Control as RadControl).ThemeName; this.RightToLeft = owner.RightToLeft ? RightToLeft.Yes : RightToLeft.No; if (!this.BackstageElement.IsFullScreenTheme()) { empty.Y += owner.ApplicationButtonElement.ActionButton.ControlBoundingRectangle.Bottom + owner.ApplicationButtonElement.Margin.Bottom; } else { Form form = owner.ElementTree.Control.FindForm(); if (form != null) { this.BackstageElement.TitleBarElement.Text = form.Text; } } this.ShowPopup(empty, owner); }
public RibbonBarPopup(RadRibbonBarElement ownerRibbon) : base((RadElement)ownerRibbon) { this.FadeAnimationType = FadeAnimationType.FadeOut; this.DropShadow = true; this.FadeAnimationFrames = 30; }
public RadRibbonBarCaption(RadRibbonBarElement ribbonBarElement) { this.radRibbonBarElement = ribbonBarElement; //create the group panel, which needs a reference to the ribbon bar element this.ribbonTextAndContextGroupPanel = new RibbonBarCaptionLayoutPanel(this.radRibbonBarElement); this.ribbonTextAndContextGroupPanel.Children.Add(this.captionText); this.Children.Add(ribbonTextAndContextGroupPanel); }
/// <summary> /// Shows the backstage view mimicking popup. /// </summary> /// <param name="location">The location on which the backstage will be shown.</param> /// <param name="owner">The RadRibbonBarElement that the backstage view is attached to.</param> public void ShowPopup(Point location, RadRibbonBarElement owner) { this.owner = owner; Control newParent = owner.ElementTree.Control.Parent; if (this.OnBackstageViewOpening()) { return; } if (owner != null) { owner.ExpandButton.Enabled = false; if (owner.Popup != null) { owner.Popup.ClosePopup(RadPopupCloseReason.AppFocusChange); } } if (this.Parent != newParent) { if (this.Parent != null) { this.Parent.Controls.Remove(this); } if (newParent != null) { newParent.Controls.Add(this); } } this.Location = location; if (this.Parent != null) { parentControl_SizeChanged(this.Parent, EventArgs.Empty); this.Parent.SizeChanged += new EventHandler(parentControl_SizeChanged); } this.Visible = true; this.BringToFront(); this.isShown = true; this.Focus(); this.OnBackstageViewOpened(); }
protected override void CreateChildItems(RadElement parent) { this.ribbonBarElement = new RadRibbonBarElement(); this.RootElement.Children.Add(this.ribbonBarElement); this.ribbonBarElement.CommandTabSelected += delegate(object sender, CommandTabEventArgs args) { OnCommandTabSelected(args); }; this.ribbonBarElement.CommandTabExpanded += delegate(object sender, CommandTabEventArgs args) { OnCommandTabExpanded(args); }; this.ribbonBarElement.CommandTabCollapsed += delegate(object sender, CommandTabEventArgs args) { OnCommandTabCollapsed(args); }; this.ribbonBarElement.ExpandedStateChanged += delegate(object sender, EventArgs args) { this.OnRibbonBarExpandedStateChanged(args); }; base.CreateChildItems(ribbonBarElement); }
private void ChangeTabVisibleCore() { RadRibbonBarElement parent = this.Owner.Parent as RadRibbonBarElement; if (parent == null) { return; } parent.SuspendPropertyNotifications(); parent.ElementTree.RootElement.SuspendLayout(); bool expanded = parent.Expanded; parent.Expanded = true; CommandTabEventArgs args = new CommandTabEventArgs(this); parent.CallOnCommandTabCollapsed(args); parent.VisibleChangedCore(); parent.Expanded = expanded; parent.ElementTree.RootElement.ResumeLayout(false); parent.ResumePropertyNotifications(); }
public RibbonBarLocalizationSettings(RadRibbonBarElement ribbonBarElement) { this.ribbonBarElement = ribbonBarElement; }
public RadQuickAccessToolBar(RadRibbonBarElement ribbonBar) { this.ribbonBarElement = ribbonBar; }
/// <summary> /// This method is responsible for measuring the rightmost visible contextual group with associated tabs. /// This is a private case method which is called only for the right most group, /// since it has to be shrinked when the system buttons panel has to 'step' over it while resizing. /// </summary> /// <param name="availableSize">The available size for measuring</param> /// <param name="tabGroup">The tab group which is to be shrinked</param> private SizeF PerformMeasureWithShrink(SizeF availableSize, ContextualTabGroup tabGroup) { bool shouldShrink = false; RadRibbonBarElement ribbonBar = this.ribbonBarElement; float groupXCoord = this.GetCalculatedGroupXCoord(tabGroup); float desiredGroupSize = this.CalculateGroupWidth(tabGroup); shouldShrink = this.ShouldShrinkGroup(tabGroup, desiredGroupSize, availableSize); if (shouldShrink && !this.isShrinking) { this.isShrinking = true; float newWidth; if (!this.RightToLeft) { newWidth = (availableSize.Width) - groupXCoord; } else { RadPageViewItem firstTabInGroup = tabGroup.TabItems[tabGroup.TabItems.Count - 1] as RadPageViewItem; float firstTabAbsXCoord = firstTabInGroup.ControlBoundingRectangle.X; float systemButtonsRightEdge = this.ribbonBarElement.RibbonCaption.SystemButtons.ControlBoundingRectangle.Right; if (firstTabAbsXCoord - systemButtonsRightEdge < 0) { newWidth = desiredGroupSize - Math.Abs(firstTabAbsXCoord - systemButtonsRightEdge); } else { newWidth = desiredGroupSize; } } if (newWidth < RIGHTMOSTGROUP_VISIBILITY_TRESHOLD) { newWidth = 0; this.showTabGroups = false; } else if (newWidth > RIGHTMOSTGROUP_VISIBILITY_TRESHOLD + 10) { this.showTabGroups = true; } return(new SizeF(newWidth, availableSize.Height)); } else if (this.isShrinking) { float newWidth; if (!this.RightToLeft) { newWidth = (availableSize.Width) - groupXCoord; } else { RadPageViewItem firstTabInGroup = tabGroup.TabItems[tabGroup.TabItems.Count - 1] as RadPageViewItem; float firstTabAbsXCoord = firstTabInGroup.ControlBoundingRectangle.X; float systemButtonsRightEdge = this.ribbonBarElement.RibbonCaption.SystemButtons.ControlBoundingRectangle.Right; if (firstTabAbsXCoord - systemButtonsRightEdge < 0) { newWidth = desiredGroupSize - Math.Abs(firstTabAbsXCoord - systemButtonsRightEdge); } else { newWidth = desiredGroupSize; } } if (newWidth < RIGHTMOSTGROUP_VISIBILITY_TRESHOLD) { newWidth = 0; this.showTabGroups = false; } else if (newWidth > RIGHTMOSTGROUP_VISIBILITY_TRESHOLD + 10) { this.showTabGroups = true; } if (newWidth >= desiredGroupSize) { newWidth = desiredGroupSize; this.showTabGroups = true; this.isShrinking = false; } return(new SizeF(newWidth, availableSize.Height)); } else { if (!this.showTabGroups) { this.showTabGroups = true; } return(new SizeF(desiredGroupSize, availableSize.Height)); } }
public RibbonBarCaptionLayoutPanel(RadRibbonBarElement ribbonBarElement) { this.tabStripElement = ribbonBarElement.TabStripElement; this.contextualTabGroups = ribbonBarElement.ContextualTabGroups; this.ribbonBarElement = ribbonBarElement; }
private SizeF PerformMeasureWithShrink(SizeF availableSize, ContextualTabGroup tabGroup) { RadRibbonBarElement ribbonBarElement = this.RibbonBarElement; float calculatedGroupXcoord = this.GetCalculatedGroupXCoord(tabGroup); float groupWidth = this.CalculateGroupWidth(tabGroup); if (this.ShouldShrinkGroup(tabGroup, groupWidth, availableSize) && !this.isShrinking) { this.isShrinking = true; float width; if (!this.RightToLeft) { width = availableSize.Width - calculatedGroupXcoord; } else { float x = (float)(tabGroup.TabItems[tabGroup.TabItems.Count - 1] as RadPageViewItem).ControlBoundingRectangle.X; float right = (float)this.RibbonBarElement.RibbonCaption.SystemButtons.ControlBoundingRectangle.Right; width = (double)x - (double)right >= 0.0 ? groupWidth : groupWidth - Math.Abs(x - right); } if ((double)width < 15.0) { width = 0.0f; this.showTabGroups = false; } else if ((double)width > 25.0) { this.showTabGroups = true; } return(new SizeF(width, availableSize.Height)); } if (this.isShrinking) { float width; if (!this.RightToLeft) { width = availableSize.Width - calculatedGroupXcoord; } else { float x = (float)(tabGroup.TabItems[tabGroup.TabItems.Count - 1] as RadPageViewItem).ControlBoundingRectangle.X; float right = (float)this.RibbonBarElement.RibbonCaption.SystemButtons.ControlBoundingRectangle.Right; width = (double)x - (double)right >= 0.0 ? groupWidth : groupWidth - Math.Abs(x - right); } if ((double)width < 15.0) { width = 0.0f; this.showTabGroups = false; } else if ((double)width > 25.0) { this.showTabGroups = true; } if ((double)width >= (double)groupWidth) { width = groupWidth; this.showTabGroups = true; this.isShrinking = false; } return(new SizeF(width, availableSize.Height)); } if (!this.showTabGroups) { this.showTabGroups = true; } return(new SizeF(groupWidth, availableSize.Height)); }
protected override void OnPropertyChanging(RadPropertyChangingEventArgs e) { base.OnPropertyChanging(e); if (e.Property == RadItem.VisibilityProperty && ((ElementVisibility)e.NewValue) == ElementVisibility.Collapsed) { int indexOfCurrentTab = this.Owner.Items.IndexOf(this); bool selectedTabChanged = false; for (int i = indexOfCurrentTab + 1; i < this.Owner.Items.Count; i++) { RadPageViewItem currentItem = this.Owner.Items[i] as RadPageViewItem; if (currentItem.Visibility == ElementVisibility.Visible) { this.Owner.SelectedItem = currentItem; selectedTabChanged = true; break; } } if (!selectedTabChanged) { for (int i = indexOfCurrentTab - 1; i > -1; i--) { RadPageViewItem currentItem = this.Owner.Items[i] as RadPageViewItem; if (currentItem.Visibility == ElementVisibility.Visible) { this.Owner.SelectedItem = currentItem; selectedTabChanged = true; break; } } } e.Cancel = !selectedTabChanged; if (!e.Cancel) { RadRibbonBarElement ribbonBar = this.Owner.Parent as RadRibbonBarElement; if (ribbonBar != null) { CommandTabEventArgs args = new CommandTabEventArgs(this); ribbonBar.CallOnCommandTabCollapsed(args); } } this.Owner.InvalidateMeasure(); this.Owner.InvalidateArrange(); this.Owner.UpdateLayout(); } else if (e.Property == RadItem.VisibilityProperty && ((ElementVisibility)e.NewValue) == ElementVisibility.Visible) { RadRibbonBarElement ribbonBar = this.Owner.Parent as RadRibbonBarElement; if (ribbonBar != null) { CommandTabEventArgs args = new CommandTabEventArgs(this); ribbonBar.CallOnCommandTabExpanded(args); ribbonBar.TabStripElement.SelectedItem = this; } } }