Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.swt.graphics
Class Device  view Device download Device.java

java.lang.Object
  extended byorg.eclipse.swt.graphics.Device
All Implemented Interfaces:
Drawable

public abstract class Device
extends java.lang.Object
implements Drawable

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
(package private)  Color COLOR_BLACK
           
(package private)  Color COLOR_BLUE
           
(package private)  Color COLOR_CYAN
           
(package private)  Color COLOR_DARK_BLUE
           
(package private)  Color COLOR_DARK_CYAN
           
(package private)  Color COLOR_DARK_GRAY
           
(package private)  Color COLOR_DARK_GREEN
           
(package private)  Color COLOR_DARK_MAGENTA
           
(package private)  Color COLOR_DARK_RED
           
(package private)  Color COLOR_DARK_YELLOW
           
(package private)  Color COLOR_GRAY
           
(package private)  Color COLOR_GREEN
           
(package private)  Color COLOR_MAGENTA
           
(package private)  Color COLOR_RED
           
(package private)  Color COLOR_WHITE
           
(package private)  Color COLOR_YELLOW
           
(package private)  int[] colorRefCount
           
protected static Device CurrentDevice
           
(package private)  boolean debug
           
static boolean DEBUG
           
protected static java.lang.Runnable DeviceFinder
           
(package private)  boolean disposed
           
(package private)  long emptyTab
           
(package private)  java.lang.Error[] errors
           
(package private)  org.eclipse.swt.internal.gtk.GdkColor[] gdkColors
           
(package private)  int[] handler_ids
           
(package private)  java.lang.String[] log_domains
           
(package private)  org.eclipse.swt.internal.Callback logCallback
           
(package private)  long logProc
           
(package private)  java.lang.Object[] objects
           
(package private)  Font systemFont
           
(package private)  boolean tracking
           
(package private)  int warningLevel
           
 
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.
(package private)  void dispose_Object(java.lang.Object object)
           
 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.
(package private) static Device getDevice()
           
 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(java.lang.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(long handle, GCData data)
          Invokes platform specific functionality to dispose a GC handle.
abstract  long 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.
(package private)  long logProc(long log_domain, long log_level, long message, long user_data)
           
(package private)  void new_Object(java.lang.Object object)
           
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

DEBUG

public static boolean DEBUG

debug

boolean debug

tracking

boolean tracking

errors

java.lang.Error[] errors

objects

java.lang.Object[] objects

gdkColors

org.eclipse.swt.internal.gtk.GdkColor[] gdkColors

colorRefCount

int[] colorRefCount

disposed

boolean disposed

logProc

long logProc

logCallback

org.eclipse.swt.internal.Callback logCallback

log_domains

java.lang.String[] log_domains

handler_ids

int[] handler_ids

warningLevel

int warningLevel

COLOR_BLACK

Color COLOR_BLACK

COLOR_DARK_RED

Color COLOR_DARK_RED

COLOR_DARK_GREEN

Color COLOR_DARK_GREEN

COLOR_DARK_YELLOW

Color COLOR_DARK_YELLOW

COLOR_DARK_BLUE

Color COLOR_DARK_BLUE

COLOR_DARK_MAGENTA

Color COLOR_DARK_MAGENTA

COLOR_DARK_CYAN

Color COLOR_DARK_CYAN

COLOR_GRAY

Color COLOR_GRAY

COLOR_DARK_GRAY

Color COLOR_DARK_GRAY

COLOR_RED

Color COLOR_RED

COLOR_GREEN

Color COLOR_GREEN

COLOR_YELLOW

Color COLOR_YELLOW

COLOR_BLUE

Color COLOR_BLUE

COLOR_MAGENTA

Color COLOR_MAGENTA

COLOR_CYAN

Color COLOR_CYAN

COLOR_WHITE

Color COLOR_WHITE

systemFont

Font systemFont

emptyTab

long emptyTab

CurrentDevice

protected static Device CurrentDevice

DeviceFinder

protected static java.lang.Runnable DeviceFinder
Constructor Detail

Device

public Device(DeviceData data)
Constructs a new instance of this class.

You must dispose the device when it is no longer required.

Method Detail

getDevice

static Device getDevice()

checkDevice

protected void checkDevice()
Throws an 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.


create

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

This method is called before init.

Subclasses are supposed to reimplement this method and not call the super implementation.


dispose

public void dispose()
Disposes of the operating system resources associated with the receiver. After this method has been invoked, the receiver will answer true when sent the message isDisposed().


dispose_Object

void dispose_Object(java.lang.Object object)

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.

Subclasses are supposed to reimplement this method and not call the super implementation.


getBounds

public Rectangle getBounds()
Returns a rectangle describing the receiver's size and location.


getDeviceData

public DeviceData getDeviceData()
Returns a DeviceData based on the receiver. Modifications made to this DeviceData will not affect the receiver.


getClientArea

public Rectangle getClientArea()
Returns a rectangle which describes the area of the receiver which is capable of displaying data.


getDepth

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


getDPI

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


getFontList

public FontData[] getFontList(java.lang.String faceName,
                              boolean scalable)
Returns FontData objects which describe the fonts that match the given arguments. If the faceName is null, all fonts will be returned.


getSystemColor

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


getSystemFont

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


getWarnings

public boolean getWarnings()
Returns true if the underlying window system prints out warning messages on the console, and setWarnings had previously been called with true.


init

protected void init()
Initializes any internal resources needed by the device.

This method is called after create.

If subclasses reimplement this method, they must call the super implementation.


internal_new_GC

public abstract long internal_new_GC(GCData data)
Invokes platform specific functionality to allocate a new GC handle.

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.

Specified by:
internal_new_GC in interface Drawable

internal_dispose_GC

public abstract void internal_dispose_GC(long handle,
                                         GCData data)
Invokes platform specific functionality to dispose a GC handle.

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.

Specified by:
internal_dispose_GC in interface Drawable

isDisposed

public boolean isDisposed()
Returns true if the device has been disposed, and false otherwise.

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.


logProc

long logProc(long log_domain,
             long log_level,
             long message,
             long user_data)

new_Object

void new_Object(java.lang.Object object)

release

protected void release()
Releases any internal resources back to the operating system and clears all fields except the device handle.

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.


setWarnings

public 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. If the argument is false message printing is not blocked.