|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.ui.forms.FormColors
Manages colors that will be applied to forms and form widgets. The colors are chosen to make the widgets look correct in the editor area. If a different set of colors is needed, subclass this class and override 'initialize' and/or 'initializeColors'.
Field Summary | |
---|---|
protected Color |
background
|
protected Color |
border
|
static String |
BORDER
Key for the tree/table border color. |
protected Map |
colorRegistry
|
protected Display |
display
|
protected Color |
foreground
|
static String |
SEPARATOR
Key for the section separator color. |
static String |
TB_BG
Key for the section title bar background. |
static String |
TB_BORDER
Key for the section title bar border. |
static String |
TB_FG
Key for the section title bar foreground. |
static String |
TB_GBG
Key for the section title bar gradient. |
static String |
TB_TOGGLE
Key for the section toggle color. |
static String |
TB_TOGGLE_HOVER
Key for the section toggle hover color. |
static String |
TITLE
Key for the form title foreground color. |
Constructor Summary | |
---|---|
FormColors(Display display)
Creates form colors using the provided display. |
Method Summary | |
---|---|
static RGB |
blend(RGB c1,
RGB c2,
int ratio)
Blends c1 and c2 based in the provided ratio. |
Color |
createColor(String key,
int r,
int g,
int b)
Creates the color for the specified key using the provided RGB values. |
Color |
createColor(String key,
RGB rgb)
Creates the color for the specified key using the provided RGB object. |
void |
dispose()
Disposes all the colors in the registry. |
Color |
getBackground()
Returns the current background color. |
Color |
getBorderColor()
Returns the computed border color. |
Color |
getColor(String key)
Returns the color object for the provided key or null if not in the registry. |
Display |
getDisplay()
Returns the display used to create colors. |
Color |
getForeground()
Returns the current foreground color. |
Color |
getInactiveBackground()
Creates a color that can be used for areas of the form that is inactive. |
RGB |
getSystemColor(int code)
Returns the RGB value of the system color represented by the code argument, as defined in SWT class. |
protected void |
initialize()
Initializes the colors. |
protected void |
initializeColorTable()
Allocates colors for the following keys: BORDER, COMPOSITE_SEPARATOR and DEFAULT_HEADER. |
void |
initializeSectionToolBarColors()
Allocates colors for the section tool bar (all the keys that start with TB). |
boolean |
isShared()
Tests if the colors are shared. |
boolean |
isWhiteBackground()
Tests if the background is white. |
void |
markShared()
Marks the colors shared. |
void |
setBackground(Color bg)
Sets the background color. |
void |
setForeground(Color fg)
Sets the foreground color. |
static boolean |
testAnyPrimaryColor(RGB rgb,
int from,
int to)
Tests the source RGB for range. |
static boolean |
testTwoPrimaryColors(RGB rgb,
int from,
int to)
Tests the source RGB for range. |
protected void |
updateBorderColor()
Computes the border color relative to the background. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String TITLE
public static final String BORDER
public static final String SEPARATOR
public static final String TB_BG
public static final String TB_FG
public static final String TB_GBG
public static final String TB_BORDER
public static final String TB_TOGGLE
public static final String TB_TOGGLE_HOVER
protected Map colorRegistry
protected Color background
protected Color foreground
protected Display display
protected Color border
Constructor Detail |
public FormColors(Display display)
display
- the display to useMethod Detail |
public Display getDisplay()
protected void initialize()
initializeColorTable()
.
initializeColorTable()
protected void initializeColorTable()
public void initializeSectionToolBarColors()
public RGB getSystemColor(int code)
SWT
class.
code
- the system color constant as defined in SWT
class.
public Color createColor(String key, RGB rgb)
key
- the unique color keyrgb
- the RGB object
public Color getInactiveBackground()
The color should not be disposed because it is managed by this class.
public Color createColor(String key, int r, int g, int b)
key
- the unique color keyr
- red valueg
- green valueb
- blue value
protected void updateBorderColor()
public void setBackground(Color bg)
bg
- background colorpublic void setForeground(Color fg)
fg
- foreground colorpublic Color getBackground()
public Color getForeground()
public Color getBorderColor()
public boolean isWhiteBackground()
public Color getColor(String key)
key
- the color key
public void dispose()
public void markShared()
public boolean isShared()
true
if shared, false
otherwise.public static RGB blend(RGB c1, RGB c2, int ratio)
c1
- first colorc2
- second colorratio
- percentage of the first color in the blend (0-100)
public static boolean testAnyPrimaryColor(RGB rgb, int from, int to)
rgb
- the tested RGBfrom
- range start (excluding the value itself)to
- range end (excluding the value itself)
true
if at least one of the primary colors in the
source RGB are within the provided range, false
otherwise.public static boolean testTwoPrimaryColors(RGB rgb, int from, int to)
rgb
- the tested RGBfrom
- range start (excluding the value itself)to
- tange end (excluding the value itself)
true
if at least two of the primary colors in the
source RGB are within the provided range, false
otherwise.
|
Eclipse Platform Release 3.1 |
|||||||||||
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, 2005. All rights reserved.