|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.swt.graphics.Device | +--org.eclipse.swt.widgets.Display
Unsafe:
Field Summary | |
(package private) boolean |
accelKeyHit
|
(package private) Menu[] |
bars
|
(package private) Object |
data
|
(package private) static Display |
Default
|
(package private) static Display[] |
Displays
|
(package private) Runnable[] |
disposeList
|
(package private) Event[] |
eventQueue
|
(package private) EventTable |
eventTable
|
(package private) EventTable |
filterTable
|
(package private) int |
hHook
|
(package private) org.eclipse.swt.internal.win32.MSG |
hookMsg
|
(package private) int |
hwndMessage
|
(package private) ImageList[] |
imageList
|
(package private) byte[] |
keyboard
|
(package private) String[] |
keys
|
(package private) static int[][] |
KeyTable
|
(package private) int |
lastAscii
|
(package private) int |
lastKey
|
(package private) int |
lastMouse
|
(package private) boolean |
lastNull
|
(package private) boolean |
lastVirtual
|
(package private) boolean |
lockActiveWindow
|
(package private) int |
lpCustColors
|
(package private) org.eclipse.swt.internal.Callback |
messageCallback
|
(package private) int |
messageProc
|
(package private) boolean |
mnemonicKeyHit
|
(package private) Shell[] |
modalWidgets
|
org.eclipse.swt.internal.win32.MSG |
msg
Suppressed: the handle to the OS message queue (Warning: This field is platform dependent) |
(package private) org.eclipse.swt.internal.Callback |
msgFilterCallback
|
(package private) int |
msgFilterProc
|
(package private) static String |
PACKAGE_PREFIX
|
(package private) Menu[] |
popups
|
(package private) int |
processId
|
(package private) Synchronizer |
synchronizer
|
(package private) int[] |
systemFonts
|
(package private) Thread |
thread
|
(package private) int |
threadId
|
(package private) int |
timerCount
|
(package private) int[] |
timerIds
|
(package private) Runnable[] |
timerList
|
(package private) ImageList[] |
toolDisabledImageList
|
(package private) ImageList[] |
toolHotImageList
|
(package private) ImageList[] |
toolImageList
|
(package private) static boolean |
TrimEnabled
|
(package private) Object[] |
values
|
(package private) org.eclipse.swt.internal.Callback |
windowCallback
|
(package private) org.eclipse.swt.internal.win32.TCHAR |
windowClass
|
(package private) static int |
WindowClassCount
|
(package private) static String |
WindowName
|
(package private) int |
windowProc
|
Fields inherited from class org.eclipse.swt.graphics.Device |
CurrentDevice, DEBUG, DeviceFinder, hPalette |
Constructor Summary | |
Display()
Enabled: Constructs a new instance of this class. |
|
Display(DeviceData data)
Suppressed: |
Method Summary | |
(package private) void |
addBar(Menu menu)
|
(package private) void |
addFilter(int eventType,
Listener listener)
Adds the listener to the collection of listeners who will be notifed when an event of the given type occurs anywhere in SWT. |
void |
addListener(int eventType,
Listener listener)
Suppressed: Adds the listener to the collection of listeners who will be notifed when an event of the given type occurs. |
(package private) void |
addPopup(Menu menu)
|
(package private) int |
asciiKey(int key)
|
void |
asyncExec(Runnable runnable)
Suppressed: Causes the run() method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. |
void |
beep()
Enabled: 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(Thread thread)
|
protected void |
checkSubclass()
Checks that this class can be subclassed. |
(package private) void |
clearModal(Shell shell)
|
void |
close()
Enabled: 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) void |
createDisplay(DeviceData data)
|
(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(Runnable runnable)
Suppressed: 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) 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(org.eclipse.swt.internal.win32.MSG msg)
|
(package private) boolean |
filters(int eventType)
|
(package private) Control |
findControl(int handle)
|
static Display |
findDisplay(Thread thread)
Suppressed: 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. |
Widget |
findWidget(int handle)
Suppressed: 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. |
Shell |
getActiveShell()
Enabled: Returns the currently active Shell , or null
if no shell belonging to the currently running application
is active. |
Rectangle |
getBounds()
Suppressed: Returns a rectangle describing the receiver's size and location. |
Rectangle |
getClientArea()
Suppressed: Returns a rectangle which describes the area of the receiver which is capable of displaying data. |
static Display |
getCurrent()
Enabled: 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()
Enabled: 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()
Enabled: Returns the location of the on-screen pointer relative to the top left corner of the screen. |
Object |
getData()
Suppressed: Returns the application defined, display specific data associated with the receiver, or null if it has not been set. |
Object |
getData(String key)
Suppressed: Returns the application defined property of the receiver with the specified name, or null if it has not been set. |
static Display |
getDefault()
Enabled: Returns the default display. |
int |
getDismissalAlignment()
Suppressed: Returns the button dismissal alignment, one of LEFT or RIGHT . |
int |
getDoubleClickTime()
Suppressed: 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()
Enabled: 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. |
int |
getIconDepth()
Suppressed: Returns the maximum allowed depth of icons on this display. |
(package private) ImageList |
getImageList(Point size)
|
(package private) int |
getLastEventTime()
|
(package private) Shell |
getModalShell()
|
Shell[] |
getShells()
Enabled: Returns an array containing all shells which have not been disposed and have the receiver as their display. |
Thread |
getSyncThread()
Suppressed: 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)
Enabled: Returns the matching standard color for the given constant, which should be one of the color constants specified in class SWT . |
Font |
getSystemFont()
Enabled: Returns a reasonable font for applications to use. |
Thread |
getThread()
Suppressed: Returns the user-interface thread for the receiver. |
(package private) ImageList |
getToolDisabledImageList(Point size)
|
(package private) ImageList |
getToolHotImageList(Point size)
|
(package private) ImageList |
getToolImageList(Point size)
|
protected void |
init()
Initializes any internal resources needed by the device. |
void |
internal_dispose_GC(int hDC,
GCData data)
Suppressed: Invokes platform specific functionality to dispose a GC handle. |
int |
internal_new_GC(GCData data)
Suppressed: Invokes platform specific functionality to allocate a new GC handle. |
(package private) static boolean |
isValidClass(Class clazz)
|
(package private) boolean |
isValidThread()
|
(package private) boolean |
isVirtualKey(int key)
|
(package private) boolean |
isWakeMessage(org.eclipse.swt.internal.win32.MSG msg)
|
(package private) int |
messageProc(int hwnd,
int msg,
int wParam,
int lParam)
|
(package private) int |
msgFilterProc(int code,
int wParam,
int lParam)
|
(package private) int |
numpadKey(int key)
|
(package private) void |
postEvent(Event event)
|
boolean |
readAndDispatch()
Enabled: 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) void |
removeFilter(int eventType,
Listener listener)
Removes the listener from the collection of listeners who will be notifed when an event of the given type occurs anywhere in SWT. |
void |
removeListener(int eventType,
Listener listener)
Suppressed: Removes the listener from the collection of listeners who will be notifed when an event of the given type occurs. |
(package private) void |
removePopup(Menu menu)
|
(package private) boolean |
runAsyncMessages()
|
(package private) boolean |
runDeferredEvents()
|
(package private) boolean |
runPopups()
|
(package private) boolean |
runTimer(int id)
|
(package private) void |
sendEvent(int eventType,
Event event)
|
static void |
setAppName(String name)
Suppressed: On platforms which support it, sets the application name to be the argument. |
void |
setCursorLocation(int x,
int y)
Suppressed: Sets the location of the on-screen pointer relative to the top left corner of the screen. |
void |
setCursorLocation(Point point)
Suppressed: Sets the location of the on-screen pointer relative to the top left corner of the screen. |
void |
setData(Object data)
Suppressed: Sets the application defined, display specific data associated with the receiver, to the argument. |
void |
setData(String key,
Object value)
Suppressed: 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 |
setModalShell(Shell shell)
|
void |
setSynchronizer(Synchronizer synchronizer)
Suppressed: Sets the synchronizer used by the display to be the argument, which can not be null. |
(package private) int |
shiftedKey(int key)
|
boolean |
sleep()
Enabled: 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(Runnable runnable)
Suppressed: Causes the run() method of the runnable to
be invoked by the user-interface thread at the next
reasonable opportunity. |
(package private) int |
systemFont()
|
void |
timerExec(int milliseconds,
Runnable runnable)
Suppressed: 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(org.eclipse.swt.internal.win32.MSG msg,
Control control)
|
(package private) static int |
translateKey(int key)
|
(package private) boolean |
translateMnemonic(org.eclipse.swt.internal.win32.MSG msg,
Control control)
|
(package private) boolean |
translateTraversal(org.eclipse.swt.internal.win32.MSG msg,
Control control)
|
(package private) static int |
untranslateKey(int key)
|
void |
update()
Suppressed: Forces all outstanding paint requests for the display to be processed before this method returns. |
(package private) void |
updateFont()
|
void |
wake()
Suppressed: If the receiver's user-interface thread was sleep 'ing,
causes it to be awakened and start running again. |
(package private) int |
windowProc(int hwnd,
int msg,
int wParam,
int lParam)
|
(package private) static String |
withCrLf(String string)
|
Methods inherited from class org.eclipse.swt.graphics.Device |
dispose, getDepth, getDeviceData, getDPI, getFontList, getWarnings, isDisposed, setWarnings |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public org.eclipse.swt.internal.win32.MSG msg
Event[] eventQueue
org.eclipse.swt.internal.Callback windowCallback
int windowProc
int threadId
int processId
org.eclipse.swt.internal.win32.TCHAR windowClass
static int WindowClassCount
static final String WindowName
EventTable eventTable
EventTable filterTable
org.eclipse.swt.internal.Callback msgFilterCallback
int msgFilterProc
int hHook
org.eclipse.swt.internal.win32.MSG hookMsg
Synchronizer synchronizer
Thread thread
Runnable[] disposeList
int timerCount
int[] timerIds
Runnable[] timerList
boolean lockActiveWindow
boolean lastVirtual
boolean lastNull
int lastKey
int lastAscii
int lastMouse
byte[] keyboard
boolean accelKeyHit
boolean mnemonicKeyHit
int hwndMessage
int messageProc
org.eclipse.swt.internal.Callback messageCallback
int[] systemFonts
ImageList[] imageList
ImageList[] toolImageList
ImageList[] toolHotImageList
ImageList[] toolDisabledImageList
int lpCustColors
Object data
String[] keys
Object[] values
Menu[] bars
Menu[] popups
static final int[][] KeyTable
static Display Default
static Display[] Displays
Shell[] modalWidgets
static boolean TrimEnabled
static final String PACKAGE_PREFIX
Constructor Detail |
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.
getCurrent()
,
getDefault()
,
Widget.checkSubclass()
,
Shell
public Display(DeviceData data)
Method Detail |
static void setDevice(Device device)
int asciiKey(int key)
void addFilter(int eventType, Listener listener)
handleEvent()
message.
eventType
- the type of event to listen forlistener
- the listener which should be notified when the event occursListener
,
removeFilter(int, org.eclipse.swt.widgets.Listener)
,
removeListener(int, org.eclipse.swt.widgets.Listener)
public void addListener(int eventType, Listener listener)
handleEvent()
message.
eventType
- the type of event to listen forlistener
- the listener which should be notified when the event occursListener
,
removeListener(int, org.eclipse.swt.widgets.Listener)
void addBar(Menu menu)
void addPopup(Menu menu)
public void asyncExec(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.
runnable
- code to run on the user-interface thread.syncExec(java.lang.Runnable)
public void beep()
protected void checkSubclass()
IMPORTANT: See the comment in Widget.checkSubclass()
.
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(Thread thread)
void clearModal(Shell shell)
int controlKey(int key)
public void close()
Device.dispose()
protected void create(DeviceData data)
This method is called before init
.
create
in class Device
data
- the DeviceData which describes the receiverinit()
void createDisplay(DeviceData data)
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(Runnable runnable)
run()
method of the runnable to
be invoked by the user-interface thread just before the
receiver is disposed.
runnable
- code to run at dispose time.void drawMenuBars()
void error(int code)
SWTError.error
to handle the error.
code
- the descriptive error codeSWTError#error
boolean filterEvent(Event event)
boolean filters(int eventType)
boolean filterMessage(org.eclipse.swt.internal.win32.MSG msg)
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.
handle
- the handle for the widget
Control findControl(int handle)
public static Display findDisplay(Thread thread)
thread
- the user-interface thread
public Shell getActiveShell()
Shell
, or null
if no shell belonging to the currently running application
is active.
public Rectangle getBounds()
getBounds
in class Device
public static Display getCurrent()
public Rectangle getClientArea()
getClientArea
in class Device
getBounds()
public Control getCursorControl()
public Point getCursorLocation()
public static Display getDefault()
static boolean isValidClass(Class clazz)
public Object getData(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 provide a
disposeExec()
handler which does so.
key
- the name of the property
setData(java.lang.String, java.lang.Object)
,
disposeExec(java.lang.Runnable)
public 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 provide a
disposeExec()
handler which does so.
setData(java.lang.String, java.lang.Object)
,
disposeExec(java.lang.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.
public int getDoubleClickTime()
public Control getFocusControl()
public int getIconDepth()
ImageList getImageList(Point size)
ImageList getToolImageList(Point size)
ImageList getToolHotImageList(Point size)
ImageList getToolDisabledImageList(Point size)
Shell getModalShell()
int getLastEventTime()
public Shell[] getShells()
public 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.
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 constant
SWT
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
public Thread getThread()
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 data
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
data
- the platform specific GC databoolean isWakeMessage(org.eclipse.swt.internal.win32.MSG msg)
boolean isValidThread()
boolean isVirtualKey(int key)
int messageProc(int hwnd, int msg, int wParam, int lParam)
int msgFilterProc(int code, int wParam, int lParam)
int numpadKey(int key)
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 methodsleep()
,
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)
void removeFilter(int eventType, Listener listener)
eventType
- the type of event to listen forlistener
- the listener which should no longer be notified when the event occursListener
,
addFilter(int, org.eclipse.swt.widgets.Listener)
,
addListener(int, org.eclipse.swt.widgets.Listener)
public void removeListener(int eventType, Listener listener)
eventType
- the type of event to listen forlistener
- the listener which should no longer be notified when the event occursListener
,
addListener(int, org.eclipse.swt.widgets.Listener)
void removeBar(Menu menu)
void removePopup(Menu menu)
boolean runAsyncMessages()
boolean runDeferredEvents()
boolean runPopups()
boolean runTimer(int id)
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 cursorpublic void setCursorLocation(Point point)
point
- new positionpublic void setData(String key, 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 propertysetData(java.lang.String, java.lang.Object)
,
disposeExec(java.lang.Runnable)
public void setData(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 datagetData(java.lang.String)
,
disposeExec(java.lang.Runnable)
public static void setAppName(String name)
name
- the new app namevoid setModalShell(Shell shell)
public void setSynchronizer(Synchronizer synchronizer)
synchronizer
- the new synchronizer for the display (must not be null)int shiftedKey(int key)
public boolean sleep()
true
if an event requiring dispatching was placed on the queue.wake()
public void syncExec(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.
runnable
- code to run on the user-interface thread.asyncExec(java.lang.Runnable)
int systemFont()
public void timerExec(int milliseconds, 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.
milliseconds
- the delay before running the runnablerunnable
- code to run on the user-interface threadasyncExec(java.lang.Runnable)
boolean translateAccelerator(org.eclipse.swt.internal.win32.MSG msg, Control control)
static int translateKey(int key)
boolean translateMnemonic(org.eclipse.swt.internal.win32.MSG msg, Control control)
boolean translateTraversal(org.eclipse.swt.internal.win32.MSG msg, Control control)
static int untranslateKey(int key)
public void update()
Control.update()
void updateFont()
public void wake()
sleep
'ing,
causes it to be awakened and start running again. Note that this
method may be called from any thread.
sleep()
int windowProc(int hwnd, int msg, int wParam, int lParam)
static String withCrLf(String string)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |