private float CalculateGroupWidth(ContextualTabGroup tabGroup) { float num = 0.0f; if (tabGroup.TabItems.Count > 0) { for (int index1 = 0; index1 < tabGroup.TabItems.Count; ++index1) { RadPageViewItem tabItem = tabGroup.TabItems[index1] as RadPageViewItem; for (int index2 = 0; index2 < this.RibbonBarElement.TabStripElement.Items.Count; ++index2) { if ((RibbonTab)this.RibbonBarElement.TabStripElement.Items[index2] == tabItem) { tabItem = this.RibbonBarElement.TabStripElement.Items[index2]; tabGroup.TabItems[index1] = (RadItem)tabItem; } } if (tabItem != null && tabItem.Visibility != ElementVisibility.Collapsed) { Rectangle rectangle = new Rectangle(tabItem.BoundingRectangle.Location, Size.Add(tabItem.BoundingRectangle.Size, tabItem.Margin.Size)); num += (float)rectangle.Width; } } } return(num); }
/// <summary> /// This method calculates the available space for the /// ribbon caption text at the right side of the</summary> /// contextual tab groups /// <param name="availableSize">The total available size for the elements /// managed by this layout panel.</param> /// <returns>The width available.</returns> private float GetRightCaptionSpace(SizeF availableSize) { ContextualTabGroup rightMost = this.GetRightMostGroup(this.IsDesignMode); if (!this.RightToLeft) { if (rightMost.TabItems.Count > 0) { float groupWidth = this.CalculateGroupWidth(rightMost); return(availableSize.Width - ((this.TransformXToClient(rightMost.TabItems[0].ControlBoundingRectangle.Location).X + groupWidth))); } else { return(availableSize.Width - ((rightMost.BoundingRectangle.X + rightMost.BoundingRectangle.Width))); } } else { if (rightMost.TabItems.Count > 0) { int tabItemIndex = rightMost.TabItems.Count - 1; return(this.TransformXToClient(rightMost.TabItems[tabItemIndex].ControlBoundingRectangle.Location).X); } else { return(rightMost.BoundingRectangle.X); } } }
/// <summary> /// Determines whether the tab strip items should be reordered so that they match /// the requirements for associated tab strip items. /// </summary> /// <returns>True if a reset is needed. Otherwise false.</returns> private bool ShouldResetContextTabs() { int tabIndexCounter = this.IsAddNewTabItemInTabStrip() ? this.tabStripElement.Items.Count - 2 : this.tabStripElement.Items.Count - 1; for (int i = this.contextualTabGroups.Count - 1; i > -1; i--) { ContextualTabGroup tabGroup = this.contextualTabGroups[i] as ContextualTabGroup; if (tabGroup != null && tabGroup.TabItems.Count > 0) { for (int k = tabGroup.TabItems.Count - 1; k > -1; k--) { RadPageViewItem currentTab = tabGroup.TabItems[k] as RadPageViewItem; int index = this.tabStripElement.Items.IndexOf(currentTab); if (tabIndexCounter - index == 0) { tabIndexCounter--; } else { return(true); } } } } return(false); }
//#warning This approach needs testing!!! internal ContextualTabGroup GetEndLeftGroup(bool considerEmpty) { ContextualTabGroup endLeftGroup = null; int leftMostIndex = -1; for (int i = 0; i < this.contextualTabGroups.Count; i++) { ContextualTabGroup currentGroup = this.contextualTabGroups[i] as ContextualTabGroup; if (currentGroup != null) { if (currentGroup.TabItems.Count == 0 && considerEmpty) { if (endLeftGroup == null) { endLeftGroup = currentGroup; leftMostIndex = this.contextualTabGroups.IndexOf(endLeftGroup); } else { if (i < leftMostIndex) { endLeftGroup = currentGroup; leftMostIndex = this.contextualTabGroups.IndexOf(endLeftGroup); } } } else { if (currentGroup.TabItems.Count > 0 && currentGroup.Visibility == ElementVisibility.Visible) { if (endLeftGroup == null) { endLeftGroup = currentGroup; leftMostIndex = this.contextualTabGroups.IndexOf(endLeftGroup); } else { if (endLeftGroup.TabItems.Count == 0) { endLeftGroup = currentGroup; leftMostIndex = this.contextualTabGroups.IndexOf(endLeftGroup); } if (i < leftMostIndex && endLeftGroup.TabItems.Count > 0) { endLeftGroup = currentGroup; leftMostIndex = this.contextualTabGroups.IndexOf(endLeftGroup); } } } } } } return(endLeftGroup); }
private bool ShouldShrinkGroup( ContextualTabGroup tabGroup, float desiredGroupWidth, SizeF availableSize) { float calculatedGroupXcoord = this.GetCalculatedGroupXCoord(tabGroup); return(this.RightToLeft ? (double)calculatedGroupXcoord <= 0.0 : (double)calculatedGroupXcoord + (double)desiredGroupWidth - (double)availableSize.Width > 0.0); }
private void ContextGroupsArrange(SizeF endSize) { float num = 0.0f; ContextualTabGroup rightMostGroup = this.GetRightMostGroup(this.IsDesignMode); for (int index = 0; index < this.RibbonBarElement.ContextualTabGroups.Count; ++index) { ContextualTabGroup contextualTabGroup = this.RibbonBarElement.ContextualTabGroups[index] as ContextualTabGroup; float y = 0.0f; if (contextualTabGroup != null) { if (contextualTabGroup.TabItems.Count == 0) { if (this.IsDesignMode) { if (this.RibbonBarElement.TabStripElement.Items.Count > 0) { RadPageViewItem radPageViewItem = this.RibbonBarElement.TabStripElement.Items[this.RibbonBarElement.TabStripElement.Items.Count - 1]; Point point = this.TransformXToClient(radPageViewItem.ControlBoundingRectangle.Location); if (!this.RightToLeft) { float x = num + (float)point.X + (float)this.GetFullBoundingRect((RadElement)radPageViewItem).Width; contextualTabGroup.Arrange(new RectangleF(x, y, Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width), contextualTabGroup.DesiredSize.Height)); num += Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width); } else { float x1 = (float)point.X; num += Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width); float x2 = x1 - num; contextualTabGroup.Arrange(new RectangleF(x2, y, Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width), endSize.Height)); } } } } else { RadPageViewItem tabItem1 = contextualTabGroup.TabItems[0] as RadPageViewItem; RadPageViewItem tabItem2 = contextualTabGroup.TabItems[contextualTabGroup.TabItems.Count - 1] as RadPageViewItem; if (tabItem1 != null && tabItem2 != null) { if (contextualTabGroup == rightMostGroup && this.RightToLeft) { contextualTabGroup.Arrange(this.PerformArrangeWithShrink(endSize, contextualTabGroup)); } else { Point point = this.RightToLeft ? this.TransformXToClient(tabItem2.ControlBoundingRectangle.Location) : this.TransformXToClient(tabItem1.ControlBoundingRectangle.Location); contextualTabGroup.Arrange(new RectangleF((float)point.X, y, Math.Max(contextualTabGroup.DesiredSize.Width, (float)contextualTabGroup.MinSize.Width), endSize.Height)); } } } } } }
/// <summary> /// This method reorders the TabStrip items so that they are positioned under the /// ContextualTabGroup they are associated with. All tab items that are /// associated with a tab groups should be positioned on the right side of the tab strip. /// This algorithm begins iterating from the first to the last contextual tab group as they /// appear in the collection of the ribbon bar. The associated tab items are always inserted /// at the end of the tab strip. In this way the effect of positioning the last associated /// tab item at the end of the corresponding contextual group is achieved. /// </summary> private void ResetAssociatedTabItems() { RibbonTab selectedTab = this.tabStripElement.SelectedItem as RibbonTab; List <RadItem> scheduledItemsForDeletion = new List <RadItem>(); for (int i = 0; i < this.contextualTabGroups.Count; i++) { ContextualTabGroup currentGroup = this.contextualTabGroups[i] as ContextualTabGroup; for (int k = 0; k < currentGroup.TabItems.Count; k++) { RadPageViewItem currentItem = currentGroup.TabItems[k] as RadPageViewItem; for (int j = 0; j < this.tabStripElement.Items.Count; ++j) { if (((RibbonTab)this.tabStripElement.Items[j]).obsoleteTab == currentItem) { currentItem = (RibbonTab)this.tabStripElement.Items[j]; currentGroup.TabItems[k] = currentItem; } } if (this.tabStripElement.Items.Contains(currentItem) && !(bool)currentItem.GetValue(RadItem.IsAddNewItemProperty) && currentItem.Parent != null) { this.tabStripElement.RemoveItem(currentItem); if (this.IsDesignMode) { if (this.tabStripElement.Items.Count == 0) { this.tabStripElement.InsertItem(this.tabStripElement.Items.Count, currentItem); } else { this.tabStripElement.InsertItem(this.tabStripElement.Items.Count - 1, currentItem); } } else { this.tabStripElement.InsertItem(this.tabStripElement.Items.Count, currentItem); } } } } this.tabStripElement.SelectedItem = selectedTab; }
private int GetEmptyGroupsCount() { int num = 0; for (int index = 0; index < this.RibbonBarElement.ContextualTabGroups.Count; ++index) { ContextualTabGroup contextualTabGroup = this.RibbonBarElement.ContextualTabGroups[index] as ContextualTabGroup; if (contextualTabGroup != null && contextualTabGroup.TabItems.Count == 0) { ++num; } } return(num); }
private float GetCalculatedGroupXCoord(ContextualTabGroup tabGroup) { float x; if (!this.RightToLeft) { x = (float)this.TransformXToClient(tabGroup.TabItems[0].ControlBoundingRectangle.Location).X; } else { int index = tabGroup.TabItems.Count - 1; x = (float)this.TransformXToClient(tabGroup.TabItems[index].ControlBoundingRectangle.Location).X; } return(x); }
internal ContextualTabGroup GetLeftMostGroup(bool considerEmpty) { ContextualTabGroup contextualTabGroup1 = (ContextualTabGroup)null; int num = -1; for (int index = 0; index < this.RibbonBarElement.ContextualTabGroups.Count; ++index) { ContextualTabGroup contextualTabGroup2 = this.RibbonBarElement.ContextualTabGroups[index] as ContextualTabGroup; if (contextualTabGroup2 != null) { if (contextualTabGroup2.TabItems.Count == 0 && considerEmpty) { if (contextualTabGroup1 == null) { contextualTabGroup1 = contextualTabGroup2; num = this.RibbonBarElement.ContextualTabGroups.IndexOf((RadItem)contextualTabGroup1); } else if (index < num) { contextualTabGroup1 = contextualTabGroup2; num = this.RibbonBarElement.ContextualTabGroups.IndexOf((RadItem)contextualTabGroup1); } } else if (contextualTabGroup2.TabItems.Count > 0 && contextualTabGroup2.Visibility == ElementVisibility.Visible) { if (contextualTabGroup1 == null) { contextualTabGroup1 = contextualTabGroup2; num = this.RibbonBarElement.ContextualTabGroups.IndexOf((RadItem)contextualTabGroup1); } else { if (contextualTabGroup1.TabItems.Count == 0) { contextualTabGroup1 = contextualTabGroup2; num = this.RibbonBarElement.ContextualTabGroups.IndexOf((RadItem)contextualTabGroup1); } if (index < num && contextualTabGroup1.TabItems.Count > 0) { contextualTabGroup1 = contextualTabGroup2; num = this.RibbonBarElement.ContextualTabGroups.IndexOf((RadItem)contextualTabGroup1); } } } } } return(contextualTabGroup1); }
private bool ShouldShrinkGroup(ContextualTabGroup tabGroup, float desiredGroupWidth, SizeF availableSize) { float groupXCoord = this.GetCalculatedGroupXCoord(tabGroup); bool shouldShrink; if (!this.RightToLeft) { shouldShrink = ((groupXCoord + desiredGroupWidth) - (availableSize.Width)) > 0; } else { shouldShrink = (groupXCoord <= 0); } return(shouldShrink); }
private void ResetAssociatedTabItems() { RibbonTab selectedItem = this.RibbonBarElement.TabStripElement.SelectedItem as RibbonTab; List <RadItem> radItemList = new List <RadItem>(); this.ResetTabPositions(); for (int index1 = 0; index1 < this.RibbonBarElement.ContextualTabGroups.Count; ++index1) { ContextualTabGroup contextualTabGroup = this.RibbonBarElement.ContextualTabGroups[index1] as ContextualTabGroup; for (int index2 = 0; index2 < contextualTabGroup.TabItems.Count; ++index2) { RadPageViewItem tabItem = contextualTabGroup.TabItems[index2] as RadPageViewItem; for (int index3 = 0; index3 < this.RibbonBarElement.TabStripElement.Items.Count; ++index3) { if (((RibbonTab)this.RibbonBarElement.TabStripElement.Items[index3]).obsoleteTab == tabItem) { tabItem = this.RibbonBarElement.TabStripElement.Items[index3]; contextualTabGroup.TabItems[index2] = (RadItem)tabItem; } } if (this.RibbonBarElement.TabStripElement.Items.Contains(tabItem) && !(bool)tabItem.GetValue(RadItem.IsAddNewItemProperty) && tabItem.Parent != null) { this.RibbonBarElement.TabStripElement.RemoveItem(tabItem); if (this.IsDesignMode) { if (this.RibbonBarElement.TabStripElement.Items.Count == 0) { this.RibbonBarElement.TabStripElement.InsertItem(this.RibbonBarElement.TabStripElement.Items.Count, tabItem); } else { this.RibbonBarElement.TabStripElement.InsertItem(this.RibbonBarElement.TabStripElement.Items.Count - 1, tabItem); } } else { this.RibbonBarElement.TabStripElement.InsertItem(this.RibbonBarElement.TabStripElement.Items.Count, tabItem); } } } } this.RibbonBarElement.TabStripElement.SelectedItem = (RadPageViewItem)selectedItem; }
/// <summary> /// Gets the count of the empty contextual tab groups. /// </summary> /// <returns>The count of the empty groups.</returns> private int GetEmptyGroupsCount() { int result = 0; for (int i = 0; i < this.contextualTabGroups.Count; i++) { ContextualTabGroup tabGroup = this.contextualTabGroups[i] as ContextualTabGroup; if (tabGroup != null) { if (tabGroup.TabItems.Count == 0) { result++; } } } return(result); }
/// <summary> /// This method calculates the size of a contextual group base on the associated tabs. /// </summary> /// <param name="tabGroup">The tab group which size is to be calculated</param> /// <returns>The calculated size of the group.</returns> private float CalculateGroupWidth(ContextualTabGroup tabGroup) { float result = 0; if (tabGroup.TabItems.Count > 0) { for (int i = 0; i < tabGroup.TabItems.Count; i++) { RadPageViewItem currentItem = tabGroup.TabItems[i] as RadPageViewItem; //backward compatabilitty //!TODO review for (int j = 0; j < this.tabStripElement.Items.Count; ++j) { if (((RibbonTab)this.tabStripElement.Items[j]) == currentItem) { currentItem = (RibbonTab)this.tabStripElement.Items[j]; tabGroup.TabItems[i] = currentItem; } } if (currentItem != null) { result += currentItem.FullBoundingRectangle.Width; } } TabLayoutPanel tabLayout = tabGroup.TabItems[0].Parent as TabLayoutPanel; int tabOverlapFactor = 0; if (tabLayout != null) { tabOverlapFactor = tabLayout.ItemsOverlapFactor; } result -= (tabGroup.TabItems.Count - 1f) * tabOverlapFactor; } return(result); }
private RectangleF PerformArrangeWithShrink( SizeF finalSize, ContextualTabGroup tabGroup) { RadPageViewItem tabItem = tabGroup.TabItems[tabGroup.TabItems.Count - 1] as RadPageViewItem; RectangleF rectangleF = new RectangleF(); rectangleF.Height = finalSize.Height; rectangleF.Y = 0.0f; if (this.isShrinking) { rectangleF.Width = tabGroup.DesiredSize.Width; rectangleF.X = 0.0f; } else { rectangleF.Width = tabGroup.DesiredSize.Width; rectangleF.X = (float)this.TransformXToClient(tabItem.ControlBoundingRectangle.Location).X; } return(rectangleF); }
private float GetRightCaptionSpace(SizeF availableSize) { ContextualTabGroup rightMostGroup = this.GetRightMostGroup(this.IsDesignMode); if (!this.RightToLeft) { if (rightMostGroup.TabItems.Count <= 0) { return(availableSize.Width - (float)(rightMostGroup.BoundingRectangle.X + rightMostGroup.BoundingRectangle.Width)); } float groupWidth = this.CalculateGroupWidth(rightMostGroup); return(availableSize.Width - ((float)this.TransformXToClient(rightMostGroup.TabItems[0].ControlBoundingRectangle.Location).X + groupWidth)); } if (rightMostGroup.TabItems.Count <= 0) { return((float)rightMostGroup.BoundingRectangle.X); } int index = rightMostGroup.TabItems.Count - 1; return((float)this.TransformXToClient(rightMostGroup.TabItems[index].ControlBoundingRectangle.Location).X); }
private float GetLeftCaptionSpace(SizeF availableSize) { ContextualTabGroup leftMostGroup = this.GetLeftMostGroup(this.IsDesignMode); if (!this.RightToLeft) { if (leftMostGroup.TabItems.Count > 0) { return((float)this.TransformXToClient(leftMostGroup.TabItems[0].ControlBoundingRectangle.Location).X); } return((float)new Rectangle(leftMostGroup.BoundingRectangle.Location, Size.Add(leftMostGroup.BoundingRectangle.Size, leftMostGroup.Margin.Size)).X); } if (leftMostGroup.TabItems.Count > 0) { int index = leftMostGroup.TabItems.Count - 1; float groupWidth = this.CalculateGroupWidth(leftMostGroup); return(availableSize.Width - ((float)this.TransformXToClient(leftMostGroup.TabItems[index].ControlBoundingRectangle.Location).X + groupWidth)); } Rectangle rectangle = new Rectangle(leftMostGroup.BoundingRectangle.Location, Size.Add(leftMostGroup.BoundingRectangle.Size, leftMostGroup.Margin.Size)); return(availableSize.Width - ((float)rectangle.X + leftMostGroup.DesiredSize.Width)); }
/// <summary> /// This method is responsible for arranging 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="finalSize">The final size for arranging</param> /// <param name="tabGroup">The tab group which is to be arranged</param> private RectangleF PerformArrangeWithShrink(SizeF finalSize, ContextualTabGroup tabGroup) { RadPageViewItem rightMost = tabGroup.TabItems[tabGroup.TabItems.Count - 1] as RadPageViewItem; RectangleF groupRectangle = new RectangleF(); groupRectangle.Height = tabGroup.DesiredSize.Height; groupRectangle.Y = (finalSize.Height - tabGroup.DesiredSize.Height) / 2; if (this.isShrinking) { groupRectangle.Width = tabGroup.DesiredSize.Width; groupRectangle.X = 0; } else { groupRectangle.Width = tabGroup.DesiredSize.Width; groupRectangle.X = this.TransformXToClient(rightMost.ControlBoundingRectangle.Location).X; } return(groupRectangle); }
private bool ShouldResetContextTabs() { int num1 = this.IsAddNewTabItemInTabStrip() ? this.RibbonBarElement.TabStripElement.Items.Count - 2 : this.RibbonBarElement.TabStripElement.Items.Count - 1; for (int index1 = this.RibbonBarElement.ContextualTabGroups.Count - 1; index1 > -1; --index1) { ContextualTabGroup contextualTabGroup = this.RibbonBarElement.ContextualTabGroups[index1] as ContextualTabGroup; if (contextualTabGroup != null && contextualTabGroup.TabItems.Count > 0) { for (int index2 = contextualTabGroup.TabItems.Count - 1; index2 > -1; --index2) { int num2 = this.RibbonBarElement.TabStripElement.Items.IndexOf(contextualTabGroup.TabItems[index2] as RadPageViewItem); if (num1 - num2 != 0) { return(true); } --num1; } } } return(false); }
public void Insert(int index, ContextualTabGroup value) { this.List.Insert(index, (object)value); }
public int IndexOf(ContextualTabGroup value) { return(this.List.IndexOf((object)value)); }
public bool Contains(ContextualTabGroup value) { return(this.List.Contains((object)value)); }
public int Add(ContextualTabGroup value) { return(this.List.Add((object)value)); }
public void Remove(ContextualTabGroup value) { this.List.Remove((object)value); }
private void ContextGroupsArrange(SizeF endSize) { float offset = 0; ContextualTabGroup rightMostGroup = this.GetRightMostGroup(this.IsDesignMode); for (int i = 0; i < this.contextualTabGroups.Count; i++) { ContextualTabGroup tabGroup = this.contextualTabGroups[i] as ContextualTabGroup; float yCoord = (endSize.Height - tabGroup.DesiredSize.Height) / 2; if (tabGroup != null) { if (tabGroup.TabItems.Count == 0) { //Arrange the empty contextual tab groups only in design time if (this.IsDesignMode) { float groupXCoord = 0; if (this.tabStripElement.Items.Count > 0) { RadPageViewItem item = this.tabStripElement.Items[this.tabStripElement.Items.Count - 1] as RadPageViewItem; Point relativeTabLocation = this.TransformXToClient(item.ControlBoundingRectangle.Location); if (!this.RightToLeft) { groupXCoord = offset + relativeTabLocation.X + item.FullBoundingRectangle.Width; tabGroup.Arrange(new RectangleF(groupXCoord, yCoord, tabGroup.DesiredSize.Width, tabGroup.DesiredSize.Height)); offset += tabGroup.DesiredSize.Width; } else { groupXCoord = relativeTabLocation.X; offset += tabGroup.DesiredSize.Width; groupXCoord -= offset; tabGroup.Arrange(new RectangleF(groupXCoord, yCoord, tabGroup.DesiredSize.Width, tabGroup.DesiredSize.Height)); } } } } else { RadPageViewItem leftMost = tabGroup.TabItems[0] as RadPageViewItem; RadPageViewItem rightMost = tabGroup.TabItems[tabGroup.TabItems.Count - 1] as RadPageViewItem; if (leftMost != null && rightMost != null) { if (tabGroup == rightMostGroup && this.RightToLeft) { tabGroup.Arrange(this.PerformArrangeWithShrink(endSize, tabGroup)); } else { Point relativeTabLocation; if (!this.RightToLeft) { relativeTabLocation = this.TransformXToClient(leftMost.ControlBoundingRectangle.Location); } else { relativeTabLocation = this.TransformXToClient(rightMost.ControlBoundingRectangle.Location); } tabGroup.Arrange(new RectangleF(relativeTabLocation.X, yCoord, tabGroup.DesiredSize.Width, tabGroup.DesiredSize.Height)); } } } } } }
private SizeF ContextGroupsMeasure(SizeF availableSize) { SizeF result = SizeF.Empty; SizeF measureSize = new SizeF(); ContextualTabGroup rightMost = this.GetRightMostGroup(this.IsDesignMode); if (rightMost != this.rightMostGroup) { this.rightMostGroup = rightMost; this.showTabGroups = true; } int emptyGroupsCount = this.GetEmptyGroupsCount(); for (int i = this.contextualTabGroups.Count - 1; i > -1; i--) { ContextualTabGroup tabGroup = this.contextualTabGroups[i] as ContextualTabGroup; if (tabGroup != null) { if (tabGroup.TabItems.Count == 0) { if (this.IsDesignMode) { float groupWidth = 100; if (emptyGroupsCount > 0 && ((this.rightEmptySpace / emptyGroupsCount) < 100)) { groupWidth = ((this.rightEmptySpace) / emptyGroupsCount); } if (groupWidth < 20) { groupWidth = 0; } measureSize = new SizeF(groupWidth, availableSize.Height); result.Width += tabGroup.DesiredSize.Width; result.Height = tabGroup.DesiredSize.Height; } else { measureSize = Size.Empty; result.Width += tabGroup.DesiredSize.Width; result.Height = tabGroup.DesiredSize.Height; } } else { if (tabGroup == rightMost) { SizeF groupSize = this.PerformMeasureWithShrink(availableSize, tabGroup); if (!this.showTabGroups) { measureSize = Size.Empty; } else { measureSize = groupSize; } result.Width += tabGroup.DesiredSize.Width; result.Height = tabGroup.DesiredSize.Height; } else { if (this.showTabGroups) { measureSize = new SizeF(this.CalculateGroupWidth(tabGroup), availableSize.Height); result.Width += tabGroup.DesiredSize.Width; result.Height = tabGroup.DesiredSize.Height; } else { measureSize = SizeF.Empty; result.Width += tabGroup.DesiredSize.Width; } } } } if (tabGroup.Visibility == ElementVisibility.Visible) { tabGroup.Measure(measureSize); } else { tabGroup.Measure(SizeF.Empty); } } return(result); }
/// <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)); } }
/// <summary> /// <para>Returns the index of a <see cref='Telerik.WinControls.UI.ContextualTabGroup'/> in /// the <see cref='Telerik.WinControls.UI.ContextualTabGroupCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='Telerik.WinControls.UI.ContextualTabGroup'/> to locate.</param> /// <returns> /// <para>The index of the <see cref='Telerik.WinControls.UI.ContextualTabGroup'/> of <paramref name='value'/> in the /// <see cref='Telerik.WinControls.UI.ContextualTabGroupCollection'/>, if found; otherwise, -1.</para> /// </returns> /// <seealso cref='Telerik.WinControls.UI.ContextualTabGroupCollection.Contains'/> public int IndexOf(ContextualTabGroup value) { return(List.IndexOf(value)); }
/// <summary> /// <para>Inserts a <see cref='Telerik.WinControls.UI.RadRibbonBarCommandTab'/> into the <see cref='Telerik.WinControls.UI.ContextualTabGroupCollection'/> at the specified index.</para> /// </summary> /// <param name='index'>The zero-based index where <paramref name='value'/> should be inserted.</param> /// <param name=' value'>The <see cref='Telerik.WinControls.UI.ContextualTabGroup'/> to insert.</param> /// <returns><para>None.</para></returns> /// <seealso cref='Telerik.WinControls.UI.ContextualTabGroupCollection.Add'/> public void Insert(int index, ContextualTabGroup value) { List.Insert(index, value); }
/// <summary> /// <para> Removes a specific <see cref='Telerik.WinControls.UI.ContextualTabGroup'/> from the /// <see cref='Telerik.WinControls.UI.ContextualTabGroupCollection'/> .</para> /// </summary> /// <param name='value'>The <see cref='Telerik.WinControls.UI.ContextualTabGroup'/> to remove from the <see cref='Telerik.WinControls.UI.ContextualTabGroupCollection'/> .</param> /// <returns><para>None.</para></returns> /// <exception cref='System.ArgumentException'><paramref name='value'/> is not found in the Collection. </exception> public void Remove(ContextualTabGroup value) { List.Remove(value); }