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

.events.DisposeListener;
import org.eclipse.swt.graphics.Point;
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.ScrollBar;
import org.eclipse.swt.widgets.Shell;

public class ScrolledComposite
  extends Composite
{
  Control content;
  Listener contentListener;
  Listener filter;
  int minHeight = 0;
  int minWidth = 0;
  boolean expandHorizontal = false;
  boolean expandVertical = false;
  boolean alwaysShowScroll = false;
  boolean showFocusedControl = false;
  
  public ScrolledComposite(Composite parent, int style)
  {
    super(parent, checkStyle(style));
    super.setLayout(new ScrolledCompositeLayout());
    ScrollBar hBar = getHorizontalBar();
    if (hBar != null)
    {
      hBar.setVisible(false);
      hBar.addListener(13, new Listener()
      {
        public void handleEvent(Event e)
        {
          hScroll();
        }
      });
    }
    ScrollBar vBar = getVerticalBar();
    if (vBar != null)
    {
      vBar.setVisible(false);
      vBar.addListener(13, new Listener()
      {
        public void handleEvent(Event e)
        {
          vScroll();
        }
      });
    }
    contentListener = new Listener()
    {
      public void handleEvent(Event e)
      {
        if (type != 11) {
          return;
        }
        layout(false);
      }
    };
    filter = new Listener()
    {
      public void handleEvent(Event event)
      {
        if ((widget instanceof Control))
        {
          Control control = (Control)widget;
          if (contains(control)) {
            showControl(control);
          }
        }
      }
    };
    addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        getDisplay().removeFilter(15, filter);
      }
    });
  }
  
  static int checkStyle(int style)
  {
    int mask = 100666112;
    return style & mask;
  }
  
  boolean contains(Control control)
  {
    if ((control == null) || (control.isDisposed())) {
      return false;
    }
    Composite parent = control.getParent();
    while ((parent != null) && (!(parent instanceof Shell)))
    {
      if (this == parent) {
        return true;
      }
      parent = parent.getParent();
    }
    return false;
  }
  
  public boolean getAlwaysShowScrollBars()
  {
    return alwaysShowScroll;
  }
  
  public boolean getExpandHorizontal()
  {
    checkWidget();
    return expandHorizontal;
  }
  
  public boolean getExpandVertical()
  {
    checkWidget();
    return expandVertical;
  }
  
  public int getMinWidth()
  {
    checkWidget();
    return minWidth;
  }
  
  public int getMinHeight()
  {
    checkWidget();
    return minHeight;
  }
  
  public Control getContent()
  {
    return content;
  }
  
  public boolean getShowFocusedControl()
  {
    checkWidget();
    return showFocusedControl;
  }
  
  void hScroll()
  {
    if (content == null) {
      return;
    }
    Point location = content.getLocation();
    ScrollBar hBar = getHorizontalBar();
    int hSelection = hBar.getSelection();
    content.setLocation(-hSelection, y);
  }
  
  boolean needHScroll(Rectangle contentRect, boolean vVisible)
  {
    ScrollBar hBar = getHorizontalBar();
    if (hBar == null) {
      return false;
    }
    Rectangle hostRect = getBounds();
    int border = getBorderWidth();
    width -= 2 * border;
    ScrollBar vBar = getVerticalBar();
    if ((vVisible) && (vBar != null)) {
      width -= getSizex;
    }
    if ((!expandHorizontal) && (width > width)) {
      return true;
    }
    if ((expandHorizontal) && (minWidth > width)) {
      return true;
    }
    return false;
  }
  
  boolean needVScroll(Rectangle contentRect, boolean hVisible)
  {
    ScrollBar vBar = getVerticalBar();
    if (vBar == null) {
      return false;
    }
    Rectangle hostRect = getBounds();
    int border = getBorderWidth();
    height -= 2 * border;
    ScrollBar hBar = getHorizontalBar();
    if ((hVisible) && (hBar != null)) {
      height -= getSizey;
    }
    if ((!expandVertical) && (height > height)) {
      return true;
    }
    if ((expandVertical) && (minHeight > height)) {
      return true;
    }
    return false;
  }
  
  public Point getOrigin()
  {
    checkWidget();
    if (content == null) {
      return new Point(0, 0);
    }
    Point location = content.getLocation();
    return new Point(-x, -y);
  }
  
  public void setOrigin(Point origin)
  {
    setOrigin(x, y);
  }
  
  public void setOrigin(int x, int y)
  {
    checkWidget();
    if (content == null) {
      return;
    }
    ScrollBar hBar = getHorizontalBar();
    if (hBar != null)
    {
      hBar.setSelection(x);
      x = -hBar.getSelection();
    }
    else
    {
      x = 0;
    }
    ScrollBar vBar = getVerticalBar();
    if (vBar != null)
    {
      vBar.setSelection(y);
      y = -vBar.getSelection();
    }
    else
    {
      y = 0;
    }
    content.setLocation(x, y);
  }
  
  public void setAlwaysShowScrollBars(boolean show)
  {
    checkWidget();
    if (show == alwaysShowScroll) {
      return;
    }
    alwaysShowScroll = show;
    ScrollBar hBar = getHorizontalBar();
    if ((hBar != null) && (alwaysShowScroll)) {
      hBar.setVisible(true);
    }
    ScrollBar vBar = getVerticalBar();
    if ((vBar != null) && (alwaysShowScroll)) {
      vBar.setVisible(true);
    }
    layout(false);
  }
  
  public void setContent(Control content)
  {
    checkWidget();
    if ((this.content != null) && (!this.content.isDisposed()))
    {
      this.content.removeListener(11, contentListener);
      this.content.setBounds(new Rectangle(65336, 65336, 0, 0));
    }
    this.content = content;
    ScrollBar vBar = getVerticalBar();
    ScrollBar hBar = getHorizontalBar();
    if (this.content != null)
    {
      if (vBar != null)
      {
        vBar.setMaximum(0);
        vBar.setThumb(0);
        vBar.setSelection(0);
      }
      if (hBar != null)
      {
        hBar.setMaximum(0);
        hBar.setThumb(0);
        hBar.setSelection(0);
      }
      content.setLocation(0, 0);
      layout(false);
      this.content.addListener(11, contentListener);
    }
    else
    {
      if (hBar != null) {
        hBar.setVisible(alwaysShowScroll);
      }
      if (vBar != null) {
        vBar.setVisible(alwaysShowScroll);
      }
    }
  }
  
  public void setExpandHorizontal(boolean expand)
  {
    checkWidget();
    if (expand == expandHorizontal) {
      return;
    }
    expandHorizontal = expand;
    layout(false);
  }
  
  public void setExpandVertical(boolean expand)
  {
    checkWidget();
    if (expand == expandVertical) {
      return;
    }
    expandVertical = expand;
    layout(false);
  }
  
  public void setLayout(Layout layout)
  {
    checkWidget();
  }
  
  public void setMinHeight(int height)
  {
    setMinSize(minWidth, height);
  }
  
  public void setMinSize(Point size)
  {
    if (size == null) {
      setMinSize(0, 0);
    } else {
      setMinSize(x, y);
    }
  }
  
  public void setMinSize(int width, int height)
  {
    checkWidget();
    if ((width == minWidth) && (height == minHeight)) {
      return;
    }
    minWidth = Math.max(0, width);
    minHeight = Math.max(0, height);
    layout(false);
  }
  
  public void setMinWidth(int width)
  {
    setMinSize(width, minHeight);
  }
  
  public void setShowFocusedControl(boolean show)
  {
    checkWidget();
    if (showFocusedControl == show) {
      return;
    }
    Display display = getDisplay();
    display.removeFilter(15, filter);
    showFocusedControl = show;
    if (!showFocusedControl) {
      return;
    }
    display.addFilter(15, filter);
    Control control = display.getFocusControl();
    if (contains(control)) {
      showControl(control);
    }
  }
  
  public void showControl(Control control)
  {
    checkWidget();
    if (control == null) {
      SWT.error(4);
    }
    if (control.isDisposed()) {
      SWT.error(5);
    }
    if (!contains(control)) {
      SWT.error(5);
    }
    Rectangle itemRect = getDisplay().map(control.getParent(), this, control.getBounds());
    Rectangle area = getClientArea();
    Point origin = getOrigin();
    if (x < 0) {
      x = Math.max(0, x + x);
    } else if (width < x + width) {
      x = Math.max(0, x + x + Math.min(width, width) - width);
    }
    if (y < 0) {
      y = Math.max(0, y + y);
    } else if (height < y + height) {
      y = Math.max(0, y + y + Math.min(height, height) - height);
    }
    setOrigin(origin);
  }
  
  void vScroll()
  {
    if (content == null) {
      return;
    }
    Point location = content.getLocation();
    ScrollBar vBar = getVerticalBar();
    int vSelection = vBar.getSelection();
    content.setLocation(x, -vSelection);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.ScrolledComposite
 * 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.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Layout;
import org.eclipse.swt.widgets.ScrollBar;

class ScrolledCompositeLayout
  extends Layout
{
  boolean inLayout = false;
  static final int DEFAULT_WIDTH = 64;
  static final int DEFAULT_HEIGHT = 64;
  
  protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache)
  {
    ScrolledComposite sc = (ScrolledComposite)composite;
    Point size = new Point(64, 64);
    if (content != null)
    {
      Point preferredSize = content.computeSize(wHint, hHint, flushCache);
      Point currentSize = content.getSize();
      x = (sc.getExpandHorizontal() ? x : x);
      y = (sc.getExpandVertical() ? y : y);
    }
    x = Math.max(x, minWidth);
    y = Math.max(y, minHeight);
    if (wHint != -1) {
      x = wHint;
    }
    if (hHint != -1) {
      y = hHint;
    }
    return size;
  }
  
  protected boolean flushCache(Control control)
  {
    return true;
  }
  
  protected void layout(Composite composite, boolean flushCache)
  {
    if (inLayout) {
      return;
    }
    ScrolledComposite sc = (ScrolledComposite)composite;
    if (content == null) {
      return;
    }
    ScrollBar hBar = sc.getHorizontalBar();
    ScrollBar vBar = sc.getVerticalBar();
    if ((hBar != null) && 
      (getSizey >= getSizey)) {
      return;
    }
    if ((vBar != null) && 
      (getSizex >= getSizex)) {
      return;
    }
    inLayout = true;
    Rectangle contentRect = content.getBounds();
    if (!alwaysShowScroll)
    {
      boolean hVisible = sc.needHScroll(contentRect, false);
      boolean vVisible = sc.needVScroll(contentRect, hVisible);
      if ((!hVisible) && (vVisible)) {
        hVisible = sc.needHScroll(contentRect, vVisible);
      }
      if (hBar != null) {
        hBar.setVisible(hVisible);
      }
      if (vBar != null) {
        vBar.setVisible(vVisible);
      }
    }
    Rectangle hostRect = sc.getClientArea();
    if (expandHorizontal) {
      width = Math.max(minWidth, width);
    }
    if (expandVertical) {
      height = Math.max(minHeight, height);
    }
    if (hBar != null)
    {
      hBar.setMaximum(width);
      hBar.setThumb(Math.min(width, width));
      int hPage = width - width;
      int hSelection = hBar.getSelection();
      if (hSelection >= hPage)
      {
        if (hPage <= 0)
        {
          hSelection = 0;
          hBar.setSelection(0);
        }
        x = (-hSelection);
      }
    }
    if (vBar != null)
    {
      vBar.setMaximum(height);
      vBar.setThumb(Math.min(height, height));
      int vPage = height - height;
      int vSelection = vBar.getSelection();
      if (vSelection >= vPage)
      {
        if (vPage <= 0)
        {
          vSelection = 0;
          vBar.setSelection(0);
        }
        y = (-vSelection);
      }
    }
    content.setBounds(contentRect);
    inLayout = false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.ScrolledCompositeLayout
 * 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.graphics.Rectangle;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Layout;

public class StackLayout
  extends Layout
{
  public int marginWidth = 0;
  public int marginHeight = 0;
  public Control topControl;
  
  protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache)
  {
    Control[] children = composite.getChildren();
    int maxWidth = 0;
    int maxHeight = 0;
    for (int i = 0; i < children.length; i++)
    {
      Point size = children[i].computeSize(wHint, hHint, flushCache);
      maxWidth = Math.max(x, maxWidth);
      maxHeight = Math.max(y, maxHeight);
    }
    int width = maxWidth + 2 * marginWidth;
    int height = maxHeight + 2 * marginHeight;
    if (wHint != -1) {
      width = wHint;
    }
    if (hHint != -1) {
      height = hHint;
    }
    return new Point(width, height);
  }
  
  protected boolean flushCache(Control control)
  {
    return true;
  }
  
  protected void layout(Composite composite, boolean flushCache)
  {
    Control[] children = composite.getChildren();
    Rectangle rect = composite.getClientArea();
    x += marginWidth;
    y += marginHeight;
    width -= 2 * marginWidth;
    height -= 2 * marginHeight;
    for (int i = 0; i < children.length; i++)
    {
      children[i].setBounds(rect);
      children[i].setVisible(children[i] == topControl);
    }
  }
  
  String getName()
  {
    String string = getClass().getName();
    int index = string.lastIndexOf('.');
    if (index == -1) {
      return string;
    }
    return string.substring(index + 1, string.length());
  }
  
  public String toString()
  {
    String string = getName() + " {";
    if (marginWidth != 0) {
      string = string + "marginWidth=" + marginWidth + " ";
    }
    if (marginHeight != 0) {
      string = string + "marginHeight=" + marginHeight + " ";
    }
    if (topControl != null) {
      string = string + "topControl=" + topControl + " ";
    }
    string = string.trim();
    string = string + "}";
    return string;
  }
}

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

import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.TextStyle;
import org.eclipse.swt.internal.CloneableCompatibility;

public class StyleRange
  extends TextStyle
  implements CloneableCompatibility
{
  public int start;
  public int length;
  public int fontStyle = 0;
  
  public StyleRange() {}
  
  public StyleRange(TextStyle style)
  {
    super(style);
  }
  
  public StyleRange(int start, int length, Color foreground, Color background)
  {
    super(null, foreground, background);
    this.start = start;
    this.length = length;
  }
  
  public StyleRange(int start, int length, Color foreground, Color background, int fontStyle)
  {
    this(start, length, foreground, background);
  }
  
  public boolean equals(Object object)
  {
    if (object == this) {
      return true;
    }
    if ((object instanceof StyleRange))
    {
      StyleRange style = (StyleRange)object;
      if (start != start) {
        return false;
      }
      if (length != length) {
        return false;
      }
      return similarTo(style);
    }
    return false;
  }
  
  public int hashCode()
  {
    return super.hashCode() ^ fontStyle;
  }
  
  boolean isVariableHeight()
  {
    return (font != null) || (metrics != null) || (rise != 0);
  }
  
  public boolean isUnstyled()
  {
    if (font != null) {
      return false;
    }
    if (rise != 0) {
      return false;
    }
    if (metrics != null) {
      return false;
    }
    if (foreground != null) {
      return false;
    }
    if (background != null) {
      return false;
    }
    if (fontStyle != 0) {
      return false;
    }
    if (underline) {
      return false;
    }
    if (strikeout) {
      return false;
    }
    if (borderStyle != 0) {
      return false;
    }
    return true;
  }
  
  public boolean similarTo(StyleRange style)
  {
    if (!super.equals(style)) {
      return false;
    }
    if (fontStyle != fontStyle) {
      return false;
    }
    return true;
  }
  
  public Object clone()
  {
    try
    {
      return super.clone();
    }
    catch (CloneNotSupportedException localCloneNotSupportedException) {}
    return null;
  }
  
  public String toString()
  {
    StringBuffer buffer = new StringBuffer();
    buffer.append("StyleRange {");
    buffer.append(start);
    buffer.append(", ");
    buffer.append(length);
    buffer.append(", fontStyle=");
    switch (fontStyle)
    {
    case 1: 
      buffer.append("bold");
      break;
    case 2: 
      buffer.append("italic");
      break;
    case 3: 
      buffer.append("bold-italic");
      break;
    default: 
      buffer.append("normal");
    }
    String str = super.toString();
    int index = str.indexOf('{');
    str = str.substring(index + 1);
    if (str.length() > 1) {
      buffer.append(", ");
    }
    buffer.append(str);
    return buffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.StyleRange
 * 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.internal.BidiUtil;

class StyledText$1
  implements Runnable
{
  final StyledText this$0;
  
  StyledText$1(StyledText paramStyledText)
  {
    this$0 = paramStyledText;
  }
  
  public void run()
  {
    int direction = BidiUtil.getKeyboardLanguage() == 1 ? 131072 : 16384;
    if (direction == this$0.caretDirection) {
      return;
    }
    if (this$0.getCaret() != this$0.defaultCaret) {
      return;
    }
    Point newCaretPos = this$0.getPointAtOffset(this$0.caretOffset);
    this$0.setCaretLocation(newCaretPos, direction);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.StyledText.1
 * 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 StyledText$10
  implements Listener
{
  final StyledText this$0;
  
  StyledText$10(StyledText paramStyledText)
  {
    this$0 = paramStyledText;
  }
  
  public void handleEvent(Event event)
  {
    this$0.handleHorizontalScroll(event);
  }
}

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

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

class StyledText$11
  extends AccessibleAdapter
{
  final StyledText this$0;
  
  StyledText$11(StyledText paramStyledText)
  {
    this$0 = paramStyledText;
  }
  
  public void getName(AccessibleEvent e)
  {
    String name = null;
    String text = this$0.getAssociatedLabel();
    if (text != null) {
      name = this$0.stripMnemonic(text);
    }
    result = name;
  }
  
  public void getHelp(AccessibleEvent e)
  {
    result = this$0.getToolTipText();
  }
  
  public void getKeyboardShortcut(AccessibleEvent e)
  {
    String shortcut = null;
    String text = this$0.getAssociatedLabel();
    if (text != null)
    {
      char mnemonic = this$0._findMnemonic(text);
      if (mnemonic != 0) {
        shortcut = "Alt+" + mnemonic;
      }
    }
    result = shortcut;
  }
}

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

import org.eclipse.swt.accessibility.AccessibleTextEvent;
import org.eclipse.swt.accessibility.AccessibleTextExtendedAdapter;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.TextLayout;
import org.eclipse.swt.widgets.Display;

class StyledText$12
  extends AccessibleTextExtendedAdapter
{
  final StyledText this$0;
  
  StyledText$12(StyledText paramStyledText)
  {
    this$0 = paramStyledText;
  }
  
  public void getCaretOffset(AccessibleTextEvent e)
  {
    offset = this$0.getCaretOffset();
  }
  
  public void setCaretOffset(AccessibleTextEvent e)
  {
    this$0.setCaretOffset(offset);
    result = "OK";
  }
  
  public void getSelectionRange(AccessibleTextEvent e)
  {
    Point selection = this$0.getSelectionRange();
    offset = x;
    length = y;
  }
  
  public void addSelection(AccessibleTextEvent e)
  {
    StyledText st = this$0;
    Point point = st.getSelection();
    if (x == y)
    {
      int end = end;
      if (end == -1) {
        end = st.getCharCount();
      }
      st.setSelection(start, end);
      result = "OK";
    }
  }
  
  public void getSelection(AccessibleTextEvent e)
  {
    StyledText st = this$0;
    if ((blockSelection) && (blockXLocation != -1))
    {
      Rectangle rect = st.getBlockSelectionPosition();
      int lineIndex = y + index;
      int linePixel = st.getLinePixel(lineIndex);
      ranges = getRanges(x, linePixel, width, linePixel);
      if (ranges.length > 0)
      {
        start = ranges[0];
        end = ranges[(ranges.length - 1)];
      }
    }
    else if (index == 0)
    {
      Point point = st.getSelection();
      start = x;
      end = y;
      if (start > end)
      {
        int temp = start;
        start = end;
        end = temp;
      }
    }
  }
  
  public void getSelectionCount(AccessibleTextEvent e)
  {
    StyledText st = this$0;
    if ((blockSelection) && (blockXLocation != -1))
    {
      Rectangle rect = st.getBlockSelectionPosition();
      count = (height - y + 1);
    }
    else
    {
      Point point = st.getSelection();
      count = (x == y ? 0 : 1);
    }
  }
  
  public void removeSelection(AccessibleTextEvent e)
  {
    StyledText st = this$0;
    if (index == 0)
    {
      if (blockSelection) {
        st.clearBlockSelection(true, false);
      } else {
        st.clearSelection(false);
      }
      result = "OK";
    }
  }
  
  public void setSelection(AccessibleTextEvent e)
  {
    if (index != 0) {
      return;
    }
    StyledText st = this$0;
    Point point = st.getSelection();
    if (x == y) {
      return;
    }
    int end = end;
    if (end == -1) {
      end = st.getCharCount();
    }
    st.setSelection(start, end);
    result = "OK";
  }
  
  public void getCharacterCount(AccessibleTextEvent e)
  {
    count = this$0.getCharCount();
  }
  
  public void getOffsetAtPoint(AccessibleTextEvent e)
  {
    StyledText st = this$0;
    Point point = new Point(x, y);
    Display display = st.getDisplay();
    point = display.map(null, st, point);
    offset = st.getOffsetAtPoint(x, y, null, true);
  }
  
  public void getTextBounds(AccessibleTextEvent e)
  {
    StyledText st = this$0;
    int start = start;
    int end = end;
    int contentLength = st.getCharCount();
    start = Math.max(0, Math.min(start, contentLength));
    end = Math.max(0, Math.min(end, contentLength));
    if (start > end)
    {
      int temp = start;
      start = end;
      end = temp;
    }
    int startLine = st.getLineAtOffset(start);
    int endLine = st.getLineAtOffset(end);
    Rectangle[] rects = new Rectangle[endLine - startLine + 1];
    Rectangle bounds = null;
    int index = 0;
    Display display = st.getDisplay();
    for (int lineIndex = startLine; lineIndex <= endLine; lineIndex++)
    {
      Rectangle rect = new Rectangle(0, 0, 0, 0);
      y = st.getLinePixel(lineIndex);
      height = renderer.getLineHeight(lineIndex);
      if (lineIndex == startLine) {
        x = getPointAtOffsetx;
      } else {
        x = (leftMargin - horizontalScrollOffset);
      }
      if (lineIndex == endLine)
      {
        width = (getPointAtOffsetx - x);
      }
      else
      {
        TextLayout layout = renderer.getTextLayout(lineIndex);
        width = (getBoundswidth - x);
        renderer.disposeTextLayout(layout);
      }
      rects[(index++)] = (rect = display.map(st, null, rect));
      if (bounds == null) {
        bounds = new Rectangle(x, y, width, height);
      } else {
        bounds.add(rect);
      }
    }
    rectangles = rects;
    if (bounds != null)
    {
      x = x;
      y = y;
      width = width;
      height = height;
    }
  }
  
  int[] getRanges(int left, int top, int right, int bottom)
  {
    StyledText st = this$0;
    int lineStart = st.getLineIndex(top);
    int lineEnd = st.getLineIndex(bottom);
    int count = lineEnd - lineStart + 1;
    int[] ranges = new int[count * 2];
    int index = 0;
    for (int lineIndex = lineStart; lineIndex <= lineEnd; lineIndex++)
    {
      String line = content.getLine(lineIndex);
      int lineOffset = content.getOffsetAtLine(lineIndex);
      int lineEndOffset = lineOffset + line.length();
      int linePixel = st.getLinePixel(lineIndex);
      int start = st.getOffsetAtPoint(left, linePixel, null, true);
      if (start == -1) {
        start = left < leftMargin ? lineOffset : lineEndOffset;
      }
      int[] trailing = new int[1];
      int end = st.getOffsetAtPoint(right, linePixel, trailing, true);
      if (end == -1) {
        end = right < leftMargin ? lineOffset : lineEndOffset;
      } else {
        end += trailing[0];
      }
      if (start > end)
      {
        int temp = start;
        start = end;
        end = temp;
      }
      ranges[(index++)] = start;
      ranges[(index++)] = end;
    }
    return ranges;
  }
  
  public void getRanges(AccessibleTextEvent e)
  {
    StyledText st = this$0;
    Point point = new Point(x, y);
    Display display = st.getDisplay();
    point = display.map(null, st, point);
    ranges = getRanges(x, y, x + width, y + height);
    if (ranges.length > 0)
    {
      start = ranges[0];
      end = ranges[(ranges.length - 1)];
    }
  }
  
  public void getText(AccessibleTextEvent e)
  {
    StyledText st = this$0;
    int start = start;
    int end = end;
    int contentLength = st.getCharCount();
    if (end == -1) {
      end = contentLength;
    }
    start = Math.max(0, Math.min(start, contentLength));
    end = Math.max(0, Math.min(end, contentLength));
    if (start > end)
    {
      int temp = start;
      start = end;
      end = temp;
    }
    int count = count;
    switch (type)
    {
    case 5: 
      break;
    case 0: 
      int newCount = 0;
      if (count > 0)
      {
        while (count-- > 0)
        {
          newEnd = st.getWordNext(end, 2);
          if ((newEnd == contentLength) || 
            (newEnd == end)) {
            break;
          }
          end = newEnd;
          newCount++;
        }
        start = end;
        end = st.getWordNext(end, 2);
      }
      else
      {
        while (count++ < 0)
        {
          int newEnd;
          int newStart = st.getWordPrevious(start, 2);
          if (newStart == start) {
            break;
          }
          start = newStart;
          newCount--;
        }
        end = st.getWordNext(start, 2);
      }
      count = newCount;
      break;
    case 1: 
      int newCount = 0;
      if (count > 0)
      {
        while (count-- > 0)
        {
          int newEnd = st.getWordNext(end, 16, true);
          if (newEnd == end) {
            break;
          }
          newCount++;
          end = newEnd;
        }
        start = end;
        end = st.getWordNext(start, 8, true);
      }
      else
      {
        if (st.getWordPrevious(Math.min(start + 1, contentLength), 16, true) == start) {
          count++;
        }
        while (count <= 0)
        {
          int newStart = st.getWordPrevious(start, 16, true);
          if (newStart == start) {
            break;
          }
          count++;
          start = newStart;
          if (count != 0) {
            newCount--;
          }
        }
        if ((count <= 0) && (start == 0)) {
          end = start;
        } else {
          end = st.getWordNext(start, 8, true);
        }
      }
      count = newCount;
      break;
    case 2: 
    case 3: 
    case 4: 
      int offset = count > 0 ? end : start;
      int lineIndex = st.getLineAtOffset(offset) + count;
      lineIndex = Math.max(0, Math.min(lineIndex, st.getLineCount() - 1));
      start = st.getOffsetAtLine(lineIndex);
      String line = st.getLine(lineIndex);
      end = start + line.length();
      count = lineIndex - st.getLineAtOffset(offset);
    }
    start = start;
    end = end;
    count = count;
    result = content.getTextRange(start, end - start);
  }
  
  public void getVisibleRanges(AccessibleTextEvent e)
  {
    ranges = getRanges(this$0.leftMargin, this$0.topMargin, this$0.clientAreaWidth - this$0.rightMargin, this$0.clientAreaHeight - this$0.bottomMargin);
    if (ranges.length > 0)
    {
      start = ranges[0];
      end = ranges[(ranges.length - 1)];
    }
  }
  
  public void scrollText(AccessibleTextEvent e)
  {
    StyledText st = this$0;
    int topPixel = this$0.getTopPixel();int horizontalPixel = st.getHorizontalPixel();
    switch (type)
    {
    case 0: 
    case 2: 
    case 4: 
    case 6: 
      Rectangle rect = st.getBoundsAtOffset(start);
      if (type != 2) {
        horizontalPixel = horizontalPixel + x - leftMargin;
      }
      if (type != 4) {
        topPixel = topPixel + y - topMargin;
      }
      break;
    case 1: 
    case 3: 
    case 5: 
      Rectangle rect = st.getBoundsAtOffset(end - 1);
      if (type != 3) {
        horizontalPixel = horizontalPixel - clientAreaWidth + x + width + rightMargin;
      }
      if (type != 5) {
        topPixel = topPixel - clientAreaHeight + y + height + bottomMargin;
      }
      break;
    case 7: 
      Point point = new Point(x, y);
      Display display = st.getDisplay();
      point = display.map(null, st, point);
      Rectangle rect = st.getBoundsAtOffset(start);
      topPixel = topPixel - y + y;
      horizontalPixel = horizontalPixel - x + x;
    }
    st.setTopPixel(topPixel);
    st.setHorizontalPixel(horizontalPixel);
    result = "OK";
  }
}

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

import org.eclipse.swt.accessibility.AccessibleEditableTextEvent;
import org.eclipse.swt.accessibility.AccessibleEditableTextListener;
import org.eclipse.swt.accessibility.AccessibleTextAttributeEvent;

class StyledText$13
  implements AccessibleEditableTextListener
{
  final StyledText this$0;
  
  StyledText$13(StyledText paramStyledText)
  {
    this$0 = paramStyledText;
  }
  
  public void setTextAttributes(AccessibleTextAttributeEvent e)
  {
    result = "OK";
  }
  
  public void replaceText(AccessibleEditableTextEvent e)
  {
    StyledText st = this$0;
    st.replaceTextRange(start, end - start, string);
    result = "OK";
  }
  
  public void pasteText(AccessibleEditableTextEvent e)
  {
    StyledText st = this$0;
    st.setSelection(start);
    st.paste();
    result = "OK";
  }
  
  public void cutText(AccessibleEditableTextEvent e)
  {
    StyledText st = this$0;
    st.setSelection(start, end);
    st.cut();
    result = "OK";
  }
  
  public void copyText(AccessibleEditableTextEvent e)
  {
    StyledText st = this$0;
    st.setSelection(start, end);
    st.copy();
    result = "OK";
  }
}

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

import org.eclipse.swt.accessibility.AccessibleAttributeAdapter;
import org.eclipse.swt.accessibility.AccessibleAttributeEvent;
import org.eclipse.swt.accessibility.AccessibleTextAttributeEvent;
import org.eclipse.swt.graphics.TextLayout;
import org.eclipse.swt.graphics.TextStyle;

class StyledText$14
  extends AccessibleAttributeAdapter
{
  final StyledText this$0;
  
  StyledText$14(StyledText paramStyledText)
  {
    this$0 = paramStyledText;
  }
  
  public void getAttributes(AccessibleAttributeEvent e)
  {
    StyledText st = this$0;
    leftMargin = st.getLeftMargin();
    topMargin = st.getTopMargin();
    rightMargin = st.getRightMargin();
    bottomMargin = st.getBottomMargin();
    tabStops = st.getTabStops();
    justify = st.getJustify();
    alignment = st.getAlignment();
    indent = st.getIndent();
  }
  
  public void getTextAttributes(AccessibleTextAttributeEvent e)
  {
    StyledText st = this$0;
    int contentLength = st.getCharCount();
    if ((!this$0.isListening(3002)) && (renderer.styleCount == 0))
    {
      start = 0;
      end = contentLength;
      textStyle = new TextStyle(st.getFont(), foreground, background);
      return;
    }
    int offset = Math.max(0, Math.min(offset, contentLength - 1));
    int lineIndex = st.getLineAtOffset(offset);
    int lineOffset = st.getOffsetAtLine(lineIndex);
    int lineCount = st.getLineCount();
    offset -= lineOffset;
    
    TextLayout layout = renderer.getTextLayout(lineIndex);
    int lineLength = layout.getText().length();
    if (lineLength > 0) {
      textStyle = layout.getStyle(Math.max(0, Math.min(offset, lineLength - 1)));
    }
    if (textStyle == null)
    {
      textStyle = new TextStyle(st.getFont(), foreground, background);
    }
    else if ((textStyle.foreground == null) || (textStyle.background == null) || (textStyle.font == null))
    {
      TextStyle textStyle = new TextStyle(textStyle);
      if (foreground == null) {
        foreground = foreground;
      }
      if (background == null) {
        background = background;
      }
      if (font == null) {
        font = st.getFont();
      }
      textStyle = textStyle;
    }
    if (offset >= lineLength)
    {
      start = (lineOffset + lineLength);
      if (lineIndex + 1 < lineCount) {
        end = st.getOffsetAtLine(lineIndex + 1);
      } else {
        end = contentLength;
      }
      return;
    }
    int[] ranges = layout.getRanges();
    renderer.disposeTextLayout(layout);
    int index = 0;
    int end = 0;
    while (index < ranges.length)
    {
      int styleStart = ranges[(index++)];
      int styleEnd = ranges[(index++)];
      if ((styleStart <= offset) && (offset <= styleEnd))
      {
        start = (lineOffset + styleStart);
        end = (lineOffset + styleEnd + 1);
        return;
      }
      if (styleStart > offset)
      {
        start = (lineOffset + end);
        end = (lineOffset + styleStart);
        return;
      }
      end = styleEnd + 1;
    }
    if (index == ranges.length)
    {
      start = (lineOffset + end);
      if (lineIndex + 1 < lineCount) {
        end = st.getOffsetAtLine(lineIndex + 1);
      } else {
        end = contentLength;
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.StyledText.14
 * 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;

class StyledText$15
  extends AccessibleControlAdapter
{
  final StyledText this$0;
  
  StyledText$15(StyledText paramStyledText)
  {
    this$0 = paramStyledText;
  }
  
  public void getRole(AccessibleControlEvent e)
  {
    detail = 42;
  }
  
  public void getState(AccessibleControlEvent e)
  {
    int state = 0;
    if (this$0.isEnabled()) {
      state |= 0x100000;
    }
    if (this$0.isFocusControl()) {
      state |= 0x4;
    }
    if (!this$0.isVisible()) {
      state |= 0x8000;
    }
    if (!this$0.getEditable()) {
      state |= 0x40;
    }
    if (this$0.isSingleLine()) {
      state |= 0x8000000;
    } else {
      state |= 0x10000000;
    }
    detail = state;
  }
  
  public void getValue(AccessibleControlEvent e)
  {
    result = this$0.getText();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.StyledText.15
 * 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 StyledText$16
  implements Listener
{
  final StyledText this$0;
  private final Accessible val$accessible;
  
  StyledText$16(StyledText paramStyledText, Accessible paramAccessible)
  {
    this$0 = paramStyledText;val$accessible = paramAccessible;
  }
  
  public void handleEvent(Event event)
  {
    val$accessible.setFocus(-1);
  }
}

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

import org.eclipse.swt.widgets.Display;

class StyledText$2
  implements Runnable
{
  final StyledText this$0;
  private final Display val$display;
  
  StyledText$2(StyledText paramStyledText, Display paramDisplay)
  {
    this$0 = paramStyledText;val$display = paramDisplay;
  }
  
  public void run()
  {
    if (this$0.autoScrollDirection == 128)
    {
      if (this$0.blockSelection)
      {
        int verticalScrollOffset = this$0.getVerticalScrollOffset();
        int y = this$0.blockYLocation - verticalScrollOffset;
        int pixels = Math.max(-this$0.autoScrollDistance, -verticalScrollOffset);
        if (pixels != 0)
        {
          this$0.setBlockSelectionLocation(this$0.blockXLocation - this$0.horizontalScrollOffset, y + pixels, true);
          this$0.scrollVertical(pixels, true);
        }
      }
      else
      {
        this$0.doSelectionPageUp(this$0.autoScrollDistance);
      }
      val$display.timerExec(50, this);
    }
  }
}

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

import org.eclipse.swt.widgets.Display;

class StyledText$3
  implements Runnable
{
  final StyledText this$0;
  private final Display val$display;
  
  StyledText$3(StyledText paramStyledText, Display paramDisplay)
  {
    this$0 = paramStyledText;val$display = paramDisplay;
  }
  
  public void run()
  {
    if (this$0.autoScrollDirection == 1024)
    {
      if (this$0.blockSelection)
      {
        int verticalScrollOffset = this$0.getVerticalScrollOffset();
        int y = this$0.blockYLocation - verticalScrollOffset;
        int max = this$0.renderer.getHeight() - verticalScrollOffset - this$0.clientAreaHeight;
        int pixels = Math.min(this$0.autoScrollDistance, Math.max(0, max));
        if (pixels != 0)
        {
          this$0.setBlockSelectionLocation(this$0.blockXLocation - this$0.horizontalScrollOffset, y + pixels, true);
          this$0.scrollVertical(pixels, true);
        }
      }
      else
      {
        this$0.doSelectionPageDown(this$0.autoScrollDistance);
      }
      val$display.timerExec(50, this);
    }
  }
}

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

import org.eclipse.swt.widgets.Display;

class StyledText$4
  implements Runnable
{
  final StyledText this$0;
  private final Display val$display;
  
  StyledText$4(StyledText paramStyledText, Display paramDisplay)
  {
    this$0 = paramStyledText;val$display = paramDisplay;
  }
  
  public void run()
  {
    if (this$0.autoScrollDirection == 16777220)
    {
      if (this$0.blockSelection)
      {
        int x = this$0.blockXLocation - this$0.horizontalScrollOffset;
        int max = this$0.renderer.getWidth() - this$0.horizontalScrollOffset - this$0.clientAreaWidth;
        int pixels = Math.min(this$0.autoS
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