org.eclipse.swt.widgets
Class Canvas

java.lang.Object
  |
  +--org.eclipse.swt.widgets.Widget
        |
        +--org.eclipse.swt.widgets.Control
              |
              +--org.eclipse.swt.widgets.Scrollable
                    |
                    +--org.eclipse.swt.widgets.Composite
                          |
                          +--org.eclipse.swt.widgets.Canvas
All Implemented Interfaces:
Drawable
Direct Known Subclasses:
AnimatedProgress, CLabel, Decorations, StyledText, TableCursor

public class Canvas
extends Composite

Safe: Instances of this class provide a surface for drawing arbitrary graphics.

Styles:
(none)
Events:
(none)

This class may be subclassed by custom control implementors who are building controls that are not constructed from aggregates of other controls. That is, they are either painted using SWT graphics calls or are handled by native methods.

See Also:
Composite

Field Summary
(package private)  Caret caret
           
 
Fields inherited from class org.eclipse.swt.widgets.Composite
font, layout, lpwp, tabList
 
Fields inherited from class org.eclipse.swt.widgets.Scrollable
horizontalBar, verticalBar
 
Fields inherited from class org.eclipse.swt.widgets.Control
ACCENTS, accessible, background, drawCount, foreground, handle, hCursor, layoutData, menu, parent, toolTipText
 
Fields inherited from class org.eclipse.swt.widgets.Widget
CANVAS, COMCTL32_MAJOR, COMCTL32_MINOR, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, DISPOSED, eventTable, HIDDEN, keys, MAJOR, MINOR, Mnemonic, state, style, values
 
Constructor Summary
(package private) Canvas()
          Prevents uninitialized instances from being created outside the package.
  Canvas(Composite parent, int style)
          Enabled: Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
 
Method Summary
(package private)  void clearArea(int x, int y, int width, int height)
           
 Caret getCaret()
          Enabled: Returns the caret.
(package private)  void releaseWidget()
           
 void scroll(int destX, int destY, int x, int y, int width, int height, boolean all)
          Enabled: Scrolls a rectangular area of the receiver by first copying the source area to the destination and then causing the area of the source which is not covered by the destination to be repainted.
 void setCaret(Caret caret)
          Enabled: Sets the receiver's caret.
 void setFont(Font font)
          Enabled:
(package private)  org.eclipse.swt.internal.win32.LRESULT WM_KILLFOCUS(int wParam, int lParam)
           
(package private)  org.eclipse.swt.internal.win32.LRESULT WM_SETFOCUS(int wParam, int lParam)
           
 
Methods inherited from class org.eclipse.swt.widgets.Composite
_getChildren, _getTabList, checkSubclass, computeSize, computeTabList, createHandle, getChildren, getChildrenCount, getLayout, getTabList, hooksKeys, layout, layout, minimumSize, moveAbove, moveBelow, releaseChildren, resizeChildren, resizeChildren, setFocus, setLayout, setResizeChildren, setTabGroupFocus, setTabItemFocus, setTabList, toolTipText, translateMnemonic, updateFont, widgetStyle, WM_ERASEBKGND, WM_GETDLGCODE, WM_GETFONT, WM_LBUTTONDOWN, WM_NOTIFY, WM_PAINT, WM_SETFONT, WM_SIZE, WM_SYSCOLORCHANGE, WM_SYSCOMMAND
 
Methods inherited from class org.eclipse.swt.widgets.Scrollable
callWindowProc, computeTrim, createScrollBar, createWidget, getClientArea, getHorizontalBar, getVerticalBar, widgetExtStyle, windowClass, windowProc, WM_HSCROLL, WM_MOUSEWHEEL, WM_VSCROLL, wmScroll
 
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addFocusListener, addHelpListener, addKeyListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addPaintListener, addTraverseListener, checkOrientation, computeSize, computeTabGroup, computeTabRoot, defaultBackground, defaultFont, defaultForeground, deregister, destroyWidget, drawBackground, drawBackground, findBrush, findCursor, findMnemonic, fixFocus, forceFocus, forceResize, getAccessible, getBackground, getBackgroundPixel, getBorderWidth, getBounds, getCodePage, getDisplay, getEnabled, getFont, getForeground, getForegroundPixel, getLayoutData, getLocation, getMenu, getParent, getPath, getShell, getSize, getToolTipText, getVisible, hasCursor, hasFocus, internal_dispose_GC, internal_new_GC, isActive, isDisposed, isEnabled, isFocusAncestor, isFocusControl, isReparentable, isShowing, isTabGroup, isTabItem, isVisible, menuShell, mnemonicHit, mnemonicMatch, moveAbove, moveBelow, new_Accessible, pack, pack, redraw, redraw, register, releaseHandle, removeControlListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removePaintListener, removeTraverseListener, sendKeyEvent, sendKeyEvent, sendMouseEvent, sendMouseEvent, setBackground, setBackgroundPixel, setBounds, setBounds, setBounds, setCapture, setCursor, setDefaultFont, setEnabled, setForeground, setForegroundPixel, setLayoutData, setLocation, setLocation, setMenu, setParent, setRadioFocus, setRadioSelection, setRedraw, setSavedFocus, setSize, setSize, setToolTipText, setVisible, sort, subclass, toControl, toControl, toDisplay, toDisplay, transferActive, transferFocus, translateAccelerator, translateMnemonic, translateTraversal, traverse, traverse, traverseEscape, traverseGroup, traverseItem, traverseMnemonic, traversePage, traverseReturn, unsubclass, update, update, windowProc, WM_ACTIVATE, WM_CHAR, WM_CLEAR, WM_CLOSE, WM_COMMAND, WM_CONTEXTMENU, WM_CTLCOLOR, WM_CUT, WM_DESTROY, WM_DRAWITEM, WM_ENDSESSION, WM_GETOBJECT, WM_HELP, WM_HOTKEY, WM_IME_CHAR, WM_IME_COMPOSITION, WM_INITMENUPOPUP, WM_KEYDOWN, WM_KEYUP, WM_LBUTTONDBLCLK, WM_LBUTTONUP, WM_MBUTTONDBLCLK, WM_MBUTTONDOWN, WM_MBUTTONUP, WM_MEASUREITEM, WM_MENUCHAR, WM_MENUSELECT, WM_MOUSEACTIVATE, WM_MOUSEHOVER, WM_MOUSELEAVE, WM_MOUSEMOVE, WM_MOVE, WM_NCACTIVATE, WM_NCCALCSIZE, WM_NCHITTEST, WM_PALETTECHANGED, WM_PASTE, WM_PRINTCLIENT, WM_QUERYENDSESSION, WM_QUERYNEWPALETTE, WM_QUERYOPEN, WM_RBUTTONDBLCLK, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_SETCURSOR, WM_SETREDRAW, WM_SETTINGCHANGE, WM_SHOWWINDOW, WM_SYSCHAR, WM_SYSKEYDOWN, WM_SYSKEYUP, WM_TIMER, WM_UNDO, WM_WINDOWPOSCHANGING, wmColorChild, wmCommandChild, wmDrawChild, wmMeasureChild, wmNotifyChild, wmScrollChild
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkBits, checkParent, checkWidget, dispose, error, filters, getData, getData, getName, getNameText, getStyle, hooks, isListening, isValidSubclass, isValidThread, mbcsToWcs, mbcsToWcs, notifyListeners, postEvent, postEvent, releaseChild, releaseResources, removeDisposeListener, removeListener, removeListener, sendEvent, sendEvent, sendEvent, sendEvent, setData, setData, setInputState, setKeyState, toString, wcsToMbcs, wcsToMbcs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

caret

Caret caret
Constructor Detail

Canvas

Canvas()
Prevents uninitialized instances from being created outside the package.


Canvas

public Canvas(Composite parent,
              int style)
Enabled: Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.

The style value is either one of the style constants defined in class SWT which is applicable to instances of this class, or must be built by bitwise OR'ing together (that is, using the int "|" operator) two or more of those SWT style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses.

Parameters:
parent - a composite control which will be the parent of the new instance (cannot be null)
style - the style of control to construct
See Also:
SWT, Widget.checkSubclass(), Widget.getStyle()
Method Detail

clearArea

void clearArea(int x,
               int y,
               int width,
               int height)

getCaret

public Caret getCaret()
Enabled: Returns the caret.

The caret for the control is automatically hidden and shown when the control is painted or resized, when focus is gained or lost and when an the control is scrolled. To avoid drawing on top of the caret, the programmer must hide and show the caret when drawing in the window any other time.

Returns:
the caret

releaseWidget

void releaseWidget()
Overrides:
releaseWidget in class Composite

scroll

public void scroll(int destX,
                   int destY,
                   int x,
                   int y,
                   int width,
                   int height,
                   boolean all)
Enabled: Scrolls a rectangular area of the receiver by first copying the source area to the destination and then causing the area of the source which is not covered by the destination to be repainted. Children that intersect the rectangle are optionally moved during the operation. In addition, outstanding paint events are flushed before the source area is copied to ensure that the contents of the canvas are drawn correctly.

Parameters:
destX - the x coordinate of the destination
destY - the y coordinate of the destination
x - the x coordinate of the source
y - the y coordinate of the source
width - the width of the area
height - the height of the area
all - trueif children should be scrolled, and false otherwise

setCaret

public void setCaret(Caret caret)
Enabled: Sets the receiver's caret.

The caret for the control is automatically hidden and shown when the control is painted or resized, when focus is gained or lost and when an the control is scrolled. To avoid drawing on top of the caret, the programmer must hide and show the caret when drawing in the window any other time.

Parameters:
caret - the new caret for the receiver, may be null

setFont

public void setFont(Font font)
Enabled:

Overrides:
setFont in class Control
Parameters:
font - the new font (or null)

WM_KILLFOCUS

org.eclipse.swt.internal.win32.LRESULT WM_KILLFOCUS(int wParam,
                                                    int lParam)
Overrides:
WM_KILLFOCUS in class Control

WM_SETFOCUS

org.eclipse.swt.internal.win32.LRESULT WM_SETFOCUS(int wParam,
                                                   int lParam)
Overrides:
WM_SETFOCUS in class Control


comments?