Package com.jogamp.newt.swt
Class NewtCanvasSWT
- 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
-
- com.jogamp.newt.swt.NewtCanvasSWT
-
- All Implemented Interfaces:
NativeSurfaceHolder,NativeWindowHolder,WindowClosingProtocol,org.eclipse.swt.graphics.Drawable
public class NewtCanvasSWT extends org.eclipse.swt.widgets.Canvas implements NativeWindowHolder, WindowClosingProtocol
SWTCanvascontaining a NEWTWindowusing native parenting.Implementation allows use of custom
GLCapabilities.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jogamp.nativewindow.WindowClosingProtocol
WindowClosingProtocol.WindowClosingMode
-
-
Constructor Summary
Constructors Constructor Description NewtCanvasSWT(org.eclipse.swt.widgets.Composite parent, int style, Window child)Instantiates a NewtCanvas with a NEWT child.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static NewtCanvasSWTcreate(org.eclipse.swt.widgets.Composite parent, int style, Window child)Creates an instance usingNewtCanvasSWT(Composite, int, Window)on the SWT thread.voiddispose()Destroys this resource: Make the NEWT Child invisible Disconnects the NEWT Child from this Canvas NativeWindow, reparent to NULL Issuesdestroy()on the NEWT Child Remove reference to the NEWT ChildbooleanforceFocus()WindowClosingProtocol.WindowClosingModegetDefaultCloseOperation()NativeSurfacegetNativeSurface()Returns the associatedNativeSurfaceof thisNativeSurfaceHolder.NativeWindowgetNativeWindow()Returns the associatedNativeWindowof thisNativeWindowHolder, which is identical toNativeSurfaceHolder.getNativeSurface()WindowgetNEWTChild()voidsetBounds(int x, int y, int width, int height)WindowClosingProtocol.WindowClosingModesetDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode op)WindowsetNEWTChild(Window newChild)Sets a new NEWT child, provoking reparenting.booleansetParent(org.eclipse.swt.widgets.Composite parent)voidupdate()-
Methods inherited from class org.eclipse.swt.widgets.Canvas
drawBackground, getCaret, getIME, scroll, setCaret, setFont, setIME
-
Methods inherited from class org.eclipse.swt.widgets.Composite
changed, drawBackground, getBackgroundMode, getChildren, getLayout, getLayoutDeferred, getTabList, isLayoutDeferred, layout, layout, layout, layout, layout, setBackgroundMode, setFocus, setLayout, setLayoutDeferred, setTabList, toString
-
Methods inherited from class org.eclipse.swt.widgets.Scrollable
computeTrim, getClientArea, getHorizontalBar, getScrollbarsMode, getVerticalBar
-
Methods inherited from class org.eclipse.swt.widgets.Control
addControlListener, addDragDetectListener, addFocusListener, addGestureListener, addHelpListener, addKeyListener, addMenuDetectListener, addMouseListener, addMouseMoveListener, addMouseTrackListener, addMouseWheelListener, addPaintListener, addTouchListener, addTraverseListener, computeSize, computeSize, dragDetect, dragDetect, getAccessible, getBackground, getBackgroundImage, getBorderWidth, 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, isAutoScalable, 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, requestLayout, setBackground, setBackgroundImage, setBounds, setCapture, setCursor, setDragDetect, setEnabled, setForeground, setLayoutData, setLocation, setLocation, setMenu, setOrientation, setRedraw, setRegion, setSize, setSize, setTextDirection, setToolTipText, setTouchEnabled, setVisible, toControl, toControl, toDisplay, toDisplay, traverse, traverse, traverse
-
-
-
-
Constructor Detail
-
NewtCanvasSWT
public NewtCanvasSWT(org.eclipse.swt.widgets.Composite parent, int style, Window child)Instantiates a NewtCanvas with a NEWT child.Note: The NEWT child
Display'sEDTUtilis being set to an SWT conform implementation viaDisplay.setEDTUtil(EDTUtil).- Parameters:
parent- the SWT compositestyle- additional styles to SWT#NO_BACKGROUNDchild- optional preassigned#Window, maybe null
-
-
Method Detail
-
create
public static NewtCanvasSWT create(org.eclipse.swt.widgets.Composite parent, int style, Window child)
Creates an instance usingNewtCanvasSWT(Composite, int, Window)on the SWT thread.Note: The NEWT child
Display'sEDTUtilis being set to an SWT conform implementation viaDisplay.setEDTUtil(EDTUtil).- Parameters:
parent- the SWT compositestyle- additional styles to SWT#NO_BACKGROUNDchild- optional preassigned#Window, maybe null- Returns:
- a new instance
-
setBounds
public void setBounds(int x, int y, int width, int height)- Overrides:
setBoundsin classorg.eclipse.swt.widgets.Control
-
update
public void update()
- Overrides:
updatein classorg.eclipse.swt.widgets.Control
-
dispose
public void dispose() throws org.eclipse.swt.SWTExceptionDestroys this resource:- Make the NEWT Child invisible
- Disconnects the NEWT Child from this Canvas NativeWindow, reparent to NULL
- Issues
destroy()on the NEWT Child - Remove reference to the NEWT Child
- Overrides:
disposein classorg.eclipse.swt.widgets.Widget- Throws:
org.eclipse.swt.SWTException- If this method is not calledfrom the SWT thread, anSWTExceptionis thrown for compliance across platforms. User may utilizeSWTAccessor.invokeOnSWTThread(org.eclipse.swt.widgets.Display, boolean, Runnable).- See Also:
Window.destroy()
-
getNativeWindow
public NativeWindow getNativeWindow()
Returns the associatedNativeWindowof thisNativeWindowHolder, which is identical toNativeSurfaceHolder.getNativeSurface()- Specified by:
getNativeWindowin interfaceNativeWindowHolder- Returns:
- this SWT Canvas
NativeWindowrepresentation, may be null in case it has not been realized
-
getNativeSurface
public NativeSurface getNativeSurface()
Returns the associatedNativeSurfaceof thisNativeSurfaceHolder.- Specified by:
getNativeSurfacein interfaceNativeSurfaceHolder- Returns:
- this SWT Canvas
NativeSurfacerepresentation, may be null in case it has not been realized
-
getDefaultCloseOperation
public WindowClosingProtocol.WindowClosingMode getDefaultCloseOperation()
- Specified by:
getDefaultCloseOperationin interfaceWindowClosingProtocol- Returns:
- the current close operation value
- See Also:
WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE,WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE
-
setDefaultCloseOperation
public WindowClosingProtocol.WindowClosingMode setDefaultCloseOperation(WindowClosingProtocol.WindowClosingMode op)
- Specified by:
setDefaultCloseOperationin interfaceWindowClosingProtocol- Parameters:
op- the new close operation value- Returns:
- the previous close operation value
- See Also:
WindowClosingProtocol.WindowClosingMode.DISPOSE_ON_CLOSE,WindowClosingProtocol.WindowClosingMode.DO_NOTHING_ON_CLOSE
-
setNEWTChild
public Window setNEWTChild(Window newChild) throws org.eclipse.swt.SWTException
Sets a new NEWT child, provoking reparenting.A previously detached
newChildwill be released to top-level status and made invisible.Note: When switching NEWT child's, detaching the previous first via
setNEWTChild(null)produced much cleaner visual results.Note: The NEWT child
Display'sEDTUtilis being set to an SWT conform implementation viaDisplay.setEDTUtil(EDTUtil).- Returns:
- the previous attached newt child.
- Throws:
org.eclipse.swt.SWTException- If this method is not calledfrom the SWT thread, anSWTExceptionis thrown for compliance across platforms. User may utilizeSWTAccessor.invokeOnSWTThread(org.eclipse.swt.widgets.Display, boolean, Runnable).
-
getNEWTChild
public Window getNEWTChild()
- Returns:
- the current NEWT child
-
setParent
public boolean setParent(org.eclipse.swt.widgets.Composite parent)
- Overrides:
setParentin classorg.eclipse.swt.widgets.Control
-
forceFocus
public boolean forceFocus()
- Overrides:
forceFocusin classorg.eclipse.swt.widgets.Control
-
-