diff options
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java')
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java | 220 |
1 files changed, 110 insertions, 110 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java index a79a25705e..faecdea2b4 100755 --- a/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/photon/org/eclipse/swt/widgets/Canvas.java @@ -1,15 +1,15 @@ -package org.eclipse.swt.widgets;
-
-/*
+package org.eclipse.swt.widgets; + +/* * Copyright (c) 2000, 2002 IBM Corp. All rights reserved. * This file is made available under the terms of the Common Public License v1.0 * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-
+ * http://www.eclipse.org/legal/cpl-v10.html + */ + +import org.eclipse.swt.*; +import org.eclipse.swt.graphics.*; + /** * Instances of this class provide a surface for drawing * arbitrary graphics. @@ -29,13 +29,13 @@ import org.eclipse.swt.graphics.*; * * @see Composite */ -public class Canvas extends Composite {
- Caret caret;
-
-Canvas () {
- /* Do nothing */
-}
-
+public class Canvas extends Composite { + Caret caret; + +Canvas () { + /* Do nothing */ +} + /** * Constructs a new instance of this class given its parent * and a style value describing its behavior and appearance. @@ -64,10 +64,10 @@ Canvas () { * @see Widget#checkSubclass * @see Widget#getStyle */ -public Canvas (Composite parent, int style) {
- super (parent, style);
-}
-
+public Canvas (Composite parent, int style) { + super (parent, style); +} + /** * Returns the caret. * <p> @@ -86,53 +86,53 @@ public Canvas (Composite parent, int style) { * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public Caret getCaret () {
- checkWidget();
- return caret;
-}
-
-int Pt_CB_GOT_FOCUS (int widget, int info) {
- int result = super.Pt_CB_GOT_FOCUS (widget, info);
- if (caret != null) caret.setFocus ();
- return result;
-}
-
-int Pt_CB_LOST_FOCUS (int widget, int info) {
- int result = super.Pt_CB_LOST_FOCUS (widget, info);
- if (caret != null) caret.killFocus ();
- return result;
-}
-
-int drawProc (int widget, int damage) {
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- int result = super.drawProc (widget, damage);
- if (isFocus) caret.setFocus ();
- return result;
-}
-
-public void redraw () {
- checkWidget();
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- super.redraw ();
- if (isFocus) caret.setFocus ();
-}
-
-public void redraw (int x, int y, int width, int height, boolean all) {
- checkWidget();
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- super.redraw (x, y, width, height, all);
- if (isFocus) caret.setFocus ();
-}
-
-void releaseWidget () {
- if (caret != null) caret.releaseResources ();
- caret = null;
- super.releaseWidget();
-}
-
+public Caret getCaret () { + checkWidget(); + return caret; +} + +int Pt_CB_GOT_FOCUS (int widget, int info) { + int result = super.Pt_CB_GOT_FOCUS (widget, info); + if (caret != null) caret.setFocus (); + return result; +} + +int Pt_CB_LOST_FOCUS (int widget, int info) { + int result = super.Pt_CB_LOST_FOCUS (widget, info); + if (caret != null) caret.killFocus (); + return result; +} + +int drawProc (int widget, int damage) { + boolean isFocus = caret != null && caret.isFocusCaret (); + if (isFocus) caret.killFocus (); + int result = super.drawProc (widget, damage); + if (isFocus) caret.setFocus (); + return result; +} + +public void redraw () { + checkWidget(); + boolean isFocus = caret != null && caret.isFocusCaret (); + if (isFocus) caret.killFocus (); + super.redraw (); + if (isFocus) caret.setFocus (); +} + +public void redraw (int x, int y, int width, int height, boolean all) { + checkWidget(); + boolean isFocus = caret != null && caret.isFocusCaret (); + if (isFocus) caret.killFocus (); + super.redraw (x, y, width, height, all); + if (isFocus) caret.setFocus (); +} + +void releaseWidget () { + if (caret != null) caret.releaseResources (); + caret = null; + super.releaseWidget(); +} + /** * Scrolls a rectangular area of the receiver by first copying * the source area to the destination and then causing the area @@ -155,29 +155,29 @@ void releaseWidget () { * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) {
- checkWidget();
- if (width <= 0 || height <= 0) return;
- int deltaX = destX - x, deltaY = destY - y;
- if (deltaX == 0 && deltaY == 0) return;
- if (!isVisible ()) return;
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- GC gc = new GC (this);
- gc.copyArea (x, y, width, height, destX, destY);
- gc.dispose ();
- if (isFocus) caret.setFocus ();
-}
-
-int setBounds (int x, int y, int width, int height, boolean move, boolean resize, boolean events) {
- checkWidget();
- boolean isFocus = caret != null && caret.isFocusCaret ();
- if (isFocus) caret.killFocus ();
- int result = super.setBounds (x, y, width, height, move, resize, events);
- if (isFocus) caret.setFocus ();
- return result;
-}
-
+public void scroll (int destX, int destY, int x, int y, int width, int height, boolean all) { + checkWidget(); + if (width <= 0 || height <= 0) return; + int deltaX = destX - x, deltaY = destY - y; + if (deltaX == 0 && deltaY == 0) return; + if (!isVisible ()) return; + boolean isFocus = caret != null && caret.isFocusCaret (); + if (isFocus) caret.killFocus (); + GC gc = new GC (this); + gc.copyArea (x, y, width, height, destX, destY); + gc.dispose (); + if (isFocus) caret.setFocus (); +} + +int setBounds (int x, int y, int width, int height, boolean move, boolean resize, boolean events) { + checkWidget(); + boolean isFocus = caret != null && caret.isFocusCaret (); + if (isFocus) caret.killFocus (); + int result = super.setBounds (x, y, width, height, move, resize, events); + if (isFocus) caret.setFocus (); + return result; +} + /** * Sets the receiver's caret. * <p> @@ -198,23 +198,23 @@ int setBounds (int x, int y, int width, int height, boolean move, boolean resize * <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li> * </ul> */ -public void setCaret (Caret caret) {
- checkWidget();
- Caret newCaret = caret;
- Caret oldCaret = this.caret;
- this.caret = newCaret;
- if (isFocusControl ()) {
- if (oldCaret != null) oldCaret.killFocus ();
- if (newCaret != null) {
- if (newCaret.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
- newCaret.setFocus ();
- }
- }
-}
-
-public void setFont (Font font) {
- checkWidget();
- super.setFont (font);
- if (caret != null) caret.setFont (font);
-}
-}
+public void setCaret (Caret caret) { + checkWidget(); + Caret newCaret = caret; + Caret oldCaret = this.caret; + this.caret = newCaret; + if (isFocusControl ()) { + if (oldCaret != null) oldCaret.killFocus (); + if (newCaret != null) { + if (newCaret.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); + newCaret.setFocus (); + } + } +} + +public void setFont (Font font) { + checkWidget(); + super.setFont (font); + if (caret != null) caret.setFont (font); +} +} |