|
|||||||||
| 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
menuPositionProc
long menuPositionProc
menuPositionCallback
org.eclipse.swt.internal.Callback menuPositionCallback
shellMapProc
long shellMapProc
shellMapCallback
org.eclipse.swt.internal.Callback shellMapCallback
treeSelection
int[] treeSelection
treeSelectionLength
int treeSelectionLength
treeSelectionProc
long treeSelectionProc
treeSelectionCallback
org.eclipse.swt.internal.Callback treeSelectionCallback
textCellDataProc
long textCellDataProc
textCellDataCallback
org.eclipse.swt.internal.Callback textCellDataCallback
pixbufCellDataProc
long pixbufCellDataProc
pixbufCellDataCallback
org.eclipse.swt.internal.Callback pixbufCellDataCallback
checkIfEventProc
long checkIfEventProc
checkIfEventCallback
org.eclipse.swt.internal.Callback checkIfEventCallback
flushWindow
long flushWindow
flushAll
boolean flushAll
flushRect
org.eclipse.swt.internal.gtk.GdkRectangle flushRect
exposeEvent
org.eclipse.swt.internal.gtk.XExposeEvent exposeEvent
visibilityEvent
org.eclipse.swt.internal.gtk.XVisibilityEvent visibilityEvent
flushData
long[] flushData
dragStartX
int dragStartX
dragStartY
int dragStartY
dragging
boolean dragging
defaultFont
long defaultFont
errorPixmap
long errorPixmap
infoPixmap
long infoPixmap
questionPixmap
long questionPixmap
warningPixmap
long warningPixmap
errorMask
long errorMask
infoMask
long infoMask
questionMask
long questionMask
warningMask
long warningMask
cursors
org.eclipse.swt.graphics.Cursor[] cursors
COLOR_WIDGET_DARK_SHADOW
org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_DARK_SHADOW
COLOR_WIDGET_NORMAL_SHADOW
org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_NORMAL_SHADOW
COLOR_WIDGET_LIGHT_SHADOW
org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_LIGHT_SHADOW
COLOR_WIDGET_HIGHLIGHT_SHADOW
org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_HIGHLIGHT_SHADOW
COLOR_WIDGET_BACKGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_BACKGROUND
COLOR_WIDGET_FOREGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_FOREGROUND
COLOR_WIDGET_BORDER
org.eclipse.swt.internal.gtk.GdkColor COLOR_WIDGET_BORDER
COLOR_LIST_FOREGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_LIST_FOREGROUND
COLOR_LIST_BACKGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_LIST_BACKGROUND
COLOR_LIST_SELECTION
org.eclipse.swt.internal.gtk.GdkColor COLOR_LIST_SELECTION
COLOR_LIST_SELECTION_TEXT
org.eclipse.swt.internal.gtk.GdkColor COLOR_LIST_SELECTION_TEXT
COLOR_TEXT_FOREGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_TEXT_FOREGROUND
COLOR_TEXT_BACKGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_TEXT_BACKGROUND
COLOR_INFO_BACKGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_INFO_BACKGROUND
COLOR_INFO_FOREGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_INFO_FOREGROUND
COLOR_TITLE_FOREGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_FOREGROUND
COLOR_TITLE_BACKGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_BACKGROUND
COLOR_TITLE_BACKGROUND_GRADIENT
org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_BACKGROUND_GRADIENT
COLOR_TITLE_INACTIVE_FOREGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_INACTIVE_FOREGROUND
COLOR_TITLE_INACTIVE_BACKGROUND
org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_INACTIVE_BACKGROUND
COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT
org.eclipse.swt.internal.gtk.GdkColor COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT
popups
Menu[] popups
popupTime
int popupTime
KeyTable
static final int[][] KeyTable
Default
static Display Default
Displays
static Display[] Displays
PACKAGE_PREFIX
static final java.lang.String PACKAGE_PREFIX
- See Also:
- Constant Field Values
OS_LOCK
static final java.lang.Class OS_LOCK
DOUBLE_CLICK_TIME
static final int DOUBLE_CLICK_TIME
- See Also:
- Constant Field Values
MAJOR
static final int MAJOR
- See Also:
- Constant Field Values
MINOR
static final int MINOR
- See Also:
- Constant Field Values
MICRO
static final int MICRO
- See Also:
- Constant Field Values
data
java.lang.Object data
keys
java.lang.String[] keys
values
java.lang.Object[] values
borderTrimWidth
int borderTrimWidth
borderTrimHeight
int borderTrimHeight
resizeTrimWidth
int resizeTrimWidth
resizeTrimHeight
int resizeTrimHeight
titleBorderTrimWidth
int titleBorderTrimWidth
titleBorderTrimHeight
int titleBorderTrimHeight
titleResizeTrimWidth
int titleResizeTrimWidth
titleResizeTrimHeight
int titleResizeTrimHeight
titleTrimWidth
int titleTrimWidth
titleTrimHeight
int titleTrimHeight
| Constructor Detail |
Display
public Display()
- Constructs a new instance of this class.
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.
Display
public Display(org.eclipse.swt.graphics.DeviceData data)
| Method Detail |
setDevice
static void setDevice(org.eclipse.swt.graphics.Device device)
addFilter
public 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. When the event does occur, the listener is
notified by sending it the
handleEvent()message.- Since:
- 3.0
addGdkEvent
void addGdkEvent(long event)
addListener
public 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. When the
event does occur in the display, the listener is notified by
sending it the
handleEvent()message.- Since:
- 2.0
addMouseHoverTimeout
void addMouseHoverTimeout(long handle)
addPopup
void addPopup(Menu menu)
addWidget
void addWidget(long handle,
Widget widget)
asyncExec
public 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. The caller of this method continues to run in parallel, and is not notified when the runnable has completed.
beep
public void beep()
- Causes the system hardware to emit a short sound
(if it supports this capability).
checkDevice
protected void checkDevice()
- Description copied from class:
org.eclipse.swt.graphics.Device - Throws an
SWTExceptionif 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()anddispose()) on a device that has had itsdispose()method called.In future releases of SWT, there may be more or fewer error checks and exceptions may be thrown for different reasons.
checkDisplay
static void checkDisplay(java.lang.Thread thread)
checkIfEventProc
long checkIfEventProc(long display,
long xEvent,
long userData)
checkSubclass
protected void checkSubclass()
- Checks that this class can be subclassed.
IMPORTANT: See the comment in
Widget.checkSubclass().
close
public void close()
- Requests that the connection between SWT and the underlying
operating system be closed.
- Since:
- 2.0
create
protected void create(org.eclipse.swt.graphics.DeviceData data)
- Creates the device in the operating system. If the device
does not have a handle, this method may do nothing depending
on the device.
This method is called before
init.
createDisplay
void createDisplay(org.eclipse.swt.graphics.DeviceData data)
createImage
long[] createImage(java.lang.String name)
deregister
void deregister()
destroy
protected void destroy()
- Destroys the device in the operating system and releases
the device's handle. If the device does not have a handle,
this method may do nothing depending on the device.
This method is called after
release.
destroyDisplay
void destroyDisplay()
findDisplay
public 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.
disposeExec
public 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.
error
void error(int code)
- Does whatever display specific cleanup is required, and then
uses the code in
SWTError.errorto handle the error.
eventProc
long eventProc(long event,
long data)
findWidget
public Widget findWidget(long handle)
- Given the operating system handle for a widget, returns
the instance of the
Widgetsubclass which represents it in the currently running application, if such exists, or null if no matching widget can be found.
flushExposes
void flushExposes(long window,
boolean all)
getActiveShell
public Shell getActiveShell()
- Returns the currently active
Shell, or null if no shell belonging to the currently running application is active.
getBounds
public org.eclipse.swt.graphics.Rectangle getBounds()
- Returns a rectangle describing the receiver's size and location.
getCurrent
public 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.
getCursorControl
public 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.
filterEvent
boolean filterEvent(Event event)
filters
boolean filters(int eventType)
filterProc
long filterProc(long xEvent,
long gdkEvent,
long data)
getCursorLocation
public org.eclipse.swt.graphics.Point getCursorLocation()
- Returns the location of the on-screen pointer relative
to the top left corner of the screen.
getCursorSizes
public org.eclipse.swt.graphics.Point[] getCursorSizes()
- Returns an array containing the recommended cursor sizes.
- Since:
- 3.0
getData
public 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.
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.
getData
public java.lang.Object getData()
- Returns the application defined, display specific data
associated with the receiver, or null if it has not been
set. The display specific data is a single,
unnamed field that is stored with every display.
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.
getDPI
public 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.
getDefault
public static Display getDefault()
- Returns the default display. One is created (making the
thread that invokes this method its user-interface thread)
if it did not already exist.
isValidClass
static boolean isValidClass(java.lang.Class clazz)
getDismissalAlignment
public int getDismissalAlignment()
- Returns the button dismissal alignment, one of
LEFTorRIGHT. 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 isLEFT, the button ordering should be OK/CANCEL. When button dismissal alignment isRIGHT, the button ordering should be CANCEL/OK.- Since:
- 2.1
getDoubleClickTime
public 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.
getFocusControl
public 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.
getHighContrast
public boolean getHighContrast()
- Returns true when the high contrast mode is enabled.
Otherwise, false is returned.
Note: This operation is a hint and is not supported on platforms that do not have this concept.
- Since:
- 3.0
getDepth
public int getDepth()
- Description copied from class:
org.eclipse.swt.graphics.Device - 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. This number
will typically be one of 1, 8, 15, 16, 24 or 32.
getIconDepth
public int getIconDepth()
- Returns the maximum allowed depth of icons on this display.
On some platforms, this may be different than the actual
depth of the display.
getIconSizes
public org.eclipse.swt.graphics.Point[] getIconSizes()
- Returns an array containing the recommended icon sizes.
- Since:
- 3.0
getLastEventTime
int getLastEventTime()
getMessageCount
int getMessageCount()
getMonitors
public Monitor[] getMonitors()
- Returns an array of monitors attached to the device.
- Since:
- 3.0
getPrimaryMonitor
public Monitor getPrimaryMonitor()
- Returns the primary monitor for that device.
- Since:
- 3.0
getShells
public Shell[] getShells()
- Returns an array containing all shells which have not been
disposed and have the receiver as their display.
getSyncThread
public java.lang.Thread getSyncThread()
- Returns the thread that has invoked
syncExecor 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.
getSystemColor
public 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. 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.
getSystemCursor
public 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. This cursor should not be free'd because it was allocated by the system, not the application. A value ofnullwill be returned if the supplied constant is not an swt cursor constant.- Since:
- 3.0
getSystemImage
public 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. This image should not be free'd because it was allocated by the system, not the application. A value ofnullwill 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.- Since:
- 3.0
initializeSystemResources
void initializeSystemResources()
getSystemFont
public org.eclipse.swt.graphics.Font getSystemFont()
- Returns a reasonable font for applications to use.
On some platforms, this will match the "default font"
or "system font" if such can be found. This font
should not be free'd because it was allocated by the
system, not the application.
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.
getSystemTray
public Tray getSystemTray()
- Returns the single instance of the system tray.
- Since:
- 3.0
getThread
public java.lang.Thread getThread()
- Returns the user-interface thread for the receiver.
getWidget
Widget getWidget(long handle)
init
protected void init()
- Initializes any internal resources needed by the
device.
This method is called after
create.
initializeCallbacks
void initializeCallbacks()
initializeWidgetTable
void initializeWidgetTable()
internal_dispose_GC
public void internal_dispose_GC(long gdkGC,
org.eclipse.swt.graphics.GCData data)
- Invokes platform specific functionality to dispose a GC handle.
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
public long internal_new_GC(org.eclipse.swt.graphics.GCData data)
- Invokes platform specific functionality to allocate a new GC handle.
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.
isValidThread
boolean isValidThread()
map
public 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.
When the control is null, coordinates are mapped to
the display.
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.
- Since:
- 2.1.2
map
public org.eclipse.swt.graphics.Point map(Control from, Control to, int x, int y)
- Maps a point from one coordinate system to another.
When the control is null, coordinates are mapped to
the display.
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.
- Since:
- 2.1.2
map
public 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.
When the control is null, coordinates are mapped to
the display.
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.
- Since:
- 2.1.2
mbcsToWcs
static char mbcsToWcs(char ch)
menuPositionProc
long menuPositionProc(long menu,
long x,
long y,
long push_in,
long user_data)
map
public 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.
When the control is null, coordinates are mapped to
the display.
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.
- Since:
- 2.1.2
mouseHoverProc
long mouseHoverProc(long handle)
post
public boolean post(Event event)
- Generate a low level system event.
postis 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.Event Types:
KeyDown, KeyUp
The following fields in the
Eventapply:- (in) type KeyDown or KeyUp
- (in) character a character that corresponds to a keyboard key
- (in) keyCode the key code of the key that was typed,
as defined by the key code constants in class
SWT
Either one of:
MouseDown, MouseUp
The following fields in the
Eventapply:- (in) type MouseDown or MouseUp
- (in) button the button that is pressed or released
MouseMove
The following fields in the
Eventapply:- (in) type MouseMove
- (in) x the x coordinate to move the mouse pointer to in screen coordinates
- (in) y the y coordinate to move the mouse pointer to in screen coordinates
- Since:
- 3.0
postEvent
void postEvent(Event event)
putGdkEvents
void putGdkEvents()
readAndDispatch
public boolean readAndDispatch()
- Reads an event from the operating system's event queue,
dispatches it appropriately, and returns
trueif there is potentially more work to do, orfalseif 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()orasyncExec()) are waiting to be processed, and if so handles them before returning.
register
void register()
release
protected void release()
- Releases any internal resources back to the operating
system and clears all fields except the device handle.
Disposes all shells which are currently open on the display. After this method has been invoked, all related related shells will answer
truewhen sent the messageisDisposed().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
This method is called beforerelease. 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 bydestroy.destroy.
releaseDisplay
void releaseDisplay()
removeFilter
public 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.
- Since:
- 3.0
removeGdkEvent
long removeGdkEvent()
removeListener
public 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.
- Since:
- 2.0
removeMouseHoverTimeout
void removeMouseHoverTimeout(long handle)
removePopup
void removePopup(Menu menu)
removeWidget
Widget removeWidget(long handle)
runAsyncMessages
boolean runAsyncMessages()
runDeferredEvents
boolean runDeferredEvents()
runPopups
boolean runPopups()
setAppName
public static void setAppName(java.lang.String name)
- On platforms which support it, sets the application name
to be the argument. On Motif, for example, this can be used
to set the name used for resource lookup.
setCursorLocation
public void setCursorLocation(int x,
int y)
- Sets the location of the on-screen pointer relative to the top left corner
of the screen. Note: It is typically considered bad practice for a
program to move the on-screen pointer location.
- Since:
- 2.1
setCursorLocation
public 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. Note: It is typically considered bad practice for a
program to move the on-screen pointer location.
- Since:
- 2.0
setData
public 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.
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.
setData
public void setData(java.lang.Object data)
- Sets the application defined, display specific data
associated with the receiver, to the argument.
The display specific data is a single,
unnamed field that is stored with every display.
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.
setSynchronizer
public void setSynchronizer(Synchronizer synchronizer)
- Sets the synchronizer used by the display to be
the argument, which can not be null.
showIMWindow
void showIMWindow(Control control)
sleep
public 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.
timerExec
public 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. If milliseconds is less than zero, the runnable is not executed.
timerProc
long timerProc(long i)
caretProc
long caretProc(long clientData)
pixbufCellDataProc
long pixbufCellDataProc(long tree_column,
long cell,
long tree_model,
long iter,
long data)
textCellDataProc
long textCellDataProc(long tree_column,
long cell,
long tree_model,
long iter,
long data)
treeSelectionProc
long treeSelectionProc(long model,
long path,
long iter,
long data)
sendEvent
void sendEvent(int eventType,
Event event)
setCurrentCaret
void setCurrentCaret(Caret caret)
shellMapProc
long shellMapProc(long handle,
long arg0,
long user_data)
syncExec
public 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. The thread which calls this method is suspended until the runnable completes.
translateKey
static int translateKey(int key)
untranslateKey
static int untranslateKey(int key)
update
public void update()
- Forces all outstanding paint requests for the display
to be processed before this method returns.
wake
public void wake()
- If the receiver's user-interface thread was
sleep'ing, causes it to be awakened and start running again. Note that this method may be called from any thread.
wakeThread
void wakeThread()
wcsToMbcs
static char wcsToMbcs(char ch)
windowProc
long windowProc(long handle,
long user_data)
windowProc
long windowProc(long handle,
long arg0,
long user_data)
windowProc
long windowProc(long handle,
long arg0,
long arg1,
long user_data)
windowProc
long windowProc(long handle,
long arg0,
long arg1,
long arg2,
long user_data)
windowTimerProc
long windowTimerProc(long handle)
|
|||||||||
| Home >> All >> org >> eclipse >> swt >> [ widgets overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC