org.eclipse.swt.widgets
Class Tracker

java.lang.Object
  |
  +--org.eclipse.swt.widgets.Widget
        |
        +--org.eclipse.swt.widgets.Tracker

public class Tracker
extends Widget

Unsafe: Instances of this class implement rubber banding rectangles that are drawn onto a parent Composite or Display. These rectangles can be specified to respond to mouse and key events by either moving or resizing themselves accordingly. Trackers are typically used to represent window geometries in a lightweight manner.

Styles:
LEFT, RIGHT, UP, DOWN, RESIZE
Events:
Move, Resize

Note: Rectangle move behavior is assumed unless RESIZE is specified.

IMPORTANT: This class is not intended to be subclassed.


Field Summary
(package private)  int clientCursor
           
(package private)  int cursorOrientation
           
(package private)  Display display
           
(package private)  boolean inEvent
           
(package private)  Control parent
           
(package private)  Rectangle[] proportions
           
(package private)  Rectangle[] rectangles
           
(package private)  int resizeCursor
           
(package private) static int STEPSIZE_LARGE
           
(package private) static int STEPSIZE_SMALL
           
(package private)  boolean stippled
           
(package private)  boolean tracking
           
 
Fields inherited from class org.eclipse.swt.widgets.Widget
CANVAS, COMCTL32_MAJOR, COMCTL32_MINOR, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, DISPOSED, eventTable, HIDDEN, keys, MAJOR, MINOR, Mnemonic, state, style, values
 
Constructor Summary
Tracker(Composite parent, int style)
          Enabled: Constructs a new instance of this class given its parent and a style value describing its behavior and appearance.
Tracker(Display display, int style)
          Enabled: Constructs a new instance of this class given the display to create it on and a style value describing its behavior and appearance.
 
Method Summary
 void addControlListener(ControlListener listener)
          Enabled: 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.
(package private)  Point adjustMoveCursor()
           
(package private)  Point adjustResizeCursor()
           
(package private) static int checkStyle(int style)
           
 void close()
          Enabled: Stops displaying the tracker rectangles.
(package private)  Rectangle computeBounds()
           
(package private)  Rectangle[] computeProportions(Rectangle[] rects)
           
(package private)  void drawRectangles(Rectangle[] rects)
          Draw the rectangles displayed by the tracker.
 Display getDisplay()
          Suppressed:
 Rectangle[] getRectangles()
          Enabled: Returns the bounds that are being drawn, expressed relative to the parent widget.
 boolean getStippled()
          Enabled: Returns true if the rectangles are drawn with a stippled line, false otherwise.
(package private)  void moveRectangles(int xChange, int yChange)
           
 boolean open()
          Enabled: Displays the Tracker rectangles for manipulation by the user.
 void removeControlListener(ControlListener listener)
          Enabled: Removes the listener from the collection of listeners who will be notified when the control is moved or resized.
(package private)  void resizeRectangles(int xChange, int yChange)
           
 void setCursor(Cursor newCursor)
          Enabled: Sets the Cursor of the Tracker.
 void setRectangles(Rectangle[] rectangles)
          Enabled: Specifies the rectangles that should be drawn, expressed relative to the parent widget.
 void setStippled(boolean stippled)
          Enabled: Changes the appearance of the line used to draw the rectangles.
 
Methods inherited from class org.eclipse.swt.widgets.Widget
addDisposeListener, addListener, checkBits, checkOrientation, checkParent, checkSubclass, checkWidget, destroyWidget, dispose, error, filters, getData, getData, getName, getNameText, getStyle, hooks, isDisposed, isListening, isValidSubclass, isValidThread, mbcsToWcs, mbcsToWcs, notifyListeners, postEvent, postEvent, releaseChild, releaseHandle, releaseResources, releaseWidget, removeDisposeListener, removeListener, removeListener, sendEvent, sendEvent, sendEvent, sendEvent, setData, setData, setInputState, setKeyState, toString, wcsToMbcs, wcsToMbcs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

parent

Control parent

display

Display display

tracking

boolean tracking

stippled

boolean stippled

rectangles

Rectangle[] rectangles

proportions

Rectangle[] proportions

resizeCursor

int resizeCursor

clientCursor

int clientCursor

cursorOrientation

int cursorOrientation

inEvent

boolean inEvent

STEPSIZE_SMALL

static final int STEPSIZE_SMALL

STEPSIZE_LARGE

static final int STEPSIZE_LARGE
Constructor Detail

Tracker

public Tracker(Composite parent,
               int style)
Enabled: 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.

Parameters:
parent - a widget which will be the parent of the new instance (cannot be null)
style - the style of widget to construct
See Also:
SWT.LEFT, SWT.RIGHT, SWT.UP, SWT.DOWN, SWT.RESIZE, Widget.checkSubclass(), Widget.getStyle()

Tracker

public Tracker(Display display,
               int style)
Enabled: Constructs a new instance of this class given the display to create it on 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.

Note: Currently, null can be passed in for the display argument. This has the effect of creating the tracker on the currently active display if there is one. If there is no current display, the tracker is created on a "default" display. Passing in null as the display argument is not considered to be good coding style, and may not be supported in a future release of SWT.

Parameters:
display - the display to create the tracker on
style - the style of control to construct
See Also:
SWT.LEFT, SWT.RIGHT, SWT.UP, SWT.DOWN
Method Detail

addControlListener

public void addControlListener(ControlListener listener)
Enabled: 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.

Parameters:
listener - the listener which should be notified
See Also:
ControlListener, removeControlListener(org.eclipse.swt.events.ControlListener)

adjustMoveCursor

Point adjustMoveCursor()

adjustResizeCursor

Point adjustResizeCursor()

checkStyle

static int checkStyle(int style)

close

public void close()
Enabled: Stops displaying the tracker rectangles. Note that this is not considered to be a cancelation by the user.


computeBounds

Rectangle computeBounds()

computeProportions

Rectangle[] computeProportions(Rectangle[] rects)

drawRectangles

void drawRectangles(Rectangle[] rects)
Draw the rectangles displayed by the tracker.


getDisplay

public Display getDisplay()
Suppressed:

Specified by:
getDisplay in class Widget
Returns:
the receiver's display

getRectangles

public Rectangle[] getRectangles()
Enabled: Returns the bounds that are being drawn, expressed relative to the parent widget. If the parent is a Display then these are screen coordinates.

Returns:
the bounds of the Rectangles being drawn

getStippled

public boolean getStippled()
Enabled: Returns true if the rectangles are drawn with a stippled line, false otherwise.

Returns:
the stippled effect of the rectangles

moveRectangles

void moveRectangles(int xChange,
                    int yChange)

open

public boolean open()
Enabled: Displays the Tracker rectangles for manipulation by the user. Returns when the user has either finished manipulating the rectangles or has cancelled the Tracker.

Returns:
true if the user did not cancel the Tracker, false otherwise

removeControlListener

public void removeControlListener(ControlListener listener)
Enabled: Removes the listener from the collection of listeners who will be notified when the control is moved or resized.

Parameters:
listener - the listener which should be notified
See Also:
ControlListener, addControlListener(org.eclipse.swt.events.ControlListener)

resizeRectangles

void resizeRectangles(int xChange,
                      int yChange)

setCursor

public void setCursor(Cursor newCursor)
Enabled: Sets the Cursor of the Tracker. If this cursor is null then the cursor reverts to the default.

Parameters:
newCursor - the new Cursor to display

setRectangles

public void setRectangles(Rectangle[] rectangles)
Enabled: Specifies the rectangles that should be drawn, expressed relative to the parent widget. If the parent is a Display then these are screen coordinates.

Parameters:
rectangles - the bounds of the rectangles to be drawn

setStippled

public void setStippled(boolean stippled)
Enabled: Changes the appearance of the line used to draw the rectangles.

Parameters:
stippled - true if rectangle should appear stippled


comments?