public class Display extends Device
Applications which are built with SWT will almost always
require only a single display. In particular, some platforms
which SWT supports will not allow more than one active
display. In other words, some platforms do not support
creating a new display if one already exists that has not been
sent the dispose()
message.
In SWT, the thread which creates a Display
instance is distinguished as the user-interface thread
for that display.
Widget
and its subclasses), may only be called
from the thread. (To support multi-threaded user-interface
applications, class Display
provides inter-thread
communication methods which allow threads other than the
user-interface thread to request that it perform operations
on their behalf.)
Display
s until that display has been disposed.
(Note that, this is in addition to the restriction mentioned
above concerning platform support for multiple displays. Thus,
the only way to have multiple simultaneously active displays,
even on platforms which support it, is to have multiple threads.)
All SWT API methods which may only be called from the user-interface
thread are distinguished in their documentation by indicating that
they throw the "ERROR_THREAD_INVALID_ACCESS
"
SWT exception.
IMPORTANT: This class is not intended to be subclassed.
Modifier and Type | Field and Description |
---|---|
(package private) static java.lang.String |
ACCEL_KEY_HIT |
(package private) boolean |
accelKeyHit |
(package private) static short[] |
ACCENTS |
(package private) static java.lang.String |
APP_NAME |
(package private) static java.lang.String |
APP_VERSION |
(package private) static java.lang.String |
AWT_WINDOW_CLASS |
(package private) Menu[] |
bars |
(package private) static char[] |
BUTTON |
(package private) boolean |
captureChanged |
(package private) int |
clickCount |
(package private) RECT |
clickRect |
(package private) int |
columnCount |
(package private) boolean[] |
columnVisible |
(package private) Control[] |
controlTable |
(package private) Cursor[] |
cursors |
(package private) java.lang.Object |
data |
(package private) static Display |
Default |
(package private) static int |
DI_GETDRAGIMAGE |
(package private) static Display[] |
Displays |
(package private) java.lang.Runnable[] |
disposeList |
(package private) Image |
downArrow |
(package private) boolean |
dragCancelled |
(package private) static char[] |
EDIT |
(package private) Callback |
embeddedCallback |
(package private) int |
embeddedHwnd |
(package private) int |
embeddedProc |
(package private) Image |
errorImage |
(package private) Event[] |
eventQueue |
(package private) EventTable |
eventTable |
(package private) static char[] |
EXPLORER |
(package private) static char[] |
EXPLORERBAR |
(package private) int |
filterHook |
(package private) EventTable |
filterTable |
(package private) boolean |
fixFocus |
(package private) Control |
focusControl |
(package private) int |
focusEvent |
(package private) Callback |
foregroundIdleCallback |
(package private) int |
foregroundIdleProc |
(package private) int |
freeSlot |
(package private) Callback |
getMsgCallback |
(package private) int |
getMsgProc |
(package private) static int |
GROW_SIZE |
(package private) int |
hButtonTheme |
(package private) NMHDR |
hdr |
(package private) int |
hEditTheme |
(package private) int |
hExplorerBarTheme |
(package private) int |
hitCount |
(package private) MSG |
hookMsg |
(package private) int |
hScrollBarTheme |
(package private) int |
hTabTheme |
(package private) int |
hwndMessage |
(package private) int |
hwndParent |
(package private) static int |
ID_START |
(package private) int |
idleHook |
(package private) boolean |
ignoreNextKey |
(package private) boolean |
ignoreRestoreFocus |
(package private) ImageList[] |
imageList |
(package private) int[] |
indexTable |
(package private) Image |
infoImage |
(package private) MenuItem[] |
items |
(package private) byte[] |
keyboard |
(package private) java.lang.String[] |
keys |
(package private) static int[][] |
KeyTable |
(package private) int |
lastAscii |
(package private) int |
lastButton |
(package private) int |
lastClickHwnd |
(package private) Control |
lastControl |
(package private) boolean |
lastDead |
(package private) double |
lastDistance |
(package private) Control |
lastGetControl |
(package private) int |
lastGetHwnd |
(package private) boolean |
lastHighContrast |
(package private) int |
lastHittest |
(package private) Control |
lastHittestControl |
(package private) int |
lastHwnd |
(package private) int |
lastKey |
(package private) int |
lastMouse |
(package private) boolean |
lastNull |
(package private) int |
lastTime |
(package private) boolean |
lastVirtual |
(package private) int |
lastX |
(package private) int |
lastY |
(package private) static java.lang.String |
LAUNCHER_PREFIX |
(package private) Composite[] |
layoutDeferred |
(package private) int |
layoutDeferredCount |
(package private) LOGFONT |
lfSystemFont |
(package private) static char[] |
LISTVIEW |
(package private) boolean |
lockActiveWindow |
(package private) int |
lpCustColors |
(package private) static STARTUPINFO |
lpStartupInfo |
(package private) double |
magStartDistance |
(package private) Callback |
messageCallback |
(package private) int |
messageProc |
(package private) boolean |
mnemonicKeyHit |
(package private) Dialog |
modalDialog |
(package private) Shell[] |
modalShells |
(package private) int |
monitorCount |
(package private) Monitor[] |
monitors |
MSG |
msg
the handle to the OS message queue
(Warning: This field is platform dependent)
IMPORTANT: This field is not part of the SWT
public API.
|
(package private) Callback |
msgFilterCallback |
(package private) int |
msgFilterProc |
(package private) int |
msgHook |
(package private) int |
nextTimerId |
(package private) int |
nextToolTipId |
(package private) int |
nextTrayId |
(package private) static java.lang.String |
PACKAGE_PREFIX |
(package private) NMLVDISPINFO |
plvfi |
(package private) Menu[] |
popups |
(package private) Image |
questionImage |
(package private) static int |
RESIZE_LIMIT |
(package private) int |
resizeCount |
(package private) static int |
RESOURCE_SIZE |
(package private) Resource[] |
resources |
(package private) double |
rotationAngle |
(package private) static java.lang.String |
RUN_MESSAGES_IN_IDLE_KEY |
(package private) static java.lang.String |
RUN_MESSAGES_IN_MESSAGE_PROC_KEY |
(package private) boolean |
runDragDrop |
(package private) boolean |
runMessages |
(package private) boolean |
runMessagesInIdle |
(package private) boolean |
runMessagesInMessageProc |
(package private) static char[] |
SCROLLBAR |
(package private) int |
scrollHRemainder |
(package private) int |
scrollRemainder |
(package private) boolean |
sendSettings |
(package private) static int |
SETTINGS_DELAY |
(package private) static int |
SETTINGS_ID |
(package private) int |
skinCount |
(package private) Widget[] |
skinList |
(package private) static int |
SWT_DESTROY |
(package private) static int |
SWT_GETACCEL |
(package private) static int |
SWT_GETACCELCOUNT |
(package private) static int |
SWT_KEYMSG |
(package private) static int |
SWT_NULL |
(package private) static int |
SWT_OBJECT_INDEX |
(package private) static int |
SWT_OPENDOC |
(package private) static int |
SWT_RESTORECARET |
(package private) static int |
SWT_RUNASYNC |
(package private) static int |
SWT_TRAYICONMSG |
(package private) Synchronizer |
synchronizer |
(package private) Font |
systemFont |
(package private) static char[] |
TAB |
(package private) char[] |
tableBuffer |
(package private) TaskBar |
taskBar |
(package private) static java.lang.String |
TASKBAR_EVENT |
(package private) static int |
TASKBARBUTTONCREATED |
(package private) static int |
TASKBARCREATED |
(package private) java.lang.Thread |
thread |
(package private) int |
threadId |
(package private) int[] |
timerIds |
(package private) java.lang.Runnable[] |
timerList |
(package private) ImageList[] |
toolDisabledImageList |
(package private) ImageList[] |
toolHotImageList |
(package private) ImageList[] |
toolImageList |
(package private) TouchSource[] |
touchSources |
(package private) Tray |
tray |
(package private) static char[] |
TREEVIEW |
(package private) static boolean |
TrimEnabled |
(package private) Image |
upArrow |
(package private) static java.lang.String |
USE_OWNDC_KEY |
(package private) static boolean |
USE_PROPERTY |
(package private) boolean |
useOwnDC |
(package private) java.lang.Object[] |
values |
(package private) Image |
warningIcon |
(package private) Callback |
windowCallback |
(package private) TCHAR |
windowClass |
(package private) static int |
WindowClassCount |
(package private) static java.lang.String |
WindowName |
(package private) TCHAR |
windowOwnDCClass |
(package private) static java.lang.String |
WindowOwnDCName |
(package private) int |
windowProc |
(package private) TCHAR |
windowShadowClass |
(package private) static java.lang.String |
WindowShadowName |
(package private) boolean |
xMouse |
CurrentDevice, DEBUG, DeviceFinder, hPalette
Constructor and Description |
---|
Display()
Constructs a new instance of this class.
|
Display(DeviceData data)
Constructs a new instance of this class using the parameter.
|
Modifier and Type | Method and Description |
---|---|
(package private) Control |
_getFocusControl() |
(package private) void |
addBar(Menu menu) |
(package private) void |
addControl(int handle,
Control control) |
void |
addFilter(int eventType,
Listener listener)
Adds the listener to the collection of listeners who will
be notified when an event of the given type occurs anywhere
in a widget.
|
(package private) void |
addLayoutDeferred(Composite comp) |
void |
addListener(int eventType,
Listener listener)
Adds the listener to the collection of listeners who will
be notified when an event of the given type occurs.
|
(package private) void |
addMenuItem(MenuItem item) |
(package private) void |
addPopup(Menu menu) |
(package private) void |
addSkinnableWidget(Widget widget) |
(package private) int |
asciiKey(int key) |
void |
asyncExec(java.lang.Runnable runnable)
Causes the
run() method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. |
void |
beep()
Causes the system hardware to emit a short sound
(if it supports this capability).
|
protected void |
checkDevice()
Throws an
SWTException if the receiver can not
be accessed by the caller. |
(package private) static void |
checkDisplay(java.lang.Thread thread,
boolean multiple) |
protected void |
checkSubclass()
Checks that this class can be subclassed.
|
(package private) void |
clearModal(Shell shell) |
void |
close()
Requests that the connection between SWT and the underlying
operating system be closed.
|
(package private) int |
controlKey(int key) |
protected void |
create(DeviceData data)
Creates the device in the operating system.
|
(package private) static int |
create32bitDIB(Image image) |
(package private) static int |
create32bitDIB(int hBitmap,
int alpha,
byte[] alphaData,
int transparentPixel) |
(package private) void |
createDisplay(DeviceData data) |
(package private) static Image |
createIcon(Image image) |
(package private) static int |
createMaskFromAlpha(ImageData data,
int destWidth,
int destHeight) |
(package private) static void |
deregister(Display display) |
protected void |
destroy()
Destroys the device in the operating system and releases
the device's handle.
|
(package private) void |
destroyDisplay() |
void |
disposeExec(java.lang.Runnable runnable)
Causes the
run() method of the runnable to
be invoked by the user-interface thread just before the
receiver is disposed. |
(package private) void |
drawMenuBars() |
(package private) int |
embeddedProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) void |
error(int code)
Does whatever display specific cleanup is required, and then
uses the code in
SWTError.error to handle the error. |
(package private) boolean |
filterEvent(Event event) |
(package private) boolean |
filterMessage(MSG msg) |
(package private) boolean |
filters(int eventType) |
(package private) Control |
findControl(int handle) |
static Display |
findDisplay(java.lang.Thread thread)
Returns the display which the given thread is the
user-interface thread for, or null if the given thread
is not a user-interface thread for any display.
|
(package private) TouchSource |
findTouchSource(int touchDevice,
Monitor monitor) |
Widget |
findWidget(int handle)
Given the operating system handle for a widget, returns
the instance of the
Widget subclass which
represents it in the currently running application, if
such exists, or null if no matching widget can be found. |
Widget |
findWidget(int handle,
int id)
Given the operating system handle for a widget,
and widget-specific id, returns the instance of
the
Widget subclass which represents
the handle/id pair in the currently running application,
if such exists, or null if no matching widget can be found. |
Widget |
findWidget(Widget widget,
int id)
Given a widget and a widget-specific id, returns the
instance of the
Widget subclass which represents
the widget/id pair in the currently running application,
if such exists, or null if no matching widget can be found. |
(package private) int |
foregroundIdleProc(int code,
int wParam,
int lParam) |
Shell |
getActiveShell()
Returns the currently active
Shell , or null
if no shell belonging to the currently running application
is active. |
static java.lang.String |
getAppName()
Returns the application name.
|
static java.lang.String |
getAppVersion()
Returns the application version.
|
Rectangle |
getBounds()
Returns a rectangle describing the receiver's size and location.
|
(package private) int |
getClickCount(int type,
int button,
int hwnd,
int lParam) |
Rectangle |
getClientArea()
Returns a rectangle which describes the area of the
receiver which is capable of displaying data.
|
(package private) Control |
getControl(int handle) |
static Display |
getCurrent()
Returns the display which the currently running thread is
the user-interface thread for, or null if the currently
running thread is not a user-interface thread for any display.
|
Control |
getCursorControl()
Returns the control which the on-screen pointer is currently
over top of, or null if it is not currently over one of the
controls built by the currently running application.
|
Point |
getCursorLocation()
Returns the location of the on-screen pointer relative
to the top left corner of the screen.
|
Point[] |
getCursorSizes()
Returns an array containing the recommended cursor sizes.
|
java.lang.Object |
getData()
Returns the application defined, display specific data
associated with the receiver, or null if it has not been
set.
|
java.lang.Object |
getData(java.lang.String key)
Returns the application defined property of the receiver
with the specified name, or null if it has not been set.
|
static Display |
getDefault()
Returns the default display.
|
int |
getDismissalAlignment()
Returns the button dismissal alignment, one of
LEFT or RIGHT . |
int |
getDoubleClickTime()
Returns the longest duration, in milliseconds, between
two mouse button clicks that will be considered a
double click by the underlying operating system.
|
Control |
getFocusControl()
Returns the control which currently has keyboard focus,
or null if keyboard events are not currently going to
any of the controls built by the currently running
application.
|
(package private) java.lang.String |
getFontName(LOGFONT logFont) |
boolean |
getHighContrast()
Returns true when the high contrast mode is enabled.
|
int |
getIconDepth()
Returns the maximum allowed depth of icons on this display, in bits per pixel.
|
Point[] |
getIconSizes()
Returns an array containing the recommended icon sizes.
|
(package private) ImageList |
getImageList(int style,
int width,
int height) |
(package private) ImageList |
getImageListToolBar(int style,
int width,
int height) |
(package private) ImageList |
getImageListToolBarDisabled(int style,
int width,
int height) |
(package private) ImageList |
getImageListToolBarHot(int style,
int width,
int height) |
(package private) int |
getLastEventTime() |
Menu |
getMenuBar()
Returns the single instance of the application menu bar, or
null if there is no application menu bar for the platform. |
(package private) MenuItem |
getMenuItem(int id) |
(package private) int |
getMessageCount() |
(package private) Dialog |
getModalDialog() |
(package private) Shell |
getModalShell() |
Monitor[] |
getMonitors()
Returns an array of monitors attached to the device.
|
(package private) int |
getMsgProc(int code,
int wParam,
int lParam) |
Monitor |
getPrimaryMonitor()
Returns the primary monitor for that device.
|
(package private) java.lang.String |
getSharedData(int pid,
int handle) |
Shell[] |
getShells()
Returns a (possibly empty) array containing all shells which have
not been disposed and have the receiver as their display.
|
(package private) Image |
getSortImage(int direction) |
Synchronizer |
getSynchronizer()
Gets the synchronizer used by the display.
|
java.lang.Thread |
getSyncThread()
Returns the thread that has invoked
syncExec
or null if no such runnable is currently being invoked by
the user-interface thread. |
Color |
getSystemColor(int id)
Returns the matching standard color for the given
constant, which should be one of the color constants
specified in class
SWT . |
Cursor |
getSystemCursor(int id)
Returns the matching standard platform cursor for the given
constant, which should be one of the cursor constants
specified in class
SWT . |
Font |
getSystemFont()
Returns a reasonable font for applications to use.
|
Image |
getSystemImage(int id)
Returns the matching standard platform image for the given
constant, which should be one of the icon constants
specified in class
SWT . |
Menu |
getSystemMenu()
Returns the single instance of the system-provided menu for the application, or
null on platforms where no menu is provided for the application. |
TaskBar |
getSystemTaskBar()
Returns the single instance of the system taskBar or null
when there is no system taskBar available for the platform.
|
Tray |
getSystemTray()
Returns the single instance of the system tray or null
when there is no system tray available for the platform.
|
java.lang.Thread |
getThread()
Returns the user-interface thread for the receiver.
|
boolean |
getTouchEnabled()
Returns a boolean indicating whether a touch-aware input device is
attached to the system and is ready for use.
|
(package private) int |
hButtonTheme() |
(package private) int |
hEditTheme() |
(package private) int |
hExplorerBarTheme() |
(package private) int |
hScrollBarTheme() |
(package private) int |
hTabTheme() |
protected void |
init()
Initializes any internal resources needed by the
device.
|
void |
internal_dispose_GC(int hDC,
GCData data)
Invokes platform specific functionality to dispose a GC handle.
|
int |
internal_new_GC(GCData data)
Invokes platform specific functionality to allocate a new GC handle.
|
(package private) static boolean |
isValidClass(java.lang.Class clazz) |
(package private) boolean |
isValidThread() |
(package private) boolean |
isXMouseActive() |
Point |
map(Control from,
Control to,
int x,
int y)
Maps a point from one coordinate system to another.
|
Rectangle |
map(Control from,
Control to,
int x,
int y,
int width,
int height)
Maps a point from one coordinate system to another.
|
Point |
map(Control from,
Control to,
Point point)
Maps a point from one coordinate system to another.
|
Rectangle |
map(Control from,
Control to,
Rectangle rectangle)
Maps a point from one coordinate system to another.
|
(package private) static char |
mbcsToWcs(int ch) |
(package private) static char |
mbcsToWcs(int ch,
int codePage) |
(package private) int |
messageProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) int |
monitorEnumProc(int hmonitor,
int hdc,
int lprcMonitor,
int dwData) |
(package private) int |
msgFilterProc(int code,
int wParam,
int lParam) |
(package private) int |
numpadKey(int key) |
boolean |
post(Event event)
Generate a low level system event.
|
(package private) void |
postEvent(Event event) |
boolean |
readAndDispatch()
Reads an event from the operating system's event queue,
dispatches it appropriately, and returns
true
if there is potentially more work to do, or false
if the caller can sleep until another event is placed on
the event queue. |
(package private) static void |
register(Display display) |
protected void |
release()
Releases any internal resources back to the operating
system and clears all fields except the device handle.
|
(package private) void |
releaseDisplay() |
(package private) void |
releaseImageList(ImageList list) |
(package private) void |
releaseToolDisabledImageList(ImageList list) |
(package private) void |
releaseToolHotImageList(ImageList list) |
(package private) void |
releaseToolImageList(ImageList list) |
(package private) void |
removeBar(Menu menu) |
(package private) Control |
removeControl(int handle) |
void |
removeFilter(int eventType,
Listener listener)
Removes the listener from the collection of listeners who will
be notified when an event of the given type occurs anywhere in
a widget.
|
void |
removeListener(int eventType,
Listener listener)
Removes the listener from the collection of listeners who will
be notified when an event of the given type occurs.
|
(package private) void |
removeMenuItem(MenuItem item) |
(package private) void |
removePopup(Menu menu) |
(package private) boolean |
runAsyncMessages(boolean all) |
(package private) boolean |
runDeferredEvents() |
(package private) boolean |
runDeferredLayouts() |
(package private) boolean |
runPopups() |
(package private) void |
runSettings() |
(package private) boolean |
runSkin() |
(package private) boolean |
runTimer(int id) |
(package private) void |
saveResources() |
(package private) void |
sendEvent(int eventType,
Event event) |
static void |
setAppName(java.lang.String name)
Sets the application name to the argument.
|
static void |
setAppVersion(java.lang.String version)
Sets the application version to the argument.
|
void |
setCursorLocation(int x,
int y)
Sets the location of the on-screen pointer relative to the top left corner
of the screen.
|
void |
setCursorLocation(Point point)
Sets the location of the on-screen pointer relative to the top left corner
of the screen.
|
void |
setData(java.lang.Object data)
Sets the application defined, display specific data
associated with the receiver, to the argument.
|
void |
setData(java.lang.String key,
java.lang.Object value)
Sets the application defined property of the receiver
with the specified name to the given argument.
|
(package private) static void |
setDevice(Device device) |
(package private) void |
setModalDialog(Dialog modalDailog) |
(package private) void |
setModalShell(Shell shell) |
void |
setSynchronizer(Synchronizer synchronizer)
Sets the synchronizer used by the display to be
the argument, which can not be null.
|
(package private) int |
shiftedKey(int key) |
boolean |
sleep()
Causes the user-interface thread to sleep (that is,
to be put in a state where it does not consume CPU cycles)
until an event is received or it is otherwise awakened.
|
void |
syncExec(java.lang.Runnable runnable)
Causes the
run() method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. |
void |
timerExec(int milliseconds,
java.lang.Runnable runnable)
Causes the
run() method of the runnable to
be invoked by the user-interface thread after the specified
number of milliseconds have elapsed. |
(package private) boolean |
translateAccelerator(MSG msg,
Control control) |
(package private) static int |
translateKey(int key) |
(package private) boolean |
translateMnemonic(MSG msg,
Control control) |
(package private) boolean |
translateTraversal(MSG msg,
Control control) |
(package private) static int |
untranslateKey(int key) |
void |
update()
Forces all outstanding paint requests for the display
to be processed before this method returns.
|
(package private) void |
updateImages() |
void |
wake()
If the receiver's user-interface thread was
sleep ing,
causes it to be awakened and start running again. |
(package private) void |
wakeThread() |
(package private) static int |
wcsToMbcs(char ch) |
(package private) static int |
wcsToMbcs(char ch,
int codePage) |
(package private) int |
windowProc(int hwnd,
int msg,
int wParam,
int lParam) |
(package private) static char[] |
withCrLf(char[] string) |
(package private) static java.lang.String |
withCrLf(java.lang.String string) |
dispose, getDepth, getDeviceData, getDPI, getFontList, getWarnings, isDisposed, loadFont, setWarnings
public MSG msg
IMPORTANT: This field is not 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.
static java.lang.String APP_NAME
static java.lang.String APP_VERSION
Event[] eventQueue
Callback windowCallback
int windowProc
int threadId
TCHAR windowClass
TCHAR windowShadowClass
TCHAR windowOwnDCClass
static int WindowClassCount
static final java.lang.String WindowName
static final java.lang.String WindowShadowName
static final java.lang.String WindowOwnDCName
EventTable eventTable
EventTable filterTable
boolean useOwnDC
int freeSlot
int[] indexTable
Control lastControl
Control lastGetControl
int lastHwnd
int lastGetHwnd
Control[] controlTable
static final int GROW_SIZE
static final int SWT_OBJECT_INDEX
static final boolean USE_PROPERTY
static STARTUPINFO lpStartupInfo
int hButtonTheme
int hEditTheme
int hExplorerBarTheme
int hScrollBarTheme
int hTabTheme
static final char[] BUTTON
static final char[] EDIT
static final char[] EXPLORER
static final char[] EXPLORERBAR
static final char[] SCROLLBAR
static final char[] LISTVIEW
static final char[] TAB
static final char[] TREEVIEW
int focusEvent
Control focusControl
boolean fixFocus
Menu[] bars
Menu[] popups
MenuItem[] items
static final int ID_START
Callback msgFilterCallback
int msgFilterProc
int filterHook
MSG hookMsg
boolean runDragDrop
boolean dragCancelled
Callback foregroundIdleCallback
int foregroundIdleProc
int idleHook
boolean ignoreNextKey
Callback getMsgCallback
Callback embeddedCallback
int getMsgProc
int msgHook
int embeddedHwnd
int embeddedProc
static final java.lang.String AWT_WINDOW_CLASS
static final short[] ACCENTS
Synchronizer synchronizer
boolean runMessages
boolean runMessagesInIdle
boolean runMessagesInMessageProc
static final java.lang.String RUN_MESSAGES_IN_IDLE_KEY
static final java.lang.String RUN_MESSAGES_IN_MESSAGE_PROC_KEY
static final java.lang.String USE_OWNDC_KEY
static final java.lang.String ACCEL_KEY_HIT
java.lang.Thread thread
java.lang.Runnable[] disposeList
Composite[] layoutDeferred
int layoutDeferredCount
Tray tray
int nextTrayId
TaskBar taskBar
static final java.lang.String TASKBAR_EVENT
static final java.lang.String LAUNCHER_PREFIX
int[] timerIds
java.lang.Runnable[] timerList
int nextTimerId
static final int SETTINGS_ID
static final int SETTINGS_DELAY
boolean lastHighContrast
boolean sendSettings
RECT clickRect
int clickCount
int lastTime
int lastButton
int lastClickHwnd
int scrollRemainder
int scrollHRemainder
int lastKey
int lastMouse
int lastAscii
boolean lastVirtual
boolean lastNull
boolean lastDead
byte[] keyboard
boolean accelKeyHit
boolean mnemonicKeyHit
boolean lockActiveWindow
boolean captureChanged
boolean xMouse
double magStartDistance
double lastDistance
double rotationAngle
int lastX
int lastY
TouchSource[] touchSources
int nextToolTipId
boolean ignoreRestoreFocus
Control lastHittestControl
int lastHittest
Callback messageCallback
int hwndMessage
int messageProc
LOGFONT lfSystemFont
Font systemFont
Image errorImage
Image infoImage
Image questionImage
Image warningIcon
Cursor[] cursors
Resource[] resources
static final int RESOURCE_SIZE
ImageList[] imageList
ImageList[] toolImageList
ImageList[] toolHotImageList
ImageList[] toolDisabledImageList
int lpCustColors
Image upArrow
Image downArrow
char[] tableBuffer
NMHDR hdr
NMLVDISPINFO plvfi
int hwndParent
int columnCount
boolean[] columnVisible
int resizeCount
static final int RESIZE_LIMIT
java.lang.Object data
java.lang.String[] keys
java.lang.Object[] values
static final int[][] KeyTable
static Display Default
static Display[] Displays
Monitor[] monitors
int monitorCount
Shell[] modalShells
Dialog modalDialog
static boolean TrimEnabled
static final int SWT_GETACCELCOUNT
static final int SWT_GETACCEL
static final int SWT_KEYMSG
static final int SWT_DESTROY
static final int SWT_TRAYICONMSG
static final int SWT_NULL
static final int SWT_RUNASYNC
static int TASKBARCREATED
static int TASKBARBUTTONCREATED
static int SWT_RESTORECARET
static int DI_GETDRAGIMAGE
static int SWT_OPENDOC
int hitCount
Widget[] skinList
int skinCount
static final java.lang.String PACKAGE_PREFIX
public Display()
Note: The resulting display is marked as the current display. If this is the first display which has been constructed since the application started, it is also marked as the default display.
SWTException
- getCurrent()
,
getDefault()
,
Widget.checkSubclass()
,
Shell
public Display(DeviceData data)
data
- the device datastatic void setDevice(Device device)
Control _getFocusControl()
void addBar(Menu menu)
void addControl(int handle, Control control)
void addSkinnableWidget(Widget widget)
public void addFilter(int eventType, Listener listener)
SWT
. When the event does occur,
the listener is notified by sending it the handleEvent()
message.
Setting the type of an event to SWT.None
from
within the handleEvent()
method can be used to
change the event type and stop subsequent Java listeners
from running. Because event filters run before other listeners,
event filters can both block other listeners and set arbitrary
fields within an event. For this reason, event filters are both
powerful and dangerous. They should generally be avoided for
performance, debugging and code maintenance reasons.
eventType
- the type of event to listen forlistener
- the listener which should be notified when the event occursjava.lang.IllegalArgumentException
- SWTException
- Listener
,
SWT
,
removeFilter(int, org.eclipse.swt.widgets.Listener)
,
removeListener(int, org.eclipse.swt.widgets.Listener)
void addLayoutDeferred(Composite comp)
public void addListener(int eventType, Listener listener)
SWT
.
When the event does occur in the display, the listener is notified by
sending it the handleEvent()
message.eventType
- the type of event to listen forlistener
- the listener which should be notified when the event occursjava.lang.IllegalArgumentException
- SWTException
- Listener
,
SWT
,
removeListener(int, org.eclipse.swt.widgets.Listener)
void addMenuItem(MenuItem item)
void addPopup(Menu menu)
int asciiKey(int key)
public void asyncExec(java.lang.Runnable runnable)
run()
method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. The caller of this method continues
to run in parallel, and is not notified when the
runnable has completed. Specifying null
as the
runnable simply wakes the user-interface thread when run.
Note that at the time the runnable is invoked, widgets that have the receiver as their display may have been disposed. Therefore, it is necessary to check for this case inside the runnable before accessing the widget.
runnable
- code to run on the user-interface thread or null
SWTException
- syncExec(java.lang.Runnable)
public void beep()
SWTException
- protected void checkSubclass()
IMPORTANT: See the comment in Widget.checkSubclass()
.
SWTException
- Widget.checkSubclass()
protected void checkDevice()
Device
SWTException
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 should be called by
device implementors to enforce the standard SWT invariants.
Currently, it is an error to invoke any method (other than
isDisposed()
and dispose()
) on a
device that has had its dispose()
method called.
In future releases of SWT, there may be more or fewer error checks and exceptions may be thrown for different reasons.
checkDevice
in class Device
static void checkDisplay(java.lang.Thread thread, boolean multiple)
void clearModal(Shell shell)
int controlKey(int key)
public void close()
SWTException
- Device.dispose()
protected void create(DeviceData data)
This method is called before init
.
void createDisplay(DeviceData data)
static int create32bitDIB(Image image)
static int create32bitDIB(int hBitmap, int alpha, byte[] alphaData, int transparentPixel)
static int createMaskFromAlpha(ImageData data, int destWidth, int destHeight)
static void deregister(Display display)
protected void destroy()
This method is called after release
.
destroy
in class Device
Device.dispose()
,
release()
void destroyDisplay()
public void disposeExec(java.lang.Runnable runnable)
run()
method of the runnable to
be invoked by the user-interface thread just before the
receiver is disposed. Specifying a null
runnable
is ignored.runnable
- code to run at dispose time.SWTException
- void drawMenuBars()
int embeddedProc(int hwnd, int msg, int wParam, int lParam)
void error(int code)
SWTError.error
to handle the error.code
- the descriptive error codeSWT.error(int)
boolean filterEvent(Event event)
boolean filters(int eventType)
boolean filterMessage(MSG msg)
Control findControl(int handle)
public Widget findWidget(int handle)
Widget
subclass which
represents it in the currently running application, if
such exists, or null if no matching widget can be found.
IMPORTANT: This method should not be called from application code. The arguments are platform-specific.
handle
- the handle for the widgetSWTException
- public Widget findWidget(int handle, int id)
Widget
subclass which represents
the handle/id pair in the currently running application,
if such exists, or null if no matching widget can be found.
IMPORTANT: This method should not be called from application code. The arguments are platform-specific.
handle
- the handle for the widgetid
- the id for the subwidget (usually an item)SWTException
- public Widget findWidget(Widget widget, int id)
Widget
subclass which represents
the widget/id pair in the currently running application,
if such exists, or null if no matching widget can be found.widget
- the widgetid
- the id for the subwidget (usually an item)SWTException
- int foregroundIdleProc(int code, int wParam, int lParam)
public static Display findDisplay(java.lang.Thread thread)
null
as the thread will return null
for the display.thread
- the user-interface threadTouchSource findTouchSource(int touchDevice, Monitor monitor)
public Shell getActiveShell()
Shell
, or null
if no shell belonging to the currently running application
is active.SWTException
- public Menu getMenuBar()
null
if there is no application menu bar for the platform.null
SWTException
- public Rectangle getBounds()
getBounds
in class Device
SWTException
- public static Display getCurrent()
int getClickCount(int type, int button, int hwnd, int lParam)
public Rectangle getClientArea()
getClientArea
in class Device
SWTException
- getBounds()
Control getControl(int handle)
public Control getCursorControl()
null
SWTException
- public Point getCursorLocation()
SWTException
- public Point[] getCursorSizes()
SWTException
- public static Display getDefault()
static boolean isValidClass(java.lang.Class clazz)
public java.lang.Object getData(java.lang.String key)
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 display is disposed
of, it is the application's responsibility to provide a
disposeExec()
handler which does so.
key
- the name of the propertyjava.lang.IllegalArgumentException
- SWTException
- setData(String, Object)
,
disposeExec(Runnable)
public java.lang.Object getData()
Applications may put arbitrary objects in this field. If
the object stored in the display specific data needs to
be notified when the display is disposed of, it is the
application's responsibility to provide a
disposeExec()
handler which does so.
SWTException
- setData(Object)
,
disposeExec(Runnable)
public int getDismissalAlignment()
LEFT
or RIGHT
.
The button dismissal alignment is the ordering that should be used when positioning the
default dismissal button for a dialog. For example, in a dialog that contains an OK and
CANCEL button, on platforms where the button dismissal alignment is LEFT
, the
button ordering should be OK/CANCEL. When button dismissal alignment is RIGHT
,
the button ordering should be CANCEL/OK.SWTException
- public int getDoubleClickTime()
SWTException
- public Control getFocusControl()
null
SWTException
- java.lang.String getFontName(LOGFONT logFont)
public boolean getHighContrast()
Note: This operation is a hint and is not supported on platforms that do not have this concept.
SWTException
- public int getIconDepth()
SWTException
- Device.getDepth()
public Point[] getIconSizes()
SWTException
- Decorations.setImages(Image[])
ImageList getImageList(int style, int width, int height)
ImageList getImageListToolBar(int style, int width, int height)
ImageList getImageListToolBarDisabled(int style, int width, int height)
ImageList getImageListToolBarHot(int style, int width, int height)
int getLastEventTime()
MenuItem getMenuItem(int id)
int getMessageCount()
Shell getModalShell()
Dialog getModalDialog()
public Monitor[] getMonitors()
int getMsgProc(int code, int wParam, int lParam)
public Monitor getPrimaryMonitor()
public Shell[] getShells()
SWTException
- Image getSortImage(int direction)
public Synchronizer getSynchronizer()
SWTException
- public java.lang.Thread getSyncThread()
syncExec
or null if no such runnable is currently being invoked by
the user-interface thread.
Note: If a runnable invoked by asyncExec is currently running, this method will return null.
SWTException
- public Color getSystemColor(int id)
SWT
. Any value other
than one of the SWT color constants which is passed
in will result in the color black. This color should
not be free'd because it was allocated by the system,
not the application.getSystemColor
in class Device
id
- the color constantSWTException
- SWT
public Cursor getSystemCursor(int id)
SWT
. This cursor should
not be free'd because it was allocated by the system,
not the application. A value of null
will
be returned if the supplied constant is not an SWT cursor
constant.id
- the SWT cursor constantnull
SWTException
- SWT.CURSOR_ARROW
,
SWT.CURSOR_WAIT
,
SWT.CURSOR_CROSS
,
SWT.CURSOR_APPSTARTING
,
SWT.CURSOR_HELP
,
SWT.CURSOR_SIZEALL
,
SWT.CURSOR_SIZENESW
,
SWT.CURSOR_SIZENS
,
SWT.CURSOR_SIZENWSE
,
SWT.CURSOR_SIZEWE
,
SWT.CURSOR_SIZEN
,
SWT.CURSOR_SIZES
,
SWT.CURSOR_SIZEE
,
SWT.CURSOR_SIZEW
,
SWT.CURSOR_SIZENE
,
SWT.CURSOR_SIZESE
,
SWT.CURSOR_SIZESW
,
SWT.CURSOR_SIZENW
,
SWT.CURSOR_UPARROW
,
SWT.CURSOR_IBEAM
,
SWT.CURSOR_NO
,
SWT.CURSOR_HAND
public Font getSystemFont()
Typically, applications which want the default look should simply not set the font on the widgets they create. Widgets are always created with the correct default font for the class of user-interface component they represent.
getSystemFont
in class Device
SWTException
- public Image getSystemImage(int id)
SWT
. This image should
not be free'd because it was allocated by the system,
not the application. A value of null
will
be returned either if the supplied constant is not an
SWT icon constant or if the platform does not define an
image that corresponds to the constant.id
- the SWT icon constantnull
SWTException
- SWT.ICON_ERROR
,
SWT.ICON_INFORMATION
,
SWT.ICON_QUESTION
,
SWT.ICON_WARNING
,
SWT.ICON_WORKING
public Menu getSystemMenu()
null
on platforms where no menu is provided for the application.null
SWTException
- public TaskBar getSystemTaskBar()
null
SWTException
- public Tray getSystemTray()
null
SWTException
- public java.lang.Thread getThread()
SWTException
- public boolean getTouchEnabled()
true
if a touch-aware input device is detected, or false
otherwiseSWTException
- int hButtonTheme()
int hEditTheme()
int hExplorerBarTheme()
int hScrollBarTheme()
int hTabTheme()
public int internal_new_GC(GCData data)
IMPORTANT: This method is not part of the public
API for Display
. 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.
internal_new_GC
in interface Drawable
internal_new_GC
in class Device
data
- the platform specific GC dataSWTException
- SWTError
- protected void init()
This method is called after create
.
init
in class Device
create(org.eclipse.swt.graphics.DeviceData)
public void internal_dispose_GC(int hDC, GCData data)
IMPORTANT: This method is not part of the public
API for Display
. 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.
internal_dispose_GC
in interface Drawable
internal_dispose_GC
in class Device
hDC
- the platform specific GC handledata
- the platform specific GC databoolean isXMouseActive()
boolean isValidThread()
public Point map(Control from, Control to, Point point)
NOTE: On right-to-left platforms where the coordinate systems are mirrored, special care needs to be taken when mapping coordinates from one control to another to ensure the result is correctly mirrored. Mapping a point that is the origin of a rectangle and then adding the width and height is not equivalent to mapping the rectangle. When one control is mirrored and the other is not, adding the width and height to a point that was mapped causes the rectangle to extend in the wrong direction. Mapping the entire rectangle instead of just one point causes both the origin and the corner of the rectangle to be mapped.
from
- the source Control
or null
to
- the destination Control
or null
point
- to be mappedjava.lang.IllegalArgumentException
- SWTException
- public Point map(Control from, Control to, int x, int y)
NOTE: On right-to-left platforms where the coordinate systems are mirrored, special care needs to be taken when mapping coordinates from one control to another to ensure the result is correctly mirrored. Mapping a point that is the origin of a rectangle and then adding the width and height is not equivalent to mapping the rectangle. When one control is mirrored and the other is not, adding the width and height to a point that was mapped causes the rectangle to extend in the wrong direction. Mapping the entire rectangle instead of just one point causes both the origin and the corner of the rectangle to be mapped.
from
- the source Control
or null
to
- the destination Control
or null
x
- coordinates to be mappedy
- coordinates to be mappedjava.lang.IllegalArgumentException
- SWTException
- public Rectangle map(Control from, Control to, Rectangle rectangle)
NOTE: On right-to-left platforms where the coordinate systems are mirrored, special care needs to be taken when mapping coordinates from one control to another to ensure the result is correctly mirrored. Mapping a point that is the origin of a rectangle and then adding the width and height is not equivalent to mapping the rectangle. When one control is mirrored and the other is not, adding the width and height to a point that was mapped causes the rectangle to extend in the wrong direction. Mapping the entire rectangle instead of just one point causes both the origin and the corner of the rectangle to be mapped.
from
- the source Control
or null
to
- the destination Control
or null
rectangle
- to be mappedjava.lang.IllegalArgumentException
- SWTException
- public Rectangle map(Control from, Control to, int x, int y, int width, int height)
NOTE: On right-to-left platforms where the coordinate systems are mirrored, special care needs to be taken when mapping coordinates from one control to another to ensure the result is correctly mirrored. Mapping a point that is the origin of a rectangle and then adding the width and height is not equivalent to mapping the rectangle. When one control is mirrored and the other is not, adding the width and height to a point that was mapped causes the rectangle to extend in the wrong direction. Mapping the entire rectangle instead of just one point causes both the origin and the corner of the rectangle to be mapped.
from
- the source Control
or null
to
- the destination Control
or null
x
- coordinates to be mappedy
- coordinates to be mappedwidth
- coordinates to be mappedheight
- coordinates to be mappedjava.lang.IllegalArgumentException
- SWTException
- static char mbcsToWcs(int ch)
static char mbcsToWcs(int ch, int codePage)
int messageProc(int hwnd, int msg, int wParam, int lParam)
java.lang.String getSharedData(int pid, int handle)
int monitorEnumProc(int hmonitor, int hdc, int lprcMonitor, int dwData)
int msgFilterProc(int code, int wParam, int lParam)
int numpadKey(int key)
public boolean post(Event event)
post
is used to generate low level keyboard
and mouse events. The intent is to enable automated UI
testing by simulating the input from the user. Most
SWT applications should never need to call this method.
Note that this operation can fail when the operating system fails to generate the event for any reason. For example, this can happen when there is no such key or mouse button or when the system event queue is full.
Event Types:
KeyDown, KeyUp
The following fields in the Event
apply:
Either one of:
SWT
MouseDown, MouseUp
The following fields in the Event
apply:
MouseMove
The following fields in the Event
apply:
MouseWheel
The following fields in the Event
apply:
event
- the event to be generatedjava.lang.IllegalArgumentException
- SWTException
- void postEvent(Event event)
public boolean readAndDispatch()
true
if there is potentially more work to do, or false
if the caller can sleep until another event is placed on
the event queue.
In addition to checking the system event queue, this method also
checks if any inter-thread messages (created by syncExec()
or asyncExec()
) are waiting to be processed, and if
so handles them before returning.
false
if the caller can sleep upon return from this methodSWTException
- sleep()
,
wake()
static void register(Display display)
protected void release()
Disposes all shells which are currently open on the display.
After this method has been invoked, all related related shells
will answer true
when sent the message
isDisposed()
.
When a device is destroyed, resources that were acquired
on behalf of the programmer need to be returned to the
operating system. For example, if the device allocated a
font to be used as the system font, this font would be
freed in release
. Also,to assist the garbage
collector and minimize the amount of memory that is not
reclaimed when the programmer keeps a reference to a
disposed device, all fields except the handle are zero'd.
The handle is needed by destroy
.
destroy
.release
in class Device
Device.dispose()
,
destroy()
void releaseDisplay()
void releaseImageList(ImageList list)
void releaseToolImageList(ImageList list)
void releaseToolHotImageList(ImageList list)
void releaseToolDisabledImageList(ImageList list)
public void removeFilter(int eventType, Listener listener)
SWT
.eventType
- the type of event to listen forlistener
- the listener which should no longer be notified when the event occursjava.lang.IllegalArgumentException
- SWTException
- Listener
,
SWT
,
addFilter(int, org.eclipse.swt.widgets.Listener)
,
addListener(int, org.eclipse.swt.widgets.Listener)
public void removeListener(int eventType, Listener listener)
SWT
.eventType
- the type of event to listen forlistener
- the listener which should no longer be notifiedjava.lang.IllegalArgumentException
- SWTException
- Listener
,
SWT
,
addListener(int, org.eclipse.swt.widgets.Listener)
void removeBar(Menu menu)
Control removeControl(int handle)
void removeMenuItem(MenuItem item)
void removePopup(Menu menu)
boolean runAsyncMessages(boolean all)
boolean runDeferredEvents()
boolean runDeferredLayouts()
boolean runPopups()
void runSettings()
boolean runSkin()
boolean runTimer(int id)
void saveResources()
void sendEvent(int eventType, Event event)
public void setCursorLocation(int x, int y)
x
- the new x coordinate for the cursory
- the new y coordinate for the cursorSWTException
- public void setCursorLocation(Point point)
point
- new positionSWTException
- public void setData(java.lang.String key, java.lang.Object value)
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 display is disposed
of, it is the application's responsibility provide a
disposeExec()
handler which does so.
key
- the name of the propertyvalue
- the new value for the propertyjava.lang.IllegalArgumentException
- SWTException
- getData(String)
,
disposeExec(Runnable)
public void setData(java.lang.Object data)
Applications may put arbitrary objects in this field. If
the object stored in the display specific data needs to
be notified when the display is disposed of, it is the
application's responsibility provide a
disposeExec()
handler which does so.
data
- the new display specific dataSWTException
- getData()
,
disposeExec(Runnable)
public static java.lang.String getAppName()
setAppName(String)
public static java.lang.String getAppVersion()
setAppVersion(String)
public static void setAppName(java.lang.String name)
The application name can be used in several ways, depending on the platform and tools being used. On Motif, for example, this can be used to set the name used for resource lookup. Accessibility tools may also ask for the application name.
Specifying null
for the name clears it.
name
- the new app name or null
public static void setAppVersion(java.lang.String version)
version
- the new app versionvoid setModalDialog(Dialog modalDailog)
void setModalShell(Shell shell)
public void setSynchronizer(Synchronizer synchronizer)
synchronizer
- the new synchronizer for the display (must not be null)java.lang.IllegalArgumentException
- SWTException
- int shiftedKey(int key)
public boolean sleep()
true
if an event requiring dispatching was placed on the queue.SWTException
- wake()
public void syncExec(java.lang.Runnable runnable)
run()
method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. The thread which calls this method
is suspended until the runnable completes. Specifying null
as the runnable simply wakes the user-interface thread.
Note that at the time the runnable is invoked, widgets that have the receiver as their display may have been disposed. Therefore, it is necessary to check for this case inside the runnable before accessing the widget.
runnable
- code to run on the user-interface thread or null
SWTException
- asyncExec(java.lang.Runnable)
public void timerExec(int milliseconds, java.lang.Runnable runnable)
run()
method of the runnable to
be invoked by the user-interface thread after the specified
number of milliseconds have elapsed. If milliseconds is less
than zero, the runnable is not executed.
Note that at the time the runnable is invoked, widgets that have the receiver as their display may have been disposed. Therefore, it is necessary to check for this case inside the runnable before accessing the widget.
milliseconds
- the delay before running the runnablerunnable
- code to run on the user-interface threadjava.lang.IllegalArgumentException
- SWTException
- asyncExec(java.lang.Runnable)
static int translateKey(int key)
static int untranslateKey(int key)
public void update()
SWTException
- Control.update()
void updateImages()
public void wake()
sleep
ing,
causes it to be awakened and start running again. Note that this
method may be called from any thread.SWTException
- sleep()
void wakeThread()
static int wcsToMbcs(char ch, int codePage)
static int wcsToMbcs(char ch)
int windowProc(int hwnd, int msg, int wParam, int lParam)
static java.lang.String withCrLf(java.lang.String string)
static char[] withCrLf(char[] string)