|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.swt.widgets.Widget
org.eclipse.swt.widgets.Control
org.eclipse.swt.widgets.Scrollable
org.eclipse.swt.widgets.Composite
edu.umd.cs.piccolox.swt.PSWTCanvas
public class PSWTCanvas
PSWTCanvas is an SWT Composite that can be used to embed Piccolo into a SWT application. Canvases view the Piccolo scene graph through a camera. The canvas manages screen updates coming from this camera, and forwards swing mouse and keyboard events to the camera.
| Field Summary | |
|---|---|
static PSWTCanvas |
CURRENT_CANVAS
Terrible Singleton instance of the PSWTCanvas. |
| Fields inherited from class org.eclipse.swt.widgets.Composite |
|---|
embeddedHandle |
| Fields inherited from class org.eclipse.swt.widgets.Widget |
|---|
handle |
| Constructor Summary | |
|---|---|
PSWTCanvas(org.eclipse.swt.widgets.Composite parent,
int style)
Construct a canvas with the basic scene graph consisting of a root, camera, and layer. |
|
| Method Summary | |
|---|---|
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. |
| Methods inherited from class org.eclipse.swt.widgets.Composite |
|---|
changed, checkSubclass, computeSize, drawBackground, getBackgroundMode, getChildren, getClientArea, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList |
| Methods inherited from class org.eclipse.swt.widgets.Scrollable |
|---|
computeTrim, getBorderWidth, getHorizontalBar, getVerticalBar |
| Methods inherited from class org.eclipse.swt.widgets.Control |
|---|
addControlListener, addDragDetectListener, addFocusListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTraverseListener, computeSize, dragDetect, dragDetect, forceFocus, getAccessible, getBackground, getBackgroundImage, getBounds, getCursor, getDragDetect, getEnabled, getFont, getForeground, getLayoutData, getLocation, getMenu, getMonitor, getParent, getRegion, getShell, getSize, getToolTipText, getVisible, internal_dispose_GC, internal_new_GC, isEnabled, isFocusControl, isReparentable, isVisible, moveAbove, moveBelow, pack, pack, print, redraw, redraw, removeControlListener, removeDragDetectListener, removeFocusListener, removeHelpListener, removeKeyListener, removeMenuDetectListener, removeMouseListener, removeMouseMoveListener, removeMouseTrackListener, removeMouseWheelListener, removePaintListener, removeTraverseListener, setBackground, setBackgroundImage, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setFont, setForeground, setLayoutData, setLocation, setLocation, setMenu, setParent, setRedraw, setRegion, setSize, setSize, setToolTipText, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse, update |
| Methods inherited from class org.eclipse.swt.widgets.Widget |
|---|
addDisposeListener, addListener, checkWidget, dispose, getData, getData, getDisplay, getListeners, getStyle, isDisposed, isListening, notifyListeners, removeDisposeListener, removeListener, removeListener, reskin, setData, setData, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static PSWTCanvas CURRENT_CANVAS
| Constructor Detail |
|---|
public PSWTCanvas(org.eclipse.swt.widgets.Composite parent,
int style)
parent - component onto which the canvas is installedstyle - component style for the PSWTCanvas| Method Detail |
|---|
public 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 PComponentisInteracting - 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 PComponentnewCursor - new cursor to push onto the cursor stackpublic void popCursor()
popCursor in interface PComponentprotected void installInputSources()
protected void sendInputEventToInputManager(InputEvent awtEvent,
int type)
awtEvent - awt event needing dispatchingtype - type of the event
public void setBounds(int x,
int y,
int newWidth,
int newHeight)
setBounds in class org.eclipse.swt.widgets.Controlx - 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 PComponentbounds - the bounds that should be repainted
public 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
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||