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.

@see <a href="http://www.eclipse.org/swt/">Sample code and further information</a>

abstract
class Device : Drawable {}

Constructors

this
this()

Constructs a new instance of this class. <p> You must dispose the device when it is no longer required. </p>

this
this(DeviceData data)

Constructs a new instance of this class. <p> You must dispose the device when it is no longer required. </p>

Members

Functions

checkCairo
void checkCairo()
Undocumented in source. Be warned that the author may not have intended to support it.
checkDevice
void checkDevice()

Throws an <code>SWTException</code> 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 <em>should</em> be called by device implementors to enforce the standard SWT invariants. <p> Currently, it is an error to invoke any method (other than <code>isDisposed()</code> and <code>dispose()</code>) on a device that has had its <code>dispose()</code> method called. </p><p> In future releases of SWT, there may be more or fewer error checks and exceptions may be thrown for different reasons. <p>

create
void create(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. <p> This method is called before <code>init</code>. </p><p> Subclasses are supposed to reimplement this method and not call the <code>super</code> implementation. </p>

destroy
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. <p> This method is called after <code>release</code>. </p><p> Subclasses are supposed to reimplement this method and not call the <code>super</code> implementation. </p>

dispose
void dispose()

Disposes of the operating system resources associated with the receiver. After this method has been invoked, the receiver will answer <code>true</code> when sent the message <code>isDisposed()</code>.

dispose_Object
void dispose_Object(Object object)
Undocumented in source. Be warned that the author may not have intended to support it.
getBounds
Rectangle getBounds()

Returns a rectangle describing the receiver's size and location.

getClientArea
Rectangle getClientArea()

Returns a rectangle which describes the area of the receiver which is capable of displaying data.

getDPI
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.

getDepth
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. This number will typically be one of 1, 8, 15, 16, 24 or 32.

getDeviceData
DeviceData getDeviceData()

Returns a <code>DeviceData</code> based on the receiver. Modifications made to this <code>DeviceData</code> will not affect the receiver.

getFontList
FontData[] getFontList(String faceName, bool scalable)

Returns <code>FontData</code> objects which describe the fonts that match the given arguments. If the <code>faceName</code> is null, all fonts will be returned.

getSystemColor
Color getSystemColor(int id)

Returns the matching standard color for the given constant, which should be one of the color constants specified in class <code>SWT</code>. 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 freed because it was allocated by the system, not the application.

getSystemFont
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 freed because it was allocated by the system, not the application. <p> 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. </p>

getWarnings
bool getWarnings()

Returns <code>true</code> if the underlying window system prints out warning messages on the console, and <code>setWarnings</code> had previously been called with <code>true</code>.

init_
void init_()

Initializes any internal resources needed by the device. <p> This method is called after <code>create</code>. </p><p> If subclasses reimplement this method, they must call the <code>super</code> implementation. </p>

internal_dispose_GC
void internal_dispose_GC(GdkGC* handle, GCData data)

Invokes platform specific functionality to dispose a GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Device</code>. 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. </p>

internal_new_GC
GdkGC* internal_new_GC(GCData data)

Invokes platform specific functionality to allocate a new GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Device</code>. 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. </p>

isDisposed
bool isDisposed()

Returns <code>true</code> if the device has been disposed, and <code>false</code> otherwise. <p> 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.

loadFont
bool loadFont(String path)

Loads the font specified by a file. The font will be present in the list of fonts available to the application.

new_Object
void new_Object(Object object)
Undocumented in source. Be warned that the author may not have intended to support it.
release
void release()

Releases any internal resources back to the operating system and clears all fields except the device handle. <p> 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 <code>release</code>. 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 <code>destroy</code>. </p> This method is called before <code>destroy</code>. </p><p> If subclasses reimplement this method, they must call the <code>super</code> implementation. </p>

setWarnings
void setWarnings(bool warnings)

If the underlying window system supports printing warning messages to the console, setting warnings to <code>false</code> prevents these messages from being printed. If the argument is <code>true</code> then message printing is not blocked.

Static functions

deregister
void deregister(Device device)
Undocumented in source. Be warned that the author may not have intended to support it.
findDevice
Device findDevice(void* xDisplay)
Undocumented in source. Be warned that the author may not have intended to support it.
getDevice
Device getDevice()
Undocumented in source. Be warned that the author may not have intended to support it.
register
void register(Device device)
Undocumented in source. Be warned that the author may not have intended to support it.

Static variables

CAIRO_LOADED
bool CAIRO_LOADED;
Undocumented in source.
CurrentDevice
Device CurrentDevice;
Undocumented in source.
DEBUG
bool DEBUG;
Undocumented in source.
DeviceFinder
Runnable DeviceFinder;
Undocumented in source.
Devices
Device[] Devices;
Undocumented in source.
XErrorProc
ptrdiff_t XErrorProc;
XIOErrorProc
ptrdiff_t XIOErrorProc;
XNullErrorProc
ptrdiff_t XNullErrorProc;
XNullIOErrorProc
ptrdiff_t XNullIOErrorProc;
Undocumented in source.
mXErrorHandler
int function(void*, XErrorEvent*) mXErrorHandler;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.
mXIOErrorHandler
int function(void*) mXIOErrorHandler;
Undocumented in source but is binding to C. You might be able to learn more by searching the web for its name.

Variables

COLOR_BLACK
Color COLOR_BLACK;
COLOR_BLUE
Color COLOR_BLUE;
COLOR_CYAN
Color COLOR_CYAN;
COLOR_DARK_BLUE
Color COLOR_DARK_BLUE;
COLOR_DARK_CYAN
Color COLOR_DARK_CYAN;
COLOR_DARK_GRAY
Color COLOR_DARK_GRAY;
COLOR_DARK_GREEN
Color COLOR_DARK_GREEN;
Undocumented in source.
COLOR_DARK_MAGENTA
Color COLOR_DARK_MAGENTA;
COLOR_DARK_RED
Color COLOR_DARK_RED;
COLOR_DARK_YELLOW
Color COLOR_DARK_YELLOW;
COLOR_GRAY
Color COLOR_GRAY;
Undocumented in source.
COLOR_GREEN
Color COLOR_GREEN;
COLOR_MAGENTA
Color COLOR_MAGENTA;
COLOR_RED
Color COLOR_RED;
COLOR_WHITE
Color COLOR_WHITE;
COLOR_YELLOW
Color COLOR_YELLOW;
Undocumented in source.
colorRefCount
int[] colorRefCount;
Undocumented in source.
debugging
bool debugging;
Undocumented in source.
disposed
bool disposed;
Undocumented in source.
emptyTab
PangoTabArray* emptyTab;
Undocumented in source.
errors
Exception[] errors;
Undocumented in source.
gdkColors
GdkColor*[] gdkColors;
Undocumented in source.
handler_ids
int[] handler_ids;
Undocumented in source.
log_domains
String[] log_domains;
Undocumented in source.
objects
Object[] objects;
Undocumented in source.
shellHandle
GtkWidget* shellHandle;
Undocumented in source.
systemFont
Font systemFont;
Undocumented in source.
tracking
bool tracking;
Undocumented in source.
trackingLock
Object trackingLock;
Undocumented in source.
useXRender
bool useXRender;
Undocumented in source.
warningLevel
int warningLevel;
Undocumented in source.
xDisplay
void* xDisplay;

the handle to the X Display (Warning: This field is platform dependent) <p> <b>IMPORTANT:</b> This field is <em>not</em> part of the SWT public API. It is marked protected only so that it can be shared within the packages provided by SWT. It is not available on all platforms and should never be accessed from application code. </p>

Inherited Members

From Drawable

internal_new_GC
GdkGC* internal_new_GC(GCData data)

Invokes platform specific functionality to allocate a new GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Drawable</code>. 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. </p>

internal_dispose_GC
void internal_dispose_GC(GdkGC* handle, GCData data)

Invokes platform specific functionality to dispose a GC handle. <p> <b>IMPORTANT:</b> This method is <em>not</em> part of the public API for <code>Drawable</code>. 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. </p>

Meta