public class PSWTCanvas extends org.eclipse.swt.widgets.Composite implements PComponent
Modifier and Type | Field and Description |
---|---|
static PSWTCanvas |
CURRENT_CANVAS
Terrible Singleton instance of the PSWTCanvas.
|
Constructor and Description |
---|
PSWTCanvas(org.eclipse.swt.widgets.Composite parent,
int style)
Construct a canvas with the basic scene graph consisting of a root,
camera, and layer.
|
Modifier and Type | Method and Description |
---|---|
void |
addInputEventListener(PInputEventListener listener)
Add an input listener to the camera associated with this canvas.
|
PCamera |
createBasicSceneGraph()
Builds the basic scene graph associated with this canvas.
|
boolean |
getAnimating()
Return true if any activities that respond with true to the method
isAnimating were run in the last PRoot.processInputs() loop.
|
PCamera |
getCamera()
Return the camera associated with this canvas.
|
boolean |
getDoubleBuffered()
Get whether this canvas should use double buffering - the default is to
double buffer.
|
boolean |
getInteracting()
Return true if this canvas has been marked as interacting.
|
PLayer |
getLayer()
Helper method to return the first layer attached to the camera of this
canvas.
|
PPanEventHandler |
getPanEventHandler()
Get the pan event handler associated with this canvas.
|
PRoot |
getRoot()
Return root for this canvas.
|
PZoomEventHandler |
getZoomEventHandler()
Get the zoom event handler associated with this canvas.
|
protected void |
installInputSources()
This method installs mouse and key listeners on the canvas that forward
those events to Piccolo2D.
|
void |
paintComponent(org.eclipse.swt.graphics.GC gc,
int x,
int y,
int w,
int h)
Paints the region specified of the canvas onto the given Graphics
Context.
|
void |
paintImmediately()
Performs an immediate repaint if no other client is currently performing
one.
|
void |
popCursor()
Pop the cursor on top of the cursorStack and set it as the canvas cursor.
|
void |
pushCursor(Cursor newCursor)
Set the canvas cursor, and remember the previous cursor on the cursor
stack.
|
void |
removeInputEventListener(PInputEventListener listener)
Remove an input listener to the camera associated with this canvas.
|
void |
repaint()
Exists to dispatch from the Swing's repaint method to SWT's redraw
method.
|
void |
repaint(PBounds bounds)
Flags the bounds provided as needing to be redrawn.
|
protected void |
sendInputEventToInputManager(InputEvent awtEvent,
int type)
Dispatches the given event to the default input manager for the root of
this canvas.
|
void |
setAnimatingRenderQuality(int requestedQuality)
Set the render quality that should be used when rendering this canvas
when it is animating.
|
void |
setBounds(int x,
int y,
int newWidth,
int newHeight)
Changes the bounds of this PSWTCanvas.
|
void |
setCamera(PCamera newCamera)
Set the camera associated with this canvas.
|
void |
setDefaultRenderQuality(int requestedQuality)
Set the render quality that should be used when rendering this canvas.
|
void |
setDoubleBuffered(boolean doubleBuffered)
Set whether this canvas should use double buffering - the default is yes.
|
void |
setInteracting(boolean isInteracting)
Changes the number of callers that are interacting with the canvas.
|
void |
setInteractingRenderQuality(int requestedQuality)
Set the render quality that should be used when rendering this canvas
when it is interacting.
|
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList
computeTrim, getBorderWidth, getHorizontalBar, getScrollbarsMode, getVerticalBar
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getOrientation, getParent, getRegion, getShell, getSize, getTextDirection, getToolTipText, getTouchEnabled, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeGestureListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTouchListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setParent, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString
public static PSWTCanvas CURRENT_CANVAS
public PSWTCanvas(org.eclipse.swt.widgets.Composite parent, int style)
parent
- component onto which the canvas is installedstyle
- component style for the PSWTCanvaspublic PPanEventHandler getPanEventHandler()
public PZoomEventHandler getZoomEventHandler()
public PCamera getCamera()
public void setCamera(PCamera newCamera)
newCamera
- camera to attach to this canvaspublic PRoot getRoot()
public PLayer getLayer()
canvas.getCamera.getLayer(0)
public void addInputEventListener(PInputEventListener listener)
listener
- listener to add to to the camerapublic void removeInputEventListener(PInputEventListener listener)
listener
- listener to remove from the set of event listeners
attached to this canvas.public PCamera createBasicSceneGraph()
public boolean getInteracting()
public boolean getAnimating()
public void setInteracting(boolean isInteracting)
setInteracting
in interface PComponent
isInteracting
- state the client considers the PSWTCanvas to be in
with regard to interactingpublic boolean getDoubleBuffered()
public void setDoubleBuffered(boolean doubleBuffered)
doubleBuffered
- value of double buffering flaspublic void setDefaultRenderQuality(int requestedQuality)
requestedQuality
- supports PPaintContext.HIGH_QUALITY_RENDERING or
PPaintContext.LOW_QUALITY_RENDERINGpublic void setAnimatingRenderQuality(int requestedQuality)
requestedQuality
- supports PPaintContext.HIGH_QUALITY_RENDERING or
PPaintContext.LOW_QUALITY_RENDERINGpublic void setInteractingRenderQuality(int requestedQuality)
requestedQuality
- supports PPaintContext.HIGH_QUALITY_RENDERING or
PPaintContext.LOW_QUALITY_RENDERINGpublic void pushCursor(Cursor newCursor)
pushCursor
in interface PComponent
newCursor
- new cursor to push onto the cursor stackpublic void popCursor()
popCursor
in interface PComponent
protected void installInputSources()
protected void sendInputEventToInputManager(InputEvent awtEvent, int type)
awtEvent
- awt event needing dispatchingtype
- type of the eventpublic void setBounds(int x, int y, int newWidth, int newHeight)
setBounds
in class org.eclipse.swt.widgets.Control
x
- left of the new boundsy
- top of the new boundsnewWidth
- new width of the boundsnewHeight
- new height of the boundspublic void repaint()
public void repaint(PBounds bounds)
repaint
in interface PComponent
bounds
- the bounds that should be repaintedpublic void paintComponent(org.eclipse.swt.graphics.GC gc, int x, int y, int w, int h)
gc
- graphics onto within painting should occurx
- left of the dirty regiony
- top of the dirty regionw
- width of the dirty regionh
- height of the dirty regionpublic void paintImmediately()
paintImmediately
in interface PComponent
Copyright © 1995–2013 Piccolo2D. All rights reserved.