|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.swtdesigner.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.
Copyright (c) 2003 - 2005, Instantiations, Inc.
All Rights Reserved
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 colors |
static void |
disposeCursors()
Dispose all of the cached cursors |
static void |
disposeFonts()
Dispose all of the cached fonts |
static void |
disposeImages()
Dispose all of the cached images |
static void |
disposeImages(java.lang.String section)
Dispose cached images in specified section |
static void |
fixCoolBarSize(org.eclipse.swt.widgets.CoolBar bar)
Fix the layout of the specified CoolBar |
static org.eclipse.swt.graphics.Font |
getBoldFont(org.eclipse.swt.graphics.Font baseFont)
Return a bold version of the give 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(java.lang.String name,
int height,
int style)
Returns a font based on its name, height and style |
static org.eclipse.swt.graphics.Font |
getFont(java.lang.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(java.lang.Class<?> clazz,
java.lang.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(java.lang.String path)
Returns an image stored in the file at the specified path |
static org.eclipse.swt.graphics.Image |
getImage(java.lang.String section,
java.lang.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 void dispose()
public static org.eclipse.swt.graphics.Color getColor(int systemColorID)
systemColorID
- int The ID value for the color
public static org.eclipse.swt.graphics.Color getColor(int r, int g, int b)
r
- int The red component of the colorg
- int The green component of the colorb
- int The blue component of the color
public static org.eclipse.swt.graphics.Color getColor(org.eclipse.swt.graphics.RGB rgb)
rgb
- RGB The RGB value of the color
public static void disposeColors()
public static org.eclipse.swt.graphics.Image getImage(java.lang.String path)
path
- String The path to the image file
public static org.eclipse.swt.graphics.Image getImage(java.lang.String section, java.lang.String path)
section
- The section to which belongs specified imagepath
- String The path to the image file
public static org.eclipse.swt.graphics.Image getImage(java.lang.Class<?> clazz, java.lang.String path)
clazz
- Class The class relative to which to find the imagepath
- String The path to the image file
public static org.eclipse.swt.graphics.Image decorateImage(org.eclipse.swt.graphics.Image baseImage, org.eclipse.swt.graphics.Image decorator)
baseImage
- Image The base image that should be decorateddecorator
- Image The image to decorate the base image
public static org.eclipse.swt.graphics.Image decorateImage(org.eclipse.swt.graphics.Image baseImage, org.eclipse.swt.graphics.Image decorator, int corner)
baseImage
- Image The base image that should be decorateddecorator
- Image The image to decorate the base imagecorner
- The corner to place decorator image
public static void disposeImages()
public static void disposeImages(java.lang.String section)
section
- the section do disposepublic static org.eclipse.swt.graphics.Font getFont(java.lang.String name, int height, int style)
name
- String The name of the fontheight
- int The height of the fontstyle
- int The style of the font
public static org.eclipse.swt.graphics.Font getFont(java.lang.String name, int size, int style, boolean strikeout, boolean underline)
name
- String The name of the fontsize
- int The size of the fontstyle
- int The style of the fontstrikeout
- boolean The strikeout flag (warning: Windows only)underline
- boolean The underline flag (warning: Windows only)
public static org.eclipse.swt.graphics.Font getBoldFont(org.eclipse.swt.graphics.Font baseFont)
baseFont
- Font The font for whoch a bold version is desired
public static void disposeFonts()
public static void fixCoolBarSize(org.eclipse.swt.widgets.CoolBar bar)
bar
- CoolBar The CoolBar that shgoud be fixedpublic static org.eclipse.swt.graphics.Cursor getCursor(int id)
id
- int The ID value for the cursor
public static void disposeCursors()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |