|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.emf.ecp.cdo.internal.ui.SWTResourceManager
public class SWTResourceManager
Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
!!! IMPORTANT !!! Application code must explicitly invoke the dispose()
method to release the operating
system resources managed by cached objects when those objects and OS resources are no longer needed (e.g. on
application shutdown)
This class may be freely distributed as part of any application or plugin.
Field Summary | |
---|---|
static int |
BOTTOM_LEFT
Style constant for placing decorator image in bottom left corner of base image. |
static int |
BOTTOM_RIGHT
Style constant for placing decorator image in bottom right corner of base image. |
static int |
TOP_LEFT
Style constant for placing decorator image in top left corner of base image. |
static int |
TOP_RIGHT
Style constant for placing decorator image in top right corner of base image. |
Constructor Summary | |
---|---|
SWTResourceManager()
|
Method Summary | |
---|---|
static org.eclipse.swt.graphics.Image |
decorateImage(org.eclipse.swt.graphics.Image baseImage,
org.eclipse.swt.graphics.Image decorator)
Returns an Image composed of a base image decorated by another image. |
static org.eclipse.swt.graphics.Image |
decorateImage(org.eclipse.swt.graphics.Image baseImage,
org.eclipse.swt.graphics.Image decorator,
int corner)
Returns an Image composed of a base image decorated by another image. |
static void |
dispose()
Dispose of cached objects and their underlying OS resources. |
static void |
disposeColors()
Dispose of all the cached Color 's. |
static void |
disposeCursors()
Dispose all of the cached cursors. |
static void |
disposeFonts()
Dispose all of the cached Font 's. |
static void |
disposeImages()
Dispose all of the cached Image 's. |
static org.eclipse.swt.graphics.Font |
getBoldFont(org.eclipse.swt.graphics.Font baseFont)
Returns a bold version of the given Font . |
static org.eclipse.swt.graphics.Color |
getColor(int systemColorID)
Returns the system Color matching the specific ID. |
static org.eclipse.swt.graphics.Color |
getColor(int r,
int g,
int b)
Returns a Color given its red, green and blue component values. |
static org.eclipse.swt.graphics.Color |
getColor(org.eclipse.swt.graphics.RGB rgb)
Returns a Color given its RGB value. |
static org.eclipse.swt.graphics.Cursor |
getCursor(int id)
Returns the system cursor matching the specific ID. |
static org.eclipse.swt.graphics.Font |
getFont(String name,
int height,
int style)
Returns a Font based on its name, height and style. |
static org.eclipse.swt.graphics.Font |
getFont(String name,
int size,
int style,
boolean strikeout,
boolean underline)
Returns a Font based on its name, height and style. |
static org.eclipse.swt.graphics.Image |
getImage(Class<?> clazz,
String path)
Returns an Image stored in the file at the specified path relative to the specified class. |
static org.eclipse.swt.graphics.Image |
getImage(String path)
Returns an Image stored in the file at the specified path. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int TOP_LEFT
public static final int TOP_RIGHT
public static final int BOTTOM_LEFT
public static final int BOTTOM_RIGHT
Constructor Detail |
---|
public SWTResourceManager()
Method Detail |
---|
public static org.eclipse.swt.graphics.Color getColor(int systemColorID)
Color
matching the specific ID.
systemColorID
- the ID value for the color
Color
matching the specific IDpublic static org.eclipse.swt.graphics.Color getColor(int r, int g, int b)
Color
given its red, green and blue component values.
r
- the red component of the colorg
- the green component of the colorb
- the blue component of the color
Color
matching the given red, green and blue component valuespublic static org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)
Color
given its RGB value.
rgb
- the RGB
value of the color
Color
matching the RGB valuepublic static void disposeColors()
Color
's.
public static org.eclipse.swt.graphics.Image getImage(String path)
Image
stored in the file at the specified path.
path
- the path to the image file
Image
stored in the file at the specified pathpublic static org.eclipse.swt.graphics.Image getImage(Class<?> clazz, String path)
Image
stored in the file at the specified path relative to the specified class.
clazz
- the Class
relative to which to find the imagepath
- the path to the image file, if starts with '/'
Image
stored in the file at the specified pathpublic static org.eclipse.swt.graphics.Image decorateImage(org.eclipse.swt.graphics.Image baseImage, org.eclipse.swt.graphics.Image decorator)
Image
composed of a base image decorated by another image.
baseImage
- the base Image
that should be decorateddecorator
- the Image
to decorate the base image
Image
The resulting decorated imagepublic static org.eclipse.swt.graphics.Image decorateImage(org.eclipse.swt.graphics.Image baseImage, org.eclipse.swt.graphics.Image decorator, int corner)
Image
composed of a base image decorated by another image.
baseImage
- the base Image
that should be decorateddecorator
- the Image
to decorate the base imagecorner
- the corner to place decorator image
Image
public static void disposeImages()
Image
's.
public static org.eclipse.swt.graphics.Font getFont(String name, int height, int style)
Font
based on its name, height and style.
name
- the name of the fontheight
- the height of the fontstyle
- the style of the font
Font
The font matching the name, height and stylepublic static org.eclipse.swt.graphics.Font getFont(String name, int size, int style, boolean strikeout, boolean underline)
Font
based on its name, height and style. Windows-specific strikeout and underline flags are
also
supported.
name
- the name of the fontsize
- the size of the fontstyle
- the style of the fontstrikeout
- the strikeout flag (warning: Windows only)underline
- the underline flag (warning: Windows only)
Font
The font matching the name, height, style, strikeout and underlinepublic static org.eclipse.swt.graphics.Font getBoldFont(org.eclipse.swt.graphics.Font baseFont)
Font
.
baseFont
- the Font
for which a bold version is desired
Font
public static void disposeFonts()
Font
's.
public static org.eclipse.swt.graphics.Cursor getCursor(int id)
id
- int The ID value for the cursor
public static void disposeCursors()
public static void dispose()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |