src/macosx/classes/com/apple/laf/AquaTabbedPaneUI.java

Print this page




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.apple.laf;
  27 
  28 import java.awt.*;
  29 import java.awt.event.*;
  30 import java.awt.geom.AffineTransform;
  31 import java.beans.*;
  32 
  33 import javax.swing.*;
  34 import javax.swing.event.*;
  35 import javax.swing.plaf.*;
  36 import javax.swing.text.View;
  37 
  38 import sun.java2d.SunGraphics2D;
  39 import sun.swing.SwingUtilities2;
  40 import apple.laf.*;
  41 import apple.laf.JRSUIConstants.*;
  42 
  43 public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
  44     private static final int kSmallTabHeight = 20; // height of a small tab
  45     private static final int kLargeTabHeight = 23; // height of a large tab
  46     private static final int kMaxIconSize = kLargeTabHeight - 7;
  47     
  48     private static final double kNinetyDegrees = (Math.PI / 2.0); // used for rotation
  49     
  50     protected final Insets currentContentDrawingInsets = new Insets(0, 0, 0, 0);
  51     protected final Insets currentContentBorderInsets = new Insets(0, 0, 0, 0);
  52     protected final Insets contentDrawingInsets = new Insets(0, 0, 0, 0);
  53     
  54     protected int pressedTab = -3; // -2 is right scroller, -1 is left scroller
  55     protected boolean popupSelectionChanged;
  56     
  57     protected Boolean isDefaultFocusReceiver = null;
  58     protected boolean hasAvoidedFirstFocus = false;


 289             }
 290         }
 291         
 292         final boolean isVertical = tabPlacement == RIGHT || tabPlacement == LEFT;
 293         if (isVertical) {
 294             transposeRect(fContentRect);
 295         }
 296         
 297         final Font font = tabPane.getFont();
 298         final FontMetrics metrics = g.getFontMetrics(font);
 299         
 300         // our scrolling tabs
 301         layoutLabel(tabPlacement, metrics, tabIndex < 0 ? 0 : tabIndex, title, icon, fContentRect, iconRect, textRect, false); // Never give it "isSelected" - ApprMgr handles this
 302         if (isVertical) {
 303             transposeRect(fContentRect);
 304             transposeRect(iconRect);
 305             transposeRect(textRect);
 306         }
 307 
 308         // from super.paintText - its normal text painting is totally wrong for the Mac
 309         if (!(g instanceof SunGraphics2D)) {
 310             g.setClip(temp);
 311             return;
 312         }
 313         final SunGraphics2D g2d = (SunGraphics2D)g;
 314 
 315         AffineTransform savedAT = null;
 316         if (isVertical) {
 317             savedAT = g2d.getTransform();
 318             rotateGraphics(g2d, tabRect, textRect, iconRect, tabPlacement);
 319         }
 320         
 321         // not for the scrolling tabs
 322         if (tabIndex >= 0) {
 323             paintTitle(g2d, font, metrics, textRect, tabIndex, title);
 324         }
 325         
 326         if (icon != null) {
 327             paintIcon(g, tabPlacement, tabIndex, icon, iconRect, isSelected);
 328         }
 329 
 330         if (savedAT != null) {
 331             g2d.setTransform(savedAT);
 332         }
 333         




  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package com.apple.laf;
  27 
  28 import java.awt.*;
  29 import java.awt.event.*;
  30 import java.awt.geom.AffineTransform;
  31 import java.beans.*;
  32 
  33 import javax.swing.*;
  34 import javax.swing.event.*;
  35 import javax.swing.plaf.*;
  36 import javax.swing.text.View;
  37 

  38 import sun.swing.SwingUtilities2;
  39 import apple.laf.*;
  40 import apple.laf.JRSUIConstants.*;
  41 
  42 public class AquaTabbedPaneUI extends AquaTabbedPaneCopyFromBasicUI {
  43     private static final int kSmallTabHeight = 20; // height of a small tab
  44     private static final int kLargeTabHeight = 23; // height of a large tab
  45     private static final int kMaxIconSize = kLargeTabHeight - 7;
  46     
  47     private static final double kNinetyDegrees = (Math.PI / 2.0); // used for rotation
  48     
  49     protected final Insets currentContentDrawingInsets = new Insets(0, 0, 0, 0);
  50     protected final Insets currentContentBorderInsets = new Insets(0, 0, 0, 0);
  51     protected final Insets contentDrawingInsets = new Insets(0, 0, 0, 0);
  52     
  53     protected int pressedTab = -3; // -2 is right scroller, -1 is left scroller
  54     protected boolean popupSelectionChanged;
  55     
  56     protected Boolean isDefaultFocusReceiver = null;
  57     protected boolean hasAvoidedFirstFocus = false;


 288             }
 289         }
 290         
 291         final boolean isVertical = tabPlacement == RIGHT || tabPlacement == LEFT;
 292         if (isVertical) {
 293             transposeRect(fContentRect);
 294         }
 295         
 296         final Font font = tabPane.getFont();
 297         final FontMetrics metrics = g.getFontMetrics(font);
 298         
 299         // our scrolling tabs
 300         layoutLabel(tabPlacement, metrics, tabIndex < 0 ? 0 : tabIndex, title, icon, fContentRect, iconRect, textRect, false); // Never give it "isSelected" - ApprMgr handles this
 301         if (isVertical) {
 302             transposeRect(fContentRect);
 303             transposeRect(iconRect);
 304             transposeRect(textRect);
 305         }
 306 
 307         // from super.paintText - its normal text painting is totally wrong for the Mac
 308         if (!(g instanceof Graphics2D)) {
 309             g.setClip(temp);
 310             return;
 311         }
 312         final Graphics2D g2d = (Graphics2D) g;
 313 
 314         AffineTransform savedAT = null;
 315         if (isVertical) {
 316             savedAT = g2d.getTransform();
 317             rotateGraphics(g2d, tabRect, textRect, iconRect, tabPlacement);
 318         }
 319         
 320         // not for the scrolling tabs
 321         if (tabIndex >= 0) {
 322             paintTitle(g2d, font, metrics, textRect, tabIndex, title);
 323         }
 324         
 325         if (icon != null) {
 326             paintIcon(g, tabPlacement, tabIndex, icon, iconRect, isSelected);
 327         }
 328 
 329         if (savedAT != null) {
 330             g2d.setTransform(savedAT);
 331         }
 332