|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.eclipse.swt.widgets
Class Display

java.lang.Objectorg.eclipse.swt.graphics.Device
org.eclipse.swt.widgets.Display
- All Implemented Interfaces:
- org.eclipse.swt.graphics.Drawable
- public class Display
- extends org.eclipse.swt.graphics.Device
Instances of this class are responsible for managing the connection between SWT and the underlying operating system. Their most important function is to implement the SWT event loop in terms of the platform event model. They also provide various methods for accessing information about the operating system, and have overall control over the operating system resources which SWT allocates.
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.
- The event loop for that display must be run from the thread.
-
Some SWT API methods (notably, most of the public methods in
Widgetand its subclasses), may only be called from the thread. (To support multi-threaded user-interface applications, classDisplayprovides inter-thread communication methods which allow threads other than the user-interface thread to request that it perform operations on their behalf.) -
The thread is not allowed to construct other
Displays 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.
- Styles:
- (none)
- Events:
- Close, Dispose
IMPORTANT: This class is not intended to be subclassed.
| Fields inherited from class org.eclipse.swt.graphics.Device |
CurrentDevice, DEBUG, DeviceFinder |
| Constructor Summary | |
Display()
Constructs a new instance of this class. |
|
Display(org.eclipse.swt.graphics.DeviceData data)
|
|
| Method Summary | |
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 this display. |
(package private) void |
addGdkEvent(long event)
|
void |
addListener(int eventType,
Listener listener)
Adds the listener to the collection of listeners who will be notifed when an event of the given type occurs. |
(package private) void |
addMouseHoverTimeout(long handle)
|
(package private) void |
addPopup(Menu menu)
|
(package private) void |
addWidget(long handle,
Widget widget)
|
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). |
(package private) long |
caretProc(long clientData)
|
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)
|
(package private) long |
checkIfEventProc(long display,
long xEvent,
long userData)
|
protected void |
checkSubclass()
Checks that this class can be subclassed. |
void |
close()
Requests that the connection between SWT and the underlying operating system be closed. |
protected void |
create(org.eclipse.swt.graphics.DeviceData data)
Creates the device in the operating system. |
(package private) void |
createDisplay(org.eclipse.swt.graphics.DeviceData data)
|
(package private) long[] |
createImage(java.lang.String name)
|
(package private) void |
deregister()
|
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 |
error(int code)
Does whatever display specific cleanup is required, and then uses the code in SWTError.error to handle the error. |
(package private) long |
eventProc(long event,
long data)
|
(package private) boolean |
filterEvent(Event event)
|
(package private) long |
filterProc(long xEvent,
long gdkEvent,
long data)
|
(package private) boolean |
filters(int eventType)
|
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. |
Widget |
findWidget(long 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. |
(package private) void |
flushExposes(long window,
boolean all)
|
Shell |
getActiveShell()
Returns the currently active Shell, or null
if no shell belonging to the currently running application
is active. |
org.eclipse.swt.graphics.Rectangle |
getBounds()
Returns a rectangle describing the receiver's size and location. |
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. |
org.eclipse.swt.graphics.Point |
getCursorLocation()
Returns the location of the on-screen pointer relative to the top left corner of the screen. |
org.eclipse.swt.graphics.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 |
getDepth()
Returns the bit depth of the screen, which is the number of bits it takes to represent the number of unique colors that the screen is currently capable of displaying. |
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. |
org.eclipse.swt.graphics.Point |
getDPI()
Returns a point whose x coordinate is the horizontal dots per inch of the display, and whose y coordinate is the vertical dots per inch of the display. |
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. |
boolean |
getHighContrast()
Returns true when the high contrast mode is enabled. |
int |
getIconDepth()
Returns the maximum allowed depth of icons on this display. |
org.eclipse.swt.graphics.Point[] |
getIconSizes()
Returns an array containing the recommended icon sizes. |
(package private) int |
getLastEventTime()
|
(package private) int |
getMessageCount()
|
Monitor[] |
getMonitors()
Returns an array of monitors attached to the device. |
Monitor |
getPrimaryMonitor()
Returns the primary monitor for that device. |
Shell[] |
getShells()
Returns an array containing all shells which have not been disposed and have the receiver as their 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. |
org.eclipse.swt.graphics.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. |
org.eclipse.swt.graphics.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. |
org.eclipse.swt.graphics.Font |
getSystemFont()
Returns a reasonable font for applications to use. |
org.eclipse.swt.graphics.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. |
Tray |
getSystemTray()
Returns the single instance of the system tray. |
java.lang.Thread |
getThread()
Returns the user-interface thread for the receiver. |
(package private) Widget |
getWidget(long handle)
|
protected void |
init()
Initializes any internal resources needed by the device. |
(package private) void |
initializeCallbacks()
|
(package private) void |
initializeSystemResources()
|
(package private) void |
initializeWidgetTable()
|
void |
internal_dispose_GC(long gdkGC,
org.eclipse.swt.graphics.GCData data)
Invokes platform specific functionality to dispose a GC handle. |
long |
internal_new_GC(org.eclipse.swt.graphics.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()
|
org.eclipse.swt.graphics.Point |
map(Control from,
Control to,
int x,
int y)
Maps a point from one coordinate system to another. |
org.eclipse.swt.graphics.Rectangle |
map(Control from,
Control to,
int x,
int y,
int width,
int height)
Maps a point from one coordinate system to another. |
org.eclipse.swt.graphics.Point |
map(Control from,
Control to,
org.eclipse.swt.graphics.Point point)
Maps a point from one coordinate system to another. |
org.eclipse.swt.graphics.Rectangle |
map(Control from,
Control to,
org.eclipse.swt.graphics.Rectangle rectangle)
Maps a point from one coordinate system to another. |
(package private) static char |
mbcsToWcs(char ch)
|
(package private) long |
menuPositionProc(long menu,
long x,
long y,
long push_in,
long user_data)
|
(package private) long |
mouseHoverProc(long handle)
|
(package private) long |
pixbufCellDataProc(long tree_column,
long cell,
long tree_model,
long iter,
long data)
|
boolean |
post(Event event)
Generate a low level system event. |
(package private) void |
postEvent(Event event)
|
(package private) void |
putGdkEvents()
|
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) void |
register()
|
protected void |
release()
Releases any internal resources back to the operating system and clears all fields except the device handle. |
(package private) void |
releaseDisplay()
|
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 this display. |
(package private) long |
removeGdkEvent()
|
void |
removeListener(int eventType,
Listener listener)
Removes the listener from the collection of listeners who will be notifed when an event of the given type occurs. |
(package private) void |
removeMouseHoverTimeout(long handle)
|
(package private) void |
removePopup(Menu menu)
|
(package private) Widget |
removeWidget(long handle)
|
(package private) boolean |
runAsyncMessages()
|
(package private) boolean |
runDeferredEvents()
|
(package private) boolean |
runPopups()
|
(package private) void |
sendEvent(int eventType,
Event event)
|
static void |
setAppName(java.lang.String name)
On platforms which support it, sets the application name to be the argument. |
(package private) void |
setCurrentCaret(Caret caret)
|
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(org.eclipse.swt.graphics.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(org.eclipse.swt.graphics.Device device)
|
void |
setSynchronizer(Synchronizer synchronizer)
Sets the synchronizer used by the display to be the argument, which can not be null. |
(package private) long |
shellMapProc(long handle,
long arg0,
long user_data)
|
(package private) void |
showIMWindow(Control control)
|
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. |
(package private) long |
textCellDataProc(long tree_column,
long cell,
long tree_model,
long iter,
long data)
|
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) long |
timerProc(long i)
|
(package private) static int |
translateKey(int key)
|
(package private) long |
treeSelectionProc(long model,
long path,
long iter,
long data)
|
(package private) static int |
untranslateKey(int key)
|
void |
update()
Forces all outstanding paint requests for the display to be processed before this method returns. |
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 char |
wcsToMbcs(char ch)
|
(package private) long |
windowProc(long handle,
long user_data)
|
(package private) long |
windowProc(long handle,
long arg0,
long user_data)
|
(package private) long |
windowProc(long handle,
long arg0,
long arg1,
long user_data)
|
(package private) long |
windowProc(long handle,
long arg0,
long arg1,
long arg2,
long user_data)
|
(package private) long |
windowTimerProc(long handle)
|
| Methods inherited from class org.eclipse.swt.graphics.Device |
dispose, getClientArea, getDeviceData, getFontList, getWarnings, isDisposed, setWarnings |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
wake
boolean wake
gdkEventCount
int gdkEventCount
gdkEvents
long[] gdkEvents
dispatchEvents
int[] dispatchEvents
gdkEventWidgets
Widget[] gdkEventWidgets
eventQueue
Event[] eventQueue
eventCallback
org.eclipse.swt.internal.Callback eventCallback
filterCallback
org.eclipse.swt.internal.Callback filterCallback
gdkEvent
org.eclipse.swt.internal.gtk.GdkEventButton gdkEvent
eventProc
long eventProc
filterProc
long filterProc
windowProc2
long windowProc2
windowProc3
long windowProc3
windowProc4
long windowProc4
windowProc5
long windowProc5
windowCallback2
org.eclipse.swt.internal.Callback windowCallback2
windowCallback3
org.eclipse.swt.internal.Callback windowCallback3
windowCallback4
org.eclipse.swt.internal.Callback windowCallback4
windowCallback5
org.eclipse.swt.internal.Callback windowCallback5
eventTable
EventTable eventTable
filterTable
EventTable filterTable
APP_NAME
static java.lang.String APP_NAME
DISPATCH_EVENT_KEY
static final java.lang.String DISPATCH_EVENT_KEY
- See Also:
- Constant Field Values
freeSlot
int freeSlot
indexTable
int[] indexTable
widgetTable
Widget[] widgetTable
GROW_SIZE
static final int GROW_SIZE
- See Also:
- Constant Field Values
SWT_OBJECT_INDEX
static final int SWT_OBJECT_INDEX
imControl
Control imControl
preeditWindow
long preeditWindow
preeditLabel
long preeditLabel
synchronizer
Synchronizer synchronizer
thread
java.lang.Thread thread
disposeList
java.lang.Runnable[] disposeList
tray
Tray tray
timerIds
int[] timerIds
timerList
java.lang.Runnable[] timerList
timerCallback
org.eclipse.swt.internal.Callback timerCallback
timerProc
long timerProc
windowTimerCallback
org.eclipse.swt.internal.Callback windowTimerCallback
windowTimerProc
long windowTimerProc
currentCaret
Caret currentCaret
caretCallback
org.eclipse.swt.internal.Callback caretCallback
caretId
int caretId
caretProc
long caretProc
mnemonicControl
Control mnemonicControl
mouseHoverId
int mouseHoverId
mouseHoverHandle
long mouseHoverHandle
mouseHoverProc
long mouseHoverProc
mouseHoverCallback
org.eclipse.swt.internal.Callback mouseHoverCallback
JAVADOC