Constructs a new instance of this class given its parent and a style value describing its behavior and appearance. <p> The style value is either one of the style constants defined in class <code>SWT</code> which is applicable to instances of this class, or must be built by <em>bitwise OR</em>'ing together (that is, using the <code>int</code> "|" operator) two or more of those <code>SWT</code> style constants. The class description lists the style constants that are applicable to the class. Style bits are also inherited from superclasses. </p>
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 <code>ControlListener</code> interface.
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 <code>DragDetectListener</code> interface.
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 <code>FocusListener</code> interface.
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 <code>HelpListener</code> interface.
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 <code>KeyListener</code> interface. <p> 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. </p> @param listener the listener which should be notified
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 <code>MenuDetectListener</code> interface.
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 <code>MouseListener</code> interface.
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 <code>MouseMoveListener</code> interface.
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 <code>MouseTrackListener</code> interface.
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 <code>MouseWheelListener</code> interface.
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 <code>PaintListener</code> interface.
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 <code>TraverseListener</code> interface.
Returns the preferred size of the receiver. <p> The <em>preferred size</em> 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 <code>SWT.DEFAULT</code> is passed for the hint. </p>
Returns the preferred size of the receiver. <p> The <em>preferred size</em> 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 <code>SWT.DEFAULT</code> is passed for the hint. </p><p> If the changed flag is <code>true</code>, it indicates that the receiver's <em>contents</em> 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 <code>false</code>, so layout manager caches can be retained. </p>
Detects a drag and drop gesture. This method is used to detect a drag gesture when called from within a mouse down listener.
Detects a drag and drop gesture. This method is used to detect a drag gesture when called from within a mouse down listener.
Forces the receiver to have the <em>keyboard focus</em>, causing all keyboard events to be delivered to it.
Returns the accessible object for the receiver. If this is the first time this object is requested, then the object is created and returned.
Returns the receiver's background color.
Returns the receiver's background image.
Returns the receiver's border width.
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.
Returns the receiver's cursor, or null if it has not been set. <p> When the mouse pointer passes over a control its appearance is changed to match the control's cursor. </p>
Returns <code>true</code> if the receiver is detecting drag gestures, and <code>false</code> otherwise.
Returns <code>true</code> if the receiver is enabled, and <code>false</code> otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.
Returns the font that the receiver will use to paint textual information.
Returns the foreground color that the receiver will use to draw.
Returns layout data which is associated with the receiver.
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.
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.
Returns the receiver's monitor.
Returns the receiver's parent, which must be a <code>Composite</code> or null when the receiver is a shell that was created with null or a display for a parent.
Returns the region that defines the shape of the control, or null if the control has the default shape.
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.
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.
Returns the receiver's tool tip text, or null if it has not been set.
Returns <code>true</code> if the receiver is visible, and <code>false</code> otherwise. <p> 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. </p>
Invokes platform specific functionality to dispose a GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Control</code>. 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. </p>
Invokes platform specific functionality to allocate a new GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Control</code>. 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. </p>
Returns <code>true</code> if the receiver is enabled and all ancestors up to and including the receiver's nearest ancestor shell are enabled. Otherwise, <code>false</code> is returned. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.
Returns <code>true</code> if the receiver has the user-interface focus, and <code>false</code> otherwise.
Returns <code>true</code> if the underlying operating system supports this reparenting, otherwise <code>false</code>
Returns <code>true</code> if the receiver is visible and all ancestors up to and including the receiver's nearest ancestor shell are visible. Otherwise, <code>false</code> is returned.
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.
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.
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.
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. <p> If the changed flag is <code>true</code>, it indicates that the receiver's <em>contents</em> 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 <code>false</code>, so layout manager caches can be retained. </p>
Prints the receiver and all children.
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.
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 <code>all</code> flag is <code>true</code>, any children of the receiver which intersect with the specified area will also paint their intersecting areas. If the <code>all</code> flag is <code>false</code>, the children will not be painted.
Removes the listener from the collection of listeners who will be notified when the control is moved or resized.
Removes the listener from the collection of listeners who will be notified when a drag gesture occurs.
Removes the listener from the collection of listeners who will be notified when the control gains or loses focus.
Removes the listener from the collection of listeners who will be notified when the help events are generated for the control.
Removes the listener from the collection of listeners who will be notified when keys are pressed and released on the system keyboard.
Removes the listener from the collection of listeners who will be notified when the platform-specific context menu trigger has occurred.
Removes the listener from the collection of listeners who will be notified when mouse buttons are pressed and released.
Removes the listener from the collection of listeners who will be notified when the mouse moves.
Removes the listener from the collection of listeners who will be notified when the mouse passes or hovers over controls.
Removes the listener from the collection of listeners who will be notified when the mouse wheel is scrolled.
Removes the listener from the collection of listeners who will be notified when the receiver needs to be painted.
Removes the listener from the collection of listeners who will be notified when traversal events occur.
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. <p> 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. </p> @param color the new color (or null)
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. <p> 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. </p> @param image the new image (or null)
Sets the receiver's size and location to the rectangular area specified by the argument. The <code>x</code> and <code>y</code> fields of the rectangle are relative to the receiver's parent (or its display if its parent is null). <p> 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. </p>
Sets the receiver's size and location to the rectangular area specified by the arguments. The <code>x</code> and <code>y</code> 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 <code>x</code> and <code>y</code> arguments are relative to the display. <p> 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. </p>
If the argument is <code>true</code>, causes the receiver to have all mouse events delivered to it until the method is called with <code>false</code> as the argument. Note that on some platforms, a mouse button must currently be down for capture to be assigned.
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. <p> When the mouse pointer passes over a control its appearance is changed to match the control's cursor. </p>
Sets the receiver's drag detect state. If the argument is <code>true</code>, the receiver will detect drag gestures, otherwise these gestures will be ignored.
Enables the receiver if the argument is <code>true</code>, and disables it otherwise. A disabled control is typically not selectable from the user interface and draws with an inactive or "grayed" look.
Causes the receiver to have the <em>keyboard focus</em>, such that all keyboard events will be delivered to it. Focus reassignment will respect applicable platform constraints.
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.
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. <p> Note: This operation is a hint and may be overridden by the platform. </p> @param color the new color (or null)
Sets the layout data associated with the receiver to the argument.
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.
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.
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. <p> 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. </p>
Changes the parent of the widget to be the one provided if the underlying operating system supports this feature. Returns <code>true</code> if the parent is successfully changed.
If the argument is <code>false</code>, 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 <code>false</code> are lost. When the flag is set to <code>true</code>, the entire widget is marked as needing to be redrawn. Nested calls to this method are stacked. <p> Note: This operation is a hint and may not be supported on some platforms or for some widgets. </p>
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.
Sets the receiver's size to the point specified by the argument. <p> Note: Attempting to set the width or height of the receiver to a negative number will cause them to be set to zero instead. </p>
Sets the receiver's size to the point specified by the arguments. <p> 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. </p>
Sets the receiver's tool tip text to the argument, which may be null indicating that no tool tip text should be shown.
Marks the receiver as visible if the argument is <code>true</code>, and marks it invisible otherwise. <p> 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. </p>
Returns a point which is the result of converting the argument, which is specified in display relative coordinates, to coordinates relative to the receiver. <p> @param x the x coordinate to be translated @param y the y coordinate to be translated @return the translated coordinates
Returns a point which is the result of converting the argument, which is specified in display relative coordinates, to coordinates relative to the receiver. <p> @param point the point to be translated (must not be null) @return the translated coordinates
Returns a point which is the result of converting the argument, which is specified in coordinates relative to the receiver, to display relative coordinates. <p> @param x the x coordinate to be translated @param y the y coordinate to be translated @return the translated coordinates
Returns a point which is the result of converting the argument, which is specified in coordinates relative to the receiver, to display relative coordinates. <p> @param point the point to be translated (must not be null) @return the translated coordinates
Based on the argument, perform one of the expected platform traversal action. The argument should be one of the constants: <code>SWT.TRAVERSE_ESCAPE</code>, <code>SWT.TRAVERSE_RETURN</code>, <code>SWT.TRAVERSE_TAB_NEXT</code>, <code>SWT.TRAVERSE_TAB_PREVIOUS</code>, <code>SWT.TRAVERSE_ARROW_NEXT</code> and <code>SWT.TRAVERSE_ARROW_PREVIOUS</code>.
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. <p> Note: This method does not cause a redraw. </p>
the handle to the OS resource (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. 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 accessed from application code. </p>
Adds the listener to the collection of listeners who will be notified when an event of the given type occurs. When the event does occur in the widget, the listener is notified by sending it the <code>handleEvent()</code> message. The event type is one of the event constants defined in class <code>SWT</code>.
Adds the listener to the collection of listeners who will be notified when the widget is disposed. When the widget is disposed, the listener is notified by sending it the <code>widgetDisposed()</code> message.
Throws an exception if the specified widget can not be used as a parent for the receiver.
Checks that this class can be subclassed. <p> The SWT class library is intended to be subclassed only at specific, controlled points (most notably, <code>Composite</code> and <code>Canvas</code> when implementing new widgets). This method enforces this rule unless it is overridden. </p><p> <em>IMPORTANT:</em> By providing an implementation of this method that allows a subclass of a class which does not normally allow subclassing to be created, the implementer agrees to be fully responsible for the fact that any such subclass will likely fail between SWT releases and will be strongly platform specific. No support is provided for user-written classes which are implemented in this fashion. </p><p> The ability to subclass outside of the allowed SWT classes is intended purely to enable those not on the SWT development team to implement patches in order to get around specific limitations in advance of when those limitations can be addressed by the team. Subclassing should not be attempted without an intimate and detailed understanding of the hierarchy. </p>
Throws an <code>SWTException</code> if the receiver can not be accessed by the caller. This may include both checks on the state of the receiver and more generally on the entire execution context. This method <em>should</em> be called by widget implementors to enforce the standard SWT invariants. <p> Currently, it is an error to invoke any method (other than <code>isDisposed()</code>) on a widget that has had its <code>dispose()</code> method called. It is also an error to call widget methods from any thread that is different from the thread that created the widget. </p><p> In future releases of SWT, there may be more or fewer error checks and exceptions may be thrown for different reasons. </p>
Disposes of the operating system resources associated with the receiver and all its descendants. After this method has been invoked, the receiver and all descendants will answer <code>true</code> when sent the message <code>isDisposed()</code>. Any internal connections between the widgets in the tree will have been removed to facilitate garbage collection. <p> NOTE: This method is not called recursively on the descendants of the receiver. This means that, widget implementers can not detect when a widget is being disposed of by re-implementing this method, but should instead listen for the <code>Dispose</code> event. </p>
Returns the application defined widget data associated with the receiver, or null if it has not been set. The <em>widget data</em> is a single, unnamed field that is stored with every widget. <p> Applications may put arbitrary objects in this field. If the object stored in the widget data needs to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so. </p>
Returns the application defined property of the receiver with the specified name, or null if it has not been set. <p> Applications may have associated arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so. </p>
Returns the <code>Display</code> that is associated with the receiver. <p> A widget's display is either provided when it is created (for example, top level <code>Shell</code>s) or is the same as its parent's display. </p>
Returns an array of listeners who will be notified when an event of the given type occurs. The event type is one of the event constants defined in class <code>SWT</code>.
Returns the receiver's style information. <p> Note that the value which is returned by this method <em>may not match</em> the value which was provided to the constructor when the receiver was created. This can occur when the underlying operating system does not support a particular combination of requested styles. For example, if the platform widget used to implement a particular SWT widget always has scroll bars, the result of calling this method would always have the <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set. </p>
Returns <code>true</code> if the widget has been disposed, and <code>false</code> otherwise. <p> This method gets the dispose state for the widget. When a widget has been disposed, it is an error to invoke any other method using the widget. </p>
Returns <code>true</code> if there are any listeners for the specified event type associated with the receiver, and <code>false</code> otherwise. The event type is one of the event constants defined in class <code>SWT</code>.
Notifies all of the receiver's listeners for events of the given type that one such event has occurred by invoking their <code>handleEvent()</code> method. The event type is one of the event constants defined in class <code>SWT</code>.
Removes the listener from the collection of listeners who will be notified when an event of the given type occurs. The event type is one of the event constants defined in class <code>SWT</code>.
Removes the listener from the collection of listeners who will be notified when an event of the given type occurs. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the SWT public API. It is marked public only so that it can be shared within the packages provided by SWT. It should never be referenced from application code. </p>
Removes the listener from the collection of listeners who will be notified when the widget is disposed.
Sets the application defined widget data associated with the receiver to be the argument. The <em>widget data</em> is a single, unnamed field that is stored with every widget. <p> Applications may put arbitrary objects in this field. If the object stored in the widget data needs to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so. </p>
Sets the application defined property of the receiver with the specified name to the given value. <p> Applications may associate arbitrary objects with the receiver in this fashion. If the objects stored in the properties need to be notified when the widget is disposed of, it is the application's responsibility to hook the Dispose event on the widget and do so. </p>
Returns a string containing a concise, human-readable description of the receiver.
Invokes platform specific functionality to allocate a new GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Drawable</code>. 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. </p>
Invokes platform specific functionality to dispose a GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Drawable</code>. 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. </p>
Control is the abstract superclass of all windowed user interface classes. <p> <dl> <dt><b>Styles:</b> <dd>BORDER</dd> <dd>LEFT_TO_RIGHT, RIGHT_TO_LEFT</dd> <dt><b>Events:</b> <dd>DragDetect, FocusIn, FocusOut, Help, KeyDown, KeyUp, MenuDetect, MouseDoubleClick, MouseDown, MouseEnter, MouseExit, MouseHover, MouseUp, MouseMove, Move, Paint, Resize, Traverse</dd> </dl> </p><p> Only one of LEFT_TO_RIGHT or RIGHT_TO_LEFT may be specified. </p><p> IMPORTANT: This class is intended to be subclassed <em>only</em> within the SWT implementation. </p>
@see <a href="http://www.eclipse.org/swt/snippets/#control">Control snippets</a> @see <a href="http://www.eclipse.org/swt/examples.php">SWT Example: ControlExample</a> @see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>