public CostOSRootPaneUI(JRootPane paramJRootPane)
	  {
		  if (!InstanceFieldsInitialized)
		  {
			  InitializeInstanceFields();
			  InstanceFieldsInitialized = true;
		  }
		  this.root = paramJRootPane;
	  }
Beispiel #2
0
 public CostOSTitlePane(JRootPane paramJRootPane, CostOSRootPaneUI paramCostOSRootPaneUI)
 {
     this.rootPane   = paramJRootPane;
     this.rootPaneUI = paramCostOSRootPaneUI;
     this.state      = -1;
     installSubcomponents();
     determineColors();
     installDefaults();
     Layout            = createLayout();
     this.ribbonArtImg = ((ImageIcon)UIManager.getIcon("Ribbon.artIcon")).Image;
     this.ribbonArtImg.getHeight(paramJRootPane);
     this.ribbonBackstageArtImg = ((ImageIcon)UIManager.getIcon("Ribbon.artBackstageIcon")).Image;
     if (this.ribbonBackstageArtImg != null)
     {
         this.ribbonBackstageArtImg.getHeight(paramJRootPane);
     }
     PreferredSize = new Dimension(100, 30);
 }
Beispiel #3
0
        public virtual void paintComponent(Graphics paramGraphics)
        {
            if (Frame != null)
            {
                State = Frame.ExtendedState;
            }
            JRootPane jRootPane = RootPane;
            Window    window1   = Window;
            bool      @bool     = (window1 == null) ? jRootPane.ComponentOrientation.LeftToRight : window1.ComponentOrientation.LeftToRight;
            int       i         = Width;
            int       j         = Height;
            Color     color     = CostOSWindowsLookAndFeel.ribbonTaskTitleTextForegroundColor;

            if (!CostOSRibbonUI.Instance.BackstageShowing)
            {
                paramGraphics.Color = CostOSWindowsLookAndFeel.ribbonBackground;
                paramGraphics.fillRect(0, 0, i, j);
                paramGraphics.drawImage(this.ribbonArtImg, i - this.ribbonArtImg.getWidth(this), 0, this.ribbonArtImg.getWidth(this), this.ribbonArtImg.getHeight(this), this);
            }
            else
            {
                int m = CostOSRibbonApplicationMenuPopupPanel.FirstLevelMenuWidth;
                paramGraphics.Color = CostOSWindowsLookAndFeel.applicationBackground;
                paramGraphics.fillRect(0, 0, i, j);
                paramGraphics.Color = CostOSWindowsLookAndFeel.ribbonBackground;
                paramGraphics.fillRect(0, 0, m, Height);
                if (this.ribbonBackstageArtImg != null)
                {
                    paramGraphics.drawImage(this.ribbonBackstageArtImg, i - this.ribbonBackstageArtImg.getWidth(this), 0, this.ribbonBackstageArtImg.getWidth(this), this.ribbonBackstageArtImg.getHeight(this), this);
                }
                color = CostOSWindowsLookAndFeel.ribbonCommandButtonForegroundColor;
            }
            int k = @bool ? 5 : (i - 5);

            if (WindowDecorationStyle == 1)
            {
                k += (@bool ? 21 : -21);
            }
            string str = Title;

            if (!string.ReferenceEquals(str, null))
            {
                FontMetrics fontMetrics = SwingUtilities2.getFontMetrics(jRootPane, paramGraphics);
                int         m           = (j - fontMetrics.Height) / 2 + fontMetrics.Ascent;
                Rectangle   rectangle   = new Rectangle(0, 0, 0, 0);
                if (this.iconifyButton != null && this.iconifyButton.Parent != null)
                {
                    rectangle = this.iconifyButton.Bounds;
                }
                if (@bool)
                {
                    if (rectangle.x == 0)
                    {
                        rectangle.x = window1.Width - (window1.Insets).right - 2;
                    }
                    int i2 = rectangle.x - k - 4;
                    str = SwingUtilities2.clipStringIfNecessary(jRootPane, fontMetrics, str, i2);
                }
                else
                {
                    int i2 = k - rectangle.x - rectangle.width - 4;
                    str = SwingUtilities2.clipStringIfNecessary(jRootPane, fontMetrics, str, i2);
                    k  -= SwingUtilities2.stringWidth(jRootPane, fontMetrics, str);
                }
                int n = SwingUtilities2.stringWidth(jRootPane, fontMetrics, str);
                paramGraphics.Color = color;
                int i1 = (int)(i / 2.0F - n / 2.0F);
                SwingUtilities2.drawString(jRootPane, paramGraphics, str, i1, m);
                k += (@bool ? (n + 5) : -5);
            }
        }
Beispiel #4
0
        private void setState(int paramInt, bool paramBoolean)
        {
            Window window1 = Window;

            if (window1 != null && WindowDecorationStyle == 1)
            {
                if (this.state == paramInt && !paramBoolean)
                {
                    return;
                }
                Frame frame = Frame;
                if (frame != null)
                {
                    JRootPane jRootPane = RootPane;
                    if ((paramInt & 0x6) != 0 && (jRootPane.Border == null || jRootPane.Border is javax.swing.plaf.UIResource) && frame.Showing)
                    {
                        jRootPane.Border = null;
                    }
                    else if ((paramInt & 0x6) == 0)
                    {
                        this.rootPaneUI.installBorder(jRootPane);
                    }
                    if (frame.Resizable)
                    {
                        if ((paramInt & 0x6) != 0)
                        {
                            updateToggleButton(this.restoreAction, this.minimizeIcon, this.minimizeDownIcon, this.minimizeOverIcon);
                            this.maximizeAction.Enabled = false;
                            this.restoreAction.Enabled  = true;
                        }
                        else
                        {
                            updateToggleButton(this.maximizeAction, this.maximizeIcon, this.maximizeDownIcon, this.maximizeOverIcon);
                            this.maximizeAction.Enabled = true;
                            this.restoreAction.Enabled  = false;
                        }
                        if (this.toggleButton.Parent == null || this.iconifyButton.Parent == null)
                        {
                            add(this.toggleButton);
                            add(this.iconifyButton);
                            revalidate();
                            repaint();
                        }
                        this.toggleButton.Text = null;
                    }
                    else
                    {
                        this.maximizeAction.Enabled = false;
                        this.restoreAction.Enabled  = false;
                        if (this.toggleButton.Parent != null)
                        {
                            remove(this.toggleButton);
                            revalidate();
                            repaint();
                        }
                    }
                }
                else
                {
                    this.maximizeAction.Enabled = false;
                    this.restoreAction.Enabled  = false;
                    this.iconifyAction.Enabled  = false;
                    remove(this.toggleButton);
                    remove(this.iconifyButton);
                    revalidate();
                    repaint();
                }
                this.closeAction.Enabled = true;
                this.helpAction.Enabled  = true;
                this.state = paramInt;
            }
        }