public class Tracker extends Widget
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.
Note: Rectangle move behavior is assumed unless RESIZE is specified.
IMPORTANT: This class is not intended to be subclassed.
Modifier and Type | Field and Description |
---|---|
(package private) Rectangle |
bounds |
(package private) boolean |
cancelled |
(package private) Cursor |
clientCursor |
(package private) int |
cursorOrientation |
(package private) int |
hwndOpaque |
(package private) int |
hwndTransparent |
(package private) boolean |
inEvent |
(package private) static boolean |
IsVista |
(package private) int |
oldOpaqueProc |
(package private) int |
oldTransparentProc |
(package private) int |
oldX |
(package private) int |
oldY |
(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 |
CANVAS, data, DEFAULT_HEIGHT, DEFAULT_WIDTH, DISABLED, display, DISPOSE_SENT, DISPOSED, DRAG_DETECT, DRAW_BACKGROUND, eventTable, FOREIGN_HANDLE, HIDDEN, IGNORE_WM_CHANGEUISTATE, KEYED_DATA, LAYOUT_CHANGED, LAYOUT_CHILD, LAYOUT_NEEDED, MAJOR, MINOR, MOVE_DEFERRED, MOVE_OCCURRED, PARENT_BACKGROUND, RELEASED, RESIZE_DEFERRED, RESIZE_OCCURRED, SKIN_NEEDED, state, style, THEME_BACKGROUND, TRACK_MOUSE
Constructor and Description |
---|
Tracker(Composite parent,
int style)
Constructs a new instance of this class given its parent
and a style value describing its behavior and appearance.
|
Tracker(Display display,
int style)
Constructs a new instance of this class given the display
to create it on and a style value describing its behavior
and appearance.
|
Modifier and Type | Method and Description |
---|---|
void |
addControlListener(ControlListener listener)
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. |
void |
addKeyListener(KeyListener listener)
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. |
(package private) Point |
adjustMoveCursor() |
(package private) Point |
adjustResizeCursor() |
(package private) static int |
checkStyle(int style) |
void |
close()
Stops displaying the tracker rectangles.
|
(package private) Rectangle |
computeBounds() |
(package private) Rectangle[] |
computeProportions(Rectangle[] rects) |
(package private) void |
drawRectangles(Rectangle[] rects,
boolean stippled)
Draw the rectangles displayed by the tracker.
|
Rectangle[] |
getRectangles()
Returns the bounds that are being drawn, expressed relative to the parent
widget.
|
boolean |
getStippled()
Returns
true if the rectangles are drawn with a stippled line, false otherwise. |
(package private) void |
moveRectangles(int xChange,
int yChange) |
boolean |
open()
Displays the Tracker rectangles for manipulation by the user.
|
(package private) void |
releaseWidget() |
void |
removeControlListener(ControlListener listener)
Removes the listener from the collection of listeners who will
be notified when the control is moved or resized.
|
void |
removeKeyListener(KeyListener listener)
Removes the listener from the collection of listeners who will
be notified when keys are pressed and released on the system keyboard.
|
(package private) void |
resizeRectangles(int xChange,
int yChange) |
void |
setCursor(Cursor newCursor)
Sets the
Cursor of the Tracker. |
void |
setRectangles(Rectangle[] rectangles)
Specifies the rectangles that should be drawn, expressed relative to the parent
widget.
|
void |
setStippled(boolean stippled)
Changes the appearance of the line used to draw the rectangles.
|
(package private) int |
transparentProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) void |
update() |
(package private) LRESULT |
wmKeyDown(int hwnd,
int wParam,
int lParam) |
(package private) LRESULT |
wmMouse(int message,
int wParam,
int lParam) |
(package private) LRESULT |
wmSysKeyDown(int hwnd,
int wParam,
int lParam) |
_addListener, addDisposeListener, addListener, callWindowProc, checkBits, checkOpened, checkOrientation, checkParent, checkSubclass, checkWidget, DeferWindowPos, destroyWidget, dispose, dragDetect, error, filters, findItem, fixMnemonic, fixMnemonic, getData, getData, getDisplay, getListeners, getMenu, getName, getNameText, getStyle, hooks, isDisposed, isListening, isValidSubclass, isValidThread, mapEvent, new_GC, notifyListeners, postEvent, postEvent, release, releaseChildren, releaseHandle, releaseParent, removeDisposeListener, removeListener, removeListener, reskin, reskinChildren, reskinWidget, sendDragEvent, sendDragEvent, sendEvent, sendEvent, sendEvent, sendEvent, sendFocusEvent, sendKeyEvent, sendKeyEvent, sendMouseEvent, sendMouseEvent, sendMouseWheelEvent, sendSelectionEvent, sendSelectionEvent, setData, setData, setInputState, setKeyState, setLocationMask, setTabGroupFocus, setTabItemFocus, SetWindowPos, showMenu, showMenu, toString, updateMenuLocation, wmCaptureChanged, wmChar, wmContextMenu, wmIMEChar, wmKeyUp, wmKillFocus, wmLButtonDblClk, wmLButtonDown, wmLButtonUp, wmMButtonDblClk, wmMButtonDown, wmMButtonUp, wmMouseHover, wmMouseHWheel, wmMouseLeave, wmMouseMove, wmMouseWheel, wmNCPaint, wmPaint, wmPrint, wmRButtonDblClk, wmRButtonDown, wmRButtonUp, wmSetFocus, wmSysChar, wmSysKeyUp, wmXButtonDblClk, wmXButtonDown, wmXButtonUp
Control parent
boolean tracking
boolean cancelled
boolean stippled
Rectangle[] rectangles
Rectangle[] proportions
Rectangle bounds
int resizeCursor
Cursor clientCursor
int cursorOrientation
boolean inEvent
int hwndTransparent
int hwndOpaque
int oldTransparentProc
int oldOpaqueProc
int oldX
int oldY
static boolean IsVista
static final int STEPSIZE_SMALL
static final int STEPSIZE_LARGE
public Tracker(Composite parent, int style)
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.
parent
- a widget which will be the parent of the new instance (cannot be null)style
- the style of widget to constructjava.lang.IllegalArgumentException
- SWTException
- SWT.LEFT
,
SWT.RIGHT
,
SWT.UP
,
SWT.DOWN
,
SWT.RESIZE
,
Widget.checkSubclass()
,
Widget.getStyle()
public Tracker(Display display, int style)
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.
display
- the display to create the tracker onstyle
- the style of control to constructSWTException
- SWT.LEFT
,
SWT.RIGHT
,
SWT.UP
,
SWT.DOWN
,
SWT.RESIZE
public void addControlListener(ControlListener listener)
ControlListener
interface.listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- SWTException
- ControlListener
,
removeControlListener(org.eclipse.swt.events.ControlListener)
public void addKeyListener(KeyListener listener)
KeyListener
interface.listener
- the listener which should be notifiedjava.lang.IllegalArgumentException
- SWTException
- KeyListener
,
removeKeyListener(org.eclipse.swt.events.KeyListener)
Point adjustMoveCursor()
Point adjustResizeCursor()
static int checkStyle(int style)
public void close()
SWTException
- Rectangle computeBounds()
void drawRectangles(Rectangle[] rects, boolean stippled)
public Rectangle[] getRectangles()
Display
then these are screen
coordinates.SWTException
- public boolean getStippled()
true
if the rectangles are drawn with a stippled line, false
otherwise.SWTException
- void moveRectangles(int xChange, int yChange)
public boolean open()
true
if the user did not cancel the Tracker, false
otherwiseSWTException
- void releaseWidget()
releaseWidget
in class Widget
public void removeControlListener(ControlListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- ControlListener
,
addControlListener(org.eclipse.swt.events.ControlListener)
public void removeKeyListener(KeyListener listener)
listener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- KeyListener
,
addKeyListener(org.eclipse.swt.events.KeyListener)
void resizeRectangles(int xChange, int yChange)
public void setCursor(Cursor newCursor)
Cursor
of the Tracker. If this cursor is null
then the cursor reverts to the default.newCursor
- the new Cursor
to displaySWTException
- public void setRectangles(Rectangle[] rectangles)
rectangles
- the bounds of the rectangles to be drawnjava.lang.IllegalArgumentException
- SWTException
- public void setStippled(boolean stippled)
stippled
- true
if rectangle should appear stippledSWTException
- int transparentProc(int hwnd, int msg, int wParam, int lParam)
void update()
LRESULT wmSysKeyDown(int hwnd, int wParam, int lParam)
wmSysKeyDown
in class Widget
LRESULT wmMouse(int message, int wParam, int lParam)