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

l;

class WindowCreator2
{
  XPCOMObject supports;
  XPCOMObject windowCreator;
  XPCOMObject windowCreator2;
  int refCount = 0;
  
  WindowCreator2()
  {
    createCOMInterfaces();
  }
  
  int AddRef()
  {
    refCount += 1;
    return refCount;
  }
  
  void createCOMInterfaces()
  {
    supports = new XPCOMObject(new int[] { 2 })
    {
      public int method0(int[] args)
      {
        return QueryInterface(args[0], args[1]);
      }
      
      public int method1(int[] args)
      {
        return AddRef();
      }
      
      public int method2(int[] args)
      {
        return Release();
      }
    };
    windowCreator = new XPCOMObject(new int[] { 2, 0, 0, 3 })
    {
      public int method0(int[] args)
      {
        return QueryInterface(args[0], args[1]);
      }
      
      public int method1(int[] args)
      {
        return AddRef();
      }
      
      public int method2(int[] args)
      {
        return Release();
      }
      
      public int method3(int[] args)
      {
        return CreateChromeWindow(args[0], args[1], args[2]);
      }
    };
    windowCreator2 = new XPCOMObject(new int[] { 2, 0, 0, 3, 6 })
    {
      public int method0(int[] args)
      {
        return QueryInterface(args[0], args[1]);
      }
      
      public int method1(int[] args)
      {
        return AddRef();
      }
      
      public int method2(int[] args)
      {
        return Release();
      }
      
      public int method3(int[] args)
      {
        return CreateChromeWindow(args[0], args[1], args[2]);
      }
      
      public int method4(int[] args)
      {
        return CreateChromeWindow2(args[0], args[1], args[2], args[3], args[4], args[5]);
      }
    };
  }
  
  void disposeCOMInterfaces()
  {
    if (supports != null)
    {
      supports.dispose();
      supports = null;
    }
    if (windowCreator != null)
    {
      windowCreator.dispose();
      windowCreator = null;
    }
    if (windowCreator2 != null)
    {
      windowCreator2.dispose();
      windowCreator2 = null;
    }
  }
  
  int getAddress()
  {
    return windowCreator.getAddress();
  }
  
  int QueryInterface(int riid, int ppvObject)
  {
    if ((riid == 0) || (ppvObject == 0)) {
      return -2147467262;
    }
    nsID guid = new nsID();
    XPCOM.memmove(guid, riid, 16);
    if (guid.Equals(nsISupports.NS_ISUPPORTS_IID))
    {
      XPCOM.memmove(ppvObject, new int[] { supports.getAddress() }, C.PTR_SIZEOF);
      AddRef();
      return 0;
    }
    if (guid.Equals(nsIWindowCreator.NS_IWINDOWCREATOR_IID))
    {
      XPCOM.memmove(ppvObject, new int[] { windowCreator.getAddress() }, C.PTR_SIZEOF);
      AddRef();
      return 0;
    }
    if (guid.Equals(nsIWindowCreator2.NS_IWINDOWCREATOR2_IID))
    {
      XPCOM.memmove(ppvObject, new int[] { windowCreator2.getAddress() }, C.PTR_SIZEOF);
      AddRef();
      return 0;
    }
    XPCOM.memmove(ppvObject, new int[1], C.PTR_SIZEOF);
    return -2147467262;
  }
  
  int Release()
  {
    refCount -= 1;
    if (refCount == 0) {
      disposeCOMInterfaces();
    }
    return refCount;
  }
  
  int CreateChromeWindow(int parent, int chromeFlags, int _retval)
  {
    return CreateChromeWindow2(parent, chromeFlags, 0, 0, 0, _retval);
  }
  
  int CreateChromeWindow2(int parent, int chromeFlags, int contextFlags, int uri, int cancel, int _retval)
  {
    if ((parent == 0) && ((chromeFlags & 0x80000000) == 0)) {
      return -2147467263;
    }
    Browser src = null;
    if (parent != 0)
    {
      nsIWebBrowserChrome browserChromeParent = new nsIWebBrowserChrome(parent);
      int[] aWebBrowser = new int[1];
      int rc = browserChromeParent.GetWebBrowser(aWebBrowser);
      if (rc != 0) {
        Mozilla.error(rc);
      }
      if (aWebBrowser[0] == 0) {
        Mozilla.error(-2147467262);
      }
      nsIWebBrowser webBrowser = new nsIWebBrowser(aWebBrowser[0]);
      int[] result = new int[1];
      rc = webBrowser.QueryInterface(nsIBaseWindow.NS_IBASEWINDOW_IID, result);
      if (rc != 0) {
        Mozilla.error(rc);
      }
      if (result[0] == 0) {
        Mozilla.error(-2147467262);
      }
      webBrowser.Release();
      
      nsIBaseWindow baseWindow = new nsIBaseWindow(result[0]);
      result[0] = 0;
      int[] aParentNativeWindow = new int[1];
      rc = baseWindow.GetParentNativeWindow(aParentNativeWindow);
      if (rc != 0) {
        Mozilla.error(rc);
      }
      if (aParentNativeWindow[0] == 0) {
        Mozilla.error(-2147467262);
      }
      baseWindow.Release();
      
      src = Mozilla.findBrowser(aParentNativeWindow[0]);
    }
    boolean doit = true;
    Browser browser;
    if ((chromeFlags & 0x80000000) != 0)
    {
      int style = 0;
      if ((chromeFlags & 0x8000) == 0) {
        style |= 0x860;
      }
      if ((chromeFlags & 0x20000000) != 0) {
        style |= 0x10000;
      }
      Shell shell = src == null ? 
        new Shell(style) : 
        new Shell(src.getShell(), style);
      shell.setLayout(new FillLayout());
      Browser browser = new Browser(shell, src == null ? 32768 : src.getStyle() & 0x8000);
      browser.addVisibilityWindowListener(new VisibilityWindowListener()
      {
        private final Shell val$shell;
        
        public void hide(WindowEvent event) {}
        
        public void show(WindowEvent event)
        {
          if (location != null) {
            val$shell.setLocation(location);
          }
          if (size != null)
          {
            Point size = size;
            val$shell.setSize(val$shell.computeSize(x, y));
          }
          val$shell.open();
        }
      });
      browser.addCloseWindowListener(new CloseWindowListener()
      {
        private final Shell val$shell;
        
        public void close(WindowEvent event)
        {
          val$shell.close();
        }
      });
      if (uri != 0)
      {
        nsIURI location = new nsIURI(uri);
        int aSpec = XPCOM.nsEmbedCString_new();
        if (location.GetSpec(aSpec) == 0)
        {
          int length = XPCOM.nsEmbedCString_Length(aSpec);
          if (length > 0)
          {
            int buffer = XPCOM.nsEmbedCString_get(aSpec);
            byte[] dest = new byte[length];
            XPCOM.memmove(dest, buffer, length);
            browser.setUrl(new String(dest));
          }
        }
        XPCOM.nsEmbedCString_delete(aSpec);
      }
    }
    else
    {
      WindowEvent event = new WindowEvent(src);
      display = src.getDisplay();
      widget = src;
      required = true;
      for (int i = 0; i < webBrowser.openWindowListeners.length; i++) {
        webBrowser.openWindowListeners[i].open(event);
      }
      browser = browser;
      
      doit = (browser != null) && (!browser.isDisposed());
      if (doit)
      {
        String platform = "win32";
        boolean isMozillaNativePlatform = (platform.equals("gtk")) || (platform.equals("motif"));
        doit = (isMozillaNativePlatform) || ((browser.getStyle() & 0x8000) != 0);
      }
    }
    if (doit)
    {
      Mozilla mozilla = (Mozilla)webBrowser;
      isChild = true;
      int chromePtr = webBrowserChrome.getAddress();
      nsIWebBrowserChrome webBrowserChrome = new nsIWebBrowserChrome(chromePtr);
      webBrowserChrome.SetChromeFlags(chromeFlags);
      webBrowserChrome.AddRef();
      XPCOM.memmove(_retval, new int[] { chromePtr }, C.PTR_SIZEOF);
    }
    else if (cancel != 0)
    {
      C.memmove(cancel, new int[] { 1 }, 4);
    }
    return doit ? 0 : -2147467263;
  }
}

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

import org.eclipse.swt.events.TypedEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Widget;

public class WindowEvent
  extends TypedEvent
{
  public boolean required;
  public Browser browser;
  public Point location;
  public Point size;
  public boolean addressBar;
  public boolean menuBar;
  public boolean statusBar;
  public boolean toolBar;
  static final long serialVersionUID = 3617851997387174969L;
  
  public WindowEvent(Widget widget)
  {
    super(widget);
  }
  
  public String toString()
  {
    String string = super.toString();
    return string.substring(0, string.length() - 1) + 
      " required=" + required + 
      " browser=" + browser + 
      " location=" + location + 
      " size=" + size + 
      " addressBar=" + addressBar + 
      " menuBar=" + menuBar + 
      " statusBar=" + statusBar + 
      " toolBar=" + toolBar + 
      "}";
  }
}

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

import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;

class AnimatedProgress$1
  extends ControlAdapter
{
  final AnimatedProgress this$0;
  
  AnimatedProgress$1(AnimatedProgress paramAnimatedProgress)
  {
    this$0 = paramAnimatedProgress;
  }
  
  public void controlResized(ControlEvent e)
  {
    this$0.redraw();
  }
}

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

import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;

class AnimatedProgress$2
  implements PaintListener
{
  final AnimatedProgress this$0;
  
  AnimatedProgress$2(AnimatedProgress paramAnimatedProgress)
  {
    this$0 = paramAnimatedProgress;
  }
  
  public void paintControl(PaintEvent e)
  {
    this$0.paint(e);
  }
}

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

import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;

class AnimatedProgress$3
  implements DisposeListener
{
  final AnimatedProgress this$0;
  
  AnimatedProgress$3(AnimatedProgress paramAnimatedProgress)
  {
    this$0 = paramAnimatedProgress;
  }
  
  public void widgetDisposed(DisposeEvent e)
  {
    this$0.stop();
  }
}

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

import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.widgets.Display;

class AnimatedProgress$4
  implements Runnable
{
  final AnimatedProgress this$0;
  private final Display val$display;
  private final Runnable[] val$timer;
  
  AnimatedProgress$4(AnimatedProgress paramAnimatedProgress, Display paramDisplay, Runnable[] paramArrayOfRunnable)
  {
    this$0 = paramAnimatedProgress;val$display = paramDisplay;val$timer = paramArrayOfRunnable;
  }
  
  public void run()
  {
    if (!this$0.active) {
      return;
    }
    GC gc = new GC(this$0);
    this$0.paintStripes(gc);
    gc.dispose();
    val$display.timerExec(70, val$timer[0]);
  }
}

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

import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;

/**
 * @deprecated
 */
public class AnimatedProgress
  extends Canvas
{
  static final int SLEEP = 70;
  static final int DEFAULT_WIDTH = 160;
  static final int DEFAULT_HEIGHT = 18;
  boolean active = false;
  boolean showStripes = false;
  int value;
  int orientation = 256;
  boolean showBorder = false;
  
  public AnimatedProgress(Composite parent, int style)
  {
    super(parent, checkStyle(style));
    if ((style & 0x200) != 0) {
      orientation = 512;
    }
    showBorder = ((style & 0x800) != 0);
    
    addControlListener(new ControlAdapter()
    {
      public void controlResized(ControlEvent e)
      {
        redraw();
      }
    });
    addPaintListener(new PaintListener()
    {
      public void paintControl(PaintEvent e)
      {
        paint(e);
      }
    });
    addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        stop();
      }
    });
  }
  
  private static int checkStyle(int style)
  {
    int mask = 0;
    return style & mask;
  }
  
  public synchronized void clear()
  {
    checkWidget();
    if (active) {
      stop();
    }
    showStripes = false;
    redraw();
  }
  
  public Point computeSize(int wHint, int hHint, boolean changed)
  {
    checkWidget();
    Point size = null;
    if (orientation == 256) {
      size = new Point(160, 18);
    } else {
      size = new Point(18, 160);
    }
    if (wHint != -1) {
      x = wHint;
    }
    if (hHint != -1) {
      y = hHint;
    }
    return size;
  }
  
  private void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright)
  {
    gc.setForeground(topleft);
    gc.drawLine(x, y, x + w - 1, y);
    gc.drawLine(x, y, x, y + h - 1);
    
    gc.setForeground(bottomright);
    gc.drawLine(x + w, y, x + w, y + h);
    gc.drawLine(x, y + h, x + w, y + h);
  }
  
  void paint(PaintEvent event)
  {
    GC gc = gc;
    Display disp = getDisplay();
    
    Rectangle rect = getClientArea();
    gc.fillRectangle(rect);
    if (showBorder) {
      drawBevelRect(gc, x, y, width - 1, height - 1, 
        disp.getSystemColor(18), 
        disp.getSystemColor(20));
    }
    paintStripes(gc);
  }
  
  void paintStripes(GC gc)
  {
    if (!showStripes) {
      return;
    }
    Rectangle rect = getClientArea();
    
    rect = new Rectangle(x + 2, y + 2, width - 4, height - 4);
    
    gc.setLineWidth(2);
    gc.setClipping(rect);
    Color color = getDisplay().getSystemColor(26);
    gc.setBackground(color);
    gc.fillRectangle(rect);
    gc.setForeground(getBackground());
    int step = 12;
    int foregroundValue = value == 0 ? step - 2 : value - 2;
    if (orientation == 256)
    {
      int y = y - 1;
      int w = width;
      int h = height + 2;
      for (int i = 0; i < w; i += step)
      {
        int x = i + foregroundValue;
        gc.drawLine(x, y, x, h);
      }
    }
    else
    {
      int x = x - 1;
      int w = width + 2;
      int h = height;
      for (int i = 0; i < h; i += step)
      {
        int y = i + foregroundValue;
        gc.drawLine(x, y, w, y);
      }
    }
    if (active) {
      value = ((value + 2) % step);
    }
  }
  
  public synchronized void start()
  {
    checkWidget();
    if (active) {
      return;
    }
    active = true;
    showStripes = true;
    
    Display display = getDisplay();
    Runnable[] timer = new Runnable[1];
    timer[0 = new Runnable()
    {
      private final Display val$display;
      private final Runnable[] val$timer;
      
      public void run()
      {
        if (!active) {
          return;
        }
        GC gc = new GC(AnimatedProgress.this);
        paintStripes(gc);
        gc.dispose();
        val$display.timerExec(70, val$timer[0]);
      }
    };
    display.timerExec(70, timer[0]);
  }
  
  public synchronized void stop()
  {
    active = false;
  }
}

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

import org.eclipse.swt.events.TypedEvent;

public class BidiSegmentEvent
  extends TypedEvent
{
  public int lineOffset;
  public String lineText;
  public int[] segments;
  public char[] segmentsChars;
  static final long serialVersionUID = 3257846571587547957L;
  
  BidiSegmentEvent(StyledTextEvent e)
  {
    super(e);
    lineOffset = detail;
    lineText = text;
  }
}

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

import org.eclipse.swt.internal.SWTEventListener;

public abstract interface BidiSegmentListener
  extends SWTEventListener
{
  public abstract void lineGetSegments(BidiSegmentEvent paramBidiSegmentEvent);
}

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

import org.eclipse.swt.SWT;

public class Bullet
{
  public int type;
  public StyleRange style;
  public String text;
  int[] linesIndices;
  int count;
  
  public Bullet(StyleRange style)
  {
    this(1, style);
  }
  
  public Bullet(int type, StyleRange style)
  {
    if (style == null) {
      SWT.error(4);
    }
    if (metrics == null) {
      SWT.error(4);
    }
    this.type = type;
    this.style = style;
  }
  
  void addIndices(int startLine, int lineCount)
  {
    if (linesIndices == null)
    {
      linesIndices = new int[lineCount];
      count = lineCount;
      for (int i = 0; i < lineCount; i++) {
        linesIndices[i] = (startLine + i);
      }
    }
    else
    {
      int modifyStart = 0;
      while (modifyStart < count)
      {
        if (startLine <= linesIndices[modifyStart]) {
          break;
        }
        modifyStart++;
      }
      int modifyEnd = modifyStart;
      while (modifyEnd < count)
      {
        if (startLine + lineCount <= linesIndices[modifyEnd]) {
          break;
        }
        modifyEnd++;
      }
      int newSize = modifyStart + lineCount + count - modifyEnd;
      if (newSize > linesIndices.length)
      {
        int[] newLinesIndices = new int[newSize];
        System.arraycopy(linesIndices, 0, newLinesIndices, 0, count);
        linesIndices = newLinesIndices;
      }
      System.arraycopy(linesIndices, modifyEnd, linesIndices, modifyStart + lineCount, count - modifyEnd);
      for (int i = 0; i < lineCount; i++) {
        linesIndices[(modifyStart + i)] = (startLine + i);
      }
      count = newSize;
    }
  }
  
  int indexOf(int lineIndex)
  {
    for (int i = 0; i < count; i++) {
      if (linesIndices[i] == lineIndex) {
        return i;
      }
    }
    return -1;
  }
  
  public int hashCode()
  {
    return style.hashCode() ^ type;
  }
  
  int[] removeIndices(int startLine, int replaceLineCount, int newLineCount, boolean update)
  {
    if (count == 0) {
      return null;
    }
    if (startLine > linesIndices[(count - 1)]) {
      return null;
    }
    int endLine = startLine + replaceLineCount;
    int delta = newLineCount - replaceLineCount;
    for (int i = 0; i < count; i++)
    {
      int index = linesIndices[i];
      if (startLine <= index)
      {
        int j = i;
        while (j < count)
        {
          if (linesIndices[j] >= endLine) {
            break;
          }
          j++;
        }
        if (update) {
          for (int k = j; k < count; k++) {
            linesIndices[k] += delta;
          }
        }
        int[] redrawLines = new int[count - j];
        System.arraycopy(linesIndices, j, redrawLines, 0, count - j);
        System.arraycopy(linesIndices, j, linesIndices, i, count - j);
        count -= j - i;
        return redrawLines;
      }
    }
    for (int i = 0; i < count; i++) {
      linesIndices[i] += delta;
    }
    return null;
  }
  
  int size()
  {
    return count;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.Bullet
 * 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.graphics.Cursor;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

public class BusyIndicator
{
  static int nextBusyId = 1;
  static final String BUSYID_NAME = "SWT BusyIndicator";
  static final String BUSY_CURSOR = "SWT BusyIndicator Cursor";
  
  public static void showWhile(Display display, Runnable runnable)
  {
    if (runnable == null) {
      SWT.error(4);
    }
    if (display == null)
    {
      display = Display.getCurrent();
      if (display == null)
      {
        runnable.run();
        return;
      }
    }
    Integer busyId = new Integer(nextBusyId);
    nextBusyId += 1;
    Cursor cursor = display.getSystemCursor(1);
    Shell[] shells = display.getShells();
    for (i = 0; i < shells.length; i++)
    {
      Integer id = (Integer)shells[i].getData("SWT BusyIndicator");
      if (id == null)
      {
        shells[i].setCursor(cursor);
        shells[i].setData("SWT BusyIndicator", busyId);
      }
    }
    int i;
    Integer id;
    try
    {
      runnable.run();
    }
    finally
    {
      shells = display.getShells();
      for (int i = 0; i < shells.length; i++)
      {
        Integer id = (Integer)shells[i].getData("SWT BusyIndicator");
        if (id == busyId)
        {
          shells[i].setCursor(null);
          shells[i].setData("SWT BusyIndicator", null);
        }
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.BusyIndicator
 * 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 CBanner$1
  implements Listener
{
  final CBanner this$0;
  
  CBanner$1(CBanner paramCBanner)
  {
    this$0 = paramCBanner;
  }
  
  public void handleEvent(Event e)
  {
    switch (type)
    {
    case 12: 
      this$0.onDispose(e); break;
    case 3: 
      this$0.onMouseDown(x, y); break;
    case 7: 
      this$0.onMouseExit(); break;
    case 5: 
      this$0.onMouseMove(x, y); break;
    case 4: 
      this$0.onMouseUp(); break;
    case 9: 
      this$0.onPaint(gc); break;
    case 11: 
      this$0.onResize();
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CBanner.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.graphics.Color;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.swt.graphics.GC;
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;

public class CBanner
  extends Composite
{
  Control left;
  Control right;
  Control bottom;
  boolean simple = true;
  int[] curve = new int[0];
  int curveStart = 0;
  Rectangle curveRect = new Rectangle(0, 0, 0, 0);
  int curve_width = 5;
  int curve_indent = -2;
  int rightWidth = -1;
  int rightMinWidth = 0;
  int rightMinHeight = 0;
  Cursor resizeCursor;
  boolean dragging = false;
  int rightDragDisplacement = 0;
  Listener listener;
  static final int OFFSCREEN = -200;
  static final int BORDER_BOTTOM = 2;
  static final int BORDER_TOP = 3;
  static final int BORDER_STRIPE = 1;
  static final int CURVE_TAIL = 200;
  static final int BEZIER_RIGHT = 30;
  static final int BEZIER_LEFT = 30;
  static final int MIN_LEFT = 10;
  static int BORDER1 = 20;
  
  public CBanner(Composite parent, int style)
  {
    super(parent, checkStyle(style));
    super.setLayout(new CBannerLayout());
    resizeCursor = getDisplay().getSystemCursor(9);
    
    listener = new Listener()
    {
      public void handleEvent(Event e)
      {
        switch (type)
        {
        case 12: 
          onDispose(e); break;
        case 3: 
          onMouseDown(x, y); break;
        case 7: 
          onMouseExit(); break;
        case 5: 
          onMouseMove(x, y); break;
        case 4: 
          onMouseUp(); break;
        case 9: 
          onPaint(gc); break;
        case 11: 
          onResize();
        }
      }
    };
    int[] events = { 12, 3, 7, 5, 4, 9, 11 };
    for (int i = 0; i < events.length; i++) {
      addListener(events[i], listener);
    }
  }
  
  static int[] bezier(int x0, int y0, int x1, int y1, int x2, int y2, int x3, int y3, int count)
  {
    double a0 = x0;
    double a1 = 3 * (x1 - x0);
    double a2 = 3 * (x0 + x2 - 2 * x1);
    double a3 = x3 - x0 + 3 * x1 - 3 * x2;
    double b0 = y0;
    double b1 = 3 * (y1 - y0);
    double b2 = 3 * (y0 + y2 - 2 * y1);
    double b3 = y3 - y0 + 3 * y1 - 3 * y2;
    
    int[] polygon = new int[2 * count + 2];
    for (int i = 0; i <= count; i++)
    {
      double t = i / count;
      polygon[(2 * i)] = ((int)(a0 + a1 * t + a2 * t * t + a3 * t * t * t));
      polygon[(2 * i + 1)] = ((int)(b0 + b1 * t + b2 * t * t + b3 * t * t * t));
    }
    return polygon;
  }
  
  static int checkStyle(int style)
  {
    return 0;
  }
  
  public Control getBottom()
  {
    checkWidget();
    return bottom;
  }
  
  public Rectangle getClientArea()
  {
    return new Rectangle(0, 0, 0, 0);
  }
  
  public Control getLeft()
  {
    checkWidget();
    return left;
  }
  
  public Control getRight()
  {
    checkWidget();
    return right;
  }
  
  public Point getRightMinimumSize()
  {
    checkWidget();
    return new Point(rightMinWidth, rightMinHeight);
  }
  
  public int getRightWidth()
  {
    checkWidget();
    if (right == null) {
      return 0;
    }
    if (rightWidth == -1)
    {
      Point size = right.computeSize(-1, -1, false);
      return x;
    }
    return rightWidth;
  }
  
  public boolean getSimple()
  {
    checkWidget();
    return simple;
  }
  
  void onDispose(Event event)
  {
    removeListener(12, listener);
    notifyListeners(12, event);
    type = 0;
    
    resizeCursor = null;
    left = null;
    right = null;
    bottom = null;
  }
  
  void onMouseDown(int x, int y)
  {
    if (curveRect.contains(x, y))
    {
      dragging = true;
      rightDragDisplacement = (curveStart - x + curve_width - curve_indent);
    }
  }
  
  void onMouseExit()
  {
    if (!dragging) {
      setCursor(null);
    }
  }
  
  void onMouseMove(int x, int y)
  {
    if (dragging)
    {
      Point size = getSize();
      if ((x <= 0) || (x >= x)) {
        return;
      }
      rightWidth = Math.max(0, x - x - rightDragDisplacement);
      if (rightMinWidth == -1)
      {
        Point minSize = right.computeSize(rightMinWidth, rightMinHeight);
        rightWidth = Math.max(x, rightWidth);
      }
      else
      {
        rightWidth = Math.max(rightMinWidth, rightWidth);
      }
      layout(false);
      return;
    }
    if (curveRect.contains(x, y)) {
      setCursor(resizeCursor);
    } else {
      setCursor(null);
    }
  }
  
  void onMouseUp()
  {
    dragging = false;
  }
  
  void onPaint(GC gc)
  {
    if ((left == null) && (right == null)) {
      return;
    }
    Point size = getSize();
    Color border1 = getDisplay().getSystemColor(BORDER1);
    if (bottom != null)
    {
      int y = bottom.getBounds().y - 1 - 1;
      gc.setForeground(border1);
      gc.drawLine(0, y, x, y);
    }
    if ((left == null) || (right == null)) {
      return;
    }
    int[] line1 = new int[curve.length + 6];
    int index = 0;
    int x = curveStart;
    line1[(index++)] = (x + 1);
    line1[(index++)] = (y - 1);
    for (int i = 0; i < curve.length / 2; i++)
    {
      line1[(index++)] = (x + curve[(2 * i)]);
      line1[(index++)] = curve[(2 * i + 1)];
    }
    line1[(index++)] = (x + curve_width);
    line1[(index++)] = 0;
    line1[(index++)] = x;
    line1[(index++)] = 0;
    
    Color background = getBackground();
    if (getDisplay().getDepth() >= 15)
    {
      int[] line2 = new int[line1.length];
      index = 0;
      for (int i = 0; i < line1.length / 2; i++)
      {
        line2[index] = (line1[(index++)] - 1);
        line2[index] = line1[(index++)];
      }
      int[] line3 = new int[line1.length];
      index = 0;
      for (int i = 0; i < line1.length / 2; i++)
      {
        line3[index] = (line1[(index++)] + 1);
        line3[index] = line1[(index++)];
      }
      RGB from = border1.getRGB();
      RGB to = background.getRGB();
      int red = red + 3 * (red - red) / 4;
      int green = green + 3 * (green - green) / 4;
      int blue = blue + 3 * (blue - blue) / 4;
      Color color = new Color(getDisplay(), red, green, blue);
      gc.setForeground(color);
      gc.drawPolyline(line2);
      gc.drawPolyline(line3);
      color.dispose();
      
      int x1 = Math.max(0, curveStart - 200);
      gc.setForeground(background);
      gc.setBackground(border1);
      gc.fillGradientRectangle(x1, y - 1, curveStart - x1 + 1, 1, false);
    }
    else
    {
      int x1 = Math.max(0, curveStart - 200);
      gc.setForeground(border1);
      gc.drawLine(x1, y - 1, curveStart + 1, y - 1);
    }
    gc.setForeground(border1);
    gc.drawPolyline(line1);
  }
  
  void onResize()
  {
    updateCurve(getSizey);
  }
  
  public void setBottom(Control control)
  {
    checkWidget();
    if ((control != null) && (control.getParent() != this)) {
      SWT.error(5);
    }
    if ((bottom != null) && (!bottom.isDisposed()))
    {
      Point size = bottom.getSize();
      bottom.setLocation(65336 - x, 65336 - y);
    }
    bottom = control;
    layout(false);
  }
  
  public void setLayout(Layout layout)
  {
    checkWidget();
  }
  
  public void setLeft(Control control)
  {
    checkWidget();
    if ((control != null) && (control.getParent() != this)) {
      SWT.error(5);
    }
    if ((left != null) && (!left.isDisposed()))
    {
      Point size = left.getSize();
      left.setLocation(65336 - x, 65336 - y);
    }
    left = control;
    layout(false);
  }
  
  public void setRight(Control control)
  {
    checkWidget();
    if ((control != null) && (control.getParent() != this)) {
      SWT.error(5);
    }
    if ((right != null) && (!right.isDisposed()))
    {
      Point size = right.getSize();
      right.setLocation(65336 - x, 65336 - y);
    }
    right = control;
    layout(false);
  }
  
  public void setRightMinimumSize(Point size)
  {
    checkWidget();
    if ((size == null) || (x < -1) || (y < -1)) {
      SWT.error(5);
    }
    rightMinWidth = x;
    rightMinHeight = y;
    layout(false);
  }
  
  public void setRightWidth(int width)
  {
    checkWidget();
    if (width < -1) {
      SWT.error(5);
    }
    rightWidth = width;
    layout(false);
  }
  
  public void setSimple(boolean simple)
  {
    checkWidget();
    if (this.simple != simple)
    {
      this.simple = simple;
      if (simple)
      {
        curve_width = 5;
        curve_indent = -2;
      }
      else
      {
        curve_width = 50;
        curve_indent = 5;
      }
      updateCurve(getSizey);
      layout(false);
      redraw();
    }
  }
  
  void updateCurve(int height)
  {
    int h = height - 1;
    if (simple) {
      curve = new int[] { 0, h, 1, h, 2, h - 1, 3, h - 2, 
        3, 2, 4, 1, 5 };
    } else {
      curve = bezier(0, h + 1, 30, h + 1, 
        curve_width - 30, 0, curve_width, 0, 
        curve_width);
    }
  }
}

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

class CBannerLayout
  extends Layout
{
  protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache)
  {
    CBanner banner = (CBanner)composite;
    Control left = left;
    Control right = right;
    Control bottom = bottom;
    boolean showCurve = (left != null) && (right != null);
    int height = hHint;
    int width = wHint;
    
    Point bottomSize = new Point(0, 0);
    if (bottom != null)
    {
      int trim = computeTrim(bottom);
      int w = wHint == -1 ? -1 : Math.max(0, width - trim);
      bottomSize = computeChildSize(bottom, w, -1, flushCache);
    }
    Point rightSize = new Point(0, 0);
    if (right != null)
    {
      int trim = computeTrim(right);
      int w = -1;
      if (rightWidth != -1)
      {
        w = rightWidth - trim;
        if (left != null) {
          w = Math.min(w, width - curve_width + 2 * curve_indent - 10 - trim);
        }
        w = Math.max(0, w);
      }
      rightSize = computeChildSize(right, w, -1, flushCache);
      if (wHint != -1) {
        width -= x + curve_width - 2 * curve_indent;
      }
    }
    Point leftSize = new Point(0, 0);
    if (left != null)
    {
      int trim = computeTrim(left);
      int w = wHint == -1 ? -1 : Math.max(0, width - trim);
      leftSize = computeChildSize(left, w, -1, flushCache);
    }
    width = x + x;
    height = y;
    if ((bottom != null) && ((left != null) || (right != null))) {
      height += 3;
    }
    if (left != null)
    {
      if (right == null) {
        height += y;
      } else {
        height += Math.max(y, rightMinHeight == -1 ? y : rightMinHeight);
      }
    }
    else {
      height += y;
    }
    if (showCurve)
    {
      width += curve_width - 2 * curve_indent;
      height += 7;
    }
    if (wHint != -1) {
      width = wHint;
    }
    if (hHint != -1) {
      height = hHint;
    }
    return new Point(width, height);
  }
  
  Point computeChildSize(Control control, int wHint, int hHint, boolean flushCache)
  {
    Object data = control.getLayoutData();
    if ((data == null) || (!(data instanceof CLayoutData)))
    {
      data = new CLayoutData();
      control.setLayoutData(data);
    }
    return ((CLayoutData)data).computeSize(control, wHint, hHint, flushCache);
  }
  
  int computeTrim(Control c)
  {
    if ((c instanceof Scrollable))
    {
      Rectangle rect = ((Scrollable)c).computeTrim(0, 0, 0, 0);
      return width;
    }
    return c.getBorderWidth() * 2;
  }
  
  protected boolean flushCache(Control control)
  {
    Object data = control.getLayoutData();
    if ((data != null) && ((data instanceof CLayoutData))) {
      ((CLayoutData)data).flushCache();
    }
    return true;
  }
  
  protected void layout(Composite composite, boolean flushCache)
  {
    CBanner banner = (CBanner)composite;
    Control left = left;
    Control right = right;
    Control bottom = bottom;
    
    Point size = banner.getSize();
    boolean showCurve = (left != null) && (right != null);
    int width = x - 2 * banner.getBorderWidth();
    int height = y - 2 * banner.getBorderWidth();
    
    Point bottomSize = new Point(0, 0);
    if (bottom != null)
    {
      int trim = computeTrim(bottom);
      int w = Math.max(0, width - trim);
      bottomSize = computeChildSize(bottom, w, -1, flushCache);
      height -= y + 1 + 2;
    }
    if (showCurve) {
      height -= 7;
    }
    height = Math.max(0, height);
    Point rightSize = new Point(0, 0);
    if (right != null)
    {
      int trim = computeTrim(right);
      int w = -1;
      if (rightWidth != -1)
      {
        w = rightWidth - trim;
        if (left != null) {
          w = Math.min(w, width - curve_width + 2 * curve_indent - 10 - trim);
        }
        w = Math.max(0, w);
      }
      rightSize = computeChildSize(right, w, -1, flushCache);
      width -= x - curve_indent + curve_width - curve_indent;
    }
    Point leftSize = new Point(0, 0);
    if (left != null)
    {
      int trim = computeTrim(left);
      int w = Math.max(0, width - trim);
      leftSize = computeChildSize(left, w, -1, flushCache);
    }
    int x = 0;
    int y = 0;
    int oldStart = curveStart;
    Rectangle leftRect = null;
    Rectangle rightRect = null;
    Rectangle bottomRect = null;
    if (bottom != null) {
      bottomRect = new Rectangle(x, y + y - y, x, y);
    }
    if (showCurve) {
      y += 4;
    }
    if (left != null)
    {
      leftRect = new Rectangle(x, y, x, y);
      curveStart = (x + x - curve_indent);
      x += x - curve_indent + curve_width - curve_indent;
    }
    if (right != null)
    {
      if (left != null) {
        y = Math.max(y, rightMinHeight == -1 ? y : rightMinHeight);
      }
      rightRect = new Rectangle(x, y, x, y);
    }
    if (curveStart < oldStart) {
      banner.redraw(curveStart - 200, 0, oldStart + curve_width - curveStart + 200 + 5, y, false);
    }
    if (curveStart > oldStart) {
      banner.redraw(oldStart - 200, 0, curveStart + curve_width - oldStart + 200 + 5, y, false);
    }
    banner.update();
    curveRect = new Rectangle(curveStart, 0, curve_width, y);
    if (bottomRect != null) {
      bottom.setBounds(bottomRect);
    }
    if (rightRect != null) {
      right.setBounds(rightRect);
    }
    if (leftRect != null) {
      left.setBounds(leftRect);
    }
  }
}

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

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

class CCombo$1
  implements Listener
{
  final CCombo this$0;
  
  CCombo$1(CCombo paramCCombo)
  {
    this$0 = paramCCombo;
  }
  
  public void handleEvent(Event event)
  {
    if (this$0.isDisposed()) {
      return;
    }
    if (this$0.popup == widget)
    {
      this$0.popupEvent(event);
      return;
    }
    if (this$0.text == widget)
    {
      this$0.textEvent(event);
      return;
    }
    if (this$0.list == widget)
    {
      this$0.listEvent(event);
      return;
    }
    if (this$0.arrow == widget)
    {
      this$0.arrowEvent(event);
      return;
    }
    if (this$0 == widget)
    {
      this$0.comboEvent(event);
      return;
    }
    if (this$0.getShell() == widget) {
      this$0.getDisplay().asyncExec(new CCombo.2(this));
    }
  }
}

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

class CCombo$2
  implements Runnable
{
  final CCombo.1 this$1;
  
  CCombo$2(CCombo.1 param1)
  {
    this$1 = param1;
  }
  
  public void run()
  {
    if (CCombo.1.access$0(this$1).isDisposed()) {
      return;
    }
    CCombo.1.access$0(this$1).handleFocus(16);
  }
}

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

import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Shell;

class CCombo$3
  implements Listener
{
  final CCombo this$0;
  
  CCombo$3(CCombo paramCCombo)
  {
    this$0 = paramCCombo;
  }
  
  public void handleEvent(Event event)
  {
    if (this$0.isDisposed()) {
      return;
    }
    if (type == 13)
    {
      if ((widget instanceof ScrollBar)) {
        this$0.handleScroll(event);
      }
      return;
    }
    Shell shell = ((Control)widget).getShell();
    if (shell == this$0.getShell()) {
      this$0.handleFocus(16);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.swt.custom.CCombo.3
 * 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 CCombo$4
  extends AccessibleAdapter
{
  final CCombo this$0;
  
  CCombo$4(CCombo paramCCombo)
  {
    this$0 = paramCCombo;
  }
  
  public void getName(AccessibleEvent e)
  {
    String name = null;
    String text = this$0.getAssociatedLabel();
    if (text != 
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