Mercurial > projects > dwt-addons
diff dwtx/jface/text/AbstractInformationControl.d @ 156:a9566845f1cb
...
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 25 Aug 2008 19:03:46 +0200 |
parents | 75302ef3f92f |
children | f8d52b926852 |
line wrap: on
line diff
--- a/dwtx/jface/text/AbstractInformationControl.d Mon Aug 25 00:45:19 2008 +0200 +++ b/dwtx/jface/text/AbstractInformationControl.d Mon Aug 25 19:03:46 2008 +0200 @@ -304,7 +304,7 @@ * * @deprecated clients should use one of the public constructors */ - this(Shell parentShell, int shellStyle, final String statusFieldText, final ToolBarManager toolBarManager) { + this(Shell parentShell, int shellStyle, String statusFieldText, ToolBarManager toolBarManager) { Assert.isTrue(statusFieldText is null || toolBarManager is null); fResizeHandleSize= -1; fToolBarManager= toolBarManager; @@ -333,7 +333,7 @@ createStatusComposite(statusFieldText, toolBarManager, foreground, background); } - private void createStatusComposite(final String statusFieldText, final ToolBarManager toolBarManager, Color foreground, Color background) { + private void createStatusComposite(String statusFieldText, ToolBarManager toolBarManager, Color foreground, Color background) { if (toolBarManager is null && statusFieldText is null) return; @@ -356,7 +356,7 @@ } } - private void createStatusLabel(final String statusFieldText, Color foreground, Color background) { + private void createStatusLabel(String statusFieldText, Color foreground, Color background) { fStatusLabel= new Label(fStatusComposite, DWT.RIGHT); fStatusLabel.setLayoutData(new GridData(DWT.FILL, DWT.CENTER, true, false)); fStatusLabel.setText(statusFieldText); @@ -373,7 +373,7 @@ } private void createToolBar(ToolBarManager toolBarManager) { - final Composite bars= new Composite(fStatusComposite, DWT.NONE); + Composite bars= new Composite(fStatusComposite, DWT.NONE); bars.setLayoutData(new GridData(DWT.FILL, DWT.FILL, false, false)); GridLayout layout= new GridLayout(3, false); @@ -397,16 +397,16 @@ addResizeSupportIfNecessary(bars); } - private void addResizeSupportIfNecessary(final Composite bars) { + private void addResizeSupportIfNecessary(Composite bars) { // XXX: workarounds for // - https://bugs.eclipse.org/bugs/show_bug.cgi?id=219139 : API to add resize grip / grow box in lower right corner of shell // - https://bugs.eclipse.org/bugs/show_bug.cgi?id=23980 : platform specific shell resize behavior String platform= DWT.getPlatform(); - final bool isWin= platform.equals("win32"); //$NON-NLS-1$ + bool isWin= platform.equals("win32"); //$NON-NLS-1$ if (!isWin && !platform.equals("gtk")) //$NON-NLS-1$ return; - final Canvas resizer= new Canvas(bars, DWT.NONE); + Canvas resizer= new Canvas(bars, DWT.NONE); int size= getResizeHandleSize(bars); @@ -414,32 +414,38 @@ data.widthHint= size; data.heightHint= size; resizer.setLayoutData(data); - resizer.addPaintListener(new class() PaintListener { + resizer.addPaintListener(new class(isWin,resizer) PaintListener { + bool isWin_; + Canvas resizer_; + this(bool a, Canvas b ){ + isWin_=a; + resizer_=b; + } public void paintControl(PaintEvent e) { - Point s= resizer.getSize(); + Point s= resizer_.getSize(); int x= s.x - 2; int y= s.y - 2; int min= Math.min(x, y); - if (isWin) { + if (isWin_) { // draw dots - e.gc.setBackground(resizer.getDisplay().getSystemColor(DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); + e.gc.setBackground(resizer_.getDisplay().getSystemColor(DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); int end= min - 1; for (int i= 0; i <= 2; i++) for (int j= 0; j <= 2 - i; j++) e.gc.fillRectangle(end - 4 * i, end - 4 * j, 2, 2); end--; - e.gc.setBackground(resizer.getDisplay().getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW)); + e.gc.setBackground(resizer_.getDisplay().getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW)); for (int i= 0; i <= 2; i++) for (int j= 0; j <= 2 - i; j++) e.gc.fillRectangle(end - 4 * i, end - 4 * j, 2, 2); } else { // draw diagonal lines - e.gc.setForeground(resizer.getDisplay().getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW)); + e.gc.setForeground(resizer_.getDisplay().getSystemColor(DWT.COLOR_WIDGET_NORMAL_SHADOW)); for (int i= 1; i < min; i+= 4) { e.gc.drawLine(i, y, x, i); } - e.gc.setForeground(resizer.getDisplay().getSystemColor(DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); + e.gc.setForeground(resizer_.getDisplay().getSystemColor(DWT.COLOR_WIDGET_HIGHLIGHT_SHADOW)); for (int i= 2; i < min; i+= 4) { e.gc.drawLine(i, y, x, i); } @@ -448,29 +454,43 @@ }); resizer.setCursor(new Cursor(resizer.getDisplay(), DWT.CURSOR_SIZESE)); - MouseAdapter resizeSupport= new class() MouseAdapter { + MouseAdapter resizeSupport= new class(resizer) MouseAdapter { + Canvas resizer_; + this(Canvas a){ + resizer_=a; + } private MouseMoveListener fResizeListener; public void mouseDown(MouseEvent e) { Point shellSize= fShell.getSize(); - final int shellX= shellSize.x; - final int shellY= shellSize.y; - Point mouseLoc= resizer.toDisplay(e.x, e.y); - final int mouseX= mouseLoc.x; - final int mouseY= mouseLoc.y; - fResizeListener= new class() MouseMoveListener { + int shellX= shellSize.x; + int shellY= shellSize.y; + Point mouseLoc= resizer_.toDisplay(e.x, e.y); + int mouseX= mouseLoc.x; + int mouseY= mouseLoc.y; + fResizeListener= new class(shellX,shellY,mouseX,mouseY) MouseMoveListener { + int shellX_; + int shellY_; + int mouseX_; + int mouseY_; + this(int a, int b, int c, int d ){ + shellX_=a; + shellY_=b; + mouseX_=c; + mouseY_=d; + } public void mouseMove(MouseEvent e2) { - Point mouseLoc2= resizer.toDisplay(e2.x, e2.y); - int dx= mouseLoc2.x - mouseX; - int dy= mouseLoc2.y - mouseY; - setSize(shellX + dx, shellY + dy); + Point mouseLoc2= resizer_.toDisplay(e2.x, e2.y); + int dx= mouseLoc2.x - mouseX_; + int dy= mouseLoc2.y - mouseY_; + setSize(shellX_ + dx, shellY_ + dy); } }; - resizer.addMouseMoveListener(fResizeListener); + resizer_.addMouseMoveListener(fResizeListener); } public void mouseUp(MouseEvent e) { - resizer.removeMouseMoveListener(fResizeListener); + resizer_.removeMouseMoveListener(fResizeListener); fResizeListener= null; } }; @@ -496,30 +516,33 @@ * * @param control the control that can be used to move the shell */ - private void addMoveSupport(final Control control) { - MouseAdapter moveSupport= new class() MouseAdapter { + private void addMoveSupport(Control control) { + MouseAdapter moveSupport= new class(control) MouseAdapter { private MouseMoveListener fMoveListener; - + Control control_; + this(Control a){ + control_=a; + } public void mouseDown(MouseEvent e) { Point shellLoc= fShell.getLocation(); final int shellX= shellLoc.x; final int shellY= shellLoc.y; - Point mouseLoc= control.toDisplay(e.x, e.y); + Point mouseLoc= control_.toDisplay(e.x, e.y); final int mouseX= mouseLoc.x; final int mouseY= mouseLoc.y; fMoveListener= new class() MouseMoveListener { public void mouseMove(MouseEvent e2) { - Point mouseLoc2= control.toDisplay(e2.x, e2.y); + Point mouseLoc2= control_.toDisplay(e2.x, e2.y); int dx= mouseLoc2.x - mouseX; int dy= mouseLoc2.y - mouseY; fShell.setLocation(shellX + dx, shellY + dy); } }; - control.addMouseMoveListener(fMoveListener); + control_.addMouseMoveListener(fMoveListener); } public void mouseUp(MouseEvent e) { - control.removeMouseMoveListener(fMoveListener); + control_.removeMouseMoveListener(fMoveListener); fMoveListener= null; } }; @@ -769,7 +792,7 @@ * {@inheritDoc} * This method is not intended to be overridden by subclasses. */ - public void addFocusListener(final FocusListener listener) { + public void addFocusListener(FocusListener listener) { if (fFocusListeners.isEmpty()) { fShellListener= new class() Listener {