/******************************************************************************* * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.swt.widgets; import org.eclipse.swt.internal.photon.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.events.*; import org.eclipse.swt.*; import org.eclipse.swt.accessibility.*; /** * Control is the abstract superclass of all windowed user interface classes. *

*

*
Styles: *
BORDER
*
LEFT_TO_RIGHT, RIGHT_TO_LEFT
*
Events: *
DragDetect, FocusIn, FocusOut, Help, KeyDown, KeyUp, MenuDetect, MouseDoubleClick, MouseDown, MouseEnter, * MouseExit, MouseHover, MouseUp, MouseMove, MouseWheel, MouseHorizontalWheel, MouseVerticalWheel, Move, * Paint, Resize, Traverse
*
*

* Only one of LEFT_TO_RIGHT or RIGHT_TO_LEFT may be specified. *

* IMPORTANT: This class is intended to be subclassed only * within the SWT implementation. *

* * @see Control snippets * @see SWT Example: ControlExample * @see Sample code and further information * @noextend This class is not intended to be subclassed by clients. */ public abstract class Control extends Widget implements Drawable { Composite parent; Cursor cursor; Font font; Menu menu; Object layoutData; String toolTipText; Image backgroundImage; Region region; int toolTipHandle; Accessible accessible; Control () { /* Do nothing */ } /** * 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. *

* * @param parent a composite control which will be the parent of the new instance (cannot be null) * @param style the style of control to construct * * @exception IllegalArgumentException * @exception SWTException * * @see SWT#BORDER * @see SWT#LEFT_TO_RIGHT * @see SWT#RIGHT_TO_LEFT * @see Widget#checkSubclass * @see Widget#getStyle */ public Control (Composite parent, int style) { super (parent, style); this.parent = parent; createWidget (0); } /** * Adds the listener to the collection of listeners who will * be notified when the control is moved or resized, by sending * it one of the messages defined in the ControlListener * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see ControlListener * @see #removeControlListener */ public void addControlListener(ControlListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Resize,typedListener); addListener (SWT.Move,typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when a drag gesture occurs, by sending it * one of the messages defined in the DragDetectListener * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see DragDetectListener * @see #removeDragDetectListener * * @since 3.3 */ public void addDragDetectListener (DragDetectListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.DragDetect,typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when the control gains or loses focus, by sending * it one of the messages defined in the FocusListener * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see FocusListener * @see #removeFocusListener */ public void addFocusListener (FocusListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.FocusIn,typedListener); addListener (SWT.FocusOut,typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when gesture events are generated for the control, * by sending it one of the messages defined in the * GestureListener interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see GestureListener * @see #removeGestureListener * * @since 3.7 */ public void addGestureListener (GestureListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Gesture, typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when help events are generated for the control, * by sending it one of the messages defined in the * HelpListener interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see HelpListener * @see #removeHelpListener */ public void addHelpListener (HelpListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Help, typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when keys are pressed and released on the system keyboard, by sending * it one of the messages defined in the KeyListener * interface. *

* When a key listener is added to a control, the control * will take part in widget traversal. By default, all * traversal keys (such as the tab key and so on) are * delivered to the control. In order for a control to take * part in traversal, it should listen for traversal events. * Otherwise, the user can traverse into a control but not * out. Note that native controls such as table and tree * implement key traversal in the operating system. It is * not necessary to add traversal listeners for these controls, * unless you want to override the default traversal. *

* @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see KeyListener * @see #removeKeyListener */ public void addKeyListener (KeyListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.KeyUp,typedListener); addListener (SWT.KeyDown,typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when the platform-specific context menu trigger * has occurred, by sending it one of the messages defined in * the MenuDetectListener interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see MenuDetectListener * @see #removeMenuDetectListener * * @since 3.3 */ public void addMenuDetectListener (MenuDetectListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.MenuDetect, typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when mouse buttons are pressed and released, by sending * it one of the messages defined in the MouseListener * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see MouseListener * @see #removeMouseListener */ public void addMouseListener (MouseListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.MouseDown,typedListener); addListener (SWT.MouseUp,typedListener); addListener (SWT.MouseDoubleClick,typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when the mouse moves, by sending it one of the * messages defined in the MouseMoveListener * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see MouseMoveListener * @see #removeMouseMoveListener */ public void addMouseMoveListener (MouseMoveListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.MouseMove,typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when the mouse passes or hovers over controls, by sending * it one of the messages defined in the MouseTrackListener * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see MouseTrackListener * @see #removeMouseTrackListener */ public void addMouseTrackListener (MouseTrackListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.MouseEnter,typedListener); addListener (SWT.MouseExit,typedListener); addListener (SWT.MouseHover,typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when the mouse wheel is scrolled, by sending * it one of the messages defined in the * MouseWheelListener interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see MouseWheelListener * @see #removeMouseWheelListener * * @since 3.3 */ public void addMouseWheelListener (MouseWheelListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.MouseWheel, typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when the receiver needs to be painted, by sending it * one of the messages defined in the PaintListener * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see PaintListener * @see #removePaintListener */ public void addPaintListener (PaintListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Paint,typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when touch events occur, by sending it * one of the messages defined in the TouchListener * interface. *

* NOTE: You must also call setTouchEnabled to notify the * windowing toolkit that you want touch events to be generated. *

* * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see TouchListener * @see #removeTouchListener * * @since 3.7 */ public void addTouchListener (TouchListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Touch,typedListener); } /** * Adds the listener to the collection of listeners who will * be notified when traversal events occur, by sending it * one of the messages defined in the TraverseListener * interface. * * @param listener the listener which should be notified * * @exception IllegalArgumentException * @exception SWTException * * @see TraverseListener * @see #removeTraverseListener */ public void addTraverseListener (TraverseListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); TypedListener typedListener = new TypedListener (listener); addListener (SWT.Traverse,typedListener); } /** * Forces the receiver to have the keyboard focus, causing * all keyboard events to be delivered to it. * * @return true if the control got focus, and false if it was unable to. * * @exception SWTException * * @see #setFocus */ public boolean forceFocus () { checkWidget(); /* * Bug in Photon. Photon will stop sending key * events, if a menu is up and focus is given to * a widget by calling PtContainerGiveFocus(). The * fix is to detect when a menu is up and avoid * calling this function. */ Shell shell = getShell (); if (shell.activeMenu != null) return false; shell.bringToTop (false); OS.PtContainerGiveFocus (handle, null); return hasFocus (); } void checkBuffered () { style &= ~SWT.DOUBLE_BUFFERED; } /** * Returns the preferred size of the receiver. *

* The preferred size of a control is the size that it would * best be displayed at. The width hint and height hint arguments * allow the caller to ask a control questions such as "Given a particular * width, how high does the control need to be to show all of the contents?" * To indicate that the caller does not wish to constrain a particular * dimension, the constant SWT.DEFAULT is passed for the hint. *

* * @param wHint the width hint (can be SWT.DEFAULT) * @param hHint the height hint (can be SWT.DEFAULT) * @return the preferred size of the control * * @exception SWTException * * @see Layout * @see #getBorderWidth * @see #getBounds * @see #getSize * @see #pack(boolean) * @see "computeTrim, getClientArea for controls that implement them" */ public Point computeSize (int wHint, int hHint) { return computeSize (wHint, hHint, true); } /** * Returns the preferred size of the receiver. *

* The preferred size of a control is the size that it would * best be displayed at. The width hint and height hint arguments * allow the caller to ask a control questions such as "Given a particular * width, how high does the control need to be to show all of the contents?" * To indicate that the caller does not wish to constrain a particular * dimension, the constant SWT.DEFAULT is passed for the hint. *

* If the changed flag is true, it indicates that the receiver's * contents have changed, therefore any caches that a layout manager * containing the control may have been keeping need to be flushed. When the * control is resized, the changed flag will be false, so layout * manager caches can be retained. *

* * @param wHint the width hint (can be SWT.DEFAULT) * @param hHint the height hint (can be SWT.DEFAULT) * @param changed true if the control's contents have changed, and false otherwise * @return the preferred size of the control. * * @exception SWTException * * @see Layout * @see #getBorderWidth * @see #getBounds * @see #getSize * @see #pack(boolean) * @see "computeTrim, getClientArea for controls that implement them" */ public Point computeSize (int wHint, int hHint, boolean changed) { checkWidget(); int width = DEFAULT_WIDTH; int height = DEFAULT_HEIGHT; if (wHint != SWT.DEFAULT) width = wHint; if (hHint != SWT.DEFAULT) height = hHint; int border = getBorderWidth (); width += border * 2; height += border * 2; return new Point (width, height); } Control computeTabGroup () { if (isTabGroup ()) return this; return parent.computeTabGroup (); } Control computeTabRoot () { Control [] tabList = parent._getTabList (); if (tabList != null) { int index = 0; while (index < tabList.length) { if (tabList [index] == this) break; index++; } if (index == tabList.length) { if (isTabGroup ()) return this; } } return parent.computeTabRoot (); } Control [] computeTabList () { if (isTabGroup ()) { if (getVisible () && getEnabled ()) { return new Control [] {this}; } } return new Control [0]; } void createWidget (int index) { checkOrientation (parent); super.createWidget (index); checkBuffered (); setZOrder (); realizeWidget (); setDefaultFont (); } int defaultBackground () { return display.WIDGET_BACKGROUND; } byte [] defaultFont () { return display.TEXT_FONT; } int defaultForeground () { return display.WIDGET_FOREGROUND; } boolean drawGripper (int x, int y, int width, int height, boolean vertical) { return false; } /** * Detects a drag and drop gesture. This method is used * to detect a drag gesture when called from within a mouse * down listener. * *

By default, a drag is detected when the gesture * occurs anywhere within the client area of a control. * Some controls, such as tables and trees, override this * behavior. In addition to the operating system specific * drag gesture, they require the mouse to be inside an * item. Custom widget writers can use setDragDetect * to disable the default detection, listen for mouse down, * and then call dragDetect() from within the * listener to conditionally detect a drag. *

* * @param event the mouse down event * * @return true if the gesture occurred, and false otherwise. * * @exception IllegalArgumentException * @exception SWTException * * @see DragDetectListener * @see #addDragDetectListener * * @see #getDragDetect * @see #setDragDetect * * @since 3.3 */ public boolean dragDetect (Event event) { checkWidget (); if (event == null) error (SWT.ERROR_NULL_ARGUMENT); return dragDetect (event.button, event.count, event.stateMask, event.x, event.y); } /** * Detects a drag and drop gesture. This method is used * to detect a drag gesture when called from within a mouse * down listener. * *

By default, a drag is detected when the gesture * occurs anywhere within the client area of a control. * Some controls, such as tables and trees, override this * behavior. In addition to the operating system specific * drag gesture, they require the mouse to be inside an * item. Custom widget writers can use setDragDetect * to disable the default detection, listen for mouse down, * and then call dragDetect() from within the * listener to conditionally detect a drag. *

* * @param event the mouse down event * * @return true if the gesture occurred, and false otherwise. * * @exception IllegalArgumentException * @exception SWTException * * @see DragDetectListener * @see #addDragDetectListener * * @see #getDragDetect * @see #setDragDetect * * @since 3.3 */ public boolean dragDetect (MouseEvent event) { checkWidget (); if (event == null) error (SWT.ERROR_NULL_ARGUMENT); return dragDetect (event.button, event.count, event.stateMask, event.x, event.y); } boolean dragDetect (int button, int count, int stateMask, int x, int y) { //TODO - not implemented return false; } int drawProc (int widget, int damage) { if (widget <=0) return OS.Pt_CONTINUE; drawWidget (widget, damage ); if (!hooks(SWT.Paint) && !filters (SWT.Paint)) return OS.Pt_CONTINUE; /* Send the paint event */ PhPoint_t pt = new PhPoint_t (); PhRect_t widRect = new PhRect_t(); OS.PtWidgetExtent(widget, widRect) ; OS.PtWidgetOffset(widget, pt); pt.x += widRect.ul_x; pt.y += widRect.ul_y; damage = OS.PhCopyTiles( damage ); PhTile_t tile = new PhTile_t (); OS.memmove (tile, damage, PhTile_t.sizeof); int transPoint = OS.malloc ( PhPoint_t.sizeof); OS.memmove(transPoint, pt, PhPoint_t.sizeof); OS.PhDeTranslateTiles(damage, transPoint); OS.free(transPoint); OS.memmove (tile, damage, PhTile_t.sizeof); boolean noMerge = (style & SWT.NO_MERGE_PAINTS) != 0 && (state & CANVAS) != 0; if (tile.next != 0 && noMerge) { OS.memmove (tile, tile.next, PhTile_t.sizeof); while (tile.next != 0) { Event event = new Event (); event.width = tile.rect_lr_x - tile.rect_ul_x + 1; event.height = tile.rect_lr_y - tile.rect_ul_y + 1; event.x = tile.rect_ul_x; event.y = tile.rect_ul_y; GC gc = event.gc = new GC (this); gc.setClipping(event.x, event.y, event.width, event.height); sendEvent (SWT.Paint, event); if (isDisposed ()) break; gc.dispose (); event.gc = null; if ( tile.next != 0 ) OS.memmove (tile, tile.next, PhTile_t.sizeof); } } else { int rect1 = OS.malloc (PhRect_t.sizeof); int rect2 = OS.malloc (PhRect_t.sizeof); OS.memmove (rect1, tile, PhRect_t.sizeof); OS.memmove (rect2, widRect, PhRect_t.sizeof); int inter = OS.PhRectIntersect(rect1, rect2); if ( inter == 1 ) { OS.memmove(widRect, rect1, PhRect_t.sizeof); Event event = new Event (); event.x = widRect.ul_x; event.y = widRect.ul_y; event.width = widRect.lr_x - widRect.ul_x + 1; event.height = widRect.lr_y - widRect.ul_y + 1; GC gc = event.gc = new GC (this); gc.setClipping(event.x, event.y, event.width, event.height ); sendEvent (SWT.Paint, event); gc.dispose (); event.gc = null; } OS.free(rect1); OS.free(rect2); } OS.PhFreeTiles( damage ); return OS.Pt_CONTINUE; } void drawWidget (int widget, int damage) { int widgetClass = widgetClass (); if (widgetClass != 0) OS.PtSuperClassDraw (widgetClass, handle, damage); } void enableWidget (boolean enabled) { int topHandle = topHandle (); int flags = enabled ? 0 : OS.Pt_BLOCKED | OS.Pt_GHOST; OS.PtSetResource (topHandle, OS.Pt_ARG_FLAGS, flags, OS.Pt_BLOCKED | OS.Pt_GHOST); } /** * Returns the accessible object for the receiver. *

* If this is the first time this object is requested, * then the object is created and returned. The object * returned by getAccessible() does not need to be disposed. *

* * @return the accessible object * * @exception SWTException * * @see Accessible#addAccessibleListener * @see Accessible#addAccessibleControlListener * * @since 2.0 */ public Accessible getAccessible () { checkWidget (); if (accessible == null) { accessible = Accessible.internal_new_Accessible (this); } return accessible; } /** * Returns the receiver's background color. *

* Note: This operation is a hint and may be overridden by the platform. * For example, on some versions of Windows the background of a TabFolder, * is a gradient rather than a solid color. *

* @return the background color * * @exception SWTException */ public Color getBackground () { checkWidget(); int [] args = {OS.Pt_ARG_FILL_COLOR, 0, 0}; OS.PtGetResources (handle, args.length / 3, args); return Color.photon_new (display, args [1]); } /** * Returns the receiver's background image. * * @return the background image * * @exception SWTException * * @since 3.2 */ public Image getBackgroundImage () { checkWidget (); return backgroundImage; } /** * Returns the font that the receiver will use to paint textual information. * * @return the receiver's font * * @exception SWTException */ public Font getFont () { checkWidget(); if (font != null) return font; int [] args = { OS.Pt_ARG_TEXT_FONT, 0, 0, OS.Pt_ARG_LIST_FONT, 0, 0, OS.Pt_ARG_TITLE_FONT, 0, 0, OS.Pt_ARG_GAUGE_FONT, 0, 0, }; OS.PtGetResources (handle, args.length / 3, args); byte [] font; int ptr = args [1]; if (ptr == 0) ptr = args [4]; if (ptr == 0) ptr = args [7]; if (ptr == 0) ptr = args [11]; if (ptr == 0) { font = defaultFont (); } else { int length = OS.strlen (ptr); font = new byte [length + 1]; OS.memmove (font, ptr, length); } return Font.photon_new (display, font); } /** * Returns the foreground color that the receiver will use to draw. * * @return the receiver's foreground color * * @exception SWTException */ public Color getForeground () { checkWidget(); int [] args = {OS.Pt_ARG_COLOR, 0, 0}; OS.PtGetResources (handle, args.length / 3, args); return Color.photon_new (display, args [1]); } /** * Returns the receiver's border width. * * @return the border width * * @exception SWTException */ public int getBorderWidth () { checkWidget(); int topHandle = topHandle (); int [] args = { OS.Pt_ARG_BASIC_FLAGS, 0, 0, OS.Pt_ARG_FLAGS, 0, 0, // OS.Pt_ARG_BEVEL_WIDTH, 0, 0, }; OS.PtGetResources (topHandle, args.length / 3, args); if ((args [4] & OS.Pt_HIGHLIGHTED) == 0) return 0; int border = 0; int flags = args [1]; if ((flags & OS.Pt_ALL_ETCHES) != 0) border++; if ((flags & OS.Pt_ALL_OUTLINES) != 0) border++; if ((flags & OS.Pt_ALL_INLINES) != 0) border++; // if ((flags & OS.Pt_ALL_BEVELS) != 0) border += args [7]; return border; } /** * Returns a rectangle describing the receiver's size and location * relative to its parent (or its display if its parent is null), * unless the receiver is a shell. In this case, the location is * relative to the display. * * @return the receiver's bounding rectangle * * @exception SWTException */ public Rectangle getBounds () { checkWidget(); int topHandle = topHandle (); PhArea_t area = new PhArea_t (); OS.PtWidgetArea (topHandle, area); return new Rectangle (area.pos_x, area.pos_y, area.size_w, area.size_h); } /** * Returns the receiver's cursor, or null if it has not been set. *

* When the mouse pointer passes over a control its appearance * is changed to match the control's cursor. *

* * @return the receiver's cursor or null * * @exception SWTException * * @since 3.3 */ public Cursor getCursor () { checkWidget (); return cursor; } /** * Returns true if the receiver is detecting * drag gestures, and false otherwise. * * @return the receiver's drag detect state * * @exception SWTException * * @since 3.3 */ public boolean getDragDetect () { checkWidget (); //TODO - not implemented return true; } /** * Returns true if the receiver is enabled, and * false otherwise. A disabled control is typically * not selectable from the user interface and draws with an * inactive or "grayed" look. * * @return the receiver's enabled state * * @exception SWTException * * @see #isEnabled */ public boolean getEnabled () { checkWidget (); return (state & DISABLED) == 0; } /** * Returns layout data which is associated with the receiver. * * @return the receiver's layout data * * @exception SWTException */ public Object getLayoutData () { checkWidget(); return layoutData; } /** * Returns a point describing the receiver's location relative * to its parent (or its display if its parent is null), unless * the receiver is a shell. In this case, the point is * relative to the display. * * @return the receiver's location * * @exception SWTException */ public Point getLocation () { checkWidget(); int topHandle = topHandle (); PhArea_t area = new PhArea_t (); OS.PtWidgetArea (topHandle, area); return new Point (area.pos_x, area.pos_y); } /** * Returns the receiver's pop up menu if it has one, or null * if it does not. All controls may optionally have a pop up * menu that is displayed when the user requests one for * the control. The sequence of key strokes, button presses * and/or button releases that are used to request a pop up * menu is platform specific. * * @return the receiver's menu * * @exception SWTException */ public Menu getMenu () { checkWidget(); return menu; } /** * Returns the receiver's monitor. * * @return the receiver's monitor * * @exception SWTException * * @since 3.0 */ public Monitor getMonitor () { checkWidget(); Monitor [] monitors = display.getMonitors (); if (monitors.length == 1) return monitors [0]; int index = -1, value = -1; Rectangle bounds = getBounds (); if (this != getShell ()) { bounds = display.map (this.parent, null, bounds); } for (int i=0; i 0 && area > value) { index = i; value = area; } } if (index >= 0) return monitors [index]; int centerX = bounds.x + bounds.width / 2, centerY = bounds.y + bounds.height / 2; for (int i=0; i rect.x + rect.width ? centerX - rect.x - rect.width : 0; int y = centerY < rect.y ? rect.y - centerY : centerY > rect.y + rect.height ? centerY - rect.y - rect.height : 0; int distance = x * x + y * y; if (index == -1 || distance < value) { index = i; value = distance; } } return monitors [index]; } /** * Returns the orientation of the receiver, which will be one of the * constants SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT. * * @return the orientation style * * @exception SWTException * * @since 3.7 */ public int getOrientation () { checkWidget (); return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT); } /** * Returns the receiver's parent, which must be a Composite * or null when the receiver is a shell that was created with null or * a display for a parent. * * @return the receiver's parent * * @exception SWTException */ public Composite getParent () { checkWidget(); return parent; } Control [] getPath () { int count = 0; Shell shell = getShell (); Control control = this; while (control != shell) { count++; control = control.parent; } control = this; Control [] result = new Control [count]; while (control != shell) { result [--count] = control; control = control.parent; } return result; } /** * Returns a point describing the receiver's size. The * x coordinate of the result is the width of the receiver. * The y coordinate of the result is the height of the * receiver. * * @return the receiver's size * * @exception SWTException */ public Point getSize () { checkWidget(); int topHandle = topHandle (); PhArea_t area = new PhArea_t (); OS.PtWidgetArea (topHandle, area); return new Point (area.size_w, area.size_h); } /** * Returns the receiver's tool tip text, or null if it has * not been set. * * @return the receiver's tool tip text * * @exception SWTException */ public String getToolTipText () { checkWidget(); return toolTipText; } /** * Returns true if this control is receiving OS-level touch events, * otherwise false *

* Note that this method will return false if the current platform does not support touch-based input. * If this method does return true, gesture events will not be sent to the control. * * @return true if the widget is currently receiving touch events; false otherwise. * * @exception SWTException

* * @since 3.7 */ public boolean getTouchEnabled() { checkWidget(); return false; } /** * Returns the region that defines the shape of the control, * or null if the control has the default shape. * * @return the region that defines the shape of the shell (or null) * * @exception SWTException * * @since 3.4 */ public Region getRegion () { checkWidget (); return region; } /** * Returns the receiver's shell. For all controls other than * shells, this simply returns the control's nearest ancestor * shell. Shells return themselves, even if they are children * of other shells. * * @return the receiver's shell * * @exception SWTException * * @see #getParent */ public Shell getShell () { checkWidget(); return parent.getShell (); } /** * Returns true if the receiver is visible, and * false otherwise. *

* If one of the receiver's ancestors is not visible or some * other condition makes the receiver not visible, this method * may still indicate that it is considered visible even though * it may not actually be showing. *

* * @return the receiver's visibility state * * @exception SWTException */ public boolean getVisible () { checkWidget (); int topHandle = topHandle (); return (OS.PtWidgetFlags (topHandle) & OS.Pt_DELAY_REALIZE) == 0; } boolean hasFocus () { return OS.PtIsFocused (handle) != 0; } void hookEvents () { int windowProc = display.windowProc; int focusHandle = focusHandle (); OS.PtAddFilterCallback (handle, OS.Ph_EV_KEY, windowProc, OS.Ph_EV_KEY); OS.PtAddEventHandler (handle, OS.Ph_EV_BUT_PRESS, windowProc, OS.Ph_EV_BUT_PRESS); OS.PtAddEventHandler (handle, OS.Ph_EV_BUT_RELEASE, windowProc, OS.Ph_EV_BUT_RELEASE); OS.PtAddEventHandler (handle, OS.Ph_EV_PTR_MOTION, windowProc, OS.Ph_EV_PTR_MOTION); OS.PtAddEventHandler (handle, OS.Ph_EV_BOUNDARY, windowProc, OS.Ph_EV_BOUNDARY); if ((state & GRAB) != 0) { OS.PtAddEventHandler (handle, OS.Ph_EV_DRAG, windowProc, OS.Ph_EV_DRAG); OS.PtAddCallback (handle, OS.Pt_CB_OUTBOUND, windowProc, OS.Pt_CB_OUTBOUND); } OS.PtAddCallback (focusHandle, OS.Pt_CB_GOT_FOCUS, windowProc, OS.Pt_CB_GOT_FOCUS); OS.PtAddCallback (focusHandle, OS.Pt_CB_LOST_FOCUS, windowProc, OS.Pt_CB_LOST_FOCUS); } int focusHandle () { return handle; } /** * Invokes platform specific functionality to allocate a new GC handle. *

* IMPORTANT: This method is not part of the public * API for Control. It is marked public only so that it * can be shared within the packages provided by SWT. It is not * available on all platforms, and should never be called from * application code. *

* * @param data the platform specific GC data * @return the platform specific GC handle * * @noreference This method is not intended to be referenced by clients. */ public int internal_new_GC (GCData data) { checkWidget(); int phGC = OS.PgCreateGC(0); // NOTE: PgCreateGC ignores the parameter if (phGC == 0) SWT.error(SWT.ERROR_NO_HANDLES); int mask = SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT; if ((data.style & mask) == 0) { data.style |= style & (mask | SWT.MIRRORED); } int [] args = {OS.Pt_ARG_COLOR, 0, 0, OS.Pt_ARG_FILL_COLOR, 0, 0}; OS.PtGetResources (handle, args.length / 3, args); data.device = display; data.widget = handle; int disjoint = OS.PtFindDisjoint( handle ); if( disjoint != 0 ) OS.PgSetRegion( OS.PtWidgetRid( disjoint ) ); data.topWidget = topHandle (); data.foreground = args [1]; data.background = args [4]; data.font = getFont (); return phGC; } /** * Invokes platform specific functionality to dispose a GC handle. *

* IMPORTANT: This method is not part of the public * API for Control. It is marked public only so that it * can be shared within the packages provided by SWT. It is not * available on all platforms, and should never be called from * application code. *

* * @param hDC the platform specific GC handle * @param data the platform specific GC data * * @noreference This method is not intended to be referenced by clients. */ public void internal_dispose_GC (int phGC, GCData data) { checkWidget (); OS.PgDestroyGC(phGC); } /** * Returns true if the receiver is enabled and all * ancestors up to and including the receiver's nearest ancestor * shell are enabled. Otherwise, false is returned. * A disabled control is typically not selectable from the user * interface and draws with an inactive or "grayed" look. * * @return the receiver's enabled state * * @exception SWTException * * @see #getEnabled */ public boolean isEnabled () { checkWidget(); return getEnabled () && parent.isEnabled (); } /** * Returns true if the receiver has the user-interface * focus, and false otherwise. * * @return the receiver's focus state * * @exception SWTException */ public boolean isFocusControl () { checkWidget(); return hasFocus (); } /** * Returns true if the underlying operating * system supports this reparenting, otherwise false * * @return true if the widget can be reparented, otherwise false * * @exception SWTException */ public boolean isReparentable () { checkWidget(); return false; } boolean isShowing () { /* * This is not complete. Need to check if the * widget is obscurred by a parent or sibling. */ if (!isVisible ()) return false; Control control = this; while (control != null) { Point size = control.getSize (); if (size.x == 0 || size.y == 0) { return false; } control = control.parent; } return true; /* * Check to see if current damage is included. */ // if (!OS.IsWindowVisible (handle)) return false; // int flags = OS.DCX_CACHE | OS.DCX_CLIPCHILDREN | OS.DCX_CLIPSIBLINGS; // int hDC = OS.GetDCEx (handle, 0, flags); // int result = OS.GetClipBox (hDC, new RECT ()); // OS.ReleaseDC (handle, hDC); // return result != OS.NULLREGION; } boolean isTabGroup () { Control [] tabList = parent._getTabList (); if (tabList != null) { for (int i=0; itrue if the receiver is visible and all * ancestors up to and including the receiver's nearest ancestor * shell are visible. Otherwise, false is returned. * * @return the receiver's visibility state * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see #getVisible */ public boolean isVisible () { checkWidget(); return OS.PtWidgetIsRealized (handle); } void markLayout (boolean changed, boolean all) { /* Do nothing */ } Decorations menuShell () { return parent.menuShell (); } /** * Moves the receiver above the specified control in the * drawing order. If the argument is null, then the receiver * is moved to the top of the drawing order. The control at * the top of the drawing order will not be covered by other * controls even if they occupy intersecting areas. * * @param control the sibling control (or null) * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the control has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see Control#moveBelow * @see Composite#getChildren */ public void moveAbove (Control control) { checkWidget(); int topHandle1 = topHandle (); if (control == null) { OS.PtWidgetToFront (topHandle1); OS.PtWindowToFront (topHandle1); return; } if (control.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); if (parent != control.parent) return; int topHandle2 = control.topHandle (); OS.PtWidgetInsert (topHandle1, topHandle2, 0); } /** * Moves the receiver below the specified control in the * drawing order. If the argument is null, then the receiver * is moved to the bottom of the drawing order. The control at * the bottom of the drawing order will be covered by all other * controls which occupy intersecting areas. * * @param control the sibling control (or null) * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the control has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see Control#moveAbove * @see Composite#getChildren */ public void moveBelow (Control control) { checkWidget(); int topHandle1 = topHandle (); if (control == null) { if (parent != null) parent.moveToBack (topHandle1); OS.PtWindowToBack (topHandle1); return; } if (control.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT); if (parent != control.parent) return; int topHandle2 = control.topHandle (); OS.PtWidgetInsert (topHandle1, topHandle2, 1); } /** * Causes the receiver to be resized to its preferred size. * For a composite, this involves computing the preferred size * from its layout, if there is one. * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see #computeSize(int, int, boolean) */ public void pack () { checkWidget(); pack (true); } /** * Causes the receiver to be resized to its preferred size. * For a composite, this involves computing the preferred size * from its layout, if there is one. *

* If the changed flag is true, it indicates that the receiver's * contents have changed, therefore any caches that a layout manager * containing the control may have been keeping need to be flushed. When the * control is resized, the changed flag will be false, so layout * manager caches can be retained. *

* * @param changed whether or not the receiver's contents have changed * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see #computeSize(int, int, boolean) */ public void pack (boolean changed) { checkWidget(); setSize (computeSize (SWT.DEFAULT, SWT.DEFAULT, changed)); } /** * Prints the receiver and all children. * * @param gc the gc where the drawing occurs * @return true if the operation was successful and false otherwise * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the gc is null
  • *
  • ERROR_INVALID_ARGUMENT - if the gc has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @since 3.4 */ public boolean print (GC gc) { checkWidget (); if (gc == null) error (SWT.ERROR_NULL_ARGUMENT); if (gc.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); return false; } int Ph_EV_BOUNDARY (int widget, int info) { if (info == 0) return OS.Pt_END; PtCallbackInfo_t cbinfo = new PtCallbackInfo_t (); OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof); if (cbinfo.event == 0) return OS.Pt_END; PhEvent_t ev = new PhEvent_t (); OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof); int data = OS.PhGetData (cbinfo.event); if (data == 0) return OS.Pt_END; PhPointerEvent_t pe = new PhPointerEvent_t (); OS.memmove (pe, data, PhPointerEvent_t.sizeof); switch ((int) ev.subtype) { case OS.Ph_EV_PTR_ENTER: case OS.Ph_EV_PTR_ENTER_FROM_CHILD:{ Event event = new Event (); event.time = ev.timestamp; setMouseState (event, SWT.MouseEnter, pe, ev); sendEvent (SWT.MouseEnter, event); break; } case OS.Ph_EV_PTR_LEAVE: case OS.Ph_EV_PTR_LEAVE_TO_CHILD: { Event event = new Event (); event.time = ev.timestamp; setMouseState (event, SWT.MouseExit, pe, ev); sendEvent (SWT.MouseExit, event); break; } case OS.Ph_EV_PTR_STEADY: { Event event = new Event (); event.time = ev.timestamp; setMouseState (event, SWT.MouseHover, pe, ev); postEvent (SWT.MouseHover, event); destroyToolTip (toolTipHandle); toolTipHandle = createToolTip (toolTipText, handle, getFont ().handle); break; } case OS.Ph_EV_PTR_UNSTEADY: destroyToolTip (toolTipHandle); toolTipHandle = 0; break; } return OS.Pt_END; } int Ph_EV_BUT_PRESS (int widget, int info) { if (info == 0) return OS.Pt_END; PtCallbackInfo_t cbinfo = new PtCallbackInfo_t (); OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof); if (cbinfo.event == 0) return OS.Pt_END; PhEvent_t ev = new PhEvent_t (); OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof); if ((ev.processing_flags & OS.Ph_FAKE_EVENT) != 0) { return OS.Pt_CONTINUE; } ev.processing_flags |= OS.Ph_CONSUMED; OS.memmove (cbinfo.event, ev, PhEvent_t.sizeof); int data = OS.PhGetData (cbinfo.event); if (data == 0) return OS.Pt_END; PhPointerEvent_t pe = new PhPointerEvent_t (); OS.memmove (pe, data, PhPointerEvent_t.sizeof); Event event = new Event (); event.count = pe.click_count; event.time = ev.timestamp; setMouseState (event, SWT.MouseDown, pe, ev); postEvent (SWT.MouseDown, event); if (pe.click_count == 2) { Event clickEvent = new Event (); clickEvent.count = pe.click_count; clickEvent.time = ev.timestamp; setMouseState (clickEvent, SWT.MouseDoubleClick, pe, ev); postEvent (SWT.MouseDoubleClick, clickEvent); } if (event.button == 3) { Event menuEvent = new Event (); menuEvent.x = pe.pos_x; menuEvent.y = pe.pos_y; sendEvent (SWT.MenuDetect, menuEvent); if (menuEvent.doit) { if (menu != null && !menu.isDisposed ()) { if (menuEvent.x != event.x || menuEvent.y != event.y) { menu.setLocation (menuEvent.x, menuEvent.y); } menu.setVisible (true); } } } display.dragStartX = pe.pos_x + ev.translation_x; display.dragStartY = pe.pos_y + ev.translation_y; /* * It is possible that the shell may be * disposed at this point. If this happens * don't send the activate and deactivate * events. */ Shell shell = getShell (); if (!shell.isDisposed ()) { shell.setActiveControl (this); } return OS.Pt_CONTINUE; } int Ph_EV_BUT_RELEASE (int widget, int info) { if (info == 0) return OS.Pt_END; PtCallbackInfo_t cbinfo = new PtCallbackInfo_t (); OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof); if (cbinfo.event == 0) return OS.Pt_END; PhEvent_t ev = new PhEvent_t (); OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof); if ((ev.processing_flags & OS.Ph_FAKE_EVENT) != 0) { return OS.Pt_CONTINUE; } ev.processing_flags |= OS.Ph_CONSUMED; OS.memmove (cbinfo.event, ev, PhEvent_t.sizeof); if (ev.subtype != OS.Ph_EV_RELEASE_PHANTOM) { return OS.Pt_CONTINUE; } int data = OS.PhGetData (cbinfo.event); if (data == 0) return OS.Pt_END; PhPointerEvent_t pe = new PhPointerEvent_t (); OS.memmove (pe, data, PhPointerEvent_t.sizeof); Event event = new Event (); event.count = pe.click_count; event.time = ev.timestamp; setMouseState (event, SWT.MouseUp, pe, ev); postEvent (SWT.MouseUp, event); return OS.Pt_CONTINUE; } int Ph_EV_DRAG (int widget, int info) { if (info == 0) return OS.Pt_END; PtCallbackInfo_t cbinfo = new PtCallbackInfo_t (); OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof); if (cbinfo.event == 0) return OS.Pt_END; PhEvent_t ev = new PhEvent_t (); OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof); if ((ev.processing_flags & OS.Ph_FAKE_EVENT) != 0) { return OS.Pt_CONTINUE; } if (ev.subtype != OS.Ph_EV_DRAG_MOTION_EVENT) { return OS.Pt_CONTINUE; } int data = OS.PhGetData (cbinfo.event); if (data == 0) return OS.Pt_END; PhPointerEvent_t pe = new PhPointerEvent_t (); OS.memmove (pe, data, PhPointerEvent_t.sizeof); Event event = new Event (); event.time = ev.timestamp; setMouseState (event, SWT.MouseMove, pe, ev); postEvent (SWT.MouseMove, event); return OS.Pt_CONTINUE; } int Ph_EV_KEY (int widget, int info) { if (!hasFocus ()) return OS.Pt_PROCESS; if (info == 0) return OS.Pt_PROCESS; PtCallbackInfo_t cbinfo = new PtCallbackInfo_t (); OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof); if (cbinfo.event == 0) return OS.Pt_PROCESS; PhEvent_t ev = new PhEvent_t (); OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof); if ((ev.processing_flags & OS.Ph_FAKE_EVENT) != 0) { return OS.Pt_PROCESS; } int data = OS.PhGetData (cbinfo.event); if (data == 0) return OS.Pt_PROCESS; PhKeyEvent_t ke = new PhKeyEvent_t (); OS.memmove (ke, data, PhKeyEvent_t.sizeof); /* * Feature in Photon. When the user presses certain keys * (such as the arrow keys), Photon sends 2 event for one * key press. The first event has only the scan code while * the second has the keysym and other information. This * also happens for key release. The fix is to ignore the * first event. */ if (ke.key_flags == OS.Pk_KF_Scan_Valid) { return OS.Pt_PROCESS; } /* Ignore repeating modifier keys */ if ((ke.key_flags & OS.Pk_KF_Key_Repeat) != 0) { if ((ke.key_flags & OS.Pk_KF_Sym_Valid) != 0) { switch (ke.key_sym) { case OS.Pk_Alt_L: case OS.Pk_Alt_R: case OS.Pk_Control_L: case OS.Pk_Control_R: case OS.Pk_Shift_L: case OS.Pk_Shift_R: return OS.Pt_PROCESS; } } } /* Determine event type */ int type = SWT.KeyUp; if ((ke.key_flags & (OS.Pk_KF_Key_Down | OS.Pk_KF_Key_Repeat)) != 0) { type = SWT.KeyDown; } /* Determine if this is a traverse event */ if (type == SWT.KeyDown) { /* * Fetuare in Photon. The key_sym value is not valid when Ctrl * or Alt is pressed. The fix is to detect this case and try to * use the key_cap value. */ int key = ke.key_sym; if ((ke.key_flags & OS.Pk_KF_Sym_Valid) == 0) { key = 0; if ((ke.key_flags & OS.Pk_KF_Cap_Valid) != 0) { if (ke.key_cap == OS.Pk_Tab && (ke.key_mods & OS.Pk_KM_Ctrl) != 0) { key = OS.Pk_Tab; } } } switch (key) { case OS.Pk_Escape: case OS.Pk_Return: case OS.Pk_KP_Tab: case OS.Pk_Tab: case OS.Pk_Up: case OS.Pk_Down: case OS.Pk_Left: case OS.Pk_Right: case OS.Pk_Pg_Up: case OS.Pk_Pg_Down: { if (key != OS.Pk_Return) { ev.processing_flags |= OS.Ph_NOT_CUAKEY; OS.memmove (cbinfo.event, ev, PhEvent_t.sizeof); } if (translateTraversal (key, ke)) { ev.processing_flags |= OS.Ph_CONSUMED; OS.memmove (cbinfo.event, ev, PhEvent_t.sizeof); return OS.Pt_PROCESS; } // widget could be disposed at this point if (isDisposed ()) return OS.Pt_CONSUME; } } } Event event = new Event (); event.time = ev.timestamp; if (!setKeyState (event, type, ke)) return OS.Pt_PROCESS; if (type == SWT.KeyDown) { display.lastKey = event.keyCode; display.lastAscii = event.character; } else { if (event.keyCode == 0) event.keyCode = display.lastKey; if (event.character == 0) event.character = (char) display.lastAscii; } sendEvent (type, event); // widget could be disposed at this point if (isDisposed ()) return OS.Pt_CONSUME; return event.doit ? OS.Pt_PROCESS :OS.Pt_CONSUME; } int Ph_EV_PTR_MOTION (int widget, int info) { if (info == 0) return OS.Pt_END; PtCallbackInfo_t cbinfo = new PtCallbackInfo_t (); OS.memmove (cbinfo, info, PtCallbackInfo_t.sizeof); if (cbinfo.event == 0) return OS.Pt_END; PhEvent_t ev = new PhEvent_t (); OS.memmove (ev, cbinfo.event, PhEvent_t.sizeof); if ((ev.processing_flags & OS.Ph_FAKE_EVENT) != 0) { return OS.Pt_CONTINUE; } ev.processing_flags |= OS.Ph_CONSUMED; OS.memmove (cbinfo.event, ev, PhEvent_t.sizeof); if (ev.type == OS.Ph_EV_PTR_MOTION_BUTTON) { if ((state & CANVAS) != 0) return OS.Pt_CONTINUE; } int data = OS.PhGetData (cbinfo.event); if (data == 0) return OS.Pt_END; PhPointerEvent_t pe = new PhPointerEvent_t (); OS.memmove (pe, data, PhPointerEvent_t.sizeof); Event event = new Event (); event.time = ev.timestamp; setMouseState (event, SWT.MouseMove, pe, ev); postEvent (SWT.MouseMove, event); return OS.Pt_CONTINUE; } int Pt_CB_GOT_FOCUS (int widget, int info) { Shell shell = getShell (); sendEvent (SWT.FocusIn); if (isDisposed ()) return OS.Pt_CONTINUE; /* * It is possible that the shell may be * disposed at this point. If this happens * don't send the activate and deactivate * events. */ if (!shell.isDisposed ()) { shell.setActiveControl (this); } /* * Feature in Photon. Cannot return Pt_END * or the text widget will not take focus. */ return OS.Pt_CONTINUE; } int Pt_CB_LOST_FOCUS (int widget, int info) { Shell shell = getShell (); sendEvent (SWT.FocusOut); if (isDisposed ()) return OS.Pt_CONTINUE; /* * It is possible that the shell may be * disposed at this point. If this happens * don't send the activate and deactivate * events. */ if (!shell.isDisposed ()) { Display display = shell.display; Control control = display.getFocusControl (); if (control == null || shell != control.getShell () ) { shell.setActiveControl (null); } } /* * Feature in Photon. Cannot return Pt_END * or the text widget will not take focus. */ return OS.Pt_CONTINUE; } void realizeWidget() { int parentHandle = parent.handle; if (OS.PtWidgetIsRealized (parentHandle)) { OS.PtRealizeWidget (topHandle ()); } } void releaseHandle () { super.releaseHandle (); parent = null; } void releaseParent () { super.releaseParent (); parent.removeControl (this); } void releaseWidget () { super.releaseWidget (); if (toolTipHandle != 0) destroyToolTip (toolTipHandle); toolTipHandle = 0; if (menu != null && !menu.isDisposed ()) { menu.dispose (); } menu = null; cursor = null; layoutData = null; region = null; } /** * Causes the entire bounds of the receiver to be marked * as needing to be redrawn. The next time a paint request * is processed, the control will be completely painted, * including the background. * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see #update() * @see PaintListener * @see SWT#Paint * @see SWT#NO_BACKGROUND * @see SWT#NO_REDRAW_RESIZE * @see SWT#NO_MERGE_PAINTS * @see SWT#DOUBLE_BUFFERED */ public void redraw () { checkWidget(); OS.PtDamageWidget (handle); } /** * Causes the rectangular area of the receiver specified by * the arguments to be marked as needing to be redrawn. * The next time a paint request is processed, that area of * the receiver will be painted, including the background. * If the all flag is true, any * children of the receiver which intersect with the specified * area will also paint their intersecting areas. If the * all flag is false, the children * will not be painted. * * @param x the x coordinate of the area to draw * @param y the y coordinate of the area to draw * @param width the width of the area to draw * @param height the height of the area to draw * @param all true if children should redraw, and false otherwise * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see #update() * @see PaintListener * @see SWT#Paint * @see SWT#NO_BACKGROUND * @see SWT#NO_REDRAW_RESIZE * @see SWT#NO_MERGE_PAINTS * @see SWT#DOUBLE_BUFFERED */ public void redraw (int x, int y, int width, int height, boolean allChildren) { checkWidget (); if (width <= 0 || height <= 0) return; PhRect_t rect = new PhRect_t (); rect.ul_x = (short) x; rect.ul_y = (short) y; rect.lr_x = (short) (x + width - 1); rect.lr_y = (short) (y + height - 1); OS.PtDamageExtent (handle, rect); } /** * Removes the listener from the collection of listeners who will * be notified when the control is moved or resized. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see ControlListener * @see #addControlListener */ public void removeControlListener (ControlListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.Move, listener); eventTable.unhook (SWT.Resize, listener); } /** * Removes the listener from the collection of listeners who will * be notified when a drag gesture occurs. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see DragDetectListener * @see #addDragDetectListener * * @since 3.3 */ public void removeDragDetectListener(DragDetectListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.DragDetect, listener); } /** * Removes the listener from the collection of listeners who will * be notified when the control gains or loses focus. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see FocusListener * @see #addFocusListener */ public void removeFocusListener(FocusListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.FocusIn, listener); eventTable.unhook (SWT.FocusOut, listener); } /** * Removes the listener from the collection of listeners who will * be notified when gesture events are generated for the control. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see GestureListener * @see #addGestureListener * * @since 3.7 */ public void removeGestureListener (GestureListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook(SWT.Gesture, listener); } /** * Removes the listener from the collection of listeners who will * be notified when the help events are generated for the control. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see HelpListener * @see #addHelpListener */ public void removeHelpListener (HelpListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.Help, listener); } /** * Removes the listener from the collection of listeners who will * be notified when keys are pressed and released on the system keyboard. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see KeyListener * @see #addKeyListener */ public void removeKeyListener(KeyListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.KeyUp, listener); eventTable.unhook (SWT.KeyDown, listener); } /** * Removes the listener from the collection of listeners who will * be notified when the platform-specific context menu trigger has * occurred. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see MenuDetectListener * @see #addMenuDetectListener * * @since 3.3 */ public void removeMenuDetectListener (MenuDetectListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.MenuDetect, listener); } /** * Removes the listener from the collection of listeners who will * be notified when mouse buttons are pressed and released. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see MouseListener * @see #addMouseListener */ public void removeMouseListener (MouseListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.MouseDown, listener); eventTable.unhook (SWT.MouseUp, listener); eventTable.unhook (SWT.MouseDoubleClick, listener); } /** * Removes the listener from the collection of listeners who will * be notified when the mouse moves. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see MouseMoveListener * @see #addMouseMoveListener */ public void removeMouseMoveListener(MouseMoveListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.MouseMove, listener); } /** * Removes the listener from the collection of listeners who will * be notified when the mouse passes or hovers over controls. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see MouseTrackListener * @see #addMouseTrackListener */ public void removeMouseTrackListener(MouseTrackListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.MouseEnter, listener); eventTable.unhook (SWT.MouseExit, listener); eventTable.unhook (SWT.MouseHover, listener); } /** * Removes the listener from the collection of listeners who will * be notified when the mouse wheel is scrolled. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see MouseWheelListener * @see #addMouseWheelListener * * @since 3.3 */ public void removeMouseWheelListener (MouseWheelListener listener) { checkWidget (); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.MouseWheel, listener); } /** * Removes the listener from the collection of listeners who will * be notified when the receiver needs to be painted. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see PaintListener * @see #addPaintListener */ public void removePaintListener(PaintListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook(SWT.Paint, listener); } /** * Removes the listener from the collection of listeners who will * be notified when touch events occur. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see TouchListener * @see #addTouchListener * * @since 3.7 */ public void removeTouchListener(TouchListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.Touch, listener); } /** * Removes the listener from the collection of listeners who will * be notified when traversal events occur. * * @param listener the listener which should no longer be notified * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the listener is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see TraverseListener * @see #addTraverseListener */ public void removeTraverseListener(TraverseListener listener) { checkWidget(); if (listener == null) error (SWT.ERROR_NULL_ARGUMENT); if (eventTable == null) return; eventTable.unhook (SWT.Traverse, listener); } int setBounds (int x, int y, int width, int height, boolean move, boolean resize, boolean events) { int topHandle = topHandle (); PhArea_t area = new PhArea_t (); OS.PtWidgetArea (topHandle, area); width = Math.max (width, 0); height = Math.max (height, 0); boolean sameOrigin = x == area.pos_x && y == area.pos_y; boolean sameExtent = width == area.size_w && height == area.size_h; if (move && resize) { if (sameOrigin && sameExtent) return 0; area.pos_x = (short) x; area.pos_y = (short) y; area.size_w = (short) width; area.size_h = (short) height; int ptr = OS.malloc (PhArea_t.sizeof); OS.memmove (ptr, area, PhArea_t.sizeof); OS.PtSetResource (topHandle, OS.Pt_ARG_AREA, ptr, 0); OS.free (ptr); } else { if (move) { if (sameOrigin) return 0; PhPoint_t pt = new PhPoint_t (); pt.x = (short) x; pt.y = (short) y; int ptr = OS.malloc (PhPoint_t.sizeof); OS.memmove (ptr, pt, PhPoint_t.sizeof); OS.PtSetResource (topHandle, OS.Pt_ARG_POS, ptr, 0); OS.free (ptr); } else if (resize) { if (sameExtent) return 0; int [] args = { OS.Pt_ARG_WIDTH, width, 0, OS.Pt_ARG_HEIGHT, height, 0, }; OS.PtSetResources (topHandle, args.length / 3, args); } } if (!OS.PtWidgetIsRealized (topHandle)) { OS.PtExtentWidgetFamily (topHandle); } int result = 0; if (move && !sameOrigin) { sendEvent (SWT.Move); result |= MOVED; } if (resize && !sameExtent) { sendEvent (SWT.Resize); result |= RESIZED; } return result; } /** * Sets the receiver's size and location to the rectangular * area specified by the arguments. The x and * y arguments are relative to the receiver's * parent (or its display if its parent is null), unless * the receiver is a shell. In this case, the x * and y arguments are relative to the display. *

* Note: Attempting to set the width or height of the * receiver to a negative number will cause that * value to be set to zero instead. *

* * @param x the new x coordinate for the receiver * @param y the new y coordinate for the receiver * @param width the new width for the receiver * @param height the new height for the receiver * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setBounds (int x, int y, int width, int height) { checkWidget(); setBounds (x, y, width, height, true, true, true); } /** * Sets the receiver's size and location to the rectangular * area specified by the argument. The x and * y fields of the rectangle are relative to * the receiver's parent (or its display if its parent is null). *

* Note: Attempting to set the width or height of the * receiver to a negative number will cause that * value to be set to zero instead. *

* * @param rect the new bounds for the receiver * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setBounds (Rectangle rect) { if (rect == null) error (SWT.ERROR_NULL_ARGUMENT); setBounds (rect.x, rect.y, rect.width, rect.height); } /** * If the argument is true, causes the receiver to have * all mouse events delivered to it until the method is called with * false as the argument. Note that on some platforms, * a mouse button must currently be down for capture to be assigned. * * @param capture true to capture the mouse, and false to release it * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setCapture (boolean capture) { checkWidget(); } /** * Sets the receiver's cursor to the cursor specified by the * argument, or to the default cursor for that kind of control * if the argument is null. *

* When the mouse pointer passes over a control its appearance * is changed to match the control's cursor. *

* * @param cursor the new cursor (or null) * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setCursor (Cursor cursor) { checkWidget(); int type = OS.Ph_CURSOR_INHERIT; int bitmap = 0; if (cursor != null) { if (cursor.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); type = cursor.type; bitmap = cursor.bitmap; } this.cursor = cursor; int [] args = new int []{ OS.Pt_ARG_CURSOR_TYPE, type, 0, OS.Pt_ARG_BITMAP_CURSOR, bitmap, 0, }; OS.PtSetResources (handle, args.length / 3, args); /* * Bug in Photon. For some reason, the widget cursor will * not change, when the new cursor is a bitmap cursor, if * the flag Ph_CURSOR_NO_INHERIT is reset. The fix is to reset * this flag after changing the cursor type to Ph_CURSOR_BITMAP. */ if (type == OS.Ph_CURSOR_BITMAP) { type &= ~OS.Ph_CURSOR_NO_INHERIT; OS.PtSetResource (handle, OS.Pt_ARG_CURSOR_TYPE, type, 0); } } /** * Sets the receiver's drag detect state. If the argument is * true, the receiver will detect drag gestures, * otherwise these gestures will be ignored. * * @param dragDetect the new drag detect state * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @since 3.3 */ public void setDragDetect (boolean dragDetect) { checkWidget (); //TODO - not implemented } /** * Enables the receiver if the argument is true, * and disables it otherwise. A disabled control is typically * not selectable from the user interface and draws with an * inactive or "grayed" look. * * @param enabled the new enabled state * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setEnabled (boolean enabled) { checkWidget (); if (enabled) { if ((state & DISABLED) == 0) return; state &= ~DISABLED; } else { if ((state & DISABLED) != 0) return; state |= DISABLED; } enableWidget (enabled); } /** * Causes the receiver to have the keyboard focus, * such that all keyboard events will be delivered to it. Focus * reassignment will respect applicable platform constraints. * * @return true if the control got focus, and false if it was unable to. * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see #forceFocus */ public boolean setFocus () { checkWidget(); if ((style & SWT.NO_FOCUS) != 0) return false; return forceFocus (); } /** * Sets the receiver's background color to the color specified * by the argument, or to the default system color for the control * if the argument is null. *

* Note: This operation is a hint and may be overridden by the platform. * For example, on Windows the background of a Button cannot be changed. *

* @param color the new color (or null) * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setBackground (Color color) { checkWidget(); int pixel; if (color == null) { pixel = defaultBackground (); } else { if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); pixel = color.handle; } setBackgroundPixel (pixel); } /** * Sets the receiver's background image to the image specified * by the argument, or to the default system color for the control * if the argument is null. The background image is tiled to fill * the available space. *

* Note: This operation is a hint and may be overridden by the platform. * For example, on Windows the background of a Button cannot be changed. *

* @param image the new image (or null) * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
  • *
  • ERROR_INVALID_ARGUMENT - if the argument is not a bitmap
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @since 3.2 */ public void setBackgroundImage (Image image) { checkWidget (); if (image != null) { if (image.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT); if (image.type != SWT.BITMAP) error (SWT.ERROR_INVALID_ARGUMENT); } if (backgroundImage == image) return; backgroundImage = image; } void setBackgroundPixel (int pixel) { OS.PtSetResource (handle, OS.Pt_ARG_FILL_COLOR, pixel, 0); } void setDefaultFont () { if (display.defaultFont != null) setFont (defaultFont ()); } /** * Sets the font that the receiver will use to paint textual information * to the font specified by the argument, or to the default font for that * kind of control if the argument is null. * * @param font the new font (or null) * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setFont (Font font) { checkWidget(); byte[] buffer; if (font != null) { if (font.isDisposed ()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); buffer = font.handle; } else { buffer = defaultFont (); } this.font = font; setFont (buffer); } void setFont (byte [] font) { int ptr = OS.malloc (font.length); OS.memmove (ptr, font, font.length); setFont (ptr); OS.free (ptr); } void setFont (int font) { int [] args = { OS.Pt_ARG_TEXT_FONT, font, 0, OS.Pt_ARG_LIST_FONT, font, 0, OS.Pt_ARG_TITLE_FONT, font, 0, OS.Pt_ARG_GAUGE_FONT, font, 0, }; OS.PtSetResources (handle, args.length / 3, args); } /** * Sets the receiver's foreground color to the color specified * by the argument, or to the default system color for the control * if the argument is null. *

* Note: This operation is a hint and may be overridden by the platform. *

* @param color the new color (or null) * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setForeground (Color color) { checkWidget(); int pixel; if (color == null) { pixel = defaultForeground (); } else { if (color.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); pixel = color.handle; } setForegroundPixel (pixel); } void setForegroundPixel (int pixel) { OS.PtSetResource (handle, OS.Pt_ARG_COLOR, pixel, 0); } /** * Sets the layout data associated with the receiver to the argument. * * @param layoutData the new layout data for the receiver. * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setLayoutData (Object layoutData) { checkWidget(); this.layoutData = layoutData; } /** * Sets the receiver's location to the point specified by * the arguments which are relative to the receiver's * parent (or its display if its parent is null), unless * the receiver is a shell. In this case, the point is * relative to the display. * * @param x the new x coordinate for the receiver * @param y the new y coordinate for the receiver * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setLocation (int x, int y) { checkWidget(); setBounds (x, y, 0, 0, true, false, true); } /** * Sets the receiver's location to the point specified by * the arguments which are relative to the receiver's * parent (or its display if its parent is null), unless * the receiver is a shell. In this case, the point is * relative to the display. * * @param location the new location for the receiver * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setLocation (Point location) { checkWidget(); if (location == null) error (SWT.ERROR_NULL_ARGUMENT); setLocation (location.x, location.y); } /** * Sets the receiver's pop up menu to the argument. * All controls may optionally have a pop up * menu that is displayed when the user requests one for * the control. The sequence of key strokes, button presses * and/or button releases that are used to request a pop up * menu is platform specific. *

* Note: Disposing of a control that has a pop up menu will * dispose of the menu. To avoid this behavior, set the * menu to null before the control is disposed. *

* * @param menu the new pop up menu * * @exception IllegalArgumentException
    *
  • ERROR_MENU_NOT_POP_UP - the menu is not a pop up menu
  • *
  • ERROR_INVALID_PARENT - if the menu is not in the same widget tree
  • *
  • ERROR_INVALID_ARGUMENT - if the menu has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setMenu (Menu menu) { checkWidget(); int flags = 0; if (menu != null) { if (menu.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); flags = OS.Pt_MENUABLE; } OS.PtSetResource (handle, OS.Pt_ARG_FLAGS, flags, OS.Pt_ALL_BUTTONS | OS.Pt_MENUABLE); this.menu = menu; } /** * Sets the orientation of the receiver, which must be one * of the constants SWT.LEFT_TO_RIGHT or SWT.RIGHT_TO_LEFT. *

* * @param orientation new orientation style * * @exception SWTException

    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @since 3.7 */ public void setOrientation (int orientation) { checkWidget (); } /** * Changes the parent of the widget to be the one provided if * the underlying operating system supports this feature. * Returns true if the parent is successfully changed. * * @param parent the new parent for the control. * @return true if the parent is changed and false otherwise. * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the argument has been disposed
  • *
  • ERROR_NULL_ARGUMENT - if the parent is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public boolean setParent (Composite parent) { checkWidget(); if (parent.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT); reskin (SWT.ALL); return false; } /** * Sets the receiver's size to the point specified by the argument. *

* Note: Attempting to set the width or height of the * receiver to a negative number will cause them to be * set to zero instead. *

* * @param size the new size for the receiver * * @exception IllegalArgumentException
    *
  • ERROR_NULL_ARGUMENT - if the point is null
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setSize (Point size) { checkWidget(); if (size == null) error (SWT.ERROR_NULL_ARGUMENT); setSize (size.x, size.y); } boolean setTabGroupFocus () { return setTabItemFocus (); } boolean setTabItemFocus () { if (!isShowing ()) return false; return forceFocus (); } boolean setRadioSelection (boolean value) { return false; } /** * If the argument is false, causes subsequent drawing * operations in the receiver to be ignored. No drawing of any kind * can occur in the receiver until the flag is set to true. * Graphics operations that occurred while the flag was * false are lost. When the flag is set to true, * the entire widget is marked as needing to be redrawn. Nested calls * to this method are stacked. *

* Note: This operation is a hint and may not be supported on some * platforms or for some widgets. *

* * @param redraw the new redraw state * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @see #redraw(int, int, int, int, boolean) * @see #update() */ public void setRedraw (boolean redraw) { checkWidget(); if (redraw) { OS.PtContainerRelease (handle); } else { OS.PtContainerHold (handle); } } /** * Sets the shape of the control to the region specified * by the argument. When the argument is null, the * default shape of the control is restored. * * @param region the region that defines the shape of the control (or null) * * @exception IllegalArgumentException
    *
  • ERROR_INVALID_ARGUMENT - if the region has been disposed
  • *
* @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
* * @since 3.4 */ public void setRegion (Region region) { checkWidget (); if (region != null && region.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT); // TODO implement setRegion this.region = region; } /** * Sets the receiver's size to the point specified by the arguments. *

* Note: Attempting to set the width or height of the * receiver to a negative number will cause that * value to be set to zero instead. *

* * @param width the new width for the receiver * @param height the new height for the receiver * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • *
*/ public void setSize (int width, int height) { checkWidget(); setBounds (0, 0, width, height, false, true, true); } /** * Sets whether the receiver should accept touch events. By default, a Control does not accept touch * events. No error or exception is thrown if the underlying hardware does not support touch input. * * @param enabled the new touch-enabled state * * @exception SWTException
    *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • * * @since 3.7 */ public void setTouchEnabled(boolean enabled) { checkWidget(); } /** * Marks the receiver as visible if the argument is true, * and marks it invisible otherwise. *

    * If one of the receiver's ancestors is not visible or some * other condition makes the receiver not visible, marking * it visible may not actually cause it to be displayed. *

    * * @param visible the new visibility state * * @exception SWTException
      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    */ public void setVisible (boolean visible) { checkWidget (); int topHandle = topHandle (); int oldFlags = OS.PtWidgetFlags (topHandle); int flags = visible ? 0 : OS.Pt_DELAY_REALIZE; OS.PtSetResource (topHandle, OS.Pt_ARG_FLAGS, flags, OS.Pt_DELAY_REALIZE); if ((oldFlags & OS.Pt_DELAY_REALIZE) == flags) return; if (visible) { sendEvent (SWT.Show); if (isDisposed ()) return; OS.PtRealizeWidget (topHandle); } else { OS.PtUnrealizeWidget (topHandle); /* * It is possible (but unlikely), that application * code could have disposed the widget in the FocusOut * event that is triggered by PtUnrealizeWidget if the widget * being hidden has focus. If this happens, just return. */ if (isDisposed ()) return; sendEvent(SWT.Hide); } } /** * Sets the receiver's tool tip text to the argument, which * may be null indicating that the default tool tip for the * control will be shown. For a control that has a default * tool tip, such as the Tree control on Windows, setting * the tool tip text to an empty string replaces the default, * causing no tool tip text to be shown. *

    * The mnemonic indicator (character '&') is not displayed in a tool tip. * To display a single '&' in the tool tip, the character '&' can be * escaped by doubling it in the string. *

    * * @param string the new tool tip text (or null) * * @exception SWTException
      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    */ public void setToolTipText (String string) { checkWidget(); toolTipText = string; } void setZOrder() { if (parent != null) parent.moveToBack (topHandle ()); } void sort (int [] items) { /* Shell Sort from K&R, pg 108 */ int length = items.length; for (int gap=length/2; gap>0; gap/=2) { for (int i=gap; i=0; j-=gap) { if (items [j] <= items [j + gap]) { int swap = items [j]; items [j] = items [j + gap]; items [j + gap] = swap; } } } } } /** * Returns a point which is the result of converting the * argument, which is specified in display relative coordinates, * to coordinates relative to the receiver. *

    * @param x the x coordinate to be translated * @param y the y coordinate to be translated * @return the translated coordinates * * @exception SWTException

      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    * * @since 2.1 */ public Point toControl (int x, int y) { checkWidget(); short [] position_x = new short [1], position_y = new short [1]; OS.PtGetAbsPosition (handle, position_x, position_y); return new Point (x - position_x [0], y - position_y [0]); } /** * Returns a point which is the result of converting the * argument, which is specified in display relative coordinates, * to coordinates relative to the receiver. *

    * @param point the point to be translated (must not be null) * @return the translated coordinates * * @exception IllegalArgumentException

      *
    • ERROR_NULL_ARGUMENT - if the point is null
    • *
    * @exception SWTException
      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    */ public Point toControl (Point point) { checkWidget(); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); return toControl (point.x, point.y); } /** * Returns a point which is the result of converting the * argument, which is specified in coordinates relative to * the receiver, to display relative coordinates. *

    * @param x the x coordinate to be translated * @param y the y coordinate to be translated * @return the translated coordinates * * @exception SWTException

      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    * * @since 2.1 */ public Point toDisplay (int x, int y) { checkWidget(); short [] position_x = new short [1], position_y = new short [1]; OS.PtGetAbsPosition (handle, position_x, position_y); return new Point (x + position_x [0], y + position_y [0]); } /** * Returns a point which is the result of converting the * argument, which is specified in coordinates relative to * the receiver, to display relative coordinates. *

    * @param point the point to be translated (must not be null) * @return the translated coordinates * * @exception IllegalArgumentException

      *
    • ERROR_NULL_ARGUMENT - if the point is null
    • *
    * @exception SWTException
      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    */ public Point toDisplay (Point point) { checkWidget(); if (point == null) error (SWT.ERROR_NULL_ARGUMENT); return toDisplay (point.x, point.y); } boolean translateTraversal (int key_sym, PhKeyEvent_t phEvent) { int detail = SWT.TRAVERSE_NONE; int code = traversalCode (key_sym, phEvent); boolean all = false; switch (key_sym) { case OS.Pk_Escape: { all = true; detail = SWT.TRAVERSE_ESCAPE; break; } case OS.Pk_Return: { all = true; detail = SWT.TRAVERSE_RETURN; break; } case OS.Pk_Tab: case OS.Pk_KP_Tab: { boolean next = (phEvent.key_mods & OS.Pk_KM_Shift) == 0; detail = next ? SWT.TRAVERSE_TAB_NEXT : SWT.TRAVERSE_TAB_PREVIOUS; break; } case OS.Pk_Up: case OS.Pk_Left: { detail = SWT.TRAVERSE_ARROW_PREVIOUS; break; } case OS.Pk_Down: case OS.Pk_Right: { detail = SWT.TRAVERSE_ARROW_NEXT; break; } case OS.Pk_Pg_Down: case OS.Pk_Pg_Up: { all = true; if ((phEvent.key_mods & OS.Pk_KM_Ctrl) == 0) return false; detail = key_sym == OS.Pk_Pg_Down ? SWT.TRAVERSE_PAGE_NEXT : SWT.TRAVERSE_PAGE_PREVIOUS; break; } default: return false; } Event event = new Event (); event.doit = (code & detail) != 0; event.detail = detail; if (!setKeyState (event, SWT.Traverse, phEvent)) return false; Shell shell = getShell (); Control control = this; do { if (control.traverse (event)) return true; if (!event.doit && control.hooks (SWT.Traverse)) { return false; } if (control == shell) return false; control = control.parent; } while (all && control != null); return false; } int traversalCode (int key_sym, PhKeyEvent_t ke) { // if ((OS.PtWidgetFlags (handle) & OS.Pt_GETS_FOCUS) == 0) return 0; int code = SWT.TRAVERSE_RETURN | SWT.TRAVERSE_TAB_NEXT | SWT.TRAVERSE_TAB_PREVIOUS; Shell shell = getShell (); if (shell.parent != null) code |= SWT.TRAVERSE_ESCAPE; return code; } /** * Performs a platform traversal action corresponding to a KeyDown event. * *

    Valid traversal values are * SWT.TRAVERSE_NONE, SWT.TRAVERSE_MNEMONIC, * SWT.TRAVERSE_ESCAPE, SWT.TRAVERSE_RETURN, * SWT.TRAVERSE_TAB_NEXT, SWT.TRAVERSE_TAB_PREVIOUS, * SWT.TRAVERSE_ARROW_NEXT, SWT.TRAVERSE_ARROW_PREVIOUS, * SWT.TRAVERSE_PAGE_NEXT and SWT.TRAVERSE_PAGE_PREVIOUS. * If traversal is SWT.TRAVERSE_NONE then the Traverse * event is created with standard values based on the KeyDown event. If * traversal is one of the other traversal constants then the Traverse * event is created with this detail, and its doit is taken from the * KeyDown event. *

    * * @param traversal the type of traversal, or SWT.TRAVERSE_NONE to compute * this from event * @param event the KeyDown event * * @return true if the traversal succeeded * * @exception IllegalArgumentException
      *
    • ERROR_NULL_ARGUMENT if the event is null
    • *
    * @exception SWTException
      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    * * @since 3.6 */ public boolean traverse (int traversal, Event event) { checkWidget (); if (event == null) error (SWT.ERROR_NULL_ARGUMENT); return traverse (traversal, event.character, event.keyCode, event.keyLocation, event.stateMask, event.doit); } /** * Performs a platform traversal action corresponding to a KeyDown event. * *

    Valid traversal values are * SWT.TRAVERSE_NONE, SWT.TRAVERSE_MNEMONIC, * SWT.TRAVERSE_ESCAPE, SWT.TRAVERSE_RETURN, * SWT.TRAVERSE_TAB_NEXT, SWT.TRAVERSE_TAB_PREVIOUS, * SWT.TRAVERSE_ARROW_NEXT, SWT.TRAVERSE_ARROW_PREVIOUS, * SWT.TRAVERSE_PAGE_NEXT and SWT.TRAVERSE_PAGE_PREVIOUS. * If traversal is SWT.TRAVERSE_NONE then the Traverse * event is created with standard values based on the KeyDown event. If * traversal is one of the other traversal constants then the Traverse * event is created with this detail, and its doit is taken from the * KeyDown event. *

    * * @param traversal the type of traversal, or SWT.TRAVERSE_NONE to compute * this from event * @param event the KeyDown event * * @return true if the traversal succeeded * * @exception IllegalArgumentException
      *
    • ERROR_NULL_ARGUMENT if the event is null
    • *
    * @exception SWTException
      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    * * @since 3.6 */ public boolean traverse (int traversal, KeyEvent event) { checkWidget (); if (event == null) error (SWT.ERROR_NULL_ARGUMENT); return traverse (traversal, event.character, event.keyCode, event.keyLocation, event.stateMask, event.doit); } boolean traverse (int traversal, char character, int keyCode, int keyLocation, int stateMask, boolean doit) { // the following should work but is not tested // if (traversal == SWT.TRAVERSE_NONE) { // switch (keyCode) { // case SWT.ESC: { // traversal = SWT.TRAVERSE_ESCAPE; // doit = true; // break; // } // case SWT.CR: { // traversal = SWT.TRAVERSE_RETURN; // doit = true; // break; // } // case SWT.ARROW_DOWN: // case SWT.ARROW_RIGHT: { // traversal = SWT.TRAVERSE_ARROW_NEXT; // doit = false; // break; // } // case SWT.ARROW_UP: // case SWT.ARROW_LEFT: { // traversal = SWT.TRAVERSE_ARROW_PREVIOUS; // doit = false; // break; // } // case SWT.TAB: { // traversal = (stateMask & SWT.SHIFT) != 0 ? SWT.TRAVERSE_TAB_PREVIOUS : SWT.TRAVERSE_TAB_NEXT; // doit = true; // break; // } // case SWT.PAGE_DOWN: { // if ((stateMask & SWT.CTRL) != 0) { // traversal = SWT.TRAVERSE_PAGE_NEXT; // doit = true; // } // break; // } // case SWT.PAGE_UP: { // if ((stateMask & SWT.CTRL) != 0) { // traversal = SWT.TRAVERSE_PAGE_PREVIOUS; // doit = true; // } // break; // } // default: { // if (character != 0 && (stateMask & (SWT.ALT | SWT.CTRL)) == SWT.ALT) { // traversal = SWT.TRAVERSE_MNEMONIC; // doit = true; // } // break; // } // } // } // // Event event = new Event (); // event.character = character; // event.detail = traversal; // event.doit = doit; // event.keyCode = keyCode; // event.keyLocation = keyLocation; // event.stateMask = stateMask; // Shell shell = getShell (); // // boolean all = false; // switch (traversal) { // case SWT.TRAVERSE_ESCAPE: // case SWT.TRAVERSE_RETURN: // case SWT.TRAVERSE_PAGE_NEXT: // case SWT.TRAVERSE_PAGE_PREVIOUS: { // all = true; // // FALL THROUGH // } // case SWT.TRAVERSE_ARROW_NEXT: // case SWT.TRAVERSE_ARROW_PREVIOUS: // case SWT.TRAVERSE_TAB_NEXT: // case SWT.TRAVERSE_TAB_PREVIOUS: { // /* traversal is a valid traversal action */ // break; // } // case SWT.TRAVERSE_MNEMONIC: { // return translateMnemonic (event, null) || shell.translateMnemonic (event, this); // } // default: { // /* traversal is not a valid traversal action */ // return false; // } // } // // Control control = this; // do { // if (control.traverse (event)) return true; // if (!event.doit && control.hooks (SWT.Traverse)) return false; // if (control == shell) return false; // control = control.parent; // } while (all && control != null); return false; } boolean traverse (Event event) { /* * It is possible (but unlikely), that application * code could have disposed the widget in the traverse * event. If this happens, return true to stop further * event processing. */ sendEvent (SWT.Traverse, event); if (isDisposed ()) return true; if (!event.doit) return false; switch (event.detail) { case SWT.TRAVERSE_NONE: return true; case SWT.TRAVERSE_ESCAPE: return traverseEscape (); case SWT.TRAVERSE_RETURN: return traverseReturn (); case SWT.TRAVERSE_TAB_NEXT: return traverseGroup (true); case SWT.TRAVERSE_TAB_PREVIOUS: return traverseGroup (false); case SWT.TRAVERSE_ARROW_NEXT: return traverseItem (true); case SWT.TRAVERSE_ARROW_PREVIOUS: return traverseItem (false); case SWT.TRAVERSE_MNEMONIC: return traverseMnemonic (event.character); case SWT.TRAVERSE_PAGE_NEXT: return traversePage (true); case SWT.TRAVERSE_PAGE_PREVIOUS: return traversePage (false); } return false; } /** * Based on the argument, perform one of the expected platform * traversal action. The argument should be one of the constants: * SWT.TRAVERSE_ESCAPE, SWT.TRAVERSE_RETURN, * SWT.TRAVERSE_TAB_NEXT, SWT.TRAVERSE_TAB_PREVIOUS, * SWT.TRAVERSE_ARROW_NEXT, SWT.TRAVERSE_ARROW_PREVIOUS, * SWT.TRAVERSE_PAGE_NEXT and SWT.TRAVERSE_PAGE_PREVIOUS. * * @param traversal the type of traversal * @return true if the traversal succeeded * * @exception SWTException
      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    */ public boolean traverse (int traversal) { checkWidget (); Event event = new Event (); event.doit = true; event.detail = traversal; return traverse (event); } boolean traverseEscape () { return false; } boolean traverseGroup (boolean next) { Control root = computeTabRoot (); Control group = computeTabGroup (); Control [] list = root.computeTabList (); int length = list.length; int index = 0; while (index < length) { if (list [index] == group) break; index++; } /* * It is possible (but unlikely), that application * code could have disposed the widget in focus in * or out events. Ensure that a disposed widget is * not accessed. */ if (index == length) return false; int start = index, offset = (next) ? 1 : -1; while ((index = ((index + offset + length) % length)) != start) { Control control = list [index]; if (!control.isDisposed () && control.setTabGroupFocus ()) { return true; } } if (group.isDisposed ()) return false; return group.setTabGroupFocus (); } boolean traverseItem (boolean next) { Control [] children = parent._getChildren (); int length = children.length; int index = 0; while (index < length) { if (children [index] == this) break; index++; } /* * It is possible (but unlikely), that application * code could have disposed the widget in focus in * or out events. Ensure that a disposed widget is * not accessed. */ if (index == length) return false; int start = index, offset = (next) ? 1 : -1; while ((index = (index + offset + length) % length) != start) { Control child = children [index]; if (!child.isDisposed () && child.isTabItem ()) { if (child.setTabItemFocus ()) return true; } } return false; } boolean traversePage (boolean next) { return false; } boolean traverseMnemonic (char key) { // return mnemonicHit (key); return false; } boolean traverseReturn () { return false; } /** * Forces all outstanding paint requests for the widget * to be processed before this method returns. If there * are no outstanding paint request, this method does * nothing. *

    * Note: This method does not cause a redraw. *

    * * @exception SWTException
      *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • *
    * * @see #redraw() * @see #redraw(int, int, int, int, boolean) * @see PaintListener * @see SWT#Paint */ public void update () { checkWidget(); OS.PtFlush (); } void updateLayout (boolean all) { /* Do nothing */ } int widgetClass () { return 0; } }