public virtual Dimension preferredLayoutSize(Container param1Container) { Insets insets = param1Container.Insets; int i = 0; bool @bool = outerInstance.ribbon.Minimized; if (!@bool && outerInstance.ribbon.TaskCount > 0) { RibbonTask ribbonTask = outerInstance.ribbon.SelectedTask; foreach (AbstractRibbonBand abstractRibbonBand in ribbonTask.Bands) { int m = (abstractRibbonBand.PreferredSize).height; Insets insets1 = abstractRibbonBand.Insets; i = Math.Max(i, m + insets1.top + insets1.bottom); } } int j = outerInstance.TaskToggleButtonHeight; if (!outerInstance.UsingTitlePane) { j += outerInstance.TaskbarHeight; } int k = i + j + insets.top + insets.bottom; return(new Dimension(param1Container.Width, k)); }
public virtual Dimension minimumLayoutSize(Container param1Container) { Insets insets = param1Container.Insets; int i = 0; int j = 0; int k = outerInstance.BandGap; int m = outerInstance.TaskToggleButtonHeight; if (!outerInstance.UsingTitlePane) { m += outerInstance.TaskbarHeight; } if (outerInstance.ribbon.TaskCount > 0) { bool @bool = outerInstance.ribbon.Minimized; RibbonTask ribbonTask = outerInstance.ribbon.SelectedTask; foreach (AbstractRibbonBand abstractRibbonBand in ribbonTask.Bands) { int n = (abstractRibbonBand.MinimumSize).height; Insets insets1 = abstractRibbonBand.Insets; RibbonBandUI ribbonBandUI = abstractRibbonBand.UI; i += ribbonBandUI.PreferredCollapsedWidth; if (!@bool) { j = Math.Max(j, n + insets1.top + insets1.bottom); } } i += k * (ribbonTask.BandCount - 1); } else { i = 50; } return(new Dimension(i, j + m + insets.top + insets.bottom)); }
public virtual void layoutContainer(Container param1Container) { Insets insets = param1Container.Insets; int i = outerInstance.TabButtonGap; bool bool1 = outerInstance.ribbon.ComponentOrientation.LeftToRight; int j = param1Container.Width; int k = outerInstance.TaskbarHeight; int m = insets.top; bool bool2 = outerInstance.UsingTitlePane; if (!bool2) { outerInstance.taskBarPanel.removeAll(); foreach (Component component in outerInstance.ribbon.TaskbarComponents) { outerInstance.taskBarPanel.add(component); } outerInstance.taskBarPanel.setBounds(insets.left, insets.top, j - insets.left - insets.right, k); m += k; } else { outerInstance.taskBarPanel.setBounds(0, 0, 0, 0); } Font font = outerInstance.ribbon.Font; if (font == null) { font = new Font("SansSerif", 0, 12); outerInstance.ribbon.Font = font; } FontMetrics fontMetrics = outerInstance.ribbon.getFontMetrics(font); int n = fontMetrics.stringWidth(CostOSRibbonApplicationMenuButtonUI.ApplicationMenuButtonText) + 24; int i1; for (i1 = 0; i1 < outerInstance.ribbon.TaskCount; i1++) { RibbonTask ribbonTask = outerInstance.ribbon.getTask(i1); n += fontMetrics.stringWidth(ribbonTask.Title) + 32; } n += 12; i1 = outerInstance.TaskToggleButtonHeight; int i2 = bool1 ? insets.left : (j - insets.right); int i3 = k + i1; if (!bool2) { outerInstance.applicationMenuButton.Visible = (outerInstance.ribbon.ApplicationMenu != null); if (outerInstance.ribbon.ApplicationMenu != null) { if (bool1) { outerInstance.applicationMenuButton.setBounds(-5, insets.top, i3 + 24, i3); } else { outerInstance.applicationMenuButton.setBounds(i2 - i3, insets.top, i3, i3); } } } else { outerInstance.applicationMenuButton.Visible = false; } i2 = bool1 ? (i2 + 2) : (i2 - 2); if (FlamingoUtilities.getApplicationMenuButton(SwingUtilities.getWindowAncestor(outerInstance.ribbon)) != null) { i2 = bool1 ? (i2 + i3 + 15) : (i2 - i3); } if (outerInstance.o_trailingButton != null && outerInstance.helpButton == null) { Dimension dimension = outerInstance.o_trailingButton.PreferredSize; if (bool1) { outerInstance.o_trailingButton.setBounds(j - insets.right - dimension.width, m, dimension.width, dimension.height); } else { outerInstance.o_trailingButton.setBounds(insets.left, m, dimension.width, dimension.height); } if (outerInstance.o_searchButton != null) { Dimension dimension1 = outerInstance.o_searchButton.PreferredSize; if (bool1) { outerInstance.o_searchButton.setBounds(n, m, dimension1.width, dimension1.height); } else { outerInstance.o_searchButton.setBounds(insets.left + dimension1.width, m, dimension1.width, dimension1.height); } } } if (outerInstance.helpButton != null) { Dimension dimension = outerInstance.helpButton.PreferredSize; if (bool1) { outerInstance.helpButton.setBounds(j - insets.right - dimension.width, m, dimension.width, dimension.height); } else { outerInstance.helpButton.setBounds(insets.left, m, dimension.width, dimension.height); } if (outerInstance.o_trailingButton != null) { Dimension dimension1 = outerInstance.o_trailingButton.PreferredSize; if (bool1) { outerInstance.o_trailingButton.setBounds(j - insets.right * 2 - dimension1.width + dimension.width, m, dimension1.width, dimension1.height); } else { outerInstance.o_trailingButton.setBounds(insets.left + dimension1.width, m, dimension1.width, dimension1.height); } } } int i4 = 0; if (bool1) { i4 = (outerInstance.o_trailingButton != null) ? (outerInstance.o_trailingButton.X - i - i2) : (param1Container.Width - insets.right - i2); if (outerInstance.helpButton != null && outerInstance.o_trailingButton != null) { i4 = outerInstance.o_trailingButton.X - i - i2; } if (outerInstance.o_searchButton != null && outerInstance.o_trailingButton != null) { i4 = outerInstance.o_searchButton.X - i - i2; } outerInstance.taskToggleButtonsScrollablePanel.setBounds(i2, m, i4, i1); } else { i4 = (outerInstance.helpButton != null) ? (i2 - i - outerInstance.helpButton.X - outerInstance.o_trailingButton.Width) : (i2 - insets.left); if (outerInstance.helpButton != null && outerInstance.o_trailingButton != null) { i4 = i2 - i - outerInstance.o_trailingButton.X - outerInstance.o_trailingButton.Width - outerInstance.helpButton.X - outerInstance.helpButton.Width; } outerInstance.taskToggleButtonsScrollablePanel.setBounds(i2 - i4, m, i4, i1); } BasicRibbonUI.TaskToggleButtonsHostPanel taskToggleButtonsHostPanel = (BasicRibbonUI.TaskToggleButtonsHostPanel)outerInstance.taskToggleButtonsScrollablePanel.View; int i5 = (taskToggleButtonsHostPanel.MinimumSize).width; taskToggleButtonsHostPanel.PreferredSize = new Dimension(i5, (this.this$0.taskToggleButtonsScrollablePanel.Bounds).height); outerInstance.taskToggleButtonsScrollablePanel.doLayout(); m += i1; int i6 = i1; if (!bool2) { i6 += k; } if (outerInstance.bandScrollablePanel.Parent == outerInstance.ribbon) { if (!outerInstance.ribbon.Minimized && outerInstance.ribbon.TaskCount > 0) { Insets insets1 = (outerInstance.ribbon.SelectedTask.BandCount == 0) ? new Insets(0, 0, 0, 0) : outerInstance.ribbon.SelectedTask.getBand(0).Insets; outerInstance.bandScrollablePanel.setBounds(1 + insets.left, m + insets1.top, param1Container.Width - 2 * insets.left - 2 * insets.right - 1, param1Container.Height - i6 - insets.top - insets.bottom - insets1.top - insets1.bottom); BasicRibbonUI.BandHostPanel bandHostPanel = (BasicRibbonUI.BandHostPanel)outerInstance.bandScrollablePanel.View; int i7 = (bandHostPanel.MinimumSize).width; bandHostPanel.PreferredSize = new Dimension(i7, (this.this$0.bandScrollablePanel.Bounds).height); outerInstance.bandScrollablePanel.doLayout(); bandHostPanel.doLayout(); } else { outerInstance.bandScrollablePanel.setBounds(0, 0, 0, 0); } } }
protected internal virtual void syncRibbonState() { BasicRibbonUI.BandHostPanel bandHostPanel = (BasicRibbonUI.BandHostPanel) this.bandScrollablePanel.View; bandHostPanel.removeAll(); BasicRibbonUI.TaskToggleButtonsHostPanel taskToggleButtonsHostPanel = (BasicRibbonUI.TaskToggleButtonsHostPanel) this.taskToggleButtonsScrollablePanel.View; taskToggleButtonsHostPanel.removeAll(); if (this.o_searchButton != null) { this.ribbon.remove(this.o_searchButton); this.o_searchButton = null; } if (this.o_trailingButton != null) { this.ribbon.remove(this.o_trailingButton); this.o_trailingButton = null; } if (this.closeButton != null) { this.ribbon.remove(this.closeButton); this.closeButton = null; } if (this.helpButton != null) { this.ribbon.remove(this.helpButton); this.helpButton = null; } System.Collections.IList list = CurrentlyShownRibbonTasks; RibbonTask ribbonTask = this.ribbon.SelectedTask; foreach (RibbonTask ribbonTask1 in list) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.pushingpixels.flamingo.internal.ui.ribbon.JRibbonTaskToggleButton taskToggleButton = new org.pushingpixels.flamingo.internal.ui.ribbon.JRibbonTaskToggleButton(ribbonTask1); JRibbonTaskToggleButton taskToggleButton = new JRibbonTaskToggleButton(ribbonTask1); jRibbonTaskToggleButton1.KeyTip = ribbonTask1.KeyTip; jRibbonTaskToggleButton1.addActionListener(new ActionListenerAnonymousInnerClass(this, list, taskToggleButton)); jRibbonTaskToggleButton1.addMouseListener(new MouseAdapterAnonymousInnerClass(this)); if (ribbonTask1.ContextualGroup != null) { jRibbonTaskToggleButton1.ContextualGroupHueColor = ribbonTask1.ContextualGroup.HueColor; } jRibbonTaskToggleButton1.putClientProperty("flamingo.internal.commandButton.ui.dontDisposePopups", true); this.taskToggleButtonGroup.add(jRibbonTaskToggleButton1); taskToggleButtonsHostPanel.add(jRibbonTaskToggleButton1); this.taskToggleButtons.put(ribbonTask1, jRibbonTaskToggleButton1); } JRibbonTaskToggleButton jRibbonTaskToggleButton = (JRibbonTaskToggleButton)this.taskToggleButtons.get(ribbonTask); if (jRibbonTaskToggleButton != null) { jRibbonTaskToggleButton.ActionModel.Selected = true; } sbyte b; for (b = 0; b < this.ribbon.TaskCount; b++) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.pushingpixels.flamingo.api.ribbon.RibbonTask task = this.ribbon.getTask(b); RibbonTask task = this.ribbon.getTask(b); foreach (AbstractRibbonBand abstractRibbonBand in ribbonTask1.Bands) { bandHostPanel.add(abstractRibbonBand); abstractRibbonBand.Visible = (ribbonTask == ribbonTask1); } } for (b = 0; b < this.ribbon.ContextualTaskGroupCount; b++) { RibbonContextualTaskGroup ribbonContextualTaskGroup = this.ribbon.getContextualTaskGroup(b); for (sbyte b1 = 0; b1 < ribbonContextualTaskGroup.TaskCount; b1++) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final org.pushingpixels.flamingo.api.ribbon.RibbonTask task = ribbonContextualTaskGroup.getTask(b1); RibbonTask task = ribbonContextualTaskGroup.getTask(b1); foreach (AbstractRibbonBand abstractRibbonBand in ribbonTask1.Bands) { bandHostPanel.add(abstractRibbonBand); abstractRibbonBand.Visible = (ribbonTask == ribbonTask1); } } } ActionListener actionListener1 = ((BaseRibbon)this.ribbon).UserNameActionListener; if (actionListener1 != null && DatabaseDBUtil.Enterprise) { this.o_trailingButton = new UISplitButton(""); if (DatabaseDBUtil.Loaded) { ((UISplitButton)this.o_trailingButton).Text = DatabaseDBUtil.Properties.UserAndRolesData.PrincipalsData.Name; ((UISplitButton)this.o_trailingButton).VerticalTextPosition = 0; ((UISplitButton)this.o_trailingButton).HorizontalTextPosition = 2; loadImageOfUser(DatabaseDBUtil.Properties.UserId); JPopupMenu jPopupMenu = new JPopupMenu(); JMenuItem[] arrayOfJMenuItem = ((BaseRibbon)this.ribbon).UserMenuItems; foreach (JMenuItem jMenuItem in arrayOfJMenuItem) { if (jMenuItem == null) { jPopupMenu.addSeparator(); } else { jPopupMenu.add(jMenuItem); } } ((UISplitButton)this.o_trailingButton).Menu = jPopupMenu; } ((UISplitButton)this.o_trailingButton).ButtonStyle = 3; ((UISplitButton)this.o_trailingButton).Foreground = CostOSWindowsLookAndFeel.ribbonTaskTitleTextForegroundColor; this.ribbon.add(this.o_trailingButton); this.o_searchButton = ((BaseRibbon)this.ribbon).SearchButton; this.o_searchButton.PreferredSize = new Dimension((int)this.o_searchButton.PreferredSize.Width, TaskToggleButtonHeight - 1); this.o_searchButton.MaximumSize = new Dimension((int)this.o_searchButton.PreferredSize.Width, TaskToggleButtonHeight - 1); this.ribbon.add(this.o_searchButton); } ActionListener actionListener2 = this.ribbon.CloseActionListener; if (actionListener2 != null) { this.closeButton = new JCommandButton("", this.ribbon.CloseIcon); this.closeButton.DisplayState = CommandButtonDisplayState.SMALL; this.closeButton.CommandButtonKind = JCommandButton.CommandButtonKind.ACTION_ONLY; this.closeButton.ActionModel.addActionListener(actionListener2); this.ribbon.add(this.closeButton); } ActionListener actionListener3 = this.ribbon.HelpActionListener; if (actionListener3 != null) { this.helpButton = new JCommandButton("", this.ribbon.HelpIcon); this.helpButton.DisplayState = CommandButtonDisplayState.SMALL; this.helpButton.CommandButtonKind = JCommandButton.CommandButtonKind.ACTION_ONLY; this.helpButton.ActionModel.addActionListener(actionListener3); this.ribbon.add(this.helpButton); } this.ribbon.revalidate(); this.ribbon.repaint(); }