Pattern pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height,
themeRender.getTool_item_bg_color1(), themeRender
.getTool_item_bg_color1_alpha(), themeRender.getTool_item_bg_color2(),
themeRender.getTool_item_bg_color2_alpha());
Path path = new Path(null);
path.addRectangle(glossy.x, glossy.y, glossy.width, glossy.height);
gc.setBackgroundPattern(pattern);
gc.fillPath(path);
path.dispose();
// draw border
path = GraphicsUtil.createRoundRectangle(outerBorder, 2);
gc.setForeground(themeRender.getTool_item_outer_border());
gc.drawPath(path);
path.dispose();
if (selected && (menuTracked || (getMenu() != null && !canSelected()))) {
path = GraphicsUtil.createTopRoundRectangle(innerBorder, 2);
gc.setBackground(themeRender.getTool_item_bg_glossy_showMenu());
gc.fillPath(path);
path.dispose();
path = GraphicsUtil.createTopRoundRectangle(innerBorder, 2);
gc.setForeground(themeRender.getTool_item_bg_glossy_showMenu());
gc.drawPath(path);
path.dispose();
gc.setAdvanced(false);
return;
} else if (selected && getMenu() != null) {
pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height, themeRender
.getTool_item_bg_glossy_selected1(), themeRender
.getTool_item_bg_glossy_selected1_alpha(), themeRender
.getTool_item_bg_glossy_selected2(), themeRender
.getTool_item_bg_glossy_selected2_alpha());
Rectangle nonMenuRect = getNonMenuRect();
Rectangle nonMenuGlossy = new Rectangle(innerBorder.x, innerBorder.y,
nonMenuRect.width - 1, innerBorder.height / 2);
path = createTopLeftRoundRectangle(nonMenuGlossy, 2);
gc.setBackgroundPattern(pattern);
gc.fillPath(path);
path.dispose();
pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height, themeRender
.getTool_item_bg_glossy_track1(), themeRender
.getTool_item_bg_glossy_track1_alpha(), themeRender
.getTool_item_bg_glossy_track2(), themeRender
.getTool_item_bg_glossy_track2_alpha());
Rectangle menuRect = getMenuRect();
Rectangle menuGlossy = new Rectangle(menuRect.x, innerBorder.y,
menuRect.width - 1, innerBorder.height / 2);
path = createTopRightRoundRectangle(menuGlossy, 2);
gc.setBackgroundPattern(pattern);
gc.fillPath(path);
path.dispose();
Color innerBorderColor = themeRender.getTool_item_inner_border_selected();
path = createLeftRoundPath(new Rectangle(innerBorder.x, innerBorder.y,
nonMenuRect.width - 1, innerBorder.height), 2);
gc.setForeground(innerBorderColor);
gc.drawPath(path);
path.dispose();
innerBorderColor = themeRender.getTool_item_inner_border_track();
path = createRightRoundPath(new Rectangle(menuRect.x, innerBorder.y,
menuRect.width, innerBorder.height), 2);
gc.setForeground(innerBorderColor);
gc.drawPath(path);
path.dispose();
path = GraphicsUtil.createRoundRectangle(glow, 2);
gc.setClipping(path);
path.dispose();
Color glowColor = themeRender.getTool_item_bg_glow_track();
path = createBottomRadialPath(glow);
float[] point = new float[2];
float[] bounds = new float[4];
path.getBounds(bounds);
point[0] = (bounds[0] + bounds[0] + bounds[2]) / 2f;
point[1] = (bounds[1] + bounds[1] + bounds[3]) / 2f;
GCExtension extension = new GCExtension(gc);
extension.fillGradientPath(path, point, glowColor, 255, new Color[] { glowColor },
new int[] { 0 });
path.dispose();
gc.setClipping((Region) null);
gc.setAdvanced(false);
return;
}
if (!(selected)) pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height,
themeRender.getTool_item_bg_glossy_track1(), themeRender
.getTool_item_bg_glossy_track1_alpha(), themeRender
.getTool_item_bg_glossy_track2(), themeRender
.getTool_item_bg_glossy_track2_alpha());
else
pattern = new Pattern(null, 0, glossy.y, 0, glossy.y + glossy.height, themeRender
.getTool_item_bg_glossy_selected1(), themeRender
.getTool_item_bg_glossy_selected1_alpha(), themeRender
.getTool_item_bg_glossy_selected2(), themeRender
.getTool_item_bg_glossy_selected2_alpha());
path = GraphicsUtil.createTopRoundRectangle(glossy, 2);
gc.setBackgroundPattern(pattern);
gc.fillPath(path);
path.dispose();
Color innerBorderColor = (selected)
|| ((getStyle() & SWT.TOGGLE) != 0 && getSelection()) ? themeRender
.getTool_item_inner_border_selected() : themeRender
.getTool_item_inner_border_track();
path = GraphicsUtil.createRoundRectangle(innerBorder, 2);
gc.setForeground(innerBorderColor);
gc.drawPath(path);
path.dispose();
if (!((menuTracked || (getMenu() != null && !canSelected())) && selected)) {
path = GraphicsUtil.createRoundRectangle(glow, 2);
gc.setClipping(path);
path.dispose();
Color glowColor = themeRender.getTool_item_bg_glow_track();
if ((getStyle() & SWT.TOGGLE) != 0 && getSelection()) {
glowColor = themeRender.getTool_item_bg_checked_glow_track();
}
path = createBottomRadialPath(glow);
float[] point = new float[2];
float[] bounds = new float[4];
path.getBounds(bounds);
point[0] = (bounds[0] + bounds[0] + bounds[2]) / 2f;
point[1] = (bounds[1] + bounds[1] + bounds[3]) / 2f;
GCExtension extension = new GCExtension(gc);
extension.fillGradientPath(path, point, glowColor, 255, new Color[] { glowColor },
new int[] { 0 });
path.dispose();
gc.setClipping((Region) null);
}
gc.setAdvanced(false);
}