org.eclipse.swt.win32.win32.x86_3.7.2.v3740f

tends AccessibleAdapter
{
  final CLabel this$0;
  
  CLabel$4(CLabel paramCLabel)
  {
    this$0 = paramCLabel;
  }
  
  public void getName(AccessibleEvent e)
  {
    result = this$0.getText();
  }
  
  public void getHelp(AccessibleEvent e)
  {
    result = this$0.getToolTipText();
  }
  
  public void getKeyboardShortcut(AccessibleEvent e)
  {
    char mnemonic = this$0._findMnemonic(CLabel.access$0(this$0));
    if (mnemonic != 0) {
      result = ("Alt+" + mnemonic);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CLabel.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.accessibility.AccessibleControlAdapter;
import org.eclipse.swt.accessibility.AccessibleControlEvent;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;

class CLabel$5
  extends AccessibleControlAdapter
{
  final CLabel this$0;
  
  CLabel$5(CLabel paramCLabel)
  {
    this$0 = paramCLabel;
  }
  
  public void getChildAtPoint(AccessibleControlEvent e)
  {
    childID = -1;
  }
  
  public void getLocation(AccessibleControlEvent e)
  {
    Rectangle rect = this$0.getDisplay().map(this$0.getParent(), null, this$0.getBounds());
    x = x;
    y = y;
    width = width;
    height = height;
  }
  
  public void getChildCount(AccessibleControlEvent e)
  {
    detail = 0;
  }
  
  public void getRole(AccessibleControlEvent e)
  {
    detail = 41;
  }
  
  public void getState(AccessibleControlEvent e)
  {
    detail = 64;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CLabel.5
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.accessibility.Accessible;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleControlAdapter;
import org.eclipse.swt.accessibility.AccessibleControlEvent;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.TraverseEvent;
import org.eclipse.swt.events.TraverseListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontMetrics;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.TextLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

public class CLabel
  extends Canvas
{
  private static final int GAP = 5;
  private static final int DEFAULT_MARGIN = 3;
  private static final String ELLIPSIS = "...";
  private int align = 16384;
  private int leftMargin = 3;
  private int topMargin = 3;
  private int rightMargin = 3;
  private int bottomMargin = 3;
  private String text;
  private Image image;
  private String appToolTipText;
  private boolean ignoreDispose;
  private Image backgroundImage;
  private Color[] gradientColors;
  private int[] gradientPercents;
  private boolean gradientVertical;
  private Color background;
  private static int DRAW_FLAGS = 15;
  
  public CLabel(Composite parent, int style)
  {
    super(parent, checkStyle(style));
    if ((style & 0x1020000) == 0) {
      style |= 0x4000;
    }
    if ((style & 0x1000000) != 0) {
      align = 16777216;
    }
    if ((style & 0x20000) != 0) {
      align = 131072;
    }
    if ((style & 0x4000) != 0) {
      align = 16384;
    }
    addPaintListener(new PaintListener()
    {
      public void paintControl(PaintEvent event)
      {
        onPaint(event);
      }
    });
    addTraverseListener(new TraverseListener()
    {
      public void keyTraversed(TraverseEvent event)
      {
        if (detail == 128) {
          onMnemonic(event);
        }
      }
    });
    addListener(12, new Listener()
    {
      public void handleEvent(Event event)
      {
        onDispose(event);
      }
    });
    initAccessible();
  }
  
  private static int checkStyle(int style)
  {
    if ((style & 0x800) != 0) {
      style |= 0x4;
    }
    int mask = 100663340;
    style &= mask;
    return style |= 0x20080000;
  }
  
  public Point computeSize(int wHint, int hHint, boolean changed)
  {
    checkWidget();
    Point e = getTotalSize(image, text);
    if (wHint == -1) {
      x += leftMargin + rightMargin;
    } else {
      x = wHint;
    }
    if (hHint == -1) {
      y += topMargin + bottomMargin;
    } else {
      y = hHint;
    }
    return e;
  }
  
  private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright)
  {
    gc.setForeground(bottomright);
    gc.drawLine(x + w, y, x + w, y + h);
    gc.drawLine(x, y + h, x + w, y + h);
    
    gc.setForeground(topleft);
    gc.drawLine(x, y, x + w - 1, y);
    gc.drawLine(x, y, x, y + h - 1);
  }
  
  char _findMnemonic(String string)
  {
    if (string == null) {
      return '\000';
    }
    int index = 0;
    int length = string.length();
    do
    {
      while ((index < length) && (string.charAt(index) != '&')) {
        index++;
      }
      index++;
      if (index >= length) {
        return '\000';
      }
      if (string.charAt(index) != '&') {
        return Character.toLowerCase(string.charAt(index));
      }
      index++;
    } while (index < length);
    return '\000';
  }
  
  public int getAlignment()
  {
    return align;
  }
  
  public int getBottomMargin()
  {
    return bottomMargin;
  }
  
  public Image getImage()
  {
    return image;
  }
  
  public int getLeftMargin()
  {
    return leftMargin;
  }
  
  public int getRightMargin()
  {
    return rightMargin;
  }
  
  private Point getTotalSize(Image image, String text)
  {
    Point size = new Point(0, 0);
    if (image != null)
    {
      Rectangle r = image.getBounds();
      x += width;
      y += height;
    }
    GC gc = new GC(this);
    if ((text != null) && (text.length() > 0))
    {
      Point e = gc.textExtent(text, DRAW_FLAGS);
      x += x;
      y = Math.max(y, y);
      if (image != null) {
        x += 5;
      }
    }
    else
    {
      y = Math.max(y, gc.getFontMetrics().getHeight());
    }
    gc.dispose();
    
    return size;
  }
  
  public int getStyle()
  {
    int style = super.getStyle();
    switch (align)
    {
    case 131072: 
      style |= 0x20000; break;
    case 16777216: 
      style |= 0x1000000; break;
    case 16384: 
      style |= 0x4000;
    }
    return style;
  }
  
  public String getText()
  {
    return text;
  }
  
  public String getToolTipText()
  {
    checkWidget();
    return appToolTipText;
  }
  
  public int getTopMargin()
  {
    return topMargin;
  }
  
  private void initAccessible()
  {
    Accessible accessible = getAccessible();
    accessible.addAccessibleListener(new AccessibleAdapter()
    {
      public void getName(AccessibleEvent e)
      {
        result = getText();
      }
      
      public void getHelp(AccessibleEvent e)
      {
        result = getToolTipText();
      }
      
      public void getKeyboardShortcut(AccessibleEvent e)
      {
        char mnemonic = _findMnemonic(text);
        if (mnemonic != 0) {
          result = ("Alt+" + mnemonic);
        }
      }
    });
    accessible.addAccessibleControlListener(new AccessibleControlAdapter()
    {
      public void getChildAtPoint(AccessibleControlEvent e)
      {
        childID = -1;
      }
      
      public void getLocation(AccessibleControlEvent e)
      {
        Rectangle rect = getDisplay().map(getParent(), null, getBounds());
        x = x;
        y = y;
        width = width;
        height = height;
      }
      
      public void getChildCount(AccessibleControlEvent e)
      {
        detail = 0;
      }
      
      public void getRole(AccessibleControlEvent e)
      {
        detail = 41;
      }
      
      public void getState(AccessibleControlEvent e)
      {
        detail = 64;
      }
    });
  }
  
  void onDispose(Event event)
  {
    if (ignoreDispose)
    {
      ignoreDispose = false;
      return;
    }
    ignoreDispose = true;
    notifyListeners(type, event);
    type = 0;
    
    gradientColors = null;
    gradientPercents = null;
    backgroundImage = null;
    text = null;
    image = null;
    appToolTipText = null;
  }
  
  void onMnemonic(TraverseEvent event)
  {
    char mnemonic = _findMnemonic(text);
    if (mnemonic == 0) {
      return;
    }
    if (Character.toLowerCase(character) != mnemonic) {
      return;
    }
    Composite control = getParent();
    while (control != null)
    {
      Control[] children = control.getChildren();
      int index = 0;
      while (index < children.length)
      {
        if (children[index] == this) {
          break;
        }
        index++;
      }
      index++;
      if ((index < children.length) && 
        (children[index].setFocus()))
      {
        doit = true;
        detail = 0;
      }
      control = control.getParent();
    }
  }
  
  void onPaint(PaintEvent event)
  {
    Rectangle rect = getClientArea();
    if ((width == 0) || (height == 0)) {
      return;
    }
    boolean shortenText = false;
    String t = text;
    Image img = image;
    int availableWidth = Math.max(0, width - (leftMargin + rightMargin));
    Point extent = getTotalSize(img, t);
    if (x > availableWidth)
    {
      img = null;
      extent = getTotalSize(img, t);
      if (x > availableWidth) {
        shortenText = true;
      }
    }
    GC gc = gc;
    String[] lines = text == null ? null : splitString(text);
    if (shortenText)
    {
      x = 0;
      for (int i = 0; i < lines.length; i++)
      {
        Point e = gc.textExtent(lines[i], DRAW_FLAGS);
        if (x > availableWidth)
        {
          lines[i] = shortenText(gc, lines[i], availableWidth);
          x = Math.max(x, getTotalSizex);
        }
        else
        {
          x = Math.max(x, x);
        }
      }
      if (appToolTipText == null) {
        super.setToolTipText(text);
      }
    }
    else
    {
      super.setToolTipText(appToolTipText);
    }
    int x = x + leftMargin;
    if (align == 16777216) {
      x = (width - x) / 2;
    }
    if (align == 131072) {
      x = width - rightMargin - x;
    }
    try
    {
      if (backgroundImage != null)
      {
        Rectangle imageRect = backgroundImage.getBounds();
        
        gc.setBackground(getBackground());
        gc.fillRectangle(rect);
        int xPos = 0;
        while (xPos < width)
        {
          int yPos = 0;
          while (yPos < height)
          {
            gc.drawImage(backgroundImage, xPos, yPos);
            yPos += height;
          }
          xPos += width;
        }
      }
      else if (gradientColors != null)
      {
        Color oldBackground = gc.getBackground();
        if (gradientColors.length == 1)
        {
          if (gradientColors[0] != null) {
            gc.setBackground(gradientColors[0]);
          }
          gc.fillRectangle(0, 0, width, height);
        }
        else
        {
          Color oldForeground = gc.getForeground();
          Color lastColor = gradientColors[0];
          if (lastColor == null) {
            lastColor = oldBackground;
          }
          int pos = 0;
          for (int i = 0; i < gradientPercents.length; i++)
          {
            gc.setForeground(lastColor);
            lastColor = gradientColors[(i + 1)];
            if (lastColor == null) {
              lastColor = oldBackground;
            }
            gc.setBackground(lastColor);
            if (gradientVertical)
            {
              int gradientHeight = gradientPercents[i] * height / 100 - pos;
              gc.fillGradientRectangle(0, pos, width, gradientHeight, true);
              pos += gradientHeight;
            }
            else
            {
              int gradientWidth = gradientPercents[i] * width / 100 - pos;
              gc.fillGradientRectangle(pos, 0, gradientWidth, height, false);
              pos += gradientWidth;
            }
          }
          if ((gradientVertical) && (pos < height))
          {
            gc.setBackground(getBackground());
            gc.fillRectangle(0, pos, width, height - pos);
          }
          if ((!gradientVertical) && (pos < width))
          {
            gc.setBackground(getBackground());
            gc.fillRectangle(pos, 0, width - pos, height);
          }
          gc.setForeground(oldForeground);
        }
        gc.setBackground(oldBackground);
      }
      else if ((background != null) || ((getStyle() & 0x20000000) == 0))
      {
        gc.setBackground(getBackground());
        gc.fillRectangle(rect);
      }
    }
    catch (SWTException localSWTException)
    {
      if ((getStyle() & 0x20000000) == 0)
      {
        gc.setBackground(getBackground());
        gc.fillRectangle(rect);
      }
    }
    int style = getStyle();
    if (((style & 0x4) != 0) || ((style & 0x8) != 0)) {
      paintBorder(gc, rect);
    }
    Rectangle imageRect = null;
    int lineHeight = 0;int textHeight = 0;int imageHeight = 0;
    if (img != null)
    {
      imageRect = img.getBounds();
      imageHeight = height;
    }
    if (lines != null)
    {
      lineHeight = gc.getFontMetrics().getHeight();
      textHeight = lines.length * lineHeight;
    }
    int imageY = 0;int midPoint = 0;int lineY = 0;
    if (imageHeight > textHeight)
    {
      if ((topMargin == 3) && (bottomMargin == 3)) {
        imageY = y + (height - imageHeight) / 2;
      } else {
        imageY = topMargin;
      }
      midPoint = imageY + imageHeight / 2;
      lineY = midPoint - textHeight / 2;
    }
    else
    {
      if ((topMargin == 3) && (bottomMargin == 3)) {
        lineY = y + (height - textHeight) / 2;
      } else {
        lineY = topMargin;
      }
      midPoint = lineY + textHeight / 2;
      imageY = midPoint - imageHeight / 2;
    }
    if (img != null)
    {
      gc.drawImage(img, 0, 0, width, imageHeight, 
        x, imageY, width, imageHeight);
      x += width + 5;
      x -= width + 5;
    }
    if (lines != null)
    {
      gc.setForeground(getForeground());
      for (int i = 0; i < lines.length; i++)
      {
        int lineX = x;
        if (lines.length > 1)
        {
          if (align == 16777216)
          {
            int lineWidth = textExtentDRAW_FLAGSx;
            lineX = x + Math.max(0, (x - lineWidth) / 2);
          }
          if (align == 131072)
          {
            int lineWidth = textExtentDRAW_FLAGSx;
            lineX = Math.max(x, x + width - rightMargin - lineWidth);
          }
        }
        gc.drawText(lines[i], lineX, lineY, DRAW_FLAGS);
        lineY += lineHeight;
      }
    }
  }
  
  private void paintBorder(GC gc, Rectangle r)
  {
    Display disp = getDisplay();
    
    Color c1 = null;
    Color c2 = null;
    
    int style = getStyle();
    if ((style & 0x4) != 0)
    {
      c1 = disp.getSystemColor(18);
      c2 = disp.getSystemColor(20);
    }
    if ((style & 0x8) != 0)
    {
      c1 = disp.getSystemColor(19);
      c2 = disp.getSystemColor(18);
    }
    if ((c1 != null) && (c2 != null))
    {
      gc.setLineWidth(1);
      drawBevelRect(gc, x, y, width - 1, height - 1, c1, c2);
    }
  }
  
  public void setAlignment(int align)
  {
    checkWidget();
    if ((align != 16384) && (align != 131072) && (align != 16777216)) {
      SWT.error(5);
    }
    if (this.align != align)
    {
      this.align = align;
      redraw();
    }
  }
  
  public void setBackground(Color color)
  {
    super.setBackground(color);
    if ((backgroundImage == null) && 
      (gradientColors == null) && 
      (gradientPercents == null)) {
      if (color == null)
      {
        if (background != null) {}
      }
      else if (color.equals(background)) {
        return;
      }
    }
    background = color;
    backgroundImage = null;
    gradientColors = null;
    gradientPercents = null;
    redraw();
  }
  
  public void setBackground(Color[] colors, int[] percents)
  {
    setBackground(colors, percents, false);
  }
  
  public void setBackground(Color[] colors, int[] percents, boolean vertical)
  {
    checkWidget();
    if (colors != null)
    {
      if ((percents == null) || (percents.length != colors.length - 1)) {
        SWT.error(5);
      }
      if (getDisplay().getDepth() < 15)
      {
        colors = new Color[] { colors[(colors.length - 1)] };
        percents = new int[0];
      }
      for (int i = 0; i < percents.length; i++)
      {
        if ((percents[i] < 0) || (percents[i] > 100)) {
          SWT.error(5);
        }
        if ((i > 0) && (percents[i] < percents[(i - 1)])) {
          SWT.error(5);
        }
      }
    }
    Color background = getBackground();
    if (backgroundImage == null)
    {
      if ((gradientColors != null) && (colors != null) && 
        (gradientColors.length == colors.length))
      {
        boolean same = false;
        for (int i = 0; i < gradientColors.length; i++)
        {
          same = (gradientColors[i] == colors[i]) || 
            ((gradientColors[i] == null) && (colors[i] == background)) || (
            (gradientColors[i] == background) && (colors[i] == null));
          if (!same) {
            break;
          }
        }
        if (same) {
          for (int i = 0; i < gradientPercents.length; i++)
          {
            same = gradientPercents[i] == percents[i];
            if (!same) {
              break;
            }
          }
        }
        if ((!same) || (gradientVertical != vertical)) {}
      }
    }
    else {
      backgroundImage = null;
    }
    if (colors == null)
    {
      gradientColors = null;
      gradientPercents = null;
      gradientVertical = false;
    }
    else
    {
      gradientColors = new Color[colors.length];
      for (int i = 0; i < colors.length; i++) {
        gradientColors[i] = (colors[i] != null ? colors[i] : background);
      }
      gradientPercents = new int[percents.length];
      for (int i = 0; i < percents.length; i++) {
        gradientPercents[i] = percents[i];
      }
      gradientVertical = vertical;
    }
    redraw();
  }
  
  public void setBackground(Image image)
  {
    checkWidget();
    if (image == backgroundImage) {
      return;
    }
    if (image != null)
    {
      gradientColors = null;
      gradientPercents = null;
    }
    backgroundImage = image;
    redraw();
  }
  
  public void setBottomMargin(int bottomMargin)
  {
    checkWidget();
    if ((this.bottomMargin == bottomMargin) || (bottomMargin < 0)) {
      return;
    }
    this.bottomMargin = bottomMargin;
    redraw();
  }
  
  public void setFont(Font font)
  {
    super.setFont(font);
    redraw();
  }
  
  public void setImage(Image image)
  {
    checkWidget();
    if (image != this.image)
    {
      this.image = image;
      redraw();
    }
  }
  
  public void setLeftMargin(int leftMargin)
  {
    checkWidget();
    if ((this.leftMargin == leftMargin) || (leftMargin < 0)) {
      return;
    }
    this.leftMargin = leftMargin;
    redraw();
  }
  
  public void setMargins(int leftMargin, int topMargin, int rightMargin, int bottomMargin)
  {
    checkWidget();
    this.leftMargin = Math.max(0, leftMargin);
    this.topMargin = Math.max(0, topMargin);
    this.rightMargin = Math.max(0, rightMargin);
    this.bottomMargin = Math.max(0, bottomMargin);
    redraw();
  }
  
  public void setRightMargin(int rightMargin)
  {
    checkWidget();
    if ((this.rightMargin == rightMargin) || (rightMargin < 0)) {
      return;
    }
    this.rightMargin = rightMargin;
    redraw();
  }
  
  public void setText(String text)
  {
    checkWidget();
    if (text == null) {
      text = "";
    }
    if (!text.equals(this.text))
    {
      this.text = text;
      redraw();
    }
  }
  
  public void setToolTipText(String string)
  {
    super.setToolTipText(string);
    appToolTipText = super.getToolTipText();
  }
  
  public void setTopMargin(int topMargin)
  {
    checkWidget();
    if ((this.topMargin == topMargin) || (topMargin < 0)) {
      return;
    }
    this.topMargin = topMargin;
    redraw();
  }
  
  protected String shortenText(GC gc, String t, int width)
  {
    if (t == null) {
      return null;
    }
    int w = textExtent"..."DRAW_FLAGSx;
    if (width <= w) {
      return t;
    }
    int l = t.length();
    int max = l / 2;
    int min = 0;
    int mid = (max + min) / 2 - 1;
    if (mid <= 0) {
      return t;
    }
    TextLayout layout = new TextLayout(getDisplay());
    layout.setText(t);
    mid = validateOffset(layout, mid);
    while ((min < mid) && (mid < max))
    {
      String s1 = t.substring(0, mid);
      String s2 = t.substring(validateOffset(layout, l - mid), l);
      int l1 = textExtentDRAW_FLAGSx;
      int l2 = textExtentDRAW_FLAGSx;
      if (l1 + w + l2 > width)
      {
        max = mid;
        mid = validateOffset(layout, (max + min) / 2);
      }
      else if (l1 + w + l2 < width)
      {
        min = mid;
        mid = validateOffset(layout, (max + min) / 2);
      }
      else
      {
        min = max;
      }
    }
    String result = t.substring(0, mid) + "..." + t.substring(validateOffset(layout, l - mid), l);
    layout.dispose();
    return result;
  }
  
  int validateOffset(TextLayout layout, int offset)
  {
    int nextOffset = layout.getNextOffset(offset, 2);
    if (nextOffset != offset) {
      return layout.getPreviousOffset(nextOffset, 2);
    }
    return offset;
  }
  
  private String[] splitString(String text)
  {
    String[] lines = new String[1];
    int start = 0;
    int pos;
    do
    {
      pos = text.indexOf('\n', start);
      if (pos == -1)
      {
        lines[(lines.length - 1)] = text.substring(start);
      }
      else
      {
        boolean crlf = (pos > 0) && (text.charAt(pos - 1) == '\r');
        lines[(lines.length - 1)] = text.substring(start, pos - (crlf ? 1 : 0));
        start = pos + 1;
        String[] newLines = new String[lines.length + 1];
        System.arraycopy(lines, 0, newLines, 0, lines.length);
        lines = newLines;
      }
    } while (pos != -1);
    return lines;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CLabel
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;

class CLayoutData
{
  int defaultWidth = -1;
  int defaultHeight = -1;
  int currentWidth = -1;
  int currentHeight = -1;
  int currentWhint;
  int currentHhint;
  
  Point computeSize(Control control, int wHint, int hHint, boolean flushCache)
  {
    if (flushCache) {
      flushCache();
    }
    if ((wHint == -1) && (hHint == -1))
    {
      if ((defaultWidth == -1) || (defaultHeight == -1))
      {
        Point size = control.computeSize(wHint, hHint, flushCache);
        defaultWidth = x;
        defaultHeight = y;
      }
      return new Point(defaultWidth, defaultHeight);
    }
    if ((currentWidth == -1) || (currentHeight == -1) || (wHint != currentWhint) || (hHint != currentHhint))
    {
      Point size = control.computeSize(wHint, hHint, flushCache);
      currentWhint = wHint;
      currentHhint = hHint;
      currentWidth = x;
      currentHeight = y;
    }
    return new Point(currentWidth, currentHeight);
  }
  
  void flushCache()
  {
    defaultWidth = (defaultHeight = -1);
    currentWidth = (currentHeight = -1);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CLayoutData
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class CTabFolder$1
  implements Listener
{
  final CTabFolder this$0;
  
  CTabFolder$1(CTabFolder paramCTabFolder)
  {
    this$0 = paramCTabFolder;
  }
  
  public void handleEvent(Event event)
  {
    switch (type)
    {
    case 12: 
      this$0.onDispose(event); break;
    case 29: 
      this$0.onDragDetect(event); break;
    case 15: 
      this$0.onFocus(event); break;
    case 16: 
      this$0.onFocus(event); break;
    case 1: 
      this$0.onKeyDown(event); break;
    case 8: 
      this$0.onMouseDoubleClick(event); break;
    case 3: 
      this$0.onMouse(event); break;
    case 6: 
      this$0.onMouse(event); break;
    case 7: 
      this$0.onMouse(event); break;
    case 5: 
      this$0.onMouse(event); break;
    case 4: 
      this$0.onMouse(event); break;
    case 9: 
      this$0.onPaint(event); break;
    case 11: 
      this$0.onResize(); break;
    case 31: 
      this$0.onTraverse(event);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CTabFolder.1
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;

class CTabFolder$2
  extends AccessibleAdapter
{
  final CTabFolder this$0;
  
  CTabFolder$2(CTabFolder paramCTabFolder)
  {
    this$0 = paramCTabFolder;
  }
  
  public void getName(AccessibleEvent e)
  {
    String name = null;
    int childID = childID;
    if ((childID >= 0) && (childID < this$0.items.length)) {
      name = this$0.stripMnemonic(this$0.items[childID].getText());
    } else if (childID == this$0.items.length + 0) {
      name = SWT.getMessage("SWT_ShowList");
    } else if (childID == this$0.items.length + 1) {
      name = this$0.minimized ? SWT.getMessage("SWT_Restore") : SWT.getMessage("SWT_Minimize");
    } else if (childID == this$0.items.length + 2) {
      name = this$0.maximized ? SWT.getMessage("SWT_Restore") : SWT.getMessage("SWT_Maximize");
    }
    result = name;
  }
  
  public void getHelp(AccessibleEvent e)
  {
    String help = null;
    int childID = childID;
    if (childID == -1) {
      help = this$0.getToolTipText();
    } else if ((childID >= 0) && (childID < this$0.items.length)) {
      help = this$0.items[childID].getToolTipText();
    }
    result = help;
  }
  
  public void getKeyboardShortcut(AccessibleEvent e)
  {
    String shortcut = null;
    int childID = childID;
    if ((childID >= 0) && (childID < this$0.items.length))
    {
      String text = this$0.items[childID].getText();
      if (text != null)
      {
        char mnemonic = this$0._findMnemonic(text);
        if (mnemonic != 0) {
          shortcut = "Alt+" + mnemonic;
        }
      }
    }
    if (childID == -1) {
      shortcut = "Ctrl+PageDown";
    }
    result = shortcut;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CTabFolder.2
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleControlAdapter;
import org.eclipse.swt.accessibility.AccessibleControlEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;

class CTabFolder$3
  extends AccessibleControlAdapter
{
  final CTabFolder this$0;
  
  CTabFolder$3(CTabFolder paramCTabFolder)
  {
    this$0 = paramCTabFolder;
  }
  
  public void getChildAtPoint(AccessibleControlEvent e)
  {
    Point testPoint = this$0.toControl(x, y);
    int childID = -2;
    for (int i = 0; i < this$0.items.length; i++) {
      if (this$0.items[i].getBounds().contains(testPoint))
      {
        childID = i;
        break;
      }
    }
    if (childID == -2) {
      if ((this$0.showChevron) && (this$0.chevronRect.contains(testPoint)))
      {
        childID = this$0.items.length + 0;
      }
      else if ((this$0.showMin) && (this$0.minRect.contains(testPoint)))
      {
        childID = this$0.items.length + 1;
      }
      else if ((this$0.showMax) && (this$0.maxRect.contains(testPoint)))
      {
        childID = this$0.items.length + 2;
      }
      else
      {
        Rectangle location = this$0.getBounds();
        x = (y = 0);
        height -= this$0.getClientArea().height;
        if (location.contains(testPoint)) {
          childID = -1;
        }
      }
    }
    childID = childID;
  }
  
  public void getLocation(AccessibleControlEvent e)
  {
    Rectangle location = null;
    Point pt = null;
    int childID = childID;
    if (childID == -1)
    {
      location = this$0.getBounds();
      pt = this$0.getParent().toDisplay(x, y);
    }
    else
    {
      if ((childID >= 0) && (childID < this$0.items.length) && (this$0.items[childID].isShowing())) {
        location = this$0.items[childID].getBounds();
      } else if ((this$0.showChevron) && (childID == this$0.items.length + 0)) {
        location = this$0.chevronRect;
      } else if ((this$0.showMin) && (childID == this$0.items.length + 1)) {
        location = this$0.minRect;
      } else if ((this$0.showMax) && (childID == this$0.items.length + 2)) {
        location = this$0.maxRect;
      }
      if (location != null) {
        pt = this$0.toDisplay(x, y);
      }
    }
    if ((location != null) && (pt != null))
    {
      x = x;
      y = y;
      width = width;
      height = height;
    }
  }
  
  public void getChildCount(AccessibleControlEvent e)
  {
    detail = (this$0.items.length + 3);
  }
  
  public void getDefaultAction(AccessibleControlEvent e)
  {
    String action = null;
    int childID = childID;
    if ((childID >= 0) && (childID < this$0.items.length)) {
      action = SWT.getMessage("SWT_Switch");
    }
    if ((childID >= this$0.items.length) && (childID < this$0.items.length + 3)) {
      action = SWT.getMessage("SWT_Press");
    }
    result = action;
  }
  
  public void getFocus(AccessibleControlEvent e)
  {
    int childID = -2;
    if (this$0.isFocusControl()) {
      if (this$0.selectedIndex == -1) {
        childID = -1;
      } else {
        childID = this$0.selectedIndex;
      }
    }
    childID = childID;
  }
  
  public void getRole(AccessibleControlEvent e)
  {
    int role = 0;
    int childID = childID;
    if (childID == -1) {
      role = 60;
    } else if ((childID >= 0) && (childID < this$0.items.length)) {
      role = 37;
    } else if ((childID >= this$0.items.length) && (childID < this$0.items.length + 3)) {
      role = 43;
    }
    detail = role;
  }
  
  public void getSelection(AccessibleControlEvent e)
  {
    childID = (this$0.selectedIndex == -1 ? -2 : this$0.selectedIndex);
  }
  
  public void getState(AccessibleControlEvent e)
  {
    int state = 0;
    int childID = childID;
    if (childID == -1)
    {
      state = 0;
    }
    else if ((childID >= 0) && (childID < this$0.items.length))
    {
      state = 2097152;
      if (this$0.isFocusControl()) {
        state |= 0x100000;
      }
      if (this$0.selectedIndex == childID)
      {
        state |= 0x2;
        if (this$0.isFocusControl()) {
          state |= 0x4;
        }
      }
    }
    else if (childID == this$0.items.length + 0)
    {
      state = this$0.showChevron ? 0 : 32768;
    }
    else if (childID == this$0.items.length + 1)
    {
      state = this$0.showMin ? 0 : 32768;
    }
    else if (childID == this$0.items.length + 2)
    {
      state = this$0.showMax ? 0 : 32768;
    }
    detail = state;
  }
  
  public void getChildren(AccessibleControlEvent e)
  {
    int childIdCount = this$0.items.length + 3;
    Object[] children = new Object[childIdCount];
    for (int i = 0; i < childIdCount; i++) {
      children[i] = new Integer(i);
    }
    children = children;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CTabFolder.3
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.accessibility.Accessible;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class CTabFolder$4
  implements Listener
{
  final CTabFolder this$0;
  private final Accessible val$accessible;
  
  CTabFolder$4(CTabFolder paramCTabFolder, Accessible paramAccessible)
  {
    this$0 = paramCTabFolder;val$accessible = paramAccessible;
  }
  
  public void handleEvent(Event event)
  {
    if (this$0.isFocusControl()) {
      if (this$0.selectedIndex == -1) {
        val$accessible.setFocus(-1);
      } else {
        val$accessible.setFocus(this$0.selectedIndex);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CTabFolder.4
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.accessibility.Accessible;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;

class CTabFolder$5
  implements Listener
{
  final CTabFolder this$0;
  private final Accessible val$accessible;
  
  CTabFolder$5(CTabFolder paramCTabFolder, Accessible paramAccessible)
  {
    this$0 = paramCTabFolder;val$accessible = paramAccessible;
  }
  
  public void handleEvent(Event event)
  {
    if (this$0.selectedIndex == -1) {
      val$accessible.setFocus(-1);
    } else {
      val$accessible.setFocus(this$0.selectedIndex);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CTabFolder.5
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.MenuItem;

class CTabFolder$6
  extends SelectionAdapter
{
  final CTabFolder this$0;
  
  CTabFolder$6(CTabFolder paramCTabFolder)
  {
    this$0 = paramCTabFolder;
  }
  
  public void widgetSelected(SelectionEvent e)
  {
    MenuItem menuItem = (MenuItem)widget;
    int index = this$0.indexOf((CTabItem)menuItem.getData("CTabFolder_showList_Index"));
    this$0.setSelection(index, true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CTabFolder.6
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.swt.custom;

import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.Accessible;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleControlAdapter;
import org.eclipse.swt.accessibility.AccessibleControlEvent;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.MenuItem;
import org.eclipse.swt.widgets.TypedListener;

public class CTabFolder
  extends Composite
{
  public int marginWidth = 0;
  public int marginHeight = 0;
  /**
   * @deprecated
   */
  public int MIN_TAB_WIDTH = 4;
  /**
   * @deprecated
   */
  public static RGB borderInsideRGB = new RGB(132, 130, 132);
  /**
   * @deprecated
   */
  public static RGB borderMiddleRGB = new RGB(143, 141, 138);
  /**
   * @deprecated
   */
  public static RGB borderOutsideRGB = new RGB(171, 168, 165);
  boolean onBottom = false;
  boolean single = false;
  boolean simple = true;
  int fixedTabHeight = -1;
  int tabHeight;
  int minChars = 20;
  boolean borderVisible = false;
  CTabFolderRenderer renderer;
  CTabItem[] items = new CTabItem[0];
  int firstIndex = -1;
  int selectedIndex = -1;
  int[] priority = new int[0];
  boolean mru = false;
  Listener listener;
  boolean ignoreTraverse;
  CTabFolder2Listener[] folderListeners = new CTabFolder2Listener[0];
  CTabFolderListener[] tabListeners = new CTabFolderListener[0];
  Image selectionBgImage;
  Color[] selectionGradientColors;
  int[] selectionGradientPercents;
  boolean selectionGradientVertical;
  Color selectionForeground;
  Color selectionBackground;
  Color[] gradientColors;
  int[] gradientPercents;
  boolean gradientVertical;
  boolean showUnselectedImage = true;
  boolean showClose = false;
  boolean showUnselectedClose = true;
  Rectangle chevronRect = new Rectangle(0, 0, 0, 0);
  int chevronImageState = 0;
  boolean showChevron = false;
  Menu showMenu;
  boolean showMin = false;
  Rectangle minRect = new Rectangle(0, 0, 0, 0);
  boolean minimized = false;
  int minImageState = 0;
  boolean showMax = false;
  Rectangle maxRect = new Rectangle(0, 0, 0, 0);
  boolean maximized = false;
  int maxImageState = 0;
  Control topRight;
  Rectangle topRightRect = new Rectangle(0, 0, 0, 0);
  int topRightAlignment = 131072;
  boolean inDispose = false;
  Point oldSize;
  Font oldFont;
  static final int DEFAULT_WIDTH = 64;
  static final int DEFAULT_HEIGHT = 64;
  static final int SELECTION_FOREGROUND = 24;
  static final int SELECTION_BACKGROUND = 25;
  static final int FOREGROUND = 21;
  static final int BACKGROUND = 22;
  static final int CHEVRON_CHILD_ID = 0;
  static final int MINIMIZE_CHILD_ID = 1;
  static final int MAXIMIZE_CHILD_ID = 2;
  static final int EXTRA_CHILD_ID_COUNT = 3;
  
  public CTabFolder(Composite parent, int style)
  {
    super(parent, checkStyle(parent, style));
    init(style);
  }
  
  void init(int style)
  {
    super.setLayout(new CTabFolderLayout());
    int style2 = super.getStyle();
    oldFont = getFont();
    onBottom = ((style2 & 0x400) != 0);
    showClose = ((style2 & 0x40) != 0);
    
    single = ((style2 & 0x4) != 0);
    borderVisible = ((style & 0x800) != 0);
    
    Display display = getDisplay();
    selectionForeground = display.getSystemColor(24);
    selectionBackground = display.getSystemColor(25);
    renderer = new CTabFolderRenderer(this);
    updateTabHeight(false);
    
    listener = new Listener()
    {
      public void handleEvent(Event event)
      {
        switch (type)
        {
        case 12: 
          onDispose(event); break;
        case 29: 
          onDragDetect(event); break;
        case 15: 
          onFocus(event); break;
        case 16: 
          onFocus(event); break;
        case 1: 
          onKeyDown(event); break;
        case 8: 
          onMouseDoubleClick(event); break;
        case 3: 
          onMouse(event); break;
        case 6: 
          onMouse(event); break;
        case 7: 
          onMouse(event); break;
        case 5: 
          onMouse(event); break;
        case 4: 
          onMouse(event); break;
        case 9: 
          onPaint(event); break;
        case 11: 
          onResize(); break;
        case 31: 
          onTraverse(event);
        }
      }
    };
    int[] folderEvents = {
      12, 
      29, 
      15, 
      16, 
      1, 
      8, 
      3, 
      6, 
      7, 
      5, 
      4, 
      9, 
      11, 
      31 };
    for (int i = 0; i < folderEvents.length; i++) {
      addListener(folderEvents[i], listener);
    }
    initAccessible();
  }
  
  static int checkStyle(Composite parent, int style)
  {
    int mask = 109053126;
    style &= mask;
    if ((style & 0x80) != 0) {
      style &= 0xFBFF;
    }
    if ((style & 0x2) != 0) {
      style &= 0xFFFFFFFB;
    }
    style |= 0x100000;
    if ((style & 0x4000000) != 0) {
      return style;
    }
    if (((parent.getStyle() & 0x8000000) != 0) && ((style & 0x2000000) == 0)) {
      return style;
    }
    return style | 0x20000000;
  }
  
  public void addCTabFolder2Listener
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd