|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.swt.graphics.Device
This class is the abstract superclass of all device objects, such as the Display device and the Printer device. Devices can have a graphics context (GC) created for them, and they can be drawn on by sending messages to the associated GC.
Field Summary | |
protected static Device | CurrentDevice
|
static boolean | DEBUG
|
protected static Runnable | DeviceFinder
|
int | hPalette
|
Constructor Summary | |
Device(DeviceData data)
Constructs a new instance of this class. |
Method Summary | |
protected void | checkDevice()
Throws an SWTException if the receiver can not be accessed by the caller. |
protected void | create(DeviceData data)
Creates the device in the operating system. |
protected void | destroy()
Destroys the device in the operating system and releases the device's handle. |
void | dispose()
Disposes of the operating system resources associated with the receiver. |
Rectangle | getBounds()
Returns a rectangle describing the receiver's size and location. |
Rectangle | getClientArea()
Returns a rectangle which describes the area of the receiver which is capable of displaying data. |
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. |
DeviceData | getDeviceData()
Returns a DeviceData based on the receiver. |
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. |
FontData[] | getFontList(String faceName,
boolean scalable)
Returns FontData objects which describe the fonts that match the given arguments. |
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. |
Font | getSystemFont()
Returns a reasonable font for applications to use. |
boolean | getWarnings()
Returns true if the underlying window system prints out warning messages on the console, and setWarnings had previously been called with true. |
protected void | init()
Initializes any internal resources needed by the device. |
abstract void | internal_dispose_GC(int hDC,
GCData data)
Invokes platform specific functionality to dispose a GC handle. |
abstract int | internal_new_GC(GCData data)
Invokes platform specific functionality to allocate a new GC handle. |
boolean | isDisposed()
Returns true if the device has been disposed, and false otherwise. |
protected void | release()
Releases any internal resources back to the operating system and clears all fields except the device handle. |
void | setWarnings(boolean warnings)
If the underlying window system supports printing warning messages to the console, setting warnings to true prevents these messages from being printed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static boolean DEBUG
public int hPalette
protected static Device CurrentDevice
protected static Runnable DeviceFinder
Constructor Detail |
public Device(DeviceData data)
You must dispose the device when it is no longer required.
Method Detail |
protected void checkDevice()
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.
protected void create(DeviceData data)
This method is called before init.
Subclasses are supposed to reimplement this method and not call the super implementation.
protected void destroy()
This method is called after release.
Subclasses are supposed to reimplement this method and not call the super implementation.
public void dispose()
public Rectangle getBounds()
public DeviceData getDeviceData()
public Rectangle getClientArea()
public int getDepth()
public Point getDPI()
public FontData[] getFontList(String faceName, boolean scalable)
public Color getSystemColor(int id)
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.
public boolean getWarnings()
protected void init()
This method is called after create.
If subclasses reimplement this method, they must call the super implementation.
public abstract int internal_new_GC(GCData data)
IMPORTANT: This method is not part of the public API for Device. 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.
public abstract void internal_dispose_GC(int hDC, GCData data)
IMPORTANT: This method is not part of the public API for Device. 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.
public boolean isDisposed()
This method gets the dispose state for the device. When a device has been disposed, it is an error to invoke any other method using the device.
protected void release()
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.
This method is called before destroy.If subclasses reimplement this method, they must call the super implementation.
public void setWarnings(boolean warnings)
|
Eclipse Platform Release 3.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2004. All rights reserved.