summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-10-05 00:09:32 +0000
committerDavid Robillard <d@drobilla.net>2008-10-05 00:09:32 +0000
commit8635f0e897f1be58e42886abe07e853d6d5d404a (patch)
tree20c6a2b40fb7659dec87c6e1a3fdef9387b6a0ad /libs
parent9a8eda6930aef71a17456704967a9f0b2e7b1769 (diff)
Update to clearlooks from gtk-engines-2.16.0
git-svn-id: svn://localhost/ardour2/branches/3.0@3857 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r--libs/clearlooks/animation.h2
-rw-r--r--libs/clearlooks/bits.c121
-rw-r--r--libs/clearlooks/cairo-support.c228
-rw-r--r--libs/clearlooks/cairo-support.h2
-rw-r--r--libs/clearlooks/clearlooks_draw.c1336
-rw-r--r--libs/clearlooks/clearlooks_draw.h15
-rw-r--r--libs/clearlooks/clearlooks_draw_glossy.c310
-rw-r--r--libs/clearlooks/clearlooks_draw_gummy.c730
-rw-r--r--libs/clearlooks/clearlooks_draw_inverted.c169
-rw-r--r--libs/clearlooks/clearlooks_rc_style.c181
-rw-r--r--libs/clearlooks/clearlooks_rc_style.h41
-rw-r--r--libs/clearlooks/clearlooks_style.c1151
-rw-r--r--libs/clearlooks/clearlooks_style.h19
-rw-r--r--libs/clearlooks/clearlooks_theme_main.c4
-rw-r--r--libs/clearlooks/clearlooks_types.h301
-rw-r--r--libs/clearlooks/config.h17
-rw-r--r--libs/clearlooks/ge-support.h1
-rw-r--r--libs/clearlooks/general-support.h4
-rw-r--r--libs/clearlooks/support.c43
-rw-r--r--libs/clearlooks/widget-information.c199
-rw-r--r--libs/clearlooks/widget-information.h47
21 files changed, 2844 insertions, 2077 deletions
diff --git a/libs/clearlooks/animation.h b/libs/clearlooks/animation.h
index da70b6ce66..b2059c29c2 100644
--- a/libs/clearlooks/animation.h
+++ b/libs/clearlooks/animation.h
@@ -16,7 +16,7 @@
* Boston, MA 02111-1307, USA.
*/
-#include "config.h"
+#include <config.h>
#ifdef HAVE_ANIMATION
#include <gtk/gtk.h>
diff --git a/libs/clearlooks/bits.c b/libs/clearlooks/bits.c
deleted file mode 100644
index 1e871bc5d3..0000000000
--- a/libs/clearlooks/bits.c
+++ /dev/null
@@ -1,121 +0,0 @@
-static unsigned char dot_intensity[] = {
-0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0x98,0xb9,0xc6,0xb9,0x91,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0xb9,0xbd,0xac,0x9e,0x65,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0xc6,0xac,0x9e,0x96,0x5c,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0xb9,0x9e,0x96,0x62,0x55,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0x91,0x65,0x5c,0x55,0x68,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
-0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,0x6e,
-};
-static unsigned char dot_alpha[] = {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x66,0xc4,0xff,0xc4,0x66,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x66,0xdf,0xff,0xff,0xff,0xdf,0x66,0x00,0x00,0x00,
-0x00,0x00,0x00,0xc4,0xff,0xff,0xff,0xff,0xff,0xc4,0x00,0x00,0x00,
-0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,
-0x00,0x00,0x00,0xc4,0xff,0xff,0xff,0xff,0xff,0xc4,0x00,0x00,0x00,
-0x00,0x00,0x00,0x66,0xdf,0xff,0xff,0xff,0xdf,0x66,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x66,0xc4,0xff,0xc4,0x66,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-};
-
-static unsigned char circle_alpha[] = {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x23,0x62,0x92,0xb3,0xb2,0x95,0x2b,0x00,0x00,0x00,
-0x00,0x00,0x3e,0xab,0xc9,0xeb,0xf9,0xf5,0xfd,0xff,0x57,0x00,0x00,
-0x00,0x1f,0xb5,0xd8,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0x00,
-0x00,0x67,0xb9,0xf2,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9c,0x00,
-0x00,0x9a,0xe2,0xfc,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0x00,
-0x00,0xba,0xeb,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xc0,0xfa,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe5,0x00,
-0x00,0x9b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x9c,0x00,
-0x00,0x2b,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x2b,0x00,
-0x00,0x00,0x57,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x57,0x00,0x00,
-0x00,0x00,0x00,0x2b,0x9c,0xe5,0xff,0xe5,0x9c,0x2b,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-};
-static unsigned char outline_alpha[] = {
-0x00,0x00,0x00,0x4a,0xac,0xe9,0xff,0xe9,0xac,0x4a,0x00,0x00,0x00,
-0x00,0x00,0x98,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x98,0x00,0x00,
-0x00,0x98,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x98,0x00,
-0x4a,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4a,
-0xac,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xac,
-0xe9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe9,
-0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,
-0xe9,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xe9,
-0xac,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xac,
-0x4a,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x4a,
-0x00,0x98,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x98,0x00,
-0x00,0x00,0x98,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x98,0x00,0x00,
-0x00,0x00,0x00,0x4a,0xac,0xe9,0xff,0xe9,0xac,0x4a,0x00,0x00,0x00,
-};
-static unsigned char inconsistent_alpha[] = {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0xfe,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,
-0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,0x00,
-0x00,0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xf8,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-};
-static unsigned char check_base_alpha[] = {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0xea,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0xea,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-};
-static unsigned char check_alpha[] = {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 11, 137, 151,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00, 9, 183, 172, 7,0x00,0x00,
-0x00,0x00, 12, 18,0x00,0x00, 3, 161, 233, 27,0x00,0x00,0x00,
-0x00,0x00, 199, 239, 101,0x00, 85, 253, 108,0x00,0x00,0x00,0x00,
-0x00,0x00, 83, 245, 250, 75, 206, 230, 8,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00, 104, 252, 243, 253, 124,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00, 2, 162, 255, 241, 28,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00, 18, 228, 163,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00, 78, 62,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-};
-static unsigned char check_inconsistent_alpha[] = {
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
-0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
-0x00,0x00,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
-};
diff --git a/libs/clearlooks/cairo-support.c b/libs/clearlooks/cairo-support.c
index dbe6fd3d34..450c41bcfc 100644
--- a/libs/clearlooks/cairo-support.c
+++ b/libs/clearlooks/cairo-support.c
@@ -81,31 +81,31 @@ ge_color_from_hsb (gdouble hue,
gdouble m1, m2, m3;
if (!color) return;
-
+
if (brightness <= 0.5)
m2 = brightness * (1 + saturation);
else
m2 = brightness + saturation - brightness * saturation;
-
+
m1 = 2 * brightness - m2;
-
+
hue_shift[0] = hue + 120;
hue_shift[1] = hue;
hue_shift[2] = hue - 120;
-
+
color_shift[0] = color_shift[1] = color_shift[2] = brightness;
-
+
i = (saturation == 0)?3:0;
-
+
for (; i < 3; i++)
{
m3 = hue_shift[i];
-
+
if (m3 > 360)
m3 = MODULA(m3, 360);
else if (m3 < 0)
m3 = 360 - MODULA(ABS(m3), 360);
-
+
if (m3 < 60)
color_shift[i] = m1 + (m2 - m1) * m3 / 60;
else if (m3 < 180)
@@ -114,8 +114,8 @@ ge_color_from_hsb (gdouble hue,
color_shift[i] = m1 + (m2 - m1) * (240 - m3) / 60;
else
color_shift[i] = m1;
- }
-
+ }
+
color->r = color_shift[0];
color->g = color_shift[1];
color->b = color_shift[2];
@@ -163,7 +163,7 @@ ge_gtk_style_to_cairo_color_cube (GtkStyle * style, CairoColorCube *cube)
g_return_if_fail (style && cube);
for (i = 0; i < 5; i++)
- {
+ {
ge_gdk_color_to_cairo (&style->bg[i], &cube->bg[i]);
ge_gdk_color_to_cairo (&style->fg[i], &cube->fg[i]);
@@ -174,7 +174,7 @@ ge_gtk_style_to_cairo_color_cube (GtkStyle * style, CairoColorCube *cube)
ge_gdk_color_to_cairo (&style->base[i], &cube->base[i]);
ge_gdk_color_to_cairo (&style->text[i], &cube->text[i]);
ge_gdk_color_to_cairo (&style->text_aa[i], &cube->text_aa[i]);
- }
+ }
cube->black.r = cube->black.g = cube->black.b = 0;
cube->black.a = 1;
@@ -189,17 +189,27 @@ ge_shade_color(const CairoColor *base, gdouble shade_ratio, CairoColor *composit
gdouble hue = 0;
gdouble saturation = 0;
gdouble brightness = 0;
-
+
g_return_if_fail (base && composite);
+
+ if (shade_ratio == 1.0)
+ {
+ composite->r = base->r;
+ composite->g = base->g;
+ composite->b = base->b;
+ composite->a = base->a;
+
+ return;
+ }
ge_hsb_from_color (base, &hue, &saturation, &brightness);
-
+
brightness = MIN(brightness*shade_ratio, 1.0);
brightness = MAX(brightness, 0.0);
-
+
saturation = MIN(saturation*shade_ratio, 1.0);
saturation = MAX(saturation, 0.0);
-
+
ge_color_from_hsb (hue, saturation, brightness, composite);
composite->a = base->a;
}
@@ -210,7 +220,7 @@ ge_saturate_color (const CairoColor *base, gdouble saturate_level, CairoColor *c
gdouble hue = 0;
gdouble saturation = 0;
gdouble brightness = 0;
-
+
g_return_if_fail (base && composite);
ge_hsb_from_color (base, &hue, &saturation, &brightness);
@@ -223,7 +233,7 @@ ge_saturate_color (const CairoColor *base, gdouble saturate_level, CairoColor *c
}
void
-ge_mix_color (const CairoColor *color1, const CairoColor *color2,
+ge_mix_color (const CairoColor *color1, const CairoColor *color2,
gdouble mix_factor, CairoColor *composite)
{
g_return_if_fail (color1 && color2 && composite);
@@ -246,7 +256,7 @@ ge_gdk_drawable_to_cairo (GdkDrawable *window, GdkRectangle *area)
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_MITER);
- if (area)
+ if (area)
{
cairo_rectangle (cr, area->x, area->y, area->width, area->height);
cairo_clip_preserve (cr);
@@ -277,8 +287,8 @@ ge_cairo_set_gdk_color_with_alpha (cairo_t *cr, const GdkColor *color, gdouble a
void
ge_cairo_pattern_add_color_stop_color (cairo_pattern_t *pattern,
- gfloat offset,
- const CairoColor *color)
+ gfloat offset,
+ const CairoColor *color)
{
g_return_if_fail (pattern && color);
@@ -286,10 +296,10 @@ ge_cairo_pattern_add_color_stop_color (cairo_pattern_t *pattern,
}
void
-ge_cairo_pattern_add_color_stop_shade(cairo_pattern_t *pattern,
- gdouble offset,
- const CairoColor *color,
- gdouble shade)
+ge_cairo_pattern_add_color_stop_shade (cairo_pattern_t *pattern,
+ gdouble offset,
+ const CairoColor *color,
+ gdouble shade)
{
CairoColor shaded;
@@ -302,12 +312,14 @@ ge_cairo_pattern_add_color_stop_shade(cairo_pattern_t *pattern,
ge_shade_color(color, shade, &shaded);
}
- ge_cairo_pattern_add_color_stop_color(pattern, offset, &shaded);
+ ge_cairo_pattern_add_color_stop_color(pattern, offset, &shaded);
}
-/* This function will draw a rounded corner at position x,y. If the radius
+/*
+ * This function will draw a rounded corner at position x,y. If the radius
* is very small (or negative) it will instead just do a line_to.
- * ge_cairo_rounded_corner assumes clockwise drawing. */
+ * ge_cairo_rounded_corner assumes clockwise drawing.
+ */
void
ge_cairo_rounded_corner (cairo_t *cr,
double x,
@@ -321,28 +333,29 @@ ge_cairo_rounded_corner (cairo_t *cr,
}
else
{
- switch (corner) {
- case CR_CORNER_NONE:
- cairo_line_to (cr, x, y);
- break;
- case CR_CORNER_TOPLEFT:
- cairo_arc (cr, x + radius, y + radius, radius, G_PI, G_PI * 3/2);
- break;
- case CR_CORNER_TOPRIGHT:
- cairo_arc (cr, x - radius, y + radius, radius, G_PI * 3/2, G_PI * 2);
- break;
- case CR_CORNER_BOTTOMRIGHT:
- cairo_arc (cr, x - radius, y - radius, radius, 0, G_PI * 1/2);
- break;
- case CR_CORNER_BOTTOMLEFT:
- cairo_arc (cr, x + radius, y - radius, radius, G_PI * 1/2, G_PI);
- break;
-
- default:
- /* A bitfield and not a sane value ... */
- g_assert_not_reached ();
- cairo_line_to (cr, x, y);
- return;
+ switch (corner)
+ {
+ case CR_CORNER_NONE:
+ cairo_line_to (cr, x, y);
+ break;
+ case CR_CORNER_TOPLEFT:
+ cairo_arc (cr, x + radius, y + radius, radius, G_PI, G_PI * 3/2);
+ break;
+ case CR_CORNER_TOPRIGHT:
+ cairo_arc (cr, x - radius, y + radius, radius, G_PI * 3/2, G_PI * 2);
+ break;
+ case CR_CORNER_BOTTOMRIGHT:
+ cairo_arc (cr, x - radius, y - radius, radius, 0, G_PI * 1/2);
+ break;
+ case CR_CORNER_BOTTOMLEFT:
+ cairo_arc (cr, x + radius, y - radius, radius, G_PI * 1/2, G_PI);
+ break;
+
+ default:
+ /* A bitfield and not a sane value ... */
+ g_assert_not_reached ();
+ cairo_line_to (cr, x, y);
+ return;
}
}
}
@@ -395,9 +408,9 @@ ge_cairo_rounded_rectangle (cairo_t *cr,
/* ge_cairo_stroke_rectangle.
*
- * A simple function to stroke the rectangle { x, y, w, h}.
- * (This function only exists because of a cairo performance bug that
- * has been fixed and it may be a good idea to get rid of it again.)
+ * A simple function to stroke the rectangle { x, y, w, h}.
+ * (This function only exists because of a cairo performance bug that
+ * has been fixed and it may be a good idea to get rid of it again.)
*/
void
ge_cairo_stroke_rectangle (cairo_t *cr, double x, double y, double w, double h)
@@ -406,19 +419,48 @@ ge_cairo_stroke_rectangle (cairo_t *cr, double x, double y, double w, double h)
cairo_stroke (cr);
}
+void
+ge_cairo_inner_rectangle (cairo_t *cr,
+ double x, double y,
+ double width, double height)
+{
+ double line_width = cairo_get_line_width (cr);
+
+ cairo_rectangle (cr, x + line_width / 2.0,
+ y + line_width / 2.0,
+ width - line_width,
+ height - line_width);
+}
+
+void
+ge_cairo_inner_rounded_rectangle (cairo_t *cr,
+ double x, double y,
+ double width, double height,
+ double radius, CairoCorners corners)
+{
+ double line_width = cairo_get_line_width (cr);
+
+ ge_cairo_rounded_rectangle (cr,
+ x + line_width / 2.0,
+ y + line_width / 2.0,
+ width - line_width,
+ height - line_width,
+ radius, corners);
+}
+
/***********************************************
* ge_cairo_simple_border -
*
* A simple routine to draw thin squared
* borders with a topleft and bottomright color.
- *
+ *
* It originated in Smooth-Engine.
***********************************************/
void
ge_cairo_simple_border (cairo_t *cr,
- const CairoColor * tl, const CairoColor * br,
- gint x, gint y, gint width, gint height,
- gboolean topleft_overlap)
+ const CairoColor * tl, const CairoColor * br,
+ gint x, gint y, gint width, gint height,
+ gboolean topleft_overlap)
{
gboolean solid_color;
@@ -445,7 +487,7 @@ ge_cairo_simple_border (cairo_t *cr,
cairo_stroke (cr);
}
-
+
ge_cairo_set_color(cr, tl);
cairo_move_to(cr, x + 0.5, y + height - 0.5);
@@ -471,9 +513,9 @@ ge_cairo_simple_border (cairo_t *cr,
}
void ge_cairo_polygon (cairo_t *cr,
- const CairoColor *color,
- GdkPoint *points,
- gint npoints)
+ const CairoColor *color,
+ GdkPoint *points,
+ gint npoints)
{
int i = 0;
@@ -503,12 +545,12 @@ void ge_cairo_polygon (cairo_t *cr,
}
void ge_cairo_line (cairo_t *cr,
- const CairoColor *color,
- gint x1,
- gint y1,
- gint x2,
- gint y2)
-{
+ const CairoColor *color,
+ gint x1,
+ gint y1,
+ gint x2,
+ gint y2)
+{
cairo_save(cr);
ge_cairo_set_color(cr, color);
@@ -584,18 +626,19 @@ ge_cairo_exchange_axis (cairo_t *cr,
***********************************************/
void
ge_cairo_pattern_fill(cairo_t *canvas,
- CairoPattern *pattern,
- gint x,
- gint y,
- gint width,
- gint height)
+ CairoPattern *pattern,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
cairo_matrix_t original_matrix, current_matrix;
if (pattern->operator == CAIRO_OPERATOR_DEST)
- {
return;
- }
+
+ if (width <= 0 || height <= 0)
+ return;
cairo_pattern_get_matrix(pattern->handle, &original_matrix);
current_matrix = original_matrix;
@@ -641,7 +684,7 @@ ge_cairo_pattern_fill(cairo_t *canvas,
cairo_save(canvas);
cairo_set_source(canvas, pattern->handle);
- cairo_set_operator(canvas, pattern->operator);
+ cairo_set_operator(canvas, pattern->operator);
cairo_rectangle(canvas, x, y, width, height);
cairo_fill (canvas);
@@ -658,7 +701,7 @@ ge_cairo_pattern_fill(cairo_t *canvas,
***********************************************/
CairoPattern*
ge_cairo_color_pattern(CairoColor *base)
-{
+{
CairoPattern * result = g_new0(CairoPattern, 1);
#if ((CAIRO_VERSION_MAJOR < 1) || ((CAIRO_VERSION_MAJOR == 1) && (CAIRO_VERSION_MINOR < 2)))
@@ -668,10 +711,10 @@ ge_cairo_color_pattern(CairoColor *base)
result->scale = GE_DIRECTION_NONE;
result->translate = GE_DIRECTION_NONE;
- result->handle = cairo_pattern_create_rgba(base->r,
- base->g,
- base->b,
- base->a);
+ result->handle = cairo_pattern_create_rgba(base->r,
+ base->g,
+ base->b,
+ base->a);
result->operator = CAIRO_OPERATOR_SOURCE;
@@ -685,14 +728,14 @@ ge_cairo_color_pattern(CairoColor *base)
***********************************************/
CairoPattern*
ge_cairo_pixbuf_pattern(GdkPixbuf *pixbuf)
-{
+{
CairoPattern * result = g_new0(CairoPattern, 1);
cairo_t *canvas;
cairo_surface_t * surface;
gint width, height;
- #if ((CAIRO_VERSION_MAJOR < 1) || ((CAIRO_VERSION_MAJOR == 1) && (CAIRO_VERSION_MINOR < 2)))
+ #if ((CAIRO_VERSION_MAJOR < 1) || ((CAIRO_VERSION_MAJOR == 1) && (CAIRO_VERSION_MINOR < 2)))
result->type = CAIRO_PATTERN_TYPE_SURFACE;
#endif
@@ -737,8 +780,8 @@ ge_cairo_pixmap_pattern(GdkPixmap *pixmap)
gdk_drawable_get_size (GDK_DRAWABLE (pixmap), &width, &height);
pixbuf = gdk_pixbuf_get_from_drawable(NULL, GDK_DRAWABLE (pixmap),
- gdk_drawable_get_colormap(GDK_DRAWABLE (pixmap)),
- 0, 0, 0, 0, width, height);
+ gdk_drawable_get_colormap(GDK_DRAWABLE (pixmap)),
+ 0, 0, 0, 0, width, height);
result = ge_cairo_pixbuf_pattern(pixbuf);
@@ -757,9 +800,9 @@ ge_cairo_pixmap_pattern(GdkPixmap *pixmap)
***********************************************/
CairoPattern *
ge_cairo_linear_shade_gradient_pattern(CairoColor *base,
- gdouble shade1,
- gdouble shade2,
- gboolean vertical)
+ gdouble shade1,
+ gdouble shade2,
+ gboolean vertical)
{
CairoPattern * result = g_new0(CairoPattern, 1);
@@ -796,12 +839,13 @@ ge_cairo_pattern_destroy(CairoPattern *pattern)
{
if (pattern->handle)
cairo_pattern_destroy(pattern->handle);
-
+
g_free(pattern);
}
}
-/* The following function will be called by GTK+ when the module
+/*
+ * The following function will be called by GTK+ when the module
* is loaded and checks to see if we are compatible with the
* version of GTK+ that loads us.
*/
@@ -809,7 +853,7 @@ GE_EXPORT const gchar* g_module_check_init (GModule *module);
const gchar*
g_module_check_init (GModule *module)
{
- return gtk_check_version (GTK_MAJOR_VERSION,
- GTK_MINOR_VERSION,
- GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
+ return gtk_check_version (GTK_MAJOR_VERSION,
+ GTK_MINOR_VERSION,
+ GTK_MICRO_VERSION - GTK_INTERFACE_AGE);
}
diff --git a/libs/clearlooks/cairo-support.h b/libs/clearlooks/cairo-support.h
index 12163b0469..2abcb81609 100644
--- a/libs/clearlooks/cairo-support.h
+++ b/libs/clearlooks/cairo-support.h
@@ -101,6 +101,8 @@ GE_INTERNAL void ge_cairo_rounded_corner (cairo_t *cr, double x, double y, doubl
GE_INTERNAL void ge_cairo_rounded_rectangle (cairo_t *cr, double x, double y, double w, double h, double radius, CairoCorners corners);
GE_INTERNAL void ge_cairo_stroke_rectangle (cairo_t *cr, double x, double y, double w, double h);
+GE_INTERNAL void ge_cairo_inner_rectangle (cairo_t *cr, double x, double y, double width, double height);
+GE_INTERNAL void ge_cairo_inner_rounded_rectangle (cairo_t *cr, double x, double y, double width, double height, double radius, CairoCorners corners);
GE_INTERNAL void ge_cairo_simple_border (cairo_t *cr, const CairoColor * tl, const CairoColor * br, gint x, gint y, gint width, gint height, gboolean topleft_overlap);
GE_INTERNAL void ge_cairo_line (cairo_t *cr, const CairoColor *color, gint x1, gint y1, gint x2, gint y2);
diff --git a/libs/clearlooks/clearlooks_draw.c b/libs/clearlooks/clearlooks_draw.c
index 614317ea3b..a6586ab0d6 100644
--- a/libs/clearlooks/clearlooks_draw.c
+++ b/libs/clearlooks/clearlooks_draw.c
@@ -31,6 +31,12 @@
#include <cairo.h>
+/* Normal shadings */
+#define SHADE_TOP 1.055
+#define SHADE_CENTER_TOP 1.01
+#define SHADE_CENTER_BOTTOM 0.98
+#define SHADE_BOTTOM 0.90
+
typedef void (*menubar_draw_proto) (cairo_t *cr,
const ClearlooksColors *colors,
const WidgetParameters *params,
@@ -38,98 +44,124 @@ typedef void (*menubar_draw_proto) (cairo_t *cr,
int x, int y, int width, int height);
static void
-clearlooks_draw_inset (cairo_t *cr,
- const CairoColor *bg_color,
- double x, double y, double w, double h,
+clearlooks_draw_inset (cairo_t *cr,
+ const CairoColor *bg_color,
+ double x, double y, double width, double height,
double radius, uint8 corners)
{
CairoColor shadow;
CairoColor highlight;
+ double line_width;
+ double min = MIN (width, height);
+
+ line_width = cairo_get_line_width (cr);
/* not really sure of shading ratios... we will think */
ge_shade_color (bg_color, 0.94, &shadow);
ge_shade_color (bg_color, 1.06, &highlight);
/* highlight */
- cairo_move_to (cr, x + w + (radius * -0.2928932188), y - (radius * -0.2928932188)); /* 0.2928932... 1-sqrt(2)/2 gives middle of curve */
-
- if (corners & CR_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, G_PI * 1.75, G_PI * 2);
- else
- cairo_line_to (cr, x + w, y);
+ cairo_save (cr);
- if (corners & CR_CORNER_BOTTOMRIGHT)
- cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, G_PI * 0.5);
- else
- cairo_line_to (cr, x + w, y + h);
+ cairo_move_to (cr, x, y + height);
+ cairo_line_to (cr, x + min / 2.0, y + height - min / 2.0);
+ cairo_line_to (cr, x + width - min / 2.0, y + min / 2.0);
+ cairo_line_to (cr, x + width, y);
+ cairo_line_to (cr, x, y);
+ cairo_close_path (cr);
+
+ cairo_clip (cr);
- if (corners & CR_CORNER_BOTTOMLEFT)
- cairo_arc (cr, x + radius, y + h - radius, radius, G_PI * 0.5, G_PI * 0.75);
- else
- cairo_line_to (cr, x, y + h);
+ ge_cairo_rounded_rectangle (cr, x + line_width / 2.0, y + line_width / 2.0,
+ width - line_width, height - line_width,
+ radius, corners);
- ge_cairo_set_color (cr, &highlight);
+ ge_cairo_set_color (cr, &shadow);
cairo_stroke (cr);
+
+ cairo_restore (cr);
/* shadow */
- cairo_move_to (cr, x + (radius * 0.2928932188), y + h + (radius * -0.2928932188));
+ cairo_save (cr);
- if (corners & CR_CORNER_BOTTOMLEFT)
- cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.75, M_PI);
- else
- cairo_line_to (cr, x, y + h);
+ cairo_move_to (cr, x, y + height);
+ cairo_line_to (cr, x + min / 2.0, y + height - min / 2.0);
+ cairo_line_to (cr, x + width - min / 2.0, y + min / 2.0);
+ cairo_line_to (cr, x + width, y);
+ cairo_line_to (cr, x + width, y + height);
+ cairo_close_path (cr);
+
+ cairo_clip (cr);
- if (corners & CR_CORNER_TOPLEFT)
- cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
- else
- cairo_line_to (cr, x, y);
+ ge_cairo_rounded_rectangle (cr, x + line_width / 2.0, y + line_width / 2.0,
+ width - line_width, height - line_width,
+ radius, corners);
- if (corners & CR_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
- else
- cairo_line_to (cr, x + w, y);
-
- ge_cairo_set_color (cr, &shadow);
+ ge_cairo_set_color (cr, &highlight);
cairo_stroke (cr);
+
+ cairo_restore (cr);
}
static void
clearlooks_draw_shadow (cairo_t *cr, const ClearlooksColors *colors, gfloat radius, int width, int height)
{
- CairoColor shadow;
+ CairoColor shadow;
+ cairo_save (cr);
+
ge_shade_color (&colors->shade[6], 0.92, &shadow);
cairo_set_line_width (cr, 1.0);
-
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+
cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, 0.1);
-
- cairo_move_to (cr, width, radius);
- ge_cairo_rounded_corner (cr, width, height, radius, CR_CORNER_BOTTOMRIGHT);
- cairo_line_to (cr, radius, height);
+
+ cairo_move_to (cr, width - 0.5, radius);
+ ge_cairo_rounded_corner (cr, width - 0.5, height - 0.5, radius, CR_CORNER_BOTTOMRIGHT);
+ cairo_line_to (cr, radius, height - 0.5);
cairo_stroke (cr);
+ cairo_restore (cr);
}
+/* This is copied at least in clearlooks_draw_gummy.c.
+ * KEEP IN SYNC IF POSSIBLE! */
static void
clearlooks_draw_top_left_highlight (cairo_t *cr, const CairoColor *color,
const WidgetParameters *params,
- int width, int height, gdouble radius)
+ int x, int y, int width, int height,
+ gdouble radius, CairoCorners corners)
{
- CairoColor hilight;
+ CairoColor hilight;
+
+ double line_width = cairo_get_line_width (cr);
+ double offset = line_width / 2.0;
+ double light_top, light_bottom, light_left, light_right;
+
+ cairo_save (cr);
- double light_top = params->ythickness-1,
- light_bottom = height - params->ythickness - 1,
- light_left = params->xthickness-1,
- light_right = width - params->xthickness - 1;
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
- ge_shade_color (color, 1.3, &hilight);
- cairo_move_to (cr, light_left, light_bottom - (int)radius/2);
+ light_top = y + offset;
+ light_bottom = y + height;
+ light_left = x + offset;
+ light_right = x + width;
+
+ if (corners & CR_CORNER_BOTTOMLEFT)
+ light_bottom -= radius;
+ if (corners & CR_CORNER_TOPRIGHT)
+ light_right -= radius;
- ge_cairo_rounded_corner (cr, light_left, light_top, radius, params->corners & CR_CORNER_TOPLEFT);
+ ge_shade_color (color, params->style_constants->topleft_highlight_shade, &hilight);
+ cairo_move_to (cr, light_left, light_bottom);
- cairo_line_to (cr, light_right - (int)radius/2, light_top);
- cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.5);
+ ge_cairo_rounded_corner (cr, light_left, light_top, radius, corners & CR_CORNER_TOPLEFT);
+
+ cairo_line_to (cr, light_right, light_top);
+ cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, params->style_constants->topleft_highlight_alpha);
cairo_stroke (cr);
+
+ cairo_restore (cr);
}
#ifdef DEVELOPMENT
@@ -147,47 +179,46 @@ clearlooks_draw_highlight_and_shade (cairo_t *cr, const ClearlooksColors *colors
double x = 1.0;
double y = 1.0;
- ge_shade_color (&colors->bg[GTK_STATE_NORMAL], 1.06, &hilight);
- ge_shade_color (&colors->bg[GTK_STATE_NORMAL], 0.94, &shadow);
+ ge_shade_color (&colors->bg[0], 1.06, &hilight);
+ ge_shade_color (&colors->bg[0], 0.94, &shadow);
+
+ width -= 2;
+ height -= 2;
- width -= 3;
- height -= 3;
-
cairo_save (cr);
-
+
/* Top/Left highlight */
if (corners & CR_CORNER_BOTTOMLEFT)
- cairo_move_to (cr, x, y+height-radius);
+ cairo_move_to (cr, x + 0.5, y+height-radius);
else
- cairo_move_to (cr, x, y+height);
-
- ge_cairo_rounded_corner (cr, x, y, radius, corners & CR_CORNER_TOPLEFT);
+ cairo_move_to (cr, x + 0.5, y+height);
+
+ ge_cairo_rounded_corner (cr, x + 0.5, y + 0.5, radius, corners & CR_CORNER_TOPLEFT);
if (corners & CR_CORNER_TOPRIGHT)
- cairo_line_to (cr, x+width-radius, y);
+ cairo_line_to (cr, x+width-radius, y + 0.5);
else
- cairo_line_to (cr, x+width, y);
-
+ cairo_line_to (cr, x+width, y + 0.5);
+
if (params->shadow & CL_SHADOW_OUT)
ge_cairo_set_color (cr, &hilight);
else
ge_cairo_set_color (cr, &shadow);
-
+
cairo_stroke (cr);
-
+
/* Bottom/Right highlight -- this includes the corners */
- cairo_move_to (cr, x+width-radius, y); /* topright and by radius to the left */
- ge_cairo_rounded_corner (cr, x+width, y, radius, corners & CR_CORNER_TOPRIGHT);
- ge_cairo_rounded_corner (cr, x+width, y+height, radius, corners & CR_CORNER_BOTTOMRIGHT);
- ge_cairo_rounded_corner (cr, x, y+height, radius, corners & CR_CORNER_BOTTOMLEFT);
-
+ cairo_arc (cr, x + width - 0.5 - radius, y + radius, radius, G_PI * (3/2.0+1/4.0), G_PI * 2);
+ ge_cairo_rounded_corner (cr, x+width - 0.5, y+height - 0.5, radius, corners & CR_CORNER_BOTTOMRIGHT);
+ cairo_arc (cr, x + radius, y + height - 0.5 - radius, radius, G_PI * 1/2, G_PI * 3/4);
+
if (params->shadow & CL_SHADOW_OUT)
ge_cairo_set_color (cr, &shadow);
else
ge_cairo_set_color (cr, &hilight);
-
+
cairo_stroke (cr);
-
+
cairo_restore (cr);
}
@@ -202,7 +233,7 @@ clearlooks_set_border_gradient (cairo_t *cr, const CairoColor *color, double hil
pattern = cairo_pattern_create_linear (0, 0, width, height);
cairo_pattern_add_color_stop_rgb (pattern, 0, color->r, color->g, color->b);
cairo_pattern_add_color_stop_rgb (pattern, 1, bottom_shade.r, bottom_shade.g, bottom_shade.b);
-
+
cairo_set_source (cr, pattern);
cairo_pattern_destroy (pattern);
}
@@ -216,20 +247,25 @@ clearlooks_draw_gripdots (cairo_t *cr, const ClearlooksColors *colors, int x, in
CairoColor hilight;
int i, j;
int xoff, yoff;
+ int x_start, y_start;
ge_shade_color (dark, 1.5, &hilight);
-
- for ( i = 0; i < xr; i++ )
+
+ /* The "- 1" is because there is no space in front of the first dot. */
+ x_start = x + width / 2 - ((xr * 3 - 1) / 2);
+ y_start = y + height / 2 - ((yr * 3 - 1) / 2);
+
+ for ( i = 0; i < xr; i++ )
{
for ( j = 0; j < yr; j++ )
{
- xoff = x -(xr * 3 / 2) + 3 * i;
- yoff = y -(yr * 3 / 2) + 3 * j;
-
- cairo_rectangle (cr, width/2+0.5+xoff, height/2+0.5+yoff, 2, 2);
+ xoff = 3 * i;
+ yoff = 3 * j;
+
+ cairo_rectangle (cr, x_start + xoff, y_start + yoff, 2, 2);
cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.8+contrast);
cairo_fill (cr);
- cairo_rectangle (cr, width/2+0.5+xoff, height/2+0.5+yoff, 1, 1);
+ cairo_rectangle (cr, x_start + xoff, y_start + yoff, 1, 1);
cairo_set_source_rgba (cr, dark->r, dark->g, dark->b, 0.8+contrast);
cairo_fill (cr);
}
@@ -245,14 +281,16 @@ clearlooks_draw_button (cairo_t *cr,
double xoffset = 0, yoffset = 0;
double radius = params->radius;
const CairoColor *fill = &colors->bg[params->state_type];
- const CairoColor *border_normal = &colors->shade[6];
- const CairoColor *border_disabled = &colors->shade[4];
+ CairoColor border_normal = colors->shade[6];
+ CairoColor border_disabled = colors->shade[4];
CairoColor shadow;
- ge_shade_color (border_normal, 0.925, &shadow);
-
+ ge_shade_color (&border_normal, 1.04, &border_normal);
+ ge_shade_color (&border_normal, 0.94, &shadow);
+ ge_shade_color (&border_disabled, 1.08, &border_disabled);
+
cairo_save (cr);
-
+
cairo_translate (cr, x, y);
cairo_set_line_width (cr, 1.0);
@@ -268,42 +306,52 @@ clearlooks_draw_button (cairo_t *cr,
if (params->xthickness == 3 || params->ythickness == 3)
{
- cairo_translate (cr, 0.5, 0.5);
- params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width-1, height-1, radius+1, params->corners);
- cairo_translate (cr, -0.5, -0.5);
- }
-
+ params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width, height, radius+1, params->corners);
+ }
+
ge_cairo_rounded_rectangle (cr, xoffset+1, yoffset+1,
width-(xoffset*2)-2,
height-(yoffset*2)-2,
radius, params->corners);
-
+
if (!params->active)
{
cairo_pattern_t *pattern;
- gdouble shade_size = ((100.0/height)*8.0)/100.0;
- CairoColor top_shade, bottom_shade, middle_shade;
-
- ge_shade_color (fill, 1.1, &top_shade);
- ge_shade_color (fill, 0.98, &middle_shade);
- ge_shade_color (fill, 0.93, &bottom_shade);
-
+ CairoColor top_shade, topmiddle_shade, bottom_shade, middle_shade;
+
+ ge_shade_color (fill, SHADE_TOP, &top_shade);
+ ge_shade_color (fill, SHADE_CENTER_TOP, &topmiddle_shade);
+ ge_shade_color (fill, SHADE_CENTER_BOTTOM, &middle_shade);
+ ge_shade_color (fill, SHADE_BOTTOM, &bottom_shade);
+
+ cairo_save (cr);
+ cairo_clip_preserve (cr);
+
pattern = cairo_pattern_create_linear (0, 0, 0, height);
cairo_pattern_add_color_stop_rgb (pattern, 0.0, top_shade.r, top_shade.g, top_shade.b);
- cairo_pattern_add_color_stop_rgb (pattern, shade_size, fill->r, fill->g, fill->b);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0 - shade_size, middle_shade.r, middle_shade.g, middle_shade.b);
- cairo_pattern_add_color_stop_rgb (pattern, (height-(yoffset*2)-1)/height, bottom_shade.r, bottom_shade.g, bottom_shade.b);
- cairo_pattern_add_color_stop_rgba (pattern, (height-(yoffset*2)-1)/height, bottom_shade.r, bottom_shade.g, bottom_shade.b, 0.7);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, bottom_shade.r, bottom_shade.g, bottom_shade.b, 0.7);
-
+ cairo_pattern_add_color_stop_rgb (pattern, 0.3, topmiddle_shade.r, topmiddle_shade.g, topmiddle_shade.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.7, middle_shade.r, middle_shade.g, middle_shade.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0, bottom_shade.r, bottom_shade.g, bottom_shade.b);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
+
+ cairo_move_to (cr, width-(xoffset*2)-0.5, 0);
+ cairo_line_to (cr, width-(xoffset*2)-0.5, height);
+ ge_cairo_set_color (cr, &bottom_shade);
+ cairo_stroke (cr);
+
+ /* Draw topleft shadow */
+ params->style_functions->draw_top_left_highlight (cr, fill, params, xoffset + 1, yoffset + 1,
+ width - 2*(xoffset + 1), height - 2*(yoffset + 1),
+ MAX(radius-1, 0), params->corners);
+
+ cairo_restore (cr);
}
else
{
cairo_pattern_t *pattern;
-
+
ge_cairo_set_color (cr, fill);
cairo_fill_preserve (cr);
@@ -316,58 +364,46 @@ clearlooks_draw_button (cairo_t *cr,
cairo_pattern_destroy (pattern);
pattern = cairo_pattern_create_linear (0, yoffset+1, 0, 3+yoffset);
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, params->disabled ? 0.125 : 0.3);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, params->disabled ? 0.125 : 0.32);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.0);
cairo_set_source (cr, pattern);
cairo_fill_preserve (cr);
cairo_pattern_destroy (pattern);
pattern = cairo_pattern_create_linear (xoffset+1, 0, 3+xoffset, 0);
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, params->disabled ? 0.125 : 0.3);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, params->disabled ? 0.125 : 0.32);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.0);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
}
-
/* Drawing the border */
if (!params->active && params->is_default)
{
- const CairoColor *l = &colors->shade[4];
- const CairoColor *d = &colors->shade[4];
- ge_cairo_set_color (cr, l);
- ge_cairo_stroke_rectangle (cr, 2.5, 2.5, width-5, height-5);
-
- ge_cairo_set_color (cr, d);
- ge_cairo_stroke_rectangle (cr, 3.5, 3.5, width-7, height-7);
+ ge_shade_color (&border_normal, 0.74, &border_normal);
}
-
- ge_cairo_rounded_rectangle (cr, xoffset + 0.5, yoffset + 0.5, width-(xoffset*2)-1, height-(yoffset*2)-1, radius, params->corners);
+
+ ge_cairo_inner_rounded_rectangle (cr, xoffset, yoffset, width-(xoffset*2), height-(yoffset*2), radius, params->corners);
if (params->disabled)
- ge_cairo_set_color (cr, border_disabled);
+ {
+ ge_cairo_set_color (cr, &border_disabled);
+ }
else
+ {
if (!params->active)
- clearlooks_set_border_gradient (cr, border_normal, 1.32, 0, height);
+ clearlooks_set_border_gradient (cr, &border_normal,
+ params->is_default ? 1.1 : 1.3, 0, height);
else
- ge_cairo_set_color (cr, border_normal);
-
- cairo_stroke (cr);
-
- /* Draw the "shadow" */
- if (!params->active)
- {
- cairo_translate (cr, 0.5, 0.5);
- /* Draw right shadow */
- cairo_move_to (cr, width-params->xthickness, params->ythickness - 1);
- cairo_line_to (cr, width-params->xthickness, height - params->ythickness - 1);
- cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, 0.1);
- cairo_stroke (cr);
-
- /* Draw topleft shadow */
- clearlooks_draw_top_left_highlight (cr, fill, params, width, height, radius);
+ {
+ ge_shade_color (&border_normal, 1.08, &border_normal);
+ ge_cairo_set_color (cr, &border_normal);
+ }
}
+
+ cairo_stroke (cr);
+
cairo_restore (cr);
}
@@ -378,56 +414,53 @@ clearlooks_draw_entry (cairo_t *cr,
int x, int y, int width, int height)
{
const CairoColor *base = &colors->base[params->state_type];
- CairoColor border = colors->shade[params->disabled ? 4 : 6];
+ CairoColor border = colors->shade[params->disabled ? 3 : 6];
double radius = MIN (params->radius, MIN ((width - 4.0) / 2.0, (height - 4.0) / 2.0));
-
+
if (params->focus)
border = colors->spot[2];
- cairo_translate (cr, x+0.5, y+0.5);
+ cairo_save (cr);
+
+ cairo_translate (cr, x, y);
cairo_set_line_width (cr, 1.0);
-
- /* Fill the background (shouldn't have to) */
- cairo_rectangle (cr, -0.5, -0.5, width, height);
- ge_cairo_set_color (cr, &params->parentbg);
- cairo_fill (cr);
- /* Fill the entry's base color (why isn't is large enough by default?) */
- cairo_rectangle (cr, 1.5, 1.5, width-4, height-4);
+ /* Now fill the area we want to be base[NORMAL]. */
+ ge_cairo_rounded_rectangle (cr, 2, 2, width-4, height-4, MAX(0, radius-1), params->corners);
ge_cairo_set_color (cr, base);
cairo_fill (cr);
-
- params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width-1, height-1, radius+1, params->corners);
+
+ params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width, height, radius+1, params->corners);
/* Draw the inner shadow */
if (params->focus)
{
- /* ge_cairo_rounded_rectangle (cr, 2, 2, width-5, height-5, RADIUS-1, params->corners); */
ge_cairo_set_color (cr, &colors->spot[0]);
- ge_cairo_stroke_rectangle (cr, 2, 2, width-5, height-5);
+ ge_cairo_inner_rounded_rectangle (cr, 2, 2, width-4, height-4, MAX(0, radius-1), params->corners);
+ cairo_stroke (cr);
}
else
{
- CairoColor shadow;
+ CairoColor shadow;
ge_shade_color (&border, 0.925, &shadow);
cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, params->disabled ? 0.05 : 0.1);
- /*
- cairo_move_to (cr, 2, height-3);
- cairo_arc (cr, params->xthickness+RADIUS-1, params->ythickness+RADIUS-1, RADIUS, G_PI, 270*(G_PI/180));
- cairo_line_to (cr, width-3, 2);*/
- cairo_move_to (cr, 2, height-3);
- cairo_line_to (cr, 2, 2);
- cairo_line_to (cr, width-3, 2);
+
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+ cairo_move_to (cr, 2.5, height-radius);
+ cairo_arc (cr, 2.5+MAX(0, radius-1), 2.5+MAX(0, radius-1), MAX(0, radius-1), G_PI, 270*(G_PI/180));
+ cairo_line_to (cr, width-radius, 2.5);
cairo_stroke (cr);
}
- ge_cairo_rounded_rectangle (cr, 1, 1, width-3, height-3, radius, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, params->corners);
if (params->focus || params->disabled)
ge_cairo_set_color (cr, &border);
else
- clearlooks_set_border_gradient (cr, &border, 1.32, 0, height);
+ clearlooks_set_border_gradient (cr, &border, 1.32, 0, height);
cairo_stroke (cr);
+
+ cairo_restore (cr);
}
static void
@@ -437,11 +470,12 @@ clearlooks_draw_spinbutton (cairo_t *cr,
int x, int y, int width, int height)
{
const CairoColor *border = &colors->shade[!params->disabled ? 5 : 3];
- CairoColor hilight;
+ CairoColor hilight;
params->style_functions->draw_button (cr, colors, params, x, y, width, height);
- ge_shade_color (border, 1.5, &hilight);
+ ge_shade_color (&colors->bg[0], params->style_constants->topleft_highlight_shade, &hilight);
+ hilight.a = params->style_constants->topleft_highlight_alpha;
cairo_translate (cr, x, y);
@@ -464,24 +498,24 @@ clearlooks_draw_spinbutton_down (cairo_t *cr,
{
cairo_pattern_t *pattern;
double radius = MIN (params->radius, MIN ((width - 4.0) / 2.0, (height - 4.0) / 2.0));
- CairoColor shadow;
- ge_shade_color (&colors->bg[GTK_STATE_NORMAL], 0.8, &shadow);
+ CairoColor shadow;
+ ge_shade_color (&colors->bg[0], 0.8, &shadow);
cairo_translate (cr, x+1, y+1);
-
+
ge_cairo_rounded_rectangle (cr, 1, 1, width-4, height-4, radius, params->corners);
-
+
ge_cairo_set_color (cr, &colors->bg[params->state_type]);
-
+
cairo_fill_preserve (cr);
-
+
pattern = cairo_pattern_create_linear (0, 0, 0, height);
cairo_pattern_add_color_stop_rgb (pattern, 0.0, shadow.r, shadow.g, shadow.b);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.0);
-
+
cairo_set_source (cr, pattern);
cairo_fill (cr);
-
+
cairo_pattern_destroy (pattern);
}
@@ -495,20 +529,21 @@ clearlooks_scale_draw_gradient (cairo_t *cr,
{
cairo_pattern_t *pattern;
- pattern = cairo_pattern_create_linear (0, 0, horizontal ? 0 : width, horizontal ? height : 0);
+ pattern = cairo_pattern_create_linear (0.5, 0.5, horizontal ? 0.5 : width + 1, horizontal ? height + 1: 0.5);
cairo_pattern_add_color_stop_rgb (pattern, 0.0, c1->r, c1->g, c1->b);
cairo_pattern_add_color_stop_rgb (pattern, 1.0, c2->r, c2->g, c2->b);
- cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
+ cairo_rectangle (cr, x, y, width, height);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
-
+
ge_cairo_set_color (cr, c3);
- ge_cairo_stroke_rectangle (cr, x, y, width, height);
+ ge_cairo_inner_rectangle (cr, x, y, width, height);
+ cairo_stroke (cr);
}
-#define TROUGH_SIZE 6
+#define TROUGH_SIZE 7
static void
clearlooks_draw_scale_trough (cairo_t *cr,
const ClearlooksColors *colors,
@@ -519,43 +554,54 @@ clearlooks_draw_scale_trough (cairo_t *cr,
int trough_width, trough_height;
double translate_x, translate_y;
+ cairo_save (cr);
+
if (slider->horizontal)
{
- trough_width = width-3;
- trough_height = TROUGH_SIZE-2;
+ trough_width = width;
+ trough_height = TROUGH_SIZE;
- translate_x = x + 0.5;
- translate_y = y + 0.5 + (height/2) - (TROUGH_SIZE/2);
+ translate_x = x;
+ translate_y = y + (height/2) - (TROUGH_SIZE/2);
}
else
{
- trough_width = TROUGH_SIZE-2;
- trough_height = height-3;
+ trough_width = TROUGH_SIZE;
+ trough_height = height;
- translate_x = x + 0.5 + (width/2) - (TROUGH_SIZE/2);
- translate_y = y + 0.5;
+ translate_x = x + (width/2) - (TROUGH_SIZE/2);
+ translate_y = y;
}
cairo_set_line_width (cr, 1.0);
cairo_translate (cr, translate_x, translate_y);
-
+
if (!slider->fill_level)
- params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, trough_width+2, trough_height+2, 0, 0);
+ params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, trough_width, trough_height, 0, 0);
- cairo_translate (cr, 1, 1);
-
- if (!slider->lower && ! slider->fill_level)
- clearlooks_scale_draw_gradient (cr, &colors->shade[3], /* top */
- &colors->shade[2], /* bottom */
- &colors->shade[6], /* border */
- 0, 0, trough_width, trough_height,
- slider->horizontal);
+ if (!slider->lower && !slider->fill_level)
+ {
+ CairoColor shadow;
+ ge_shade_color (&colors->shade[2], 0.96, &shadow);
+
+ clearlooks_scale_draw_gradient (cr, &shadow, /* top */
+ &colors->shade[2], /* bottom */
+ &colors->shade[4], /* border */
+ 1.0, 1.0, trough_width - 2, trough_height - 2,
+ slider->horizontal);
+ }
else
- clearlooks_scale_draw_gradient (cr, &colors->spot[1], /* top */
- &colors->spot[0], /* bottom */
- &colors->spot[2], /* border */
- 0, 0, trough_width, trough_height,
- slider->horizontal);
+ {
+ CairoColor border = colors->spot[2];
+ border.a = 0.64;
+
+ clearlooks_scale_draw_gradient (cr, &colors->spot[1], /* top */
+ &colors->spot[0], /* bottom */
+ &border, /* border */
+ 1.0, 1.0, trough_width - 2, trough_height - 2,
+ slider->horizontal);
+ }
+ cairo_restore (cr);
}
static void
@@ -564,21 +610,21 @@ clearlooks_draw_slider (cairo_t *cr,
const WidgetParameters *params,
int x, int y, int width, int height)
{
- const CairoColor *border = &colors->shade[params->disabled ? 4 : 6];
const CairoColor *spot = &colors->spot[1];
const CairoColor *fill = &colors->shade[2];
+ CairoColor border = colors->shade[params->disabled ? 4 : 6];
double radius = MIN (params->radius, MIN ((width - 1.0) / 2.0, (height - 1.0) / 2.0));
cairo_pattern_t *pattern;
- cairo_set_line_width (cr, 1.0);
+ cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x, y);
if (params->prelight)
- border = &colors->spot[2];
+ border = colors->spot[2];
/* fill the widget */
- cairo_rectangle (cr, 0.5, 0.5, width-2, height-2);
+ ge_cairo_rounded_rectangle (cr, 1.0, 1.0, width-2, height-2, radius, params->corners);
/* Fake light */
if (!params->disabled)
@@ -596,34 +642,33 @@ clearlooks_draw_slider (cairo_t *cr,
else
{
ge_cairo_set_color (cr, fill);
- cairo_rectangle (cr, 0.5, 0.5, width-2, height-2);
cairo_fill (cr);
}
/* Set the clip */
cairo_save (cr);
- cairo_rectangle (cr, 0.5, 0.5, 6, height-2);
- cairo_rectangle (cr, width-7.5, 0.5, 6 , height-2);
+ cairo_rectangle (cr, 1.0, 1.0, 6, height-2);
+ cairo_rectangle (cr, width-7.0, 1.0, 6, height-2);
cairo_clip_preserve (cr);
cairo_new_path (cr);
/* Draw the handles */
- ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, params->corners);
- pattern = cairo_pattern_create_linear (0.5, 0.5, 0.5, 0.5+height);
+ ge_cairo_rounded_rectangle (cr, 1.0, 1.0, width-1, height-1, radius, params->corners);
+ pattern = cairo_pattern_create_linear (1.0, 1.0, 1.0, 1.0+height);
if (params->prelight)
{
CairoColor highlight;
- ge_shade_color (spot, 1.5, &highlight);
+ ge_shade_color (spot, 1.3, &highlight);
cairo_pattern_add_color_stop_rgb (pattern, 0.0, highlight.r, highlight.g, highlight.b);
cairo_pattern_add_color_stop_rgb (pattern, 1.0, spot->r, spot->g, spot->b);
cairo_set_source (cr, pattern);
}
- else
+ else
{
- CairoColor hilight;
- ge_shade_color (fill, 1.5, &hilight);
+ CairoColor hilight;
+ ge_shade_color (fill, 1.3, &hilight);
cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.5);
}
@@ -633,28 +678,26 @@ clearlooks_draw_slider (cairo_t *cr,
cairo_restore (cr);
/* Draw the border */
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius, params->corners);
if (params->prelight || params->disabled)
- ge_cairo_set_color (cr, border);
+ ge_cairo_set_color (cr, &border);
else
- clearlooks_set_border_gradient (cr, border, 1.2, 0, height);
+ clearlooks_set_border_gradient (cr, &border, 1.2, 0, height);
cairo_stroke (cr);
/* Draw handle lines */
if (width > 14)
{
- cairo_move_to (cr, 6, 0.5);
- cairo_line_to (cr, 6, height-1);
-
- cairo_move_to (cr, width-7, 0.5);
- cairo_line_to (cr, width-7, height-1);
-
+ cairo_move_to (cr, 6.5, 1.0);
+ cairo_line_to (cr, 6.5, height-1);
+
+ cairo_move_to (cr, width-6.5, 1.0);
+ cairo_line_to (cr, width-6.5, height-1);
+
cairo_set_line_width (cr, 1.0);
- cairo_set_source_rgba (cr, border->r,
- border->g,
- border->b,
- 0.3);
+ border.a = params->disabled ? 0.6 : 0.3;
+ ge_cairo_set_color (cr, &border);
cairo_stroke (cr);
}
}
@@ -666,18 +709,22 @@ clearlooks_draw_slider_button (cairo_t *cr,
const SliderParameters *slider,
int x, int y, int width, int height)
{
- double radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
+ double radius = MIN (params->radius, MIN ((width - 1.0) / 2.0, (height - 1.0) / 2.0));
+
+ cairo_save (cr);
cairo_set_line_width (cr, 1.0);
-
+
if (!slider->horizontal)
ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
- cairo_translate (cr, x+0.5, y+0.5);
+ cairo_translate (cr, x, y);
- params->style_functions->draw_shadow (cr, colors, radius, width-1, height-1);
+ params->style_functions->draw_shadow (cr, colors, radius, width, height);
params->style_functions->draw_slider (cr, colors, params, 1, 1, width-2, height-2);
if (width > 24)
- params->style_functions->draw_gripdots (cr, colors, 0, 0, width-2, height-2, 3, 3, 0);
+ params->style_functions->draw_gripdots (cr, colors, 1, 1, width-2, height-2, 3, 3, 0);
+
+ cairo_restore (cr);
}
static void
@@ -686,24 +733,18 @@ clearlooks_draw_progressbar_trough (cairo_t *cr,
const WidgetParameters *params,
int x, int y, int width, int height)
{
- const CairoColor *border = &colors->shade[6];
- CairoColor shadow;
- cairo_pattern_t *pattern;
- double radius = MIN (params->radius, MIN ((height-2.0) / 2.0, (width-2.0) / 2.0));
-
+ const CairoColor *border = &colors->shade[4];
+ CairoColor shadow;
+ cairo_pattern_t *pattern;
+ double radius = MIN (params->radius, MIN ((height-2.0) / 2.0, (width-2.0) / 2.0));
+
cairo_save (cr);
cairo_set_line_width (cr, 1.0);
-
- /* Fill with bg color */
- ge_cairo_set_color (cr, &colors->bg[params->state_type]);
-
- cairo_rectangle (cr, x, y, width, height);
- cairo_fill (cr);
/* Create trough box */
ge_cairo_rounded_rectangle (cr, x+1, y+1, width-2, height-2, radius, params->corners);
- ge_cairo_set_color (cr, &colors->shade[3]);
+ ge_cairo_set_color (cr, &colors->shade[2]);
cairo_fill (cr);
/* Draw border */
@@ -720,8 +761,8 @@ clearlooks_draw_progressbar_trough (cairo_t *cr,
/* Top shadow */
cairo_rectangle (cr, x+1, y+1, width-2, 4);
pattern = cairo_pattern_create_linear (x, y, x, y+4);
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.3);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.2);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
@@ -729,8 +770,8 @@ clearlooks_draw_progressbar_trough (cairo_t *cr,
/* Left shadow */
cairo_rectangle (cr, x+1, y+1, 4, height-2);
pattern = cairo_pattern_create_linear (x, y, x+4, y);
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.3);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.2);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
@@ -770,9 +811,9 @@ clearlooks_draw_progressbar_fill (cairo_t *cr,
/* Clamp the radius so that the _height_ fits ... */
radius = MIN (radius, height / 2.0);
- stroke_width = height*2;
+ stroke_width = height;
x_step = (((float)stroke_width/10)*offset); /* This looks weird ... */
-
+
cairo_translate (cr, x, y);
cairo_save (cr);
@@ -785,13 +826,19 @@ clearlooks_draw_progressbar_fill (cairo_t *cr,
/* Draw the background gradient */
ge_shade_color (&colors->spot[1], 1.1, &bg_shade);
- pattern = cairo_pattern_create_linear (0, 0, 0, height);
- cairo_pattern_add_color_stop_rgb (pattern, 0.0, bg_shade.r, bg_shade.g, bg_shade.b);
- cairo_pattern_add_color_stop_rgb (pattern, 0.6, colors->spot[1].r, colors->spot[1].g, colors->spot[1].b);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0, bg_shade.r, bg_shade.g, bg_shade.b);
- cairo_set_source (cr, pattern);
+
+ /* Just leave this disabled, maybe we could use the same gradient
+ * as the buttons in the future, not flat fill */
+/* pattern = cairo_pattern_create_linear (0, 0, 0, height);*/
+/* cairo_pattern_add_color_stop_rgb (pattern, 0.0, bg_shade.r, bg_shade.g, bg_shade.b);*/
+/* cairo_pattern_add_color_stop_rgb (pattern, 0.6, colors->spot[1].r, colors->spot[1].g, colors->spot[1].b);*/
+/* cairo_pattern_add_color_stop_rgb (pattern, 1.0, bg_shade.r, bg_shade.g, bg_shade.b);*/
+/* cairo_set_source (cr, pattern);*/
+/* cairo_paint (cr);*/
+/* cairo_pattern_destroy (pattern);*/
+
+ ge_cairo_set_color (cr, &bg_shade);
cairo_paint (cr);
- cairo_pattern_destroy (pattern);
/* Draw the Strokes */
while (tile_pos <= width+x_step)
@@ -800,49 +847,19 @@ clearlooks_draw_progressbar_fill (cairo_t *cr,
cairo_line_to (cr, stroke_width-x_step, 0);
cairo_line_to (cr, stroke_width/2-x_step, height);
cairo_line_to (cr, -x_step, height);
-
+
cairo_translate (cr, stroke_width, 0);
tile_pos += stroke_width;
}
-
- cairo_set_source_rgba (cr, colors->spot[2].r,
- colors->spot[2].g,
- colors->spot[2].b,
- 0.15);
-
- cairo_fill (cr);
- cairo_restore (cr); /* rounded clip region */
-
- /* inner highlight border
- * This is again kinda ugly. Draw once from each side, clipping away the other. */
- cairo_set_source_rgba (cr, colors->spot[0].r, colors->spot[0].g, colors->spot[0].b, 0.5);
- /* left side */
- cairo_save (cr);
- cairo_rectangle (cr, 0, 0, width / 2, height);
- cairo_clip (cr);
-
- if (progressbar->pulsing)
- ge_cairo_rounded_rectangle (cr, 1.5, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
- else
- ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT);
-
- cairo_stroke (cr);
- cairo_restore (cr); /* clip */
-
- /* right side */
- cairo_save (cr);
- cairo_rectangle (cr, width / 2, 0, (width+1) / 2, height);
- cairo_clip (cr);
-
- if (progressbar->value < 1.0 || progressbar->pulsing)
- ge_cairo_rounded_rectangle (cr, -1.5 - radius, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
- else
- ge_cairo_rounded_rectangle (cr, -0.5 - radius, 0.5, width + radius, height - 1, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
-
- cairo_stroke (cr);
- cairo_restore (cr); /* clip */
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, colors->spot[2].r, colors->spot[2].g, colors->spot[2].b, 0);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0, colors->spot[2].r, colors->spot[2].g, colors->spot[2].b, 0.24);
+ cairo_set_source (cr, pattern);
+ cairo_fill (cr);
+ cairo_pattern_destroy (pattern);
+ cairo_restore (cr); /* rounded clip region */
/* Draw the dark lines and the shadow */
cairo_save (cr);
@@ -852,8 +869,6 @@ clearlooks_draw_progressbar_fill (cairo_t *cr,
ge_cairo_rounded_rectangle (cr, -radius - 1.0, 0, width + radius + 2.0, height, radius, CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT);
cairo_clip (cr);
- border = colors->spot[2];
- border.a = 0.5;
shadow.r = 0.0;
shadow.g = 0.0;
shadow.b = 0.0;
@@ -862,12 +877,6 @@ clearlooks_draw_progressbar_fill (cairo_t *cr,
if (progressbar->pulsing)
{
/* At the beginning of the bar. */
- cairo_move_to (cr, 0.5 + radius, height + 0.5);
- ge_cairo_rounded_corner (cr, 0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMLEFT);
- ge_cairo_rounded_corner (cr, 0.5, -0.5, radius + 1, CR_CORNER_TOPLEFT);
- ge_cairo_set_color (cr, &border);
- cairo_stroke (cr);
-
cairo_move_to (cr, -0.5 + radius, height + 0.5);
ge_cairo_rounded_corner (cr, -0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMLEFT);
ge_cairo_rounded_corner (cr, -0.5, -0.5, radius + 1, CR_CORNER_TOPLEFT);
@@ -877,19 +886,27 @@ clearlooks_draw_progressbar_fill (cairo_t *cr,
if (progressbar->value < 1.0 || progressbar->pulsing)
{
/* At the end of the bar. */
- cairo_move_to (cr, width - 0.5 - radius, -0.5);
- ge_cairo_rounded_corner (cr, width - 0.5, -0.5, radius + 1, CR_CORNER_TOPRIGHT);
- ge_cairo_rounded_corner (cr, width - 0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMRIGHT);
- ge_cairo_set_color (cr, &border);
- cairo_stroke (cr);
-
cairo_move_to (cr, width + 0.5 - radius, -0.5);
ge_cairo_rounded_corner (cr, width + 0.5, -0.5, radius + 1, CR_CORNER_TOPRIGHT);
ge_cairo_rounded_corner (cr, width + 0.5, height + 0.5, radius + 1, CR_CORNER_BOTTOMRIGHT);
ge_cairo_set_color (cr, &shadow);
cairo_stroke (cr);
}
-
+
+/* ge_cairo_rounded_rectangle (cr, 1.5,1.5, width-2, height-2, radius, CR_CORNER_ALL);*/
+/* cairo_set_source_rgba (cr, colors->spot[0].r, colors->spot[0].g, colors->spot[0].b, 1);*/
+/* cairo_stroke (cr);*/
+
+ params->style_functions->draw_top_left_highlight (cr, &colors->spot[1], params, 1.5, 1.5,
+ width - 1, height - 1,
+ radius, params->corners);
+
+ border = colors->spot[2];
+ border.a = 0.6;
+ ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, CR_CORNER_ALL);
+ ge_cairo_set_color (cr, &border);
+ cairo_stroke (cr);
+
cairo_restore (cr);
cairo_restore (cr); /* rotation, mirroring */
@@ -903,10 +920,10 @@ clearlooks_draw_optionmenu (cairo_t *cr,
int x, int y, int width, int height)
{
SeparatorParameters separator;
- int offset = params->ythickness + 1;
-
+ int offset = params->ythickness + 2;
+
params->style_functions->draw_button (cr, colors, params, x, y, width, height);
-
+
separator.horizontal = FALSE;
params->style_functions->draw_separator (cr, colors, params, &separator, x+optionmenu->linepos, y + offset, 2, height - offset*2);
}
@@ -939,21 +956,19 @@ clearlooks_draw_menubar0 (cairo_t *cr,
const MenuBarParameters *menubar,
int x, int y, int width, int height)
{
-/* const CairoColor *light = &colors->shade[0]; */
const CairoColor *dark = &colors->shade[3];
- cairo_set_line_width (cr, 1);
- cairo_translate (cr, x, y+0.5);
+ cairo_save (cr);
-/* cairo_move_to (cr, 0, 0); */
-/* cairo_line_to (cr, width, 0); */
-/* ge_cairo_set_color (cr, light); */
-/* cairo_stroke (cr); */
+ cairo_set_line_width (cr, 1);
+ cairo_translate (cr, x, y);
- cairo_move_to (cr, 0, height-1);
- cairo_line_to (cr, width, height-1);
+ cairo_move_to (cr, 0, height-0.5);
+ cairo_line_to (cr, width, height-0.5);
ge_cairo_set_color (cr, dark);
cairo_stroke (cr);
+
+ cairo_restore (cr);
}
static void
@@ -966,11 +981,13 @@ clearlooks_draw_menubar2 (cairo_t *cr,
CairoColor lower;
cairo_pattern_t *pattern;
+ cairo_save (cr);
+
ge_shade_color (&colors->bg[0], 0.96, &lower);
-
+
cairo_translate (cr, x, y);
cairo_rectangle (cr, 0, 0, width, height);
-
+
/* Draw the gradient */
pattern = cairo_pattern_create_linear (0, 0, 0, height);
cairo_pattern_add_color_stop_rgb (pattern, 0.0, colors->bg[0].r,
@@ -982,13 +999,15 @@ clearlooks_draw_menubar2 (cairo_t *cr,
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
-
+
/* Draw bottom line */
cairo_set_line_width (cr, 1.0);
cairo_move_to (cr, 0, height-0.5);
cairo_line_to (cr, width, height-0.5);
ge_cairo_set_color (cr, &colors->shade[3]);
cairo_stroke (cr);
+
+ cairo_restore (cr);
}
static void
@@ -1009,10 +1028,10 @@ clearlooks_draw_menubar1 (cairo_t *cr,
static menubar_draw_proto clearlooks_menubar_draw[3] =
-{
- clearlooks_draw_menubar0,
+{
+ clearlooks_draw_menubar0,
clearlooks_draw_menubar1,
- clearlooks_draw_menubar2
+ clearlooks_draw_menubar2
};
static void
@@ -1022,7 +1041,7 @@ clearlooks_draw_menubar (cairo_t *cr,
const MenuBarParameters *menubar,
int x, int y, int width, int height)
{
- if (menubar->style < 0 || menubar->style > 3)
+ if (menubar->style < 0 || menubar->style >= G_N_ELEMENTS (clearlooks_menubar_draw))
return;
clearlooks_menubar_draw[menubar->style](cr, colors, params, menubar,
@@ -1030,38 +1049,38 @@ clearlooks_draw_menubar (cairo_t *cr,
}
static void
-clearlooks_get_frame_gap_clip (int x, int y, int width, int height,
+clearlooks_get_frame_gap_clip (int x, int y, int width, int height,
const FrameParameters *frame,
ClearlooksRectangle *bevel,
ClearlooksRectangle *border)
{
if (frame->gap_side == CL_GAP_TOP)
{
- CLEARLOOKS_RECTANGLE_SET ((*bevel), 1.5 + frame->gap_x, -0.5,
- frame->gap_width - 3, 2.0);
- CLEARLOOKS_RECTANGLE_SET ((*border), 0.5 + frame->gap_x, -0.5,
- frame->gap_width - 2, 2.0);
+ CLEARLOOKS_RECTANGLE_SET (*bevel, 2.0 + frame->gap_x, 0.0,
+ frame->gap_width - 3, 2.0);
+ CLEARLOOKS_RECTANGLE_SET (*border, 1.0 + frame->gap_x, 0.0,
+ frame->gap_width - 2, 2.0);
}
else if (frame->gap_side == CL_GAP_BOTTOM)
{
- CLEARLOOKS_RECTANGLE_SET ((*bevel), 1.5 + frame->gap_x, height - 2.5,
- frame->gap_width - 3, 2.0);
- CLEARLOOKS_RECTANGLE_SET ((*border), 0.5 + frame->gap_x, height - 1.5,
- frame->gap_width - 2, 2.0);
+ CLEARLOOKS_RECTANGLE_SET (*bevel, 2.0 + frame->gap_x, height - 2.0,
+ frame->gap_width - 3, 2.0);
+ CLEARLOOKS_RECTANGLE_SET (*border, 1.0 + frame->gap_x, height - 1.0,
+ frame->gap_width - 2, 2.0);
}
else if (frame->gap_side == CL_GAP_LEFT)
{
- CLEARLOOKS_RECTANGLE_SET ((*bevel), -0.5, 1.5 + frame->gap_x,
- 2.0, frame->gap_width - 3);
- CLEARLOOKS_RECTANGLE_SET ((*border), -0.5, 0.5 + frame->gap_x,
- 1.0, frame->gap_width - 2);
+ CLEARLOOKS_RECTANGLE_SET (*bevel, 0.0, 2.0 + frame->gap_x,
+ 2.0, frame->gap_width - 3);
+ CLEARLOOKS_RECTANGLE_SET (*border, 0.0, 1.0 + frame->gap_x,
+ 1.0, frame->gap_width - 2);
}
else if (frame->gap_side == CL_GAP_RIGHT)
{
- CLEARLOOKS_RECTANGLE_SET ((*bevel), width - 2.5, 1.5 + frame->gap_x,
- 2.0, frame->gap_width - 3);
- CLEARLOOKS_RECTANGLE_SET ((*border), width - 1.5, 0.5 + frame->gap_x,
- 1.0, frame->gap_width - 2);
+ CLEARLOOKS_RECTANGLE_SET (*bevel, width - 2.0, 2.0 + frame->gap_x,
+ 2.0, frame->gap_width - 3);
+ CLEARLOOKS_RECTANGLE_SET (*border, width - 1.0, 1.0 + frame->gap_x,
+ 1.0, frame->gap_width - 2);
}
}
@@ -1079,18 +1098,18 @@ clearlooks_draw_frame (cairo_t *cr,
double radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
CairoColor hilight;
- ge_shade_color (&colors->bg[GTK_STATE_NORMAL], 1.05, &hilight);
-
+ ge_shade_color (&colors->bg[0], 1.05, &hilight);
+
if (frame->shadow == CL_SHADOW_NONE)
return;
-
+
if (frame->gap_x != -1)
clearlooks_get_frame_gap_clip (x, y, width, height,
frame, &bevel_clip, &frame_clip);
-
+
cairo_set_line_width (cr, 1.0);
- cairo_translate (cr, x+0.5, y+0.5);
-
+ cairo_translate (cr, x, y);
+
/* save everything */
cairo_save (cr);
/* Set clip for the bevel */
@@ -1098,19 +1117,19 @@ clearlooks_draw_frame (cairo_t *cr,
{
/* Set clip for gap */
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
- cairo_rectangle (cr, -0.5, -0.5, width, height);
+ cairo_rectangle (cr, 0, 0, width, height);
cairo_rectangle (cr, bevel_clip.x, bevel_clip.y, bevel_clip.width, bevel_clip.height);
cairo_clip (cr);
}
-
+
/* Draw the bevel */
if (frame->shadow == CL_SHADOW_ETCHED_IN || frame->shadow == CL_SHADOW_ETCHED_OUT)
{
ge_cairo_set_color (cr, &hilight);
if (frame->shadow == CL_SHADOW_ETCHED_IN)
- ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 1, 1, width-1, height-1, radius, params->corners);
else
- ge_cairo_rounded_rectangle (cr, 0, 0, width-2, height-2, radius, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
cairo_stroke (cr);
}
else if (frame->shadow != CL_SHADOW_NONE)
@@ -1118,9 +1137,9 @@ clearlooks_draw_frame (cairo_t *cr,
ShadowParameters shadow;
shadow.corners = params->corners;
shadow.shadow = frame->shadow;
- clearlooks_draw_highlight_and_shade (cr, colors, &shadow, width, height, 0);
+ clearlooks_draw_highlight_and_shade (cr, colors, &shadow, width, height, radius);
}
-
+
/* restore the previous clip region */
cairo_restore (cr);
cairo_save (cr);
@@ -1128,7 +1147,7 @@ clearlooks_draw_frame (cairo_t *cr,
{
/* Set clip for gap */
cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
- cairo_rectangle (cr, -0.5, -0.5, width, height);
+ cairo_rectangle (cr, 0, 0, width, height);
cairo_rectangle (cr, frame_clip.x, frame_clip.y, frame_clip.width, frame_clip.height);
cairo_clip (cr);
}
@@ -1138,14 +1157,14 @@ clearlooks_draw_frame (cairo_t *cr,
{
ge_cairo_set_color (cr, dark);
if (frame->shadow == CL_SHADOW_ETCHED_IN)
- ge_cairo_rounded_rectangle (cr, 0, 0, width-2, height-2, radius, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
else
- ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 1, 1, width-1, height-1, radius, params->corners);
}
else
{
ge_cairo_set_color (cr, border);
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius, params->corners);
}
cairo_stroke (cr);
@@ -1159,28 +1178,32 @@ clearlooks_draw_tab (cairo_t *cr,
const TabParameters *tab,
int x, int y, int width, int height)
{
- const CairoColor *border1 = &colors->shade[6];
- const CairoColor *border2 = &colors->shade[5];
- const CairoColor *stripe_fill = &colors->spot[1];
- const CairoColor *stripe_border = &colors->spot[2];
- const CairoColor *fill;
- CairoColor hilight;
-
- cairo_pattern_t *pattern;
-
- double radius;
- double strip_size;
+ const CairoColor *border1 = &colors->shade[6];
+ const CairoColor *border2 = &colors->shade[5];
+ const CairoColor *stripe_fill = &colors->spot[1];
+ const CairoColor *stripe_border = &colors->spot[2];
+ const CairoColor *fill;
+ CairoColor hilight;
+
+ cairo_pattern_t *pattern;
+
+ double radius;
+ double stripe_size = 2.0;
+ double stripe_fill_size;
+ double length;
radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
+ cairo_save (cr);
+
/* Set clip */
cairo_rectangle (cr, x, y, width, height);
cairo_clip (cr);
cairo_new_path (cr);
- /* Translate and set line width */
+ /* Translate and set line width */
cairo_set_line_width (cr, 1.0);
- cairo_translate (cr, x+0.5, y+0.5);
+ cairo_translate (cr, x, y);
/* Make the tabs slightly bigger than they should be, to create a gap */
@@ -1188,27 +1211,29 @@ clearlooks_draw_tab (cairo_t *cr,
if (tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM)
{
height += 3.0;
- strip_size = 2.0/height; /* 2 pixel high strip */
-
+ length = height;
+ stripe_fill_size = (tab->gap_side == CL_GAP_TOP ? stripe_size/height : stripe_size/(height-2));
+
if (tab->gap_side == CL_GAP_TOP)
cairo_translate (cr, 0.0, -3.0); /* gap at the other side */
}
else
{
width += 3.0;
- strip_size = 2.0/width;
-
- if (tab->gap_side == CL_GAP_LEFT)
+ length = width;
+ stripe_fill_size = (tab->gap_side == CL_GAP_LEFT ? stripe_size/width : stripe_size/(width-2));
+
+ if (tab->gap_side == CL_GAP_LEFT)
cairo_translate (cr, -3.0, 0.0); /* gap at the other side */
}
-
+
/* Set the fill color */
fill = &colors->bg[params->state_type];
/* Set tab shape */
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1,
+ ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1,
radius, params->corners);
-
+
/* Draw fill */
ge_cairo_set_color (cr, fill);
cairo_fill (cr);
@@ -1220,32 +1245,45 @@ clearlooks_draw_tab (cairo_t *cr,
if (!params->active)
{
ShadowParameters shadow;
-
+
shadow.shadow = CL_SHADOW_OUT;
shadow.corners = params->corners;
-
+
clearlooks_draw_highlight_and_shade (cr, colors, &shadow,
width,
height, radius);
}
-
+
if (params->active)
{
CairoColor shadow;
- pattern = cairo_pattern_create_linear ( tab->gap_side == CL_GAP_LEFT ? width-1 : 0,
- tab->gap_side == CL_GAP_TOP ? height-2 : 1,
- tab->gap_side == CL_GAP_RIGHT ? width : 0,
- tab->gap_side == CL_GAP_BOTTOM ? height : 0 );
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (0.5, height-1.5, 0.5, 0.5);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (0.5, 1.5, 0.5, height+0.5);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-1.5, 0.5, 1.5, 0.5);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (1.5, 0.5, width-1.5, 0.5);
+ break;
+ default:
+ pattern = NULL;
+ }
+
+ ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, params->corners);
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
-
ge_shade_color (fill, 0.92, &shadow);
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, hilight.r, hilight.g, hilight.b, 0.4);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0/height, hilight.r, hilight.g, hilight.b, 0.4);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, fill->r,fill->g,fill->b);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0, shadow.r,shadow.g,shadow.b);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, hilight.r, hilight.g, hilight.b, 0.4);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0/length, hilight.r, hilight.g, hilight.b, 0.4);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0/length, fill->r,fill->g,fill->b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0, shadow.r,shadow.g,shadow.b);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
@@ -1253,25 +1291,37 @@ clearlooks_draw_tab (cairo_t *cr,
else
{
/* Draw shade */
- pattern = cairo_pattern_create_linear ( tab->gap_side == CL_GAP_LEFT ? width-2 : 0,
- tab->gap_side == CL_GAP_TOP ? height-2 : 0,
- tab->gap_side == CL_GAP_RIGHT ? width : 0,
- tab->gap_side == CL_GAP_BOTTOM ? height : 0 );
-
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
-
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (0.5, height-1.5, 0.5, 0.5);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (0.5, 0.5, 0.5, height+0.5);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-1.5, 0.5, 0.5, 0.5);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (0.5, 0.5, width+0.5, 0.5);
+ break;
+ default:
+ pattern = NULL;
+ }
+
+ ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, params->corners);
cairo_pattern_add_color_stop_rgb (pattern, 0.0, stripe_fill->r, stripe_fill->g, stripe_fill->b);
- cairo_pattern_add_color_stop_rgb (pattern, strip_size, stripe_fill->r, stripe_fill->g, stripe_fill->b);
- cairo_pattern_add_color_stop_rgba (pattern, strip_size, hilight.r, hilight.g, hilight.b, 0.5);
+ cairo_pattern_add_color_stop_rgb (pattern, stripe_fill_size, stripe_fill->r, stripe_fill->g, stripe_fill->b);
+ cairo_pattern_add_color_stop_rgba (pattern, stripe_fill_size, hilight.r, hilight.g, hilight.b, 0.5);
cairo_pattern_add_color_stop_rgba (pattern, 0.8, hilight.r, hilight.g, hilight.b, 0.0);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
}
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
-
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius, params->corners);
+
if (params->active)
{
ge_cairo_set_color (cr, border2);
@@ -1279,19 +1329,34 @@ clearlooks_draw_tab (cairo_t *cr,
}
else
{
- pattern = cairo_pattern_create_linear ( tab->gap_side == CL_GAP_LEFT ? width-2 : 2,
- tab->gap_side == CL_GAP_TOP ? height-2 : 2,
- tab->gap_side == CL_GAP_RIGHT ? width : 2,
- tab->gap_side == CL_GAP_BOTTOM ? height : 2 );
-
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (2.5, height-1.5, 2.5, 2.5);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (2.5, 2.5, 2.5, height+0.5);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-1.5, 2.5, 2.5, 2.5);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (2.5, 2.5, width+0.5, 2.5);
+ break;
+ default:
+ pattern = NULL;
+ }
+
cairo_pattern_add_color_stop_rgb (pattern, 0.0, stripe_border->r, stripe_border->g, stripe_border->b);
- cairo_pattern_add_color_stop_rgb (pattern, strip_size, stripe_border->r, stripe_border->g, stripe_border->b);
- cairo_pattern_add_color_stop_rgb (pattern, strip_size, border1->r, border1->g, border1->b);
+ cairo_pattern_add_color_stop_rgb (pattern, stripe_fill_size, stripe_border->r, stripe_border->g, stripe_border->b);
+ cairo_pattern_add_color_stop_rgb (pattern, stripe_fill_size, border1->r, border1->g, border1->b);
cairo_pattern_add_color_stop_rgb (pattern, 1.0, border2->r, border2->g, border2->b);
cairo_set_source (cr, pattern);
cairo_stroke (cr);
cairo_pattern_destroy (pattern);
}
+
+ cairo_restore (cr);
}
static void
@@ -1301,9 +1366,9 @@ clearlooks_draw_separator (cairo_t *cr,
const SeparatorParameters *separator,
int x, int y, int width, int height)
{
- CairoColor color = colors->shade[3];
- CairoColor hilight;
- ge_shade_color (&color, 1.4, &hilight);
+ CairoColor color = colors->shade[2];
+ CairoColor hilight;
+ ge_shade_color (&colors->bg[0], 1.065, &hilight);
cairo_save (cr);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
@@ -1312,12 +1377,12 @@ clearlooks_draw_separator (cairo_t *cr,
{
cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x, y+0.5);
-
+
cairo_move_to (cr, 0.0, 0.0);
cairo_line_to (cr, width, 0.0);
ge_cairo_set_color (cr, &color);
cairo_stroke (cr);
-
+
cairo_move_to (cr, 0.0, 1.0);
cairo_line_to (cr, width, 1.0);
ge_cairo_set_color (cr, &hilight);
@@ -1327,12 +1392,12 @@ clearlooks_draw_separator (cairo_t *cr,
{
cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x+0.5, y);
-
+
cairo_move_to (cr, 0.0, 0.0);
cairo_line_to (cr, 0.0, height);
ge_cairo_set_color (cr, &color);
cairo_stroke (cr);
-
+
cairo_move_to (cr, 1.0, 0.0);
cairo_line_to (cr, 1.0, height);
ge_cairo_set_color (cr, &hilight);
@@ -1349,54 +1414,43 @@ clearlooks_draw_list_view_header (cairo_t *cr,
const ListViewHeaderParameters *header,
int x, int y, int width, int height)
{
- const CairoColor *border = &colors->shade[5];
- cairo_pattern_t *pattern;
- CairoColor hilight;
- CairoColor shadow;
+ const CairoColor *border = &colors->shade[4];
+ CairoColor hilight;
- ge_shade_color (border, 1.5, &hilight);
- ge_shade_color (border, 0.925, &shadow);
+ ge_shade_color (&colors->bg[params->state_type],
+ params->style_constants->topleft_highlight_shade, &hilight);
+ hilight.a = params->style_constants->topleft_highlight_alpha;
cairo_translate (cr, x, y);
cairo_set_line_width (cr, 1.0);
-
+
/* Draw highlight */
- if (header->order == CL_ORDER_FIRST)
+ if (header->order & CL_ORDER_FIRST)
{
cairo_move_to (cr, 0.5, height-1);
cairo_line_to (cr, 0.5, 0.5);
}
else
cairo_move_to (cr, 0.0, 0.5);
-
+
cairo_line_to (cr, width, 0.5);
-
+
ge_cairo_set_color (cr, &hilight);
cairo_stroke (cr);
-
+
/* Draw bottom border */
cairo_move_to (cr, 0.0, height-0.5);
cairo_line_to (cr, width, height-0.5);
ge_cairo_set_color (cr, border);
cairo_stroke (cr);
- /* Draw bottom shade */
- pattern = cairo_pattern_create_linear (0.0, height-5.0, 0.0, height-1.0);
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, shadow.r, shadow.g, shadow.b, 0.0);
- cairo_pattern_add_color_stop_rgba (pattern, 1.0, shadow.r, shadow.g, shadow.b, 0.3);
-
- cairo_rectangle (cr, 0.0, height-5.0, width, 4.0);
- cairo_set_source (cr, pattern);
- cairo_fill (cr);
- cairo_pattern_destroy (pattern);
-
/* Draw resize grip */
- if ((params->ltr && header->order != CL_ORDER_LAST) ||
- (!params->ltr && header->order != CL_ORDER_FIRST) || header->resizable)
+ if ((params->ltr && !(header->order & CL_ORDER_LAST)) ||
+ (!params->ltr && !(header->order & CL_ORDER_FIRST)) || header->resizable)
{
SeparatorParameters separator;
separator.horizontal = FALSE;
-
+
if (params->ltr)
params->style_functions->draw_separator (cr, colors, params, &separator,
width-1.5, 4.0, 2, height-8.0);
@@ -1415,18 +1469,18 @@ clearlooks_draw_toolbar (cairo_t *cr,
const ToolbarParameters *toolbar,
int x, int y, int width, int height)
{
- const CairoColor *fill = &colors->bg[GTK_STATE_NORMAL];
+ const CairoColor *fill = &colors->bg[0];
const CairoColor *dark = &colors->shade[3];
CairoColor light;
- ge_shade_color (fill, 1.1, &light);
-
+ ge_shade_color (fill, 1.065, &light);
+
cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x, y);
ge_cairo_set_color (cr, fill);
cairo_paint (cr);
- if (!toolbar->topmost)
+ if (!toolbar->topmost)
{
/* Draw highlight */
cairo_move_to (cr, 0, 0.5);
@@ -1481,10 +1535,10 @@ clearlooks_draw_menubaritem (cairo_t *cr,
CairoColor fill_shade;
CairoColor border = colors->spot[2];
cairo_pattern_t *pattern;
-
+
ge_shade_color (&border, 1.05, &border);
ge_shade_color (fill, 0.85, &fill_shade);
-
+
cairo_set_line_width (cr, 1.0);
ge_cairo_rounded_rectangle (cr, x + 0.5, y + 0.5, width - 1, height, widget->radius, widget->corners);
@@ -1508,10 +1562,9 @@ clearlooks_draw_selected_cell (cairo_t *cr,
{
CairoColor upper_color;
CairoColor lower_color;
- CairoColor border;
cairo_pattern_t *pattern;
cairo_save (cr);
-
+
cairo_translate (cr, x, y);
if (params->focus)
@@ -1534,16 +1587,6 @@ clearlooks_draw_selected_cell (cairo_t *cr,
cairo_fill (cr);
cairo_pattern_destroy (pattern);
-
- ge_shade_color(&upper_color, 0.8, &border);
-
- cairo_move_to (cr, 0, 0.5);
- cairo_rel_line_to (cr, width, 0);
- cairo_move_to (cr, 0, height-0.5);
- cairo_rel_line_to (cr, width, 0);
-
- ge_cairo_set_color (cr, &border);
- cairo_stroke (cr);
cairo_restore (cr);
}
@@ -1560,34 +1603,44 @@ clearlooks_draw_scrollbar_trough (cairo_t *cr,
const CairoColor *border = &colors->shade[5];
CairoColor bg_shade;
cairo_pattern_t *pattern;
-
+ double radius = MIN (widget->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
+
ge_shade_color (bg, 0.95, &bg_shade);
-
+
cairo_set_line_width (cr, 1);
/* cairo_translate (cr, x, y); */
-
+
if (scrollbar->horizontal)
ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
- cairo_translate (cr, x, y);
+ cairo_translate (cr, x, y);
/* Draw fill */
- cairo_rectangle (cr, 1, 0, width-2, height);
+ if (radius > 3.0)
+ ge_cairo_rounded_rectangle (cr, 1, 0, width-2, height,
+ radius, widget->corners);
+ else
+ cairo_rectangle (cr, 1, 0, width-2, height);
ge_cairo_set_color (cr, bg);
cairo_fill (cr);
/* Draw shadow */
pattern = cairo_pattern_create_linear (1, 0, 3, 0);
cairo_pattern_add_color_stop_rgb (pattern, 0, bg_shade.r, bg_shade.g, bg_shade.b);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0, bg->r, bg->g, bg->b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0, bg->r, bg->g, bg->b);
cairo_rectangle (cr, 1, 0, 4, height);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
-
+
/* Draw border */
+ if (radius > 3.0)
+ ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1,
+ radius, widget->corners);
+ else
+ cairo_rectangle (cr, 0.5, 0.5, width-1, height-1);
ge_cairo_set_color (cr, border);
- ge_cairo_stroke_rectangle (cr, 0.5, 0.5, width-1, height-1);
+ cairo_stroke (cr);
}
static void
@@ -1602,11 +1655,10 @@ clearlooks_draw_scrollbar_stepper (cairo_t *cr,
CairoColor border;
CairoColor s1, s2, s3, s4;
cairo_pattern_t *pattern;
- ShadowParameters shadow;
double radius = MIN (widget->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
- ge_shade_color(&colors->shade[6], 1.05, &border);
-
+ ge_shade_color(&colors->shade[6], 1.08, &border);
+
if (scrollbar->horizontal)
{
if (stepper->stepper == CL_STEPPER_A)
@@ -1621,45 +1673,35 @@ clearlooks_draw_scrollbar_stepper (cairo_t *cr,
else if (stepper->stepper == CL_STEPPER_D)
corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT;
}
-
+
cairo_translate (cr, x, y);
cairo_set_line_width (cr, 1);
-
+
ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, corners);
-
+
if (scrollbar->horizontal)
pattern = cairo_pattern_create_linear (0, 0, 0, height);
else
pattern = cairo_pattern_create_linear (0, 0, width, 0);
-
- s2 = colors->bg[widget->state_type];
- ge_shade_color(&s2, 1.06, &s1);
- ge_shade_color(&s2, 0.98, &s3);
- ge_shade_color(&s2, 0.94, &s4);
-
- cairo_pattern_add_color_stop_rgb(pattern, 0, s1.r, s1.g, s1.b);
- cairo_pattern_add_color_stop_rgb(pattern, 0.5, s2.r, s2.g, s2.b);
- cairo_pattern_add_color_stop_rgb(pattern, 0.7, s3.r, s3.g, s3.b);
- cairo_pattern_add_color_stop_rgb(pattern, 1.0, s4.r, s4.g, s4.b);
+
+ ge_shade_color (&colors->bg[widget->state_type], SHADE_TOP, &s1);
+ ge_shade_color (&colors->bg[widget->state_type], SHADE_CENTER_TOP, &s2);
+ ge_shade_color (&colors->bg[widget->state_type], SHADE_CENTER_BOTTOM, &s3);
+ ge_shade_color (&colors->bg[widget->state_type], SHADE_BOTTOM, &s4);
+
+ cairo_pattern_add_color_stop_rgb(pattern, 0, s1.r, s1.g, s1.b);
+ cairo_pattern_add_color_stop_rgb(pattern, 0.3, s2.r, s2.g, s2.b);
+ cairo_pattern_add_color_stop_rgb(pattern, 0.7, s3.r, s3.g, s3.b);
+ cairo_pattern_add_color_stop_rgb(pattern, 1.0, s4.r, s4.g, s4.b);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
-
- cairo_translate (cr, 0.5, 0.5);
- clearlooks_draw_top_left_highlight (cr, &s2, widget, width, height, (stepper->stepper == CL_STEPPER_A) ? radius : 0);
- cairo_translate (cr, -0.5, -0.5);
-
- ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, corners);
- clearlooks_set_border_gradient (cr, &border, 1.2, (scrollbar->horizontal ? 0 : width), (scrollbar->horizontal ? height: 0));
+
+ widget->style_functions->draw_top_left_highlight (cr, &s2, widget, 1, 1, width - 2, height - 2, MAX(radius - 1, 0), corners);
+
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius, corners);
+ clearlooks_set_border_gradient (cr, &border, 1.1, (scrollbar->horizontal ? 0 : width), (scrollbar->horizontal ? height: 0));
cairo_stroke (cr);
-
- cairo_translate (cr, 0.5, 0.5);
- shadow.shadow = CL_SHADOW_OUT;
- shadow.corners = corners;
- /*
- clearlooks_draw_highlight_and_shade (cr, &shadow,
- width,
- height, params->radius);*/
}
static void
@@ -1669,6 +1711,8 @@ clearlooks_draw_scrollbar_slider (cairo_t *cr,
const ScrollBarParameters *scrollbar,
int x, int y, int width, int height)
{
+ cairo_save (cr);
+
if (scrollbar->junction & CL_JUNCTION_BEGIN)
{
if (scrollbar->horizontal)
@@ -1689,11 +1733,11 @@ clearlooks_draw_scrollbar_slider (cairo_t *cr,
else
height += 1;
}
-
+
if (!scrollbar->horizontal)
ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
- cairo_translate (cr, x, y);
+ cairo_translate (cr, x, y);
if (scrollbar->has_color)
{
@@ -1705,27 +1749,27 @@ clearlooks_draw_scrollbar_slider (cairo_t *cr,
if (widget->prelight)
ge_shade_color (&fill, 1.1, &fill);
-
+
cairo_set_line_width (cr, 1);
-
+
ge_shade_color (&fill, 1.3, &hilight);
ge_shade_color (&fill, 1.1, &shade1);
ge_shade_color (&fill, 1.05, &shade2);
ge_shade_color (&fill, 0.98, &shade3);
-
+
pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
- cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade3.r, shade3.g, shade3.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade3.r, shade3.g, shade3.b);
cairo_pattern_add_color_stop_rgb (pattern, 1, fill.r, fill.g, fill.b);
cairo_rectangle (cr, 1, 1, width-2, height-2);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
-
+
cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.5);
ge_cairo_stroke_rectangle (cr, 1.5, 1.5, width-3, height-3);
-
+
ge_cairo_set_color (cr, border);
ge_cairo_stroke_rectangle (cr, 0.5, 0.5, width-1, height-1);
}
@@ -1738,16 +1782,15 @@ clearlooks_draw_scrollbar_slider (cairo_t *cr,
cairo_pattern_t *pattern;
int bar_x, i;
- ge_shade_color(&colors->shade[6], 1.05, &border);
-
- s2 = colors->bg[widget->state_type];
- ge_shade_color(&s2, 1.06, &s1);
- ge_shade_color(&s2, 0.98, &s3);
- ge_shade_color(&s2, 0.94, &s4);
-
+ ge_shade_color (&colors->shade[6], 1.08, &border);
+ ge_shade_color (&colors->bg[widget->state_type], SHADE_TOP, &s1);
+ ge_shade_color (&colors->bg[widget->state_type], SHADE_CENTER_TOP, &s2);
+ ge_shade_color (&colors->bg[widget->state_type], SHADE_CENTER_BOTTOM, &s3);
+ ge_shade_color (&colors->bg[widget->state_type], SHADE_BOTTOM, &s4);
+
pattern = cairo_pattern_create_linear(1, 1, 1, height-1);
cairo_pattern_add_color_stop_rgb(pattern, 0, s1.r, s1.g, s1.b);
- cairo_pattern_add_color_stop_rgb(pattern, 0.5, s2.r, s2.g, s2.b);
+ cairo_pattern_add_color_stop_rgb(pattern, 0.3, s2.r, s2.g, s2.b);
cairo_pattern_add_color_stop_rgb(pattern, 0.7, s3.r, s3.g, s3.b);
cairo_pattern_add_color_stop_rgb(pattern, 1.0, s4.r, s4.g, s4.b);
@@ -1755,38 +1798,41 @@ clearlooks_draw_scrollbar_slider (cairo_t *cr,
cairo_set_source(cr, pattern);
cairo_fill(cr);
cairo_pattern_destroy(pattern);
-
- clearlooks_set_border_gradient (cr, &border, 1.2, 0, height);
+
+ clearlooks_set_border_gradient (cr, &border, 1.1, 0, height);
ge_cairo_stroke_rectangle (cr, 0.5, 0.5, width-1, height-1);
-
+
cairo_move_to (cr, 1.5, height-1.5);
cairo_line_to (cr, 1.5, 1.5);
cairo_line_to (cr, width-1.5, 1.5);
- ge_shade_color (&s2, 1.3, &s5);
- cairo_set_source_rgba (cr, s5.r, s5.g, s5.b, 0.5);
+ ge_shade_color (&s2, widget->style_constants->topleft_highlight_shade, &s5);
+ s5.a = widget->style_constants->topleft_highlight_alpha;
+ ge_cairo_set_color (cr, &s5);
cairo_stroke(cr);
-
+
/* draw handles */
cairo_set_line_width (cr, 1);
-
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+
bar_x = width/2 - 4;
- cairo_translate(cr, 0.5, 0.5);
+
for (i=0; i<3; i++)
{
- cairo_move_to (cr, bar_x, 4);
- cairo_line_to (cr, bar_x, height-5);
+ cairo_move_to (cr, bar_x + 0.5, 4);
+ cairo_line_to (cr, bar_x + 0.5, height-4);
ge_cairo_set_color (cr, dark);
cairo_stroke (cr);
-
- cairo_move_to (cr, bar_x+1, 4);
- cairo_line_to (cr, bar_x+1, height-5);
+
+ cairo_move_to (cr, bar_x+1.5, 4);
+ cairo_line_to (cr, bar_x+1.5, height-4);
ge_cairo_set_color (cr, light);
cairo_stroke (cr);
-
+
bar_x += 3;
}
}
-
+
+ cairo_restore (cr);
}
static void
@@ -1804,7 +1850,7 @@ clearlooks_draw_statusbar (cairo_t *cr,
cairo_translate (cr, x, y+0.5);
cairo_move_to (cr, 0, 0);
cairo_line_to (cr, width, 0);
- ge_cairo_set_color (cr, dark);
+ ge_cairo_set_color (cr, dark);
cairo_stroke (cr);
cairo_translate (cr, 0, 1);
@@ -1823,11 +1869,7 @@ clearlooks_draw_menu_frame (cairo_t *cr,
const CairoColor *border = &colors->shade[5];
cairo_translate (cr, x, y);
cairo_set_line_width (cr, 1);
-/*
- cairo_set_source_rgba (cr, colors->bg[0].r, colors->bg[0].g, colors->bg[0].b, 0.9);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_paint (cr);
-*/
+
ge_cairo_set_color (cr, border);
ge_cairo_stroke_rectangle (cr, 0.5, 0.5, width-1, height-1);
}
@@ -1866,17 +1908,16 @@ clearlooks_draw_handle (cairo_t *cr,
{
const CairoColor *fill = &colors->bg[params->state_type];
int num_bars = 6; /* shut up gcc warnings */
- int bar_spacing;
-
+
+ cairo_save (cr);
+
switch (handle->type)
{
case CL_HANDLE_TOOLBAR:
num_bars = 6;
- bar_spacing = 3;
break;
case CL_HANDLE_SPLITTER:
num_bars = 16;
- bar_spacing = 3;
break;
}
@@ -1886,11 +1927,11 @@ clearlooks_draw_handle (cairo_t *cr,
ge_cairo_set_color (cr, fill);
cairo_fill (cr);
}
-
- cairo_translate (cr, x+0.5, y+0.5);
-
+
+ cairo_translate (cr, x, y);
+
cairo_set_line_width (cr, 1);
-
+
if (handle->horizontal)
{
params->style_functions->draw_gripdots (cr, colors, 0, 0, width, height, num_bars, 2, 0.1);
@@ -1899,6 +1940,8 @@ clearlooks_draw_handle (cairo_t *cr,
{
params->style_functions->draw_gripdots (cr, colors, 0, 0, width, height, 2, num_bars, 0.1);
}
+
+ cairo_restore (cr);
}
static void
@@ -1914,7 +1957,7 @@ clearlooks_draw_resize_grip (cairo_t *cr,
int x_down;
int y_down;
int dots;
-
+
ge_shade_color (dark, 1.5, &hilight);
/* The number of dots fitting into the area. Just hardcoded to 4 right now. */
@@ -1985,6 +2028,13 @@ clearlooks_draw_radiobutton (cairo_t *cr,
cairo_pattern_t *pt;
gboolean inconsistent;
gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
+ gdouble w, h, cx, cy, radius;
+
+ w = (gdouble) width;
+ h = (gdouble) height;
+ cx = width / 2.0;
+ cy = height / 2.0;
+ radius = MIN (width, height) / 2.0;
inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
draw_bullet |= inconsistent;
@@ -2003,53 +2053,53 @@ clearlooks_draw_radiobutton (cairo_t *cr,
ge_shade_color (&widget->parentbg, 0.9, &shadow);
ge_shade_color (&widget->parentbg, 1.1, &highlight);
- pt = cairo_pattern_create_linear (0, 0, 13, 13);
+ pt = cairo_pattern_create_linear (0, 0, radius * 2.0, radius * 2.0);
cairo_pattern_add_color_stop_rgb (pt, 0.0, shadow.r, shadow.b, shadow.g);
cairo_pattern_add_color_stop_rgba (pt, 0.5, shadow.r, shadow.b, shadow.g, 0.5);
cairo_pattern_add_color_stop_rgba (pt, 0.5, highlight.r, highlight.g, highlight.b, 0.5);
cairo_pattern_add_color_stop_rgb (pt, 1.0, highlight.r, highlight.g, highlight.b);
-
+
cairo_translate (cr, x, y);
-
- cairo_set_line_width (cr, 2);
- cairo_arc (cr, 7, 7, 6, 0, G_PI*2);
+
+ cairo_set_line_width (cr, MAX (1.0, floor (radius/3)));
+ cairo_arc (cr, ceil (cx), ceil (cy), floor (radius - 0.1), 0, G_PI*2);
cairo_set_source (cr, pt);
cairo_stroke (cr);
cairo_pattern_destroy (pt);
- cairo_set_line_width (cr, 1);
+ cairo_set_line_width (cr, MAX (1.0, floor (radius/6)));
+
+ cairo_arc (cr, ceil (cx), ceil (cy), MAX (1.0, ceil (radius) - 1.5), 0, G_PI*2);
- cairo_arc (cr, 7, 7, 5.5, 0, G_PI*2);
-
if (!widget->disabled)
{
ge_cairo_set_color (cr, &colors->base[0]);
cairo_fill_preserve (cr);
}
-
+
ge_cairo_set_color (cr, border);
cairo_stroke (cr);
-
+
if (draw_bullet)
{
if (inconsistent)
{
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
- cairo_set_line_width (cr, 4);
+ cairo_set_line_width (cr, ceil (radius * 2 / 3));
- cairo_move_to(cr, 5, 7);
- cairo_line_to(cr, 9, 7);
+ cairo_move_to (cr, ceil (cx - radius/3.0), ceil (cy));
+ cairo_line_to (cr, ceil (cx + radius/3.0), ceil (cy));
ge_cairo_set_color (cr, dot);
cairo_stroke (cr);
}
else
{
- cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
+ cairo_arc (cr, ceil (cx), ceil (cy), floor (radius/2.0), 0, G_PI*2);
ge_cairo_set_color (cr, dot);
cairo_fill (cr);
-
- cairo_arc (cr, 6, 6, 1, 0, G_PI*2);
+
+ cairo_arc (cr, floor (cx - radius/10.0), floor (cy - radius/10.0), floor (radius/6.0), 0, G_PI*2);
cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
cairo_fill (cr);
}
@@ -2070,7 +2120,7 @@ clearlooks_draw_checkbox (cairo_t *cr,
inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
draw_bullet |= inconsistent;
-
+
if (widget->disabled)
{
border = &colors->shade[5];
@@ -2084,11 +2134,11 @@ clearlooks_draw_checkbox (cairo_t *cr,
cairo_translate (cr, x, y);
cairo_set_line_width (cr, 1);
-
+
if (widget->xthickness > 2 && widget->ythickness > 2)
{
- widget->style_functions->draw_inset (cr, &widget->parentbg, 0.5, 0.5, width-1, height-1, 1, CR_CORNER_ALL);
-
+ widget->style_functions->draw_inset (cr, &widget->parentbg, 0, 0, width, height, 1, CR_CORNER_ALL);
+
/* Draw the rectangle for the checkbox itself */
ge_cairo_rounded_rectangle (cr, 1.5, 1.5, width-3, height-3, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
}
@@ -2097,13 +2147,13 @@ clearlooks_draw_checkbox (cairo_t *cr,
/* Draw the rectangle for the checkbox itself */
ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
}
-
+
if (!widget->disabled)
{
ge_cairo_set_color (cr, &colors->base[0]);
cairo_fill_preserve (cr);
}
-
+
ge_cairo_set_color (cr, border);
cairo_stroke (cr);
@@ -2120,13 +2170,13 @@ clearlooks_draw_checkbox (cairo_t *cr,
cairo_set_line_width (cr, 1.7);
cairo_move_to (cr, 0.5 + (width*0.2), (height*0.5));
cairo_line_to (cr, 0.5 + (width*0.4), (height*0.7));
-
+
cairo_curve_to (cr, 0.5 + (width*0.4), (height*0.7),
0.5 + (width*0.5), (height*0.4),
0.5 + (width*0.70), (height*0.25));
}
-
+
ge_cairo_set_color (cr, dot);
cairo_stroke (cr);
}
@@ -2145,7 +2195,7 @@ clearlooks_draw_normal_arrow (cairo_t *cr, const CairoColor *color,
arrow_width = MIN (height * 2.0 + MAX (1.0, ceil (height * 2.0 / 6.0 * 2.0) / 2.0) / 2.0, width);
line_width_2 = MAX (1.0, ceil (arrow_width / 6.0 * 2.0) / 2.0) / 2.0;
arrow_height = arrow_width / 2.0 + line_width_2;
-
+
cairo_translate (cr, x, y - arrow_height / 2.0);
cairo_move_to (cr, -arrow_width / 2.0, line_width_2);
@@ -2156,10 +2206,10 @@ clearlooks_draw_normal_arrow (cairo_t *cr, const CairoColor *color,
cairo_line_to (cr, arrow_width / 2.0, line_width_2);
cairo_line_to (cr, 0, arrow_height);
cairo_close_path (cr);
-
+
ge_cairo_set_color (cr, color);
cairo_fill (cr);
-
+
cairo_restore (cr);
}
@@ -2170,13 +2220,13 @@ clearlooks_draw_combo_arrow (cairo_t *cr, const CairoColor *color,
double arrow_width = MIN (height * 2 / 3.0, width);
double arrow_height = arrow_width / 2.0;
double gap_size = 1.0 * arrow_height;
-
+
cairo_save (cr);
cairo_translate (cr, x, y - (arrow_height + gap_size) / 2.0);
cairo_rotate (cr, G_PI);
clearlooks_draw_normal_arrow (cr, color, 0, 0, arrow_width, arrow_height);
cairo_restore (cr);
-
+
clearlooks_draw_normal_arrow (cr, color, x, y + (arrow_height + gap_size) / 2.0, arrow_width, arrow_height);
}
@@ -2186,7 +2236,7 @@ _clearlooks_draw_arrow (cairo_t *cr, const CairoColor *color,
double x, double y, double width, double height)
{
double rotate;
-
+
if (dir == CL_DIRECTION_LEFT)
rotate = G_PI*1.5;
else if (dir == CL_DIRECTION_RIGHT)
@@ -2197,11 +2247,11 @@ _clearlooks_draw_arrow (cairo_t *cr, const CairoColor *color,
rotate = 0;
else
return;
-
+
if (type == CL_ARROW_NORMAL)
{
cairo_translate (cr, x, y);
- cairo_rotate (cr, -rotate);
+ cairo_rotate (cr, -rotate);
clearlooks_draw_normal_arrow (cr, color, 0, 0, width, height);
}
else if (type == CL_ARROW_COMBO)
@@ -2213,17 +2263,17 @@ _clearlooks_draw_arrow (cairo_t *cr, const CairoColor *color,
static void
clearlooks_draw_arrow (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const ArrowParameters *arrow,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const ArrowParameters *arrow,
int x, int y, int width, int height)
{
const CairoColor *color = &colors->fg[widget->state_type];
gdouble tx, ty;
-
+
tx = x + width/2.0;
ty = y + height/2.0;
-
+
if (widget->disabled)
{
_clearlooks_draw_arrow (cr, &colors->shade[0],
@@ -2232,48 +2282,104 @@ clearlooks_draw_arrow (cairo_t *cr,
}
cairo_identity_matrix (cr);
-
+
_clearlooks_draw_arrow (cr, color, arrow->direction, arrow->type,
tx, ty, width, height);
}
void
-clearlooks_register_style_classic (ClearlooksStyleFunctions *functions)
+clearlooks_draw_focus (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const FocusParameters *focus,
+ int x, int y, int width, int height)
+{
+ if (focus->has_color)
+ ge_cairo_set_color (cr, &focus->color);
+ else if (focus->type == CL_FOCUS_COLOR_WHEEL_LIGHT)
+ cairo_set_source_rgb (cr, 0., 0., 0.);
+ else if (focus->type == CL_FOCUS_COLOR_WHEEL_DARK)
+ cairo_set_source_rgb (cr, 1., 1., 1.);
+ else
+ cairo_set_source_rgba (cr,
+ colors->fg[widget->state_type].r,
+ colors->fg[widget->state_type].g,
+ colors->fg[widget->state_type].b,
+ 0.7);
+
+ cairo_set_line_width (cr, focus->line_width);
+
+ if (focus->dash_list[0])
+ {
+ gint n_dashes = strlen ((gchar *)focus->dash_list);
+ gdouble *dashes = g_new (gdouble, n_dashes);
+ gdouble total_length = 0;
+ gdouble dash_offset;
+ gint i;
+
+ for (i = 0; i < n_dashes; i++)
+ {
+ dashes[i] = focus->dash_list[i];
+ total_length += focus->dash_list[i];
+ }
+
+ dash_offset = -focus->line_width / 2.0;
+ while (dash_offset < 0)
+ dash_offset += total_length;
+
+ cairo_set_dash (cr, dashes, n_dashes, dash_offset);
+ g_free (dashes);
+ }
+
+ cairo_rectangle (cr,
+ x + focus->line_width / 2.0,
+ y + focus->line_width / 2.0,
+ width - focus->line_width, height - focus->line_width);
+ cairo_stroke (cr);
+}
+
+void
+clearlooks_register_style_classic (ClearlooksStyleFunctions *functions, ClearlooksStyleConstants *constants)
{
g_assert (functions);
- functions->draw_button = clearlooks_draw_button;
- functions->draw_scale_trough = clearlooks_draw_scale_trough;
- functions->draw_progressbar_trough = clearlooks_draw_progressbar_trough;
- functions->draw_progressbar_fill = clearlooks_draw_progressbar_fill;
- functions->draw_slider_button = clearlooks_draw_slider_button;
- functions->draw_entry = clearlooks_draw_entry;
- functions->draw_spinbutton = clearlooks_draw_spinbutton;
- functions->draw_spinbutton_down = clearlooks_draw_spinbutton_down;
- functions->draw_optionmenu = clearlooks_draw_optionmenu;
- functions->draw_inset = clearlooks_draw_inset;
- functions->draw_menubar = clearlooks_draw_menubar;
- functions->draw_tab = clearlooks_draw_tab;
- functions->draw_frame = clearlooks_draw_frame;
- functions->draw_separator = clearlooks_draw_separator;
+ functions->draw_top_left_highlight = clearlooks_draw_top_left_highlight;
+ functions->draw_button = clearlooks_draw_button;
+ functions->draw_scale_trough = clearlooks_draw_scale_trough;
+ functions->draw_progressbar_trough = clearlooks_draw_progressbar_trough;
+ functions->draw_progressbar_fill = clearlooks_draw_progressbar_fill;
+ functions->draw_slider_button = clearlooks_draw_slider_button;
+ functions->draw_entry = clearlooks_draw_entry;
+ functions->draw_spinbutton = clearlooks_draw_spinbutton;
+ functions->draw_spinbutton_down = clearlooks_draw_spinbutton_down;
+ functions->draw_optionmenu = clearlooks_draw_optionmenu;
+ functions->draw_inset = clearlooks_draw_inset;
+ functions->draw_menubar = clearlooks_draw_menubar;
+ functions->draw_tab = clearlooks_draw_tab;
+ functions->draw_frame = clearlooks_draw_frame;
+ functions->draw_separator = clearlooks_draw_separator;
functions->draw_menu_item_separator = clearlooks_draw_menu_item_separator;
- functions->draw_list_view_header = clearlooks_draw_list_view_header;
- functions->draw_toolbar = clearlooks_draw_toolbar;
- functions->draw_menuitem = clearlooks_draw_menuitem;
- functions->draw_menubaritem = clearlooks_draw_menubaritem;
- functions->draw_selected_cell = clearlooks_draw_selected_cell;
- functions->draw_scrollbar_stepper = clearlooks_draw_scrollbar_stepper;
- functions->draw_scrollbar_slider = clearlooks_draw_scrollbar_slider;
- functions->draw_scrollbar_trough = clearlooks_draw_scrollbar_trough;
- functions->draw_statusbar = clearlooks_draw_statusbar;
- functions->draw_menu_frame = clearlooks_draw_menu_frame;
- functions->draw_tooltip = clearlooks_draw_tooltip;
- functions->draw_handle = clearlooks_draw_handle;
- functions->draw_resize_grip = clearlooks_draw_resize_grip;
- functions->draw_arrow = clearlooks_draw_arrow;
- functions->draw_checkbox = clearlooks_draw_checkbox;
- functions->draw_radiobutton = clearlooks_draw_radiobutton;
- functions->draw_shadow = clearlooks_draw_shadow;
- functions->draw_slider = clearlooks_draw_slider;
- functions->draw_gripdots = clearlooks_draw_gripdots;
+ functions->draw_list_view_header = clearlooks_draw_list_view_header;
+ functions->draw_toolbar = clearlooks_draw_toolbar;
+ functions->draw_menuitem = clearlooks_draw_menuitem;
+ functions->draw_menubaritem = clearlooks_draw_menubaritem;
+ functions->draw_selected_cell = clearlooks_draw_selected_cell;
+ functions->draw_scrollbar_stepper = clearlooks_draw_scrollbar_stepper;
+ functions->draw_scrollbar_slider = clearlooks_draw_scrollbar_slider;
+ functions->draw_scrollbar_trough = clearlooks_draw_scrollbar_trough;
+ functions->draw_statusbar = clearlooks_draw_statusbar;
+ functions->draw_menu_frame = clearlooks_draw_menu_frame;
+ functions->draw_tooltip = clearlooks_draw_tooltip;
+ functions->draw_handle = clearlooks_draw_handle;
+ functions->draw_resize_grip = clearlooks_draw_resize_grip;
+ functions->draw_arrow = clearlooks_draw_arrow;
+ functions->draw_focus = clearlooks_draw_focus;
+ functions->draw_checkbox = clearlooks_draw_checkbox;
+ functions->draw_radiobutton = clearlooks_draw_radiobutton;
+ functions->draw_shadow = clearlooks_draw_shadow;
+ functions->draw_slider = clearlooks_draw_slider;
+ functions->draw_gripdots = clearlooks_draw_gripdots;
+
+ constants->topleft_highlight_shade = 1.3;
+ constants->topleft_highlight_alpha = 0.6;
}
diff --git a/libs/clearlooks/clearlooks_draw.h b/libs/clearlooks/clearlooks_draw.h
index a3f26764da..71d3b4ae68 100644
--- a/libs/clearlooks/clearlooks_draw.h
+++ b/libs/clearlooks/clearlooks_draw.h
@@ -9,9 +9,16 @@
#include <cairo.h>
-GE_INTERNAL void clearlooks_register_style_classic (ClearlooksStyleFunctions *functions);
-GE_INTERNAL void clearlooks_register_style_glossy (ClearlooksStyleFunctions *functions);
-GE_INTERNAL void clearlooks_register_style_gummy (ClearlooksStyleFunctions *functions);
-GE_INTERNAL void clearlooks_register_style_inverted (ClearlooksStyleFunctions *functions);
+GE_INTERNAL void clearlooks_register_style_classic (ClearlooksStyleFunctions *functions, ClearlooksStyleConstants *constants);
+GE_INTERNAL void clearlooks_register_style_glossy (ClearlooksStyleFunctions *functions, ClearlooksStyleConstants *constants);
+GE_INTERNAL void clearlooks_register_style_gummy (ClearlooksStyleFunctions *functions, ClearlooksStyleConstants *constants);
+GE_INTERNAL void clearlooks_register_style_inverted (ClearlooksStyleFunctions *functions, ClearlooksStyleConstants *constants);
+
+/* Fallback focus function */
+GE_INTERNAL void clearlooks_draw_focus (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const FocusParameters *focus,
+ int x, int y, int width, int height);
#endif /* CLEARLOOKS_DRAW_H */
diff --git a/libs/clearlooks/clearlooks_draw_glossy.c b/libs/clearlooks/clearlooks_draw_glossy.c
index 8a5921efc2..752b31b3e2 100644
--- a/libs/clearlooks/clearlooks_draw_glossy.c
+++ b/libs/clearlooks/clearlooks_draw_glossy.c
@@ -36,9 +36,9 @@
static void
clearlooks_draw_glossy_gradient (cairo_t *cr,
- double x, double y, int width, int height,
- const CairoColor *color,
- gboolean disabled, gboolean radius, CairoCorners corners)
+ double x, double y, int width, int height,
+ const CairoColor *color,
+ gboolean disabled, gboolean radius, CairoCorners corners)
{
CairoColor a, b, c, d;
cairo_pattern_t *pt;
@@ -49,10 +49,10 @@ clearlooks_draw_glossy_gradient (cairo_t *cr,
ge_shade_color (color, disabled? 1.02 : 1.08, &d);
pt = cairo_pattern_create_linear (x, y, x, y+height);
- cairo_pattern_add_color_stop_rgb (pt, 0.0, a.r, a.g, a.b);
- cairo_pattern_add_color_stop_rgb (pt, 0.5, b.r, b.g, b.b);
- cairo_pattern_add_color_stop_rgb (pt, 0.5, c.r, c.g, c.b);
- cairo_pattern_add_color_stop_rgb (pt, 1.0, d.r, d.g, d.b);
+ cairo_pattern_add_color_stop_rgb (pt, 0.0, a.r, a.g, a.b);
+ cairo_pattern_add_color_stop_rgb (pt, 0.5, b.r, b.g, b.b);
+ cairo_pattern_add_color_stop_rgb (pt, 0.5, c.r, c.g, c.b);
+ cairo_pattern_add_color_stop_rgb (pt, 1.0, d.r, d.g, d.b);
cairo_set_source (cr, pt);
ge_cairo_rounded_rectangle (cr, x, y, width, height, radius, corners);
@@ -73,60 +73,66 @@ clearlooks_set_mixed_color (cairo_t *cr,
ge_cairo_set_color (cr, &composite);
}
+/* This draw_inset implementation only differes in the shades values from the
+ * default one. */
static void
clearlooks_glossy_draw_inset (cairo_t *cr,
const CairoColor *bg_color,
- double x, double y, double w, double h,
+ double x, double y, double width, double height,
double radius, uint8 corners)
{
CairoColor shadow;
CairoColor highlight;
+ double line_width;
+ double min = MIN (width, height);
+
+ line_width = cairo_get_line_width (cr);
/* not really sure of shading ratios... we will think */
ge_shade_color (bg_color, 0.93, &shadow);
ge_shade_color (bg_color, 1.07, &highlight);
/* highlight */
- cairo_move_to (cr, x + w + (radius * -0.2928932188), y - (radius * -0.2928932188)); /* 0.2928932... 1-sqrt(2)/2 gives middle of curve */
-
- if (corners & CR_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, G_PI * 1.75, G_PI * 2);
- else
- cairo_line_to (cr, x + w, y);
+ cairo_save (cr);
- if (corners & CR_CORNER_BOTTOMRIGHT)
- cairo_arc (cr, x + w - radius, y + h - radius, radius, 0, G_PI * 0.5);
- else
- cairo_line_to (cr, x + w, y + h);
+ cairo_move_to (cr, x, y + height);
+ cairo_line_to (cr, x + min / 2.0, y + height - min / 2.0);
+ cairo_line_to (cr, x + width - min / 2.0, y + min / 2.0);
+ cairo_line_to (cr, x + width, y);
+ cairo_line_to (cr, x, y);
+ cairo_close_path (cr);
+
+ cairo_clip (cr);
- if (corners & CR_CORNER_BOTTOMLEFT)
- cairo_arc (cr, x + radius, y + h - radius, radius, G_PI * 0.5, G_PI * 0.75);
- else
- cairo_line_to (cr, x, y + h);
+ ge_cairo_rounded_rectangle (cr, x + line_width / 2.0, y + line_width / 2.0,
+ width - line_width, height - line_width,
+ radius, corners);
- ge_cairo_set_color (cr, &highlight);
+ ge_cairo_set_color (cr, &shadow);
cairo_stroke (cr);
+
+ cairo_restore (cr);
/* shadow */
- cairo_move_to (cr, x + (radius * 0.2928932188), y + h + (radius * -0.2928932188));
-
- if (corners & CR_CORNER_BOTTOMLEFT)
- cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.75, M_PI);
- else
- cairo_line_to (cr, x, y + h);
+ cairo_save (cr);
- if (corners & CR_CORNER_TOPLEFT)
- cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
- else
- cairo_line_to (cr, x, y);
+ cairo_move_to (cr, x, y + height);
+ cairo_line_to (cr, x + min / 2.0, y + height - min / 2.0);
+ cairo_line_to (cr, x + width - min / 2.0, y + min / 2.0);
+ cairo_line_to (cr, x + width, y);
+ cairo_line_to (cr, x + width, y + height);
+ cairo_close_path (cr);
+
+ cairo_clip (cr);
- if (corners & CR_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
- else
- cairo_line_to (cr, x + w, y);
+ ge_cairo_rounded_rectangle (cr, x + line_width / 2.0, y + line_width / 2.0,
+ width - line_width, height - line_width,
+ radius, corners);
- ge_cairo_set_color (cr, &shadow);
+ ge_cairo_set_color (cr, &highlight);
cairo_stroke (cr);
+
+ cairo_restore (cr);
}
static void
@@ -167,17 +173,17 @@ clearlooks_glossy_draw_light_inset (cairo_t *cr,
cairo_move_to (cr, x + (radius * 0.2928932188), y + h + (radius * -0.2928932188));
if (corners & CR_CORNER_BOTTOMLEFT)
- cairo_arc (cr, x + radius, y + h - radius, radius, M_PI * 0.75, M_PI);
+ cairo_arc (cr, x + radius, y + h - radius, radius, G_PI * 0.75, G_PI);
else
cairo_line_to (cr, x, y + h);
if (corners & CR_CORNER_TOPLEFT)
- cairo_arc (cr, x + radius, y + radius, radius, M_PI, M_PI * 1.5);
+ cairo_arc (cr, x + radius, y + radius, radius, G_PI, G_PI * 1.5);
else
cairo_line_to (cr, x, y);
if (corners & CR_CORNER_TOPRIGHT)
- cairo_arc (cr, x + w - radius, y + radius, radius, M_PI * 1.5, M_PI * 1.75);
+ cairo_arc (cr, x + w - radius, y + radius, radius, G_PI * 1.5, G_PI * 1.75);
else
cairo_line_to (cr, x + w, y);
@@ -185,6 +191,7 @@ clearlooks_glossy_draw_light_inset (cairo_t *cr,
cairo_stroke (cr);
}
+/* This function currently assumes that the input is translated by 0.5px! */
static void
clearlooks_glossy_draw_highlight_and_shade (cairo_t *cr,
const CairoColor *bg_color,
@@ -241,9 +248,9 @@ clearlooks_glossy_draw_highlight_and_shade (cairo_t *cr,
static void
clearlooks_glossy_draw_button (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *params,
- int x, int y, int width, int height)
+ const ClearlooksColors *colors,
+ const WidgetParameters *params,
+ int x, int y, int width, int height)
{
double xoffset = 0, yoffset = 0;
CairoColor fill = colors->bg[params->state_type];
@@ -257,7 +264,7 @@ clearlooks_glossy_draw_button (cairo_t *cr,
cairo_translate (cr, x, y);
cairo_set_line_width (cr, 1.0);
- /* Shadows and Glow */
+ /* Shadows and shadow */
if (params->xthickness == 3 || params->ythickness == 3)
{
if (params->xthickness == 3)
@@ -270,35 +277,32 @@ clearlooks_glossy_draw_button (cairo_t *cr,
if (params->xthickness == 3 || params->ythickness == 3)
{
- cairo_translate (cr, 0.5, 0.5);
-
- /* if (params->enable_glow && !params->active && !params->disabled) */
- if (params->prelight && params->enable_glow && !params->active)
+ /* if (params->enable_shadow && !params->active && !params->disabled) */
+ if (!params->active && (params->prelight || params->enable_shadow))
{
- /* Glow becomes a shadow to have 3d prelight buttons :) */
- CairoColor glow;
+ /* shadow becomes a shadow to have 3d prelight buttons :) */
+ CairoColor shadow;
radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0 - 1.0, (height - 2.0 - 2*yoffset) / 2.0 - 1.0));
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius+1, params->corners);
- ge_shade_color (&params->parentbg, 0.96, &glow);
- ge_cairo_set_color (cr, &glow);
+ ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius+1, params->corners);
+ ge_shade_color (&params->parentbg, 0.96, &shadow);
+ ge_cairo_set_color (cr, &shadow);
cairo_stroke (cr);
- ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius+1, params->corners);
- ge_shade_color (&params->parentbg, 0.92, &glow);
- ge_cairo_set_color (cr, &glow);
+ ge_cairo_rounded_rectangle (cr, 1.5, 1.5, width-2, height-2, radius+1, params->corners);
+ ge_shade_color (&params->parentbg, 0.92, &shadow);
+ ge_cairo_set_color (cr, &shadow);
cairo_stroke (cr);
}
-
- /* if (!(params->enable_glow && !params->active && !params->disabled)) */
- if (!(params->prelight && params->enable_glow && !params->active))
+ else
+ {
if (!(params->disabled))
- params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width-1, height-1, params->radius+1, params->corners);
+ params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width, height, params->radius+1, params->corners);
else
/*Draw a lighter inset */
- clearlooks_glossy_draw_light_inset (cr, &params->parentbg, 0, 0, width-1, height-1, params->radius+1, params->corners);
- cairo_translate (cr, -0.5, -0.5);
+ clearlooks_glossy_draw_light_inset (cr, &params->parentbg, 0, 0, width, height, params->radius+1, params->corners);
+ }
}
clearlooks_draw_glossy_gradient (cr, xoffset+1, yoffset+1,
@@ -339,30 +343,30 @@ clearlooks_glossy_draw_button (cairo_t *cr,
/* Default button highlight */
if (params->is_default && !params->active && !params->disabled)
{
- const CairoColor *glow = &colors->spot[0];
+ const CairoColor *shadow = &colors->spot[0];
double hh = (height-5)/2.0 + 1;
cairo_rectangle (cr, 3.5, 3.5, width-7, height-7);
- ge_cairo_set_color (cr, glow);
+ ge_cairo_set_color (cr, shadow);
cairo_stroke (cr);
- glow = &colors->spot[0];
+ shadow = &colors->spot[0];
cairo_move_to (cr, 2.5, 2.5+hh); cairo_rel_line_to (cr, 0, -hh);
cairo_rel_line_to (cr, width-5, 0); cairo_rel_line_to (cr, 0, hh);
- ge_cairo_set_color (cr, glow);
+ ge_cairo_set_color (cr, shadow);
cairo_stroke (cr);
hh--;
- glow = &colors->spot[1];
+ shadow = &colors->spot[1];
cairo_move_to (cr, 2.5, 2.5+hh); cairo_rel_line_to (cr, 0, hh);
cairo_rel_line_to (cr, width-5, 0); cairo_rel_line_to (cr, 0, -hh);
- ge_cairo_set_color (cr, glow);
+ ge_cairo_set_color (cr, shadow);
cairo_stroke (cr);
}
/* Border */
- if (params->is_default || (params->prelight && params->enable_glow))
+ if (params->is_default || (params->prelight && params->enable_shadow))
border_normal = colors->spot[2];
/* ge_mix_color (&border_normal, &colors->spot[2], 0.5, &border_normal); */
if (params->disabled)
@@ -391,12 +395,6 @@ clearlooks_glossy_draw_progressbar_trough (cairo_t *cr,
cairo_set_line_width (cr, 1.0);
- /* Fill with bg color */
- ge_cairo_set_color (cr, &colors->bg[params->state_type]);
-
- cairo_rectangle (cr, x, y, width, height);
- cairo_fill (cr);
-
/* Create trough box */
ge_cairo_rounded_rectangle (cr, x+1, y+1, width-2, height-2, radius, params->corners);
ge_cairo_set_color (cr, &colors->shade[2]);
@@ -604,20 +602,21 @@ clearlooks_glossy_scale_draw_gradient (cairo_t *cr,
{
cairo_pattern_t *pattern;
- pattern = cairo_pattern_create_linear (0, 0, horizontal ? 0 : width, horizontal ? height : 0);
+ pattern = cairo_pattern_create_linear (0.5, 0.5, horizontal ? 0.5 : width + 1, horizontal ? height + 1 : 0.5);
cairo_pattern_add_color_stop_rgb (pattern, 0.0, c1->r, c1->g, c1->b);
cairo_pattern_add_color_stop_rgb (pattern, 1.0, c2->r, c2->g, c2->b);
- cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
+ cairo_rectangle (cr, x, y, width, height);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
clearlooks_set_mixed_color (cr, c3, c1, 0.3);
- ge_cairo_stroke_rectangle (cr, x, y, width, height);
+ ge_cairo_inner_rectangle (cr, x, y, width, height);
+ cairo_stroke (cr);
}
-#define TROUGH_SIZE 6
+#define TROUGH_SIZE 7
static void
clearlooks_glossy_draw_scale_trough (cairo_t *cr,
const ClearlooksColors *colors,
@@ -628,43 +627,44 @@ clearlooks_glossy_draw_scale_trough (cairo_t *cr,
int trough_width, trough_height;
double translate_x, translate_y;
+ cairo_save (cr);
+
if (slider->horizontal)
{
- trough_width = width-3;
- trough_height = TROUGH_SIZE-2;
+ trough_width = width;
+ trough_height = TROUGH_SIZE;
- translate_x = x + 0.5;
- translate_y = y + 0.5 + (height/2) - (TROUGH_SIZE/2);
+ translate_x = x;
+ translate_y = y + (height/2) - (TROUGH_SIZE/2);
}
else
{
- trough_width = TROUGH_SIZE-2;
- trough_height = height-3;
+ trough_width = TROUGH_SIZE;
+ trough_height = height;
- translate_x = x + 0.5 + (width/2) - (TROUGH_SIZE/2);
- translate_y = y + 0.5;
+ translate_x = x + (width/2) - (TROUGH_SIZE/2);
+ translate_y = y;
}
cairo_set_line_width (cr, 1.0);
cairo_translate (cr, translate_x, translate_y);
if (!slider->fill_level)
- params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, trough_width+2, trough_height+2, 0, 0);
-
- cairo_translate (cr, 1, 1);
+ params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, trough_width, trough_height, 0, 0);
if (!slider->lower && !slider->fill_level)
clearlooks_glossy_scale_draw_gradient (cr, &colors->shade[3], /* top */
&colors->shade[2], /* bottom */
&colors->shade[6], /* border */
- 0, 0, trough_width, trough_height,
+ 1.0, 1.0, trough_width - 2, trough_height - 2,
slider->horizontal);
else
clearlooks_glossy_scale_draw_gradient (cr, &colors->spot[1], /* top */
&colors->spot[0], /* bottom */
&colors->spot[2], /* border */
- 0, 0, trough_width, trough_height,
+ 1.0, 1.0, trough_width - 2, trough_height - 2,
slider->horizontal);
+ cairo_restore (cr);
}
static void
@@ -685,6 +685,7 @@ clearlooks_glossy_draw_tab (cairo_t *cr,
double radius;
double strip_size;
+ double length;
radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
@@ -703,6 +704,7 @@ clearlooks_glossy_draw_tab (cairo_t *cr,
if (tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM)
{
height += 3.0;
+ length = height;
strip_size = 2.0/height; /* 2 pixel high strip */
if (tab->gap_side == CL_GAP_TOP)
@@ -711,6 +713,7 @@ clearlooks_glossy_draw_tab (cairo_t *cr,
else
{
width += 3.0;
+ length = width;
strip_size = 2.0/width;
if (tab->gap_side == CL_GAP_LEFT)
@@ -738,6 +741,8 @@ clearlooks_glossy_draw_tab (cairo_t *cr,
shadow.shadow = CL_SHADOW_OUT;
shadow.corners = params->corners;
+ /* This is the only usage of clearlooks_glossy_draw_highlight_and_shade,
+ * the function assumes currently that the input is translated by 0.5 px. */
clearlooks_glossy_draw_highlight_and_shade (cr, &colors->bg[0], &shadow,
width,
height, radius);
@@ -747,10 +752,23 @@ clearlooks_glossy_draw_tab (cairo_t *cr,
{
CairoColor shadow, hilight, f1, f2;
- pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-1 : 0,
- tab->gap_side == CL_GAP_TOP ? height-2 : 1,
- tab->gap_side == CL_GAP_RIGHT ? width : 0,
- tab->gap_side == CL_GAP_BOTTOM ? height : 0);
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (0, height-2, 0, 0);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (0, 1, 0, height);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-2, 0, 1, 0);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (1, 0, width-2, 0);
+ break;
+ default:
+ pattern = NULL;
+ }
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
@@ -760,8 +778,8 @@ clearlooks_glossy_draw_tab (cairo_t *cr,
ge_shade_color (fill, 1.06, &f2);
cairo_pattern_add_color_stop_rgb (pattern, 0.0, hilight.r, hilight.g, hilight.b);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, hilight.r, hilight.g, hilight.b);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, f1.r, f1.g, f1.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0/length, hilight.r, hilight.g, hilight.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0/length, f1.r, f1.g, f1.b);
cairo_pattern_add_color_stop_rgb (pattern, 0.45, f2.r, f2.g, f2.b);
cairo_pattern_add_color_stop_rgb (pattern, 0.45, fill->r, fill->g, fill->b);
cairo_pattern_add_color_stop_rgb (pattern, 1.0, shadow.r, shadow.g, shadow.b);
@@ -772,10 +790,23 @@ clearlooks_glossy_draw_tab (cairo_t *cr,
else
{
/* Draw shade */
- pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 0,
- tab->gap_side == CL_GAP_TOP ? height-2 : 0,
- tab->gap_side == CL_GAP_RIGHT ? width : 0,
- tab->gap_side == CL_GAP_BOTTOM ? height : 0);
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (0, height-2, 0, 0);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-2, 0, 0, 0);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (0, 0, width, 0);
+ break;
+ default:
+ pattern = NULL;
+ }
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
@@ -796,10 +827,23 @@ clearlooks_glossy_draw_tab (cairo_t *cr,
}
else
{
- pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 2,
- tab->gap_side == CL_GAP_TOP ? height-2 : 2,
- tab->gap_side == CL_GAP_RIGHT ? width : 2,
- tab->gap_side == CL_GAP_BOTTOM ? height : 2);
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (2, height-2, 2, 2);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (2, 2, 2, height);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-2, 2, 2, 2);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (2, 2, width, 2);
+ break;
+ default:
+ pattern = NULL;
+ }
cairo_pattern_add_color_stop_rgb (pattern, 0.0, stripe_border->r, stripe_border->g, stripe_border->b);
cairo_pattern_add_color_stop_rgb (pattern, 0.8, border->r, border->g, border->b);
@@ -824,8 +868,6 @@ clearlooks_glossy_draw_slider (cairo_t *cr,
cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x, y);
- cairo_translate (cr, -0.5, -0.5);
-
ge_shade_color (&colors->bg[params->state_type], 1.0, &fill);
if (params->prelight)
ge_shade_color (&fill, 1.1, &fill);
@@ -871,9 +913,8 @@ clearlooks_glossy_draw_slider_button (cairo_t *cr,
if (!slider->horizontal)
ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
- cairo_translate (cr, x+0.5, y+0.5);
-
- params->style_functions->draw_shadow (cr, colors, radius, width-1, height-1);
+ cairo_translate (cr, x, y);
+ params->style_functions->draw_shadow (cr, colors, radius, width, height);
params->style_functions->draw_slider (cr, colors, params, 1, 1, width-2, height-2);
}
@@ -930,16 +971,12 @@ clearlooks_glossy_draw_scrollbar_stepper (cairo_t *cr,
cairo_fill (cr);
cairo_pattern_destroy (pattern);
- cairo_translate (cr, 0.5, 0.5);
- cairo_translate (cr, -0.5, -0.5);
-
- ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, corners);
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius, corners);
clearlooks_set_mixed_color (cr, border, &fill, 0.2);
if (widget->prelight)
ge_cairo_set_color (cr, &colors->spot[2]);
cairo_stroke (cr);
- cairo_translate (cr, 0.5, 0.5);
shadow.shadow = CL_SHADOW_OUT;
shadow.corners = corners;
}
@@ -1054,7 +1091,7 @@ clearlooks_glossy_draw_list_view_header (cairo_t *cr,
cairo_pattern_destroy (pattern);
/* Draw highlight */
- if (header->order == CL_ORDER_FIRST)
+ if (header->order & CL_ORDER_FIRST)
{
cairo_move_to (cr, 0.5, height-1);
cairo_line_to (cr, 0.5, 0.5);
@@ -1068,8 +1105,8 @@ clearlooks_glossy_draw_list_view_header (cairo_t *cr,
cairo_stroke (cr);
/* Draw resize grip */
- if ((params->ltr && header->order != CL_ORDER_LAST) ||
- (!params->ltr && header->order != CL_ORDER_FIRST) || header->resizable)
+ if ((params->ltr && !(header->order & CL_ORDER_LAST)) ||
+ (!params->ltr && !(header->order & CL_ORDER_FIRST)) || header->resizable)
{
SeparatorParameters separator;
separator.horizontal = FALSE;
@@ -1237,6 +1274,13 @@ clearlooks_glossy_draw_radiobutton (cairo_t *cr,
cairo_pattern_t *pt;
gboolean inconsistent;
gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
+ gdouble w, h, cx, cy, radius;
+
+ w = (gdouble) width;
+ h = (gdouble) height;
+ cx = width / 2.0;
+ cy = height / 2.0;
+ radius = MIN (width, height) / 2.0;
inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
draw_bullet |= inconsistent;
@@ -1258,7 +1302,7 @@ clearlooks_glossy_draw_radiobutton (cairo_t *cr,
ge_shade_color (&widget->parentbg, 0.9, &shadow);
ge_shade_color (&widget->parentbg, 1.1, &highlight);
- pt = cairo_pattern_create_linear (0, 0, 13, 13);
+ pt = cairo_pattern_create_linear (0, 0, radius * 2.0, radius * 2.0);
cairo_pattern_add_color_stop_rgb (pt, 0.0, shadow.r, shadow.b, shadow.g);
cairo_pattern_add_color_stop_rgba (pt, 0.5, shadow.r, shadow.b, shadow.g, 0.5);
cairo_pattern_add_color_stop_rgba (pt, 0.5, highlight.r, highlight.g, highlight.b, 0.5);
@@ -1266,15 +1310,15 @@ clearlooks_glossy_draw_radiobutton (cairo_t *cr,
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 2);
- cairo_arc (cr, 7, 7, 6, 0, G_PI*2);
+ cairo_set_line_width (cr, MAX (1.0, floor (radius/3)));
+ cairo_arc (cr, ceil (cx), ceil (cy), floor (radius - 0.1), 0, G_PI*2);
cairo_set_source (cr, pt);
cairo_stroke (cr);
cairo_pattern_destroy (pt);
- cairo_set_line_width (cr, 1);
+ cairo_set_line_width (cr, MAX (1.0, floor (radius/6)));
- cairo_arc (cr, 7, 7, 5.5, 0, G_PI*2);
+ cairo_arc (cr, ceil (cx), ceil (cy), MAX (1.0, ceil (radius) - 1.5), 0, G_PI*2);
if (!widget->disabled)
{
@@ -1293,21 +1337,21 @@ clearlooks_glossy_draw_radiobutton (cairo_t *cr,
if (inconsistent)
{
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
- cairo_set_line_width (cr, 4);
+ cairo_set_line_width (cr, ceil (radius * 2 / 3));
- cairo_move_to(cr, 5, 7);
- cairo_line_to(cr, 9, 7);
+ cairo_move_to (cr, ceil (cx - radius/3.0), ceil (cy));
+ cairo_line_to (cr, ceil (cx + radius/3.0), ceil (cy));
ge_cairo_set_color (cr, dot);
cairo_stroke (cr);
}
else
{
- cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
+ cairo_arc (cr, ceil (cx), ceil (cy), floor (radius/2.0), 0, G_PI*2);
ge_cairo_set_color (cr, dot);
cairo_fill (cr);
- cairo_arc (cr, 6, 6, 1, 0, G_PI*2);
+ cairo_arc (cr, floor (cx - radius/10.0), floor (cy - radius/10.0), floor (radius/6.0), 0, G_PI*2);
cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
cairo_fill (cr);
}
@@ -1348,8 +1392,8 @@ clearlooks_glossy_draw_checkbox (cairo_t *cr,
if (widget->xthickness > 2 && widget->ythickness > 2)
{
- widget->style_functions->draw_inset (cr, &widget->parentbg, 0.5, 0.5,
- width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
+ widget->style_functions->draw_inset (cr, &widget->parentbg, 0, 0,
+ width, height, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
/* Draw the rectangle for the checkbox itself */
ge_cairo_rounded_rectangle (cr, 1.5, 1.5,
@@ -1400,7 +1444,7 @@ clearlooks_glossy_draw_checkbox (cairo_t *cr,
}
void
-clearlooks_register_style_glossy (ClearlooksStyleFunctions *functions)
+clearlooks_register_style_glossy (ClearlooksStyleFunctions *functions, ClearlooksStyleConstants *constants)
{
functions->draw_inset = clearlooks_glossy_draw_inset;
functions->draw_button = clearlooks_glossy_draw_button;
diff --git a/libs/clearlooks/clearlooks_draw_gummy.c b/libs/clearlooks/clearlooks_draw_gummy.c
index e2a990230b..ccbd7d9e0f 100644
--- a/libs/clearlooks/clearlooks_draw_gummy.c
+++ b/libs/clearlooks/clearlooks_draw_gummy.c
@@ -33,10 +33,6 @@
#define SHADE_CENTER_TOP 1.02
#define SHADE_BOTTOM 0.94
-/* Topleft highlight */
-#define TOPLEFT_HIGHLIGHT_SHADE 1.3
-#define TOPLEFT_HIGHLIGHT_ALPHA 0.4
-
/* Listview */
#define LISTVIEW_SHADE_TOP 1.06
#define LISTVIEW_SHADE_CENTER_TOP 1.02
@@ -47,7 +43,6 @@
#define TOOLBAR_SHADE_CENTER_TOP 1.01
#define TOOLBAR_SHADE_BOTTOM 0.97
-
static void
clearlooks_draw_gummy_gradient (cairo_t *cr,
double x, double y, int width, int height,
@@ -77,9 +72,9 @@ clearlooks_draw_gummy_gradient (cairo_t *cr,
}
static void
-clearlooks_set_mixed_color (cairo_t *cr,
- const CairoColor *color1,
- const CairoColor *color2,
+clearlooks_set_mixed_color (cairo_t *cr,
+ const CairoColor *color1,
+ const CairoColor *color2,
gdouble mix_factor)
{
CairoColor composite;
@@ -89,7 +84,7 @@ clearlooks_set_mixed_color (cairo_t *cr,
}
static void
-clearlooks_gummy_draw_highlight_and_shade (cairo_t *cr,
+clearlooks_gummy_draw_highlight_and_shade (cairo_t *cr,
const CairoColor *bg_color,
const ShadowParameters *params,
int width, int height, gdouble radius)
@@ -123,7 +118,7 @@ clearlooks_gummy_draw_highlight_and_shade (cairo_t *cr,
cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
else
cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, 0.5);
-
+
cairo_stroke (cr);
/* Bottom/Right highlight -- this includes the corners */
@@ -143,28 +138,6 @@ clearlooks_gummy_draw_highlight_and_shade (cairo_t *cr,
}
static void
-clearlooks_gummy_draw_top_left_highlight (cairo_t *cr, const CairoColor *color,
- const WidgetParameters *params,
- int width, int height, gdouble radius)
-{
- CairoColor hilight;
-
- double light_top = params->ythickness-1,
- light_bottom = height - params->ythickness - 1,
- light_left = params->xthickness-1,
- light_right = width - params->xthickness - 1;
-
- ge_shade_color (color, TOPLEFT_HIGHLIGHT_SHADE, &hilight);
- cairo_move_to (cr, light_left, light_bottom - (int)radius/2);
-
- ge_cairo_rounded_corner (cr, light_left, light_top, radius, params->corners & CR_CORNER_TOPLEFT);
-
- cairo_line_to (cr, light_right - (int)radius/2, light_top);
- cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, TOPLEFT_HIGHLIGHT_ALPHA);
- cairo_stroke (cr);
-}
-
-static void
clearlooks_gummy_draw_button (cairo_t *cr,
const ClearlooksColors *colors,
const WidgetParameters *params,
@@ -182,33 +155,27 @@ clearlooks_gummy_draw_button (cairo_t *cr,
cairo_translate (cr, x, y);
cairo_set_line_width (cr, 1.0);
- /* Shadows and Glow */
- if (params->xthickness == 3 || params->ythickness == 3)
- {
- if (params->xthickness == 3)
- xoffset = 1;
- if (params->ythickness == 3)
- yoffset = 1;
- }
+ if (params->xthickness == 3)
+ xoffset = 1;
+ if (params->ythickness == 3)
+ yoffset = 1;
radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0, (height - 2.0 - 2*yoffset) / 2.0));
if (params->xthickness == 3 || params->ythickness == 3)
{
- cairo_translate (cr, 0.5, 0.5);
-
- if (params->enable_glow && !params->active && !params->disabled && !params->is_default)
+ if (params->enable_shadow && !params->active && !params->disabled && !params->is_default)
{
CairoColor shadow;
radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0 - 1.0, (height - 2.0 - 2*yoffset) / 2.0 - 1.0));
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius+1, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius+1, params->corners);
ge_shade_color (&params->parentbg, 0.97, &shadow);
ge_cairo_set_color (cr, &shadow);
cairo_stroke (cr);
- ge_cairo_rounded_rectangle (cr, 1, 1, width-2, height-2, radius+1, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 1, 1, width-1, height-1, radius+1, params->corners);
ge_shade_color (&params->parentbg, 0.93, &shadow);
ge_cairo_set_color (cr, &shadow);
cairo_stroke (cr);
@@ -220,19 +187,18 @@ clearlooks_gummy_draw_button (cairo_t *cr,
radius = MIN (params->radius, MIN ((width - 2.0 - 2*xoffset) / 2.0 - 1.0, (height - 2.0 - 2*yoffset) / 2.0 - 1.0));
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius+1, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius+1, params->corners);
clearlooks_set_mixed_color (cr, &params->parentbg, &shadow, 0.5);
cairo_stroke (cr);
}
- if (!(params->enable_glow && !params->active && !params->disabled))
- params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width-1, height-1, params->radius+1, params->corners);
- cairo_translate (cr, -0.5, -0.5);
+ if (!(params->enable_shadow && !params->active && !params->disabled))
+ params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width, height, params->radius+1, params->corners);
}
- clearlooks_draw_gummy_gradient (cr, xoffset+1, yoffset+1,
- width-(xoffset*2)-2, height-(yoffset*2)-2,
- &fill, params->disabled, radius, params->corners);
+ clearlooks_draw_gummy_gradient (cr, xoffset+1, yoffset+1,
+ width-(xoffset*2)-2, height-(yoffset*2)-2,
+ &fill, params->disabled, radius, params->corners);
/* Pressed button shadow */
if (params->active)
@@ -242,7 +208,7 @@ clearlooks_gummy_draw_button (cairo_t *cr,
cairo_save (cr);
- ge_cairo_rounded_rectangle (cr, xoffset+1, yoffset+1, width-(xoffset*2)-2, height, radius,
+ ge_cairo_rounded_rectangle (cr, xoffset+1, yoffset+1, width-(xoffset*2)-2, height, radius,
params->corners & (CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMLEFT));
cairo_clip (cr);
cairo_rectangle (cr, xoffset+1, yoffset+1, width-(xoffset*2)-2, 3);
@@ -267,21 +233,22 @@ clearlooks_gummy_draw_button (cairo_t *cr,
}
/* Border */
- if (params->is_default) /* || (params->prelight && params->enable_glow)) */
+ if (params->is_default) /* || (params->prelight && params->enable_shadow)) */
border_normal = colors->spot[2];
if (params->disabled)
ge_cairo_set_color (cr, &border_disabled);
else
clearlooks_set_mixed_color (cr, &border_normal, &fill, 0.2);
ge_cairo_rounded_rectangle (cr, xoffset + 0.5, yoffset + 0.5,
- width-(xoffset*2)-1, height-(yoffset*2)-1,
- radius, params->corners);
+ width-(xoffset*2)-1, height-(yoffset*2)-1,
+ radius, params->corners);
cairo_stroke (cr);
if (!params->active)
{
- cairo_translate (cr, 0.5, 0.5);
- clearlooks_gummy_draw_top_left_highlight (cr, &fill, params, width, height, radius);
+ params->style_functions->draw_top_left_highlight (cr, &fill, params, 1+xoffset, 1+xoffset,
+ width-(1+xoffset)*2, height-(1+xoffset)*2,
+ radius, params->corners);
}
cairo_restore (cr);
}
@@ -299,48 +266,44 @@ clearlooks_gummy_draw_entry (cairo_t *cr,
if (params->focus)
border = colors->spot[2];
- cairo_translate (cr, x+0.5, y+0.5);
- cairo_set_line_width (cr, 1.0);
+ cairo_save (cr);
- /* Fill the background to get the correct corners. */
- cairo_rectangle (cr, -0.5, -0.5, width, height);
- ge_cairo_set_color (cr, &params->parentbg);
- cairo_fill (cr);
+ cairo_translate (cr, x, y);
+ cairo_set_line_width (cr, 1.0);
- /* Fill with the base color, because it was just cleared above */
- cairo_rectangle (cr, 1.5, 1.5, width-4, height-4);
+ /* Now fill the area we want to be base[NORMAL]. */
+ ge_cairo_rounded_rectangle (cr, 2, 2, width-4, height-4, MAX(0, radius-1), params->corners);
ge_cairo_set_color (cr, base);
cairo_fill (cr);
- params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width-1, height-1, radius+1, params->corners);
+ params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width, height, radius+1, params->corners);
/* Draw the inner shadow */
if (params->focus)
{
- /* ge_cairo_rounded_rectangle (cr, 2, 2, width-5, height-5, RADIUS-1, params->corners); */
- ge_cairo_set_color (cr, &colors->spot[0]);
- ge_cairo_stroke_rectangle (cr, 2, 2, width-5, height-5);
+ clearlooks_set_mixed_color (cr, base, &colors->spot[1], 0.5);
+ ge_cairo_inner_rounded_rectangle (cr, 2, 2, width-4, height-4, MAX(0, radius-1), params->corners);
+ cairo_stroke (cr);
}
else
{
- CairoColor shadow;
+ CairoColor shadow;
ge_shade_color (&border, 0.92, &shadow);
cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, params->disabled ? 0.09 : 0.18);
- /*
- cairo_move_to (cr, 2, height-3);
- cairo_arc (cr, params->xthickness+RADIUS-1, params->ythickness+RADIUS-1, RADIUS, G_PI, 270*(G_PI/180));
- cairo_line_to (cr, width-3, 2);
- */
- cairo_move_to (cr, 2, height-3);
- cairo_line_to (cr, 2, 2);
- cairo_line_to (cr, width-3, 2);
+
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT);
+ cairo_move_to (cr, 2.5, height-radius);
+ cairo_arc (cr, 2.5+MAX(0, radius-1), 2.5+MAX(0, radius-1), MAX(0, radius-1), G_PI, 270*(G_PI/180));
+ cairo_line_to (cr, width-radius, 2.5);
cairo_stroke (cr);
}
- ge_cairo_rounded_rectangle (cr, 1, 1, width-3, height-3, radius, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 1, 1, width-2, height-2, radius, params->corners);
ge_cairo_set_color (cr, &border);
cairo_stroke (cr);
+
+ cairo_restore (cr);
}
static void
@@ -358,12 +321,6 @@ clearlooks_gummy_draw_progressbar_trough (cairo_t *cr,
cairo_set_line_width (cr, 1.0);
- /* Fill with bg color */
- ge_cairo_set_color (cr, &colors->bg[params->state_type]);
-
- cairo_rectangle (cr, x, y, width, height);
- cairo_fill (cr);
-
/* Create trough box */
ge_cairo_rounded_rectangle (cr, x+1, y+1, width-2, height-2, radius, params->corners);
ge_cairo_set_color (cr, &colors->shade[2]);
@@ -408,11 +365,11 @@ clearlooks_gummy_draw_progressbar_fill (cairo_t *cr,
const ProgressBarParameters *progressbar,
int x, int y, int width, int height, gint offset)
{
- boolean is_horizontal = progressbar->orientation < 2;
- double tile_pos = 0;
- double stroke_width;
- double radius;
- int x_step;
+ boolean is_horizontal = progressbar->orientation < 2;
+ double tile_pos = 0;
+ double stroke_width;
+ double radius;
+ int x_step;
cairo_pattern_t *pattern;
CairoColor shade1, shade2, shade3;
@@ -458,14 +415,14 @@ clearlooks_gummy_draw_progressbar_fill (cairo_t *cr,
cairo_paint (cr);
cairo_pattern_destroy (pattern);
- /* Draw the Strokes */
+ /* Draw the strokes */
while (tile_pos <= width+x_step)
{
cairo_move_to (cr, stroke_width/2-x_step, 0);
cairo_line_to (cr, stroke_width-x_step, 0);
cairo_line_to (cr, stroke_width/2-x_step, height);
cairo_line_to (cr, -x_step, height);
-
+
cairo_translate (cr, stroke_width, 0);
tile_pos += stroke_width;
}
@@ -572,20 +529,21 @@ clearlooks_gummy_scale_draw_gradient (cairo_t *cr,
ge_shade_color (fill, in? 0.95 : 1.1, &f1);
ge_shade_color (fill, in? 1.05 : 0.9, &f2);
- pattern = cairo_pattern_create_linear (0, 0, horizontal ? 0 : width, horizontal ? height : 0);
+ pattern = cairo_pattern_create_linear (0.5, 0.5, horizontal ? 0.5 : width + 1.0, horizontal ? height + 1.0 : 0.5);
cairo_pattern_add_color_stop_rgba (pattern, 0.0, f1.r, f1.g, f1.b, f1.a);
cairo_pattern_add_color_stop_rgba (pattern, 1.0, f2.r, f2.g, f2.b, f2.a);
- cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
+ cairo_rectangle (cr, x, y, width, height);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
clearlooks_set_mixed_color (cr, border, fill, 0.2);
- ge_cairo_stroke_rectangle (cr, x, y, width, height);
+ ge_cairo_inner_rectangle (cr, x, y, width, height);
+ cairo_stroke (cr);
}
-#define TROUGH_SIZE 6
+#define TROUGH_SIZE 7
static void
clearlooks_gummy_draw_scale_trough (cairo_t *cr,
const ClearlooksColors *colors,
@@ -593,60 +551,66 @@ clearlooks_gummy_draw_scale_trough (cairo_t *cr,
const SliderParameters *slider,
int x, int y, int width, int height)
{
- int trough_width, trough_height;
- double translate_x, translate_y;
+ int trough_width, trough_height;
+ double translate_x, translate_y;
+ CairoColor fill, border;
+ gboolean in;
+
+ cairo_save (cr);
if (slider->horizontal)
{
- trough_width = width-3;
- trough_height = TROUGH_SIZE-2;
+ trough_width = width;
+ trough_height = TROUGH_SIZE;
- translate_x = x + 0.5;
- translate_y = y + 0.5 + (height/2) - (TROUGH_SIZE/2);
+ translate_x = x;
+ translate_y = y + (height/2) - (TROUGH_SIZE/2);
}
else
{
- trough_width = TROUGH_SIZE-2;
- trough_height = height-3;
+ trough_width = TROUGH_SIZE;
+ trough_height = height;
- translate_x = x + 0.5 + (width/2) - (TROUGH_SIZE/2);
- translate_y = y + 0.5;
+ translate_x = x + (width/2) - (TROUGH_SIZE/2);
+ translate_y = y;
}
cairo_set_line_width (cr, 1.0);
cairo_translate (cr, translate_x, translate_y);
if (!slider->fill_level)
- params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, trough_width+2, trough_height+2, 0, 0);
-
- cairo_translate (cr, 1, 1);
+ params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, trough_width, trough_height, 0, 0);
if (!slider->lower && !slider->fill_level)
- clearlooks_gummy_scale_draw_gradient (cr,
- &colors->shade[2], /* bottom */
- &colors->shade[6], /* border */
- 0, 0, trough_width, trough_height,
- slider->horizontal, TRUE);
+ {
+ ge_shade_color (&params->parentbg, 0.896, &fill);
+ border = colors->shade[6];
+ in = TRUE;
+ }
else if (!slider->fill_level)
- clearlooks_gummy_scale_draw_gradient (cr,
- &colors->spot[1], /* bottom */
- &colors->spot[2], /* border */
- 0, 0, trough_width, trough_height,
- slider->horizontal, FALSE);
- else {
- CairoColor c1 = colors->spot[1];
- CairoColor c2 = colors->spot[2];
-
- c1.a = 0.25;
- c2.a = 0.25;
-
- clearlooks_gummy_scale_draw_gradient (cr,
- &c1, /* bottom */
- &c2, /* border */
- 0, 0, trough_width, trough_height,
- slider->horizontal, FALSE);
+ {
+ fill = colors->spot[1];
+ border = colors->spot[2];
+ in = FALSE;
}
+ else
+ {
+ fill = colors->spot[1];
+ border = colors->spot[2];
+ fill.a = 0.25;
+ border.a = 0.25;
+
+ in = FALSE;
+ }
+
+ clearlooks_gummy_scale_draw_gradient (cr,
+ &fill,
+ &border,
+ 1, 1, trough_width - 2, trough_height - 2,
+ slider->horizontal, in);
+
+ cairo_restore (cr);
}
static void
@@ -656,16 +620,19 @@ clearlooks_gummy_draw_tab (cairo_t *cr,
const TabParameters *tab,
int x, int y, int width, int height)
{
+ const CairoColor *border = &colors->shade[5];
+ const CairoColor *stripe_fill = &colors->spot[1];
+ const CairoColor *stripe_border = &colors->spot[2];
+ const CairoColor *fill;
- const CairoColor *border = &colors->shade[5];
- const CairoColor *stripe_fill = &colors->spot[1];
- const CairoColor *stripe_border = &colors->spot[2];
- const CairoColor *fill;
+ cairo_pattern_t *pattern = NULL;
- cairo_pattern_t *pattern;
+ double radius;
+ double stripe_size = 2.0;
+ double stripe_fill_size;
+ double stripe_border_pos;
- double radius;
- double strip_size;
+ gboolean horizontal = FALSE;
radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
@@ -682,18 +649,28 @@ clearlooks_gummy_draw_tab (cairo_t *cr,
/* And calculate the strip size too, while you're at it */
if (tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM)
{
+ if (params->ythickness == 3)
+ stripe_size = 3.0;
+
height += 3.0;
- strip_size = 2.0/height; /* 2 pixel high strip */
+ stripe_fill_size = (tab->gap_side == CL_GAP_TOP ? stripe_size/height : stripe_size/(height-2));
+ stripe_border_pos = (tab->gap_side == CL_GAP_TOP ? (stripe_size+1.0)/height : (stripe_size+1.0)/(height-2));
+
+ horizontal = TRUE;
if (tab->gap_side == CL_GAP_TOP)
cairo_translate (cr, 0.0, -3.0); /* gap at the other side */
}
else
{
+ if (params->xthickness == 3)
+ stripe_size = 3.0;
+
width += 3.0;
- strip_size = 2.0/width;
+ stripe_fill_size = (tab->gap_side == CL_GAP_LEFT ? stripe_size/width : stripe_size/(width-2));
+ stripe_border_pos = (tab->gap_side == CL_GAP_LEFT ? (stripe_size+1.0)/width : (stripe_size+1.0)/(width-2));
- if (tab->gap_side == CL_GAP_LEFT)
+ if (tab->gap_side == CL_GAP_LEFT)
cairo_translate (cr, -3.0, 0.0); /* gap at the other side */
}
@@ -717,7 +694,7 @@ clearlooks_gummy_draw_tab (cairo_t *cr,
shadow.corners = params->corners;
clearlooks_gummy_draw_highlight_and_shade (cr, &colors->bg[0], &shadow,
- width, height, radius);
+ width, height, radius);
}
if (params->active)
@@ -725,39 +702,70 @@ clearlooks_gummy_draw_tab (cairo_t *cr,
CairoColor hilight;
CairoColor shade1, shade2, shade3;
- pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-1 : 0,
- tab->gap_side == CL_GAP_TOP ? height-2 : 1,
- tab->gap_side == CL_GAP_RIGHT ? width : 0,
- tab->gap_side == CL_GAP_BOTTOM ? height : 0);
-
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
-
- ge_shade_color (fill, 1.14, &hilight);
+ ge_shade_color (fill, 1.15, &hilight);
ge_shade_color (fill, SHADE_TOP, &shade1);
ge_shade_color (fill, SHADE_CENTER_TOP, &shade2);
ge_shade_color (fill, SHADE_BOTTOM, &shade3);
- cairo_pattern_add_color_stop_rgb (pattern, 0.0, hilight.r, hilight.g, hilight.b);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, hilight.r, hilight.g, hilight.b);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0/height, shade1.r, shade1.g, shade1.b);
- cairo_pattern_add_color_stop_rgb (pattern, 0.45, shade2.r, shade2.g, shade2.b);
- cairo_pattern_add_color_stop_rgb (pattern, 0.45, fill->r, fill->g, fill->b);
- cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (0, height-2, 0, 0);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (0, 1, 0, height);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-2, 0, 1, 0);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (1, 0, width-2, 0);
+ break;
+ }
+
+ ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
+
+ cairo_pattern_add_color_stop_rgb (pattern, 0.0, hilight.r, hilight.g, hilight.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0/(horizontal ? height : width), hilight.r, hilight.g, hilight.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0/(horizontal ? height : width), shade1.r, shade1.g, shade1.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.45, shade2.r, shade2.g, shade2.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.45, fill->r, fill->g, fill->b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
}
else
{
- /* Draw shade */
- pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 0,
- tab->gap_side == CL_GAP_TOP ? height-2 : 0,
- tab->gap_side == CL_GAP_RIGHT ? width : 0,
- tab->gap_side == CL_GAP_BOTTOM ? height : 0);
+ CairoColor shade1;
+
+ ge_shade_color (fill, SHADE_TOP, &shade1);
+
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (0, height-2, 0, 0);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-2, 0, 0, 0);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (0, 0, width, 0);
+ break;
+ }
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
- cairo_pattern_add_color_stop_rgba (pattern, 0.0, stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.5);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.6);
+ /* cairo_pattern_add_color_stop_rgba (pattern, 1.0/(horizontal ? height : width), stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.34);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0/(horizontal ? height : width), stripe_fill->r, stripe_fill->g, stripe_fill->b, 0.5); */
+ cairo_pattern_add_color_stop_rgb (pattern, stripe_fill_size, stripe_fill->r, stripe_fill->g, stripe_fill->b);
+ cairo_pattern_add_color_stop_rgba (pattern, stripe_fill_size, stripe_border->r, stripe_border->g, stripe_border->b, 0.72);
+ cairo_pattern_add_color_stop_rgba (pattern, stripe_border_pos, stripe_border->r, stripe_border->g, stripe_border->b, 0.72);
+ cairo_pattern_add_color_stop_rgb (pattern, stripe_border_pos, shade1.r, shade1.g, shade1.b);
cairo_pattern_add_color_stop_rgba (pattern, 0.8, fill->r, fill->g, fill->b, 0.0);
cairo_set_source (cr, pattern);
cairo_fill (cr);
@@ -773,10 +781,21 @@ clearlooks_gummy_draw_tab (cairo_t *cr,
}
else
{
- pattern = cairo_pattern_create_linear (tab->gap_side == CL_GAP_LEFT ? width-2 : 2,
- tab->gap_side == CL_GAP_TOP ? height-2 : 2,
- tab->gap_side == CL_GAP_RIGHT ? width : 2,
- tab->gap_side == CL_GAP_BOTTOM ? height : 2);
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (2, height-2, 2, 2);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (2, 2, 2, height);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-2, 2, 2, 2);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (2, 2, width, 2);
+ break;
+ }
cairo_pattern_add_color_stop_rgb (pattern, 0.0, stripe_border->r, stripe_border->g, stripe_border->b);
cairo_pattern_add_color_stop_rgb (pattern, 0.8, border->r, border->g, border->b);
@@ -784,6 +803,39 @@ clearlooks_gummy_draw_tab (cairo_t *cr,
cairo_stroke (cr);
cairo_pattern_destroy (pattern);
}
+
+ /* In current GTK+ focus and active cannot happen together, but we are robust against it. */
+ if (params->focus && !params->active)
+ {
+ CairoColor focus_fill = tab->focus.color;
+ CairoColor fill_shade1, fill_shade2, fill_shade3;
+ CairoColor focus_border;
+
+ double focus_inset_x = ((tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM) ? 4 : stripe_size + 3);
+ double focus_inset_y = ((tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM) ? stripe_size + 3 : 4);
+ double border_alpha = 0.54;
+ double fill_alpha = 0.17;
+
+ ge_shade_color (&focus_fill, 0.65, &focus_border);
+ ge_shade_color (&focus_fill, 1.18, &fill_shade1);
+ ge_shade_color (&focus_fill, 1.02, &fill_shade2);
+ ge_shade_color (&focus_fill, 0.84, &fill_shade3);
+
+ ge_cairo_rounded_rectangle (cr, focus_inset_x, focus_inset_y, width-focus_inset_x*2-1, height-focus_inset_y*2-1, radius-1, CR_CORNER_ALL);
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, fill_shade1.r, fill_shade1.g, fill_shade1.b, fill_alpha);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.5, fill_shade2.r, fill_shade2.g, fill_shade2.b, fill_alpha);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.5, focus_fill.r, focus_fill.g, focus_fill.b, fill_alpha);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0, fill_shade3.r, fill_shade3.g, fill_shade3.b, fill_alpha);
+ cairo_set_source (cr, pattern);
+ cairo_fill_preserve (cr);
+
+ cairo_pattern_destroy (pattern);
+
+ clearlooks_set_mixed_color (cr, &params->parentbg, &focus_border, border_alpha);
+ cairo_stroke (cr);
+ }
}
static void
@@ -802,33 +854,33 @@ clearlooks_gummy_draw_separator (cairo_t *cr,
if (separator->horizontal)
{
- cairo_set_line_width (cr, 1.0);
- cairo_translate (cr, x, y+0.5);
-
- cairo_move_to (cr, 0.0, 0.0);
- cairo_line_to (cr, width, 0.0);
- ge_cairo_set_color (cr, &color);
- cairo_stroke (cr);
-
- cairo_move_to (cr, 0.0, 1.0);
- cairo_line_to (cr, width, 1.0);
- ge_cairo_set_color (cr, &hilight);
- cairo_stroke (cr);
+ cairo_set_line_width (cr, 1.0);
+ cairo_translate (cr, x, y+0.5);
+
+ cairo_move_to (cr, 0.0, 0.0);
+ cairo_line_to (cr, width, 0.0);
+ ge_cairo_set_color (cr, &color);
+ cairo_stroke (cr);
+
+ cairo_move_to (cr, 0.0, 1.0);
+ cairo_line_to (cr, width, 1.0);
+ ge_cairo_set_color (cr, &hilight);
+ cairo_stroke (cr);
}
else
{
- cairo_set_line_width (cr, 1.0);
- cairo_translate (cr, x+0.5, y);
-
- cairo_move_to (cr, 0.0, 0.0);
- cairo_line_to (cr, 0.0, height);
- ge_cairo_set_color (cr, &color);
- cairo_stroke (cr);
-
- cairo_move_to (cr, 1.0, 0.0);
- cairo_line_to (cr, 1.0, height);
- ge_cairo_set_color (cr, &hilight);
- cairo_stroke (cr);
+ cairo_set_line_width (cr, 1.0);
+ cairo_translate (cr, x+0.5, y);
+
+ cairo_move_to (cr, 0.0, 0.0);
+ cairo_line_to (cr, 0.0, height);
+ ge_cairo_set_color (cr, &color);
+ cairo_stroke (cr);
+
+ cairo_move_to (cr, 1.0, 0.0);
+ cairo_line_to (cr, 1.0, height);
+ ge_cairo_set_color (cr, &hilight);
+ cairo_stroke (cr);
}
cairo_restore (cr);
@@ -841,17 +893,15 @@ clearlooks_gummy_draw_slider (cairo_t *cr,
int x, int y, int width, int height)
{
const CairoColor *border = &colors->shade[7];
- CairoColor fill;
- CairoColor shade1, shade2, shade3;
+ CairoColor fill;
+ CairoColor shade1, shade2, shade3;
cairo_pattern_t *pattern;
int bar_x, i;
int shift_x;
- cairo_set_line_width (cr, 1.0);
+ cairo_set_line_width (cr, 1.0);
cairo_translate (cr, x, y);
- cairo_translate (cr, -0.5, -0.5);
-
ge_shade_color (&colors->bg[params->state_type], 1.0, &fill);
if (params->prelight)
ge_shade_color (&fill, 1.04, &fill);
@@ -861,10 +911,10 @@ clearlooks_gummy_draw_slider (cairo_t *cr,
ge_shade_color (&fill, SHADE_BOTTOM, &shade3);
pattern = cairo_pattern_create_linear (1, 1, 1, height-2);
- cairo_pattern_add_color_stop_rgb(pattern, 0, shade1.r, shade1.g, shade1.b);
- cairo_pattern_add_color_stop_rgb(pattern, 0.5, shade2.r, shade2.g, shade2.b);
- cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b);
- cairo_pattern_add_color_stop_rgb(pattern, 1.0, shade3.r, shade3.g, shade3.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill.r, fill.g, fill.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
cairo_rectangle (cr, 1, 1, width-2, height-2);
cairo_set_source (cr, pattern);
cairo_fill (cr);
@@ -889,7 +939,7 @@ clearlooks_gummy_draw_slider (cairo_t *cr,
}
cairo_stroke (cr);
- clearlooks_gummy_draw_top_left_highlight (cr, &fill, params, width, height, 2.0);
+ params->style_functions->draw_top_left_highlight (cr, &fill, params, 1, 1, width-2, height-2, 2.0, params->corners);
}
static void
@@ -906,9 +956,9 @@ clearlooks_gummy_draw_slider_button (cairo_t *cr,
if (!slider->horizontal)
ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
- cairo_translate (cr, x+0.5, y+0.5);
+ cairo_translate (cr, x, y);
- params->style_functions->draw_shadow (cr, colors, radius, width-1, height-1);
+ params->style_functions->draw_shadow (cr, colors, radius, width, height);
params->style_functions->draw_slider (cr, colors, params, 1, 1, width-2, height-2);
}
@@ -925,7 +975,6 @@ clearlooks_gummy_draw_scrollbar_stepper (cairo_t *cr,
CairoColor fill;
CairoColor shade1, shade2, shade3;
cairo_pattern_t *pattern;
- ShadowParameters shadow;
double radius = MIN (widget->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
if (scrollbar->horizontal)
@@ -954,29 +1003,24 @@ clearlooks_gummy_draw_scrollbar_stepper (cairo_t *cr,
pattern = cairo_pattern_create_linear (0, 0, width, 0);
fill = colors->bg[widget->state_type];
- ge_shade_color(&fill, SHADE_TOP, &shade1);
- ge_shade_color(&fill, SHADE_CENTER_TOP, &shade2);
- ge_shade_color(&fill, SHADE_BOTTOM, &shade3);
-
- cairo_pattern_add_color_stop_rgb(pattern, 0, shade1.r, shade1.g, shade1.b);
- cairo_pattern_add_color_stop_rgb(pattern, 0.5, shade2.r, shade2.g, shade2.b);
- cairo_pattern_add_color_stop_rgb(pattern, 0.5, fill.r, fill.g, fill.b);
- cairo_pattern_add_color_stop_rgb(pattern, 1.0, shade3.r, shade3.g, shade3.b);
+ ge_shade_color (&fill, SHADE_TOP, &shade1);
+ ge_shade_color (&fill, SHADE_CENTER_TOP, &shade2);
+ ge_shade_color (&fill, SHADE_BOTTOM, &shade3);
+
+ cairo_pattern_add_color_stop_rgb (pattern, 0, shade1.r, shade1.g, shade1.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.5, shade2.r, shade2.g, shade2.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.5, fill.r, fill.g, fill.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0, shade3.r, shade3.g, shade3.b);
cairo_set_source (cr, pattern);
cairo_fill (cr);
cairo_pattern_destroy (pattern);
- cairo_translate (cr, 0.5, 0.5);
- clearlooks_gummy_draw_top_left_highlight (cr, &fill, widget, width, height, (stepper->stepper == CL_STEPPER_A) ? radius : 0);
- cairo_translate (cr, -0.5, -0.5);
+ widget->style_functions->draw_top_left_highlight (cr, &fill, widget, 1, 1, width - 2, height - 2,
+ radius, corners);
ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, corners);
clearlooks_set_mixed_color (cr, border, &fill, 0.2);
cairo_stroke (cr);
-
- cairo_translate (cr, 0.5, 0.5);
- shadow.shadow = CL_SHADOW_OUT;
- shadow.corners = corners;
}
static void
@@ -1044,7 +1088,7 @@ clearlooks_gummy_draw_scrollbar_slider (cairo_t *cr,
cairo_set_line_width (cr, 1);
- ge_shade_color (&fill, TOPLEFT_HIGHLIGHT_SHADE, &hilight);
+ ge_shade_color (&fill, widget->style_constants->topleft_highlight_shade, &hilight);
ge_shade_color (&fill, SHADE_TOP, &shade1);
ge_shade_color (&fill, SHADE_CENTER_TOP, &shade2);
ge_shade_color (&fill, SHADE_BOTTOM, &shade3);
@@ -1059,7 +1103,7 @@ clearlooks_gummy_draw_scrollbar_slider (cairo_t *cr,
cairo_fill (cr);
cairo_pattern_destroy (pattern);
- if (scrollbar->has_color)
+ if (scrollbar->has_color)
{
cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.2);
ge_cairo_stroke_rectangle (cr, 1.5, 1.5, width-3, height-3);
@@ -1069,8 +1113,8 @@ clearlooks_gummy_draw_scrollbar_slider (cairo_t *cr,
cairo_move_to (cr, 1.5, height-1.5);
cairo_line_to (cr, 1.5, 1.5);
cairo_line_to (cr, width-1.5, 1.5);
- cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, TOPLEFT_HIGHLIGHT_ALPHA);
- cairo_stroke(cr);
+ cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, widget->style_constants->topleft_highlight_alpha);
+ cairo_stroke (cr);
}
ge_cairo_set_color (cr, &border);
@@ -1130,7 +1174,7 @@ clearlooks_gummy_draw_list_view_header (cairo_t *cr,
cairo_pattern_destroy (pattern);
/* Draw highlight */
- if (header->order == CL_ORDER_FIRST)
+ if (header->order & CL_ORDER_FIRST)
{
cairo_move_to (cr, 0.5, height-1.5);
cairo_line_to (cr, 0.5, 0.5);
@@ -1144,8 +1188,8 @@ clearlooks_gummy_draw_list_view_header (cairo_t *cr,
cairo_stroke (cr);
/* Draw resize grip */
- if ((params->ltr && header->order != CL_ORDER_LAST) ||
- (!params->ltr && header->order != CL_ORDER_FIRST) || header->resizable)
+ if ((params->ltr && !(header->order & CL_ORDER_LAST)) ||
+ (!params->ltr && !(header->order & CL_ORDER_FIRST)) || header->resizable)
{
SeparatorParameters separator;
separator.horizontal = FALSE;
@@ -1206,14 +1250,14 @@ clearlooks_gummy_draw_toolbar (cairo_t *cr,
{
/* Draw highlight */
cairo_move_to (cr, 0, 0.5);
- cairo_line_to (cr, width-1, 0.5);
+ cairo_line_to (cr, width-0.5, 0.5);
ge_cairo_set_color (cr, &light);
cairo_stroke (cr);
}
/* Draw shadow */
cairo_move_to (cr, 0, height-0.5);
- cairo_line_to (cr, width-1, height-0.5);
+ cairo_line_to (cr, width-0.5, height-0.5);
ge_cairo_set_color (cr, dark);
cairo_stroke (cr);
}
@@ -1243,7 +1287,7 @@ clearlooks_gummy_draw_menuitem (cairo_t *cr,
cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
cairo_set_source (cr, pattern);
- cairo_fill_preserve (cr);
+ cairo_fill_preserve (cr);
cairo_pattern_destroy (pattern);
ge_cairo_set_color (cr, border);
@@ -1275,7 +1319,7 @@ clearlooks_gummy_draw_menubaritem (cairo_t *cr,
cairo_pattern_add_color_stop_rgb (pattern, 1, shade3.r, shade3.g, shade3.b);
cairo_set_source (cr, pattern);
- cairo_fill_preserve (cr);
+ cairo_fill_preserve (cr);
cairo_pattern_destroy (pattern);
ge_cairo_set_color (cr, border);
@@ -1337,6 +1381,13 @@ clearlooks_gummy_draw_radiobutton (cairo_t *cr,
cairo_pattern_t *pt;
gboolean inconsistent;
gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
+ gdouble w, h, cx, cy, radius;
+
+ w = (gdouble) width;
+ h = (gdouble) height;
+ cx = width / 2.0;
+ cy = height / 2.0;
+ radius = MIN (width, height) / 2.0;
inconsistent = (checkbox->shadow_type == GTK_SHADOW_ETCHED_IN);
draw_bullet |= inconsistent;
@@ -1358,7 +1409,7 @@ clearlooks_gummy_draw_radiobutton (cairo_t *cr,
ge_shade_color (&widget->parentbg, 0.9, &shadow);
ge_shade_color (&widget->parentbg, 1.1, &highlight);
- pt = cairo_pattern_create_linear (0, 0, 13, 13);
+ pt = cairo_pattern_create_linear (0, 0, radius * 2.0, radius * 2.0);
cairo_pattern_add_color_stop_rgb (pt, 0.0, shadow.r, shadow.b, shadow.g);
cairo_pattern_add_color_stop_rgba (pt, 0.5, shadow.r, shadow.b, shadow.g, 0.5);
cairo_pattern_add_color_stop_rgba (pt, 0.5, highlight.r, highlight.g, highlight.b, 0.5);
@@ -1366,15 +1417,15 @@ clearlooks_gummy_draw_radiobutton (cairo_t *cr,
cairo_translate (cr, x, y);
- cairo_set_line_width (cr, 2);
- cairo_arc (cr, 7, 7, 6, 0, G_PI*2);
+ cairo_set_line_width (cr, MAX (1.0, floor (radius/3)));
+ cairo_arc (cr, ceil (cx), ceil (cy), floor (radius - 0.1), 0, G_PI*2);
cairo_set_source (cr, pt);
cairo_stroke (cr);
cairo_pattern_destroy (pt);
- cairo_set_line_width (cr, 1);
+ cairo_set_line_width (cr, MAX (1.0, floor (radius/6)));
- cairo_arc (cr, 7, 7, 5.5, 0, G_PI*2);
+ cairo_arc (cr, ceil (cx), ceil (cy), MAX (1.0, ceil (radius) - 1.5), 0, G_PI*2);
if (!widget->disabled)
{
@@ -1393,21 +1444,21 @@ clearlooks_gummy_draw_radiobutton (cairo_t *cr,
if (inconsistent)
{
cairo_set_line_cap(cr, CAIRO_LINE_CAP_ROUND);
- cairo_set_line_width (cr, 4);
+ cairo_set_line_width (cr, ceil (radius * 2 / 3));
- cairo_move_to(cr, 5, 7);
- cairo_line_to(cr, 9, 7);
+ cairo_move_to (cr, ceil (cx - radius/3.0), ceil (cy));
+ cairo_line_to (cr, ceil (cx + radius/3.0), ceil (cy));
ge_cairo_set_color (cr, dot);
cairo_stroke (cr);
}
else
{
- cairo_arc (cr, 7, 7, 3, 0, G_PI*2);
+ cairo_arc (cr, ceil (cx), ceil (cy), floor (radius/2.0), 0, G_PI*2);
ge_cairo_set_color (cr, dot);
cairo_fill (cr);
- cairo_arc (cr, 6, 6, 1, 0, G_PI*2);
+ cairo_arc (cr, floor (cx - radius/10.0), floor (cy - radius/10.0), floor (radius/6.0), 0, G_PI*2);
cairo_set_source_rgba (cr, highlight.r, highlight.g, highlight.b, 0.5);
cairo_fill (cr);
}
@@ -1422,7 +1473,7 @@ clearlooks_gummy_draw_checkbox (cairo_t *cr,
int x, int y, int width, int height)
{
const CairoColor *border;
- const CairoColor *dot;
+ const CairoColor *dot;
gboolean inconsistent = FALSE;
gboolean draw_bullet = (checkbox->shadow_type == GTK_SHADOW_IN);
@@ -1438,7 +1489,7 @@ clearlooks_gummy_draw_checkbox (cairo_t *cr,
{
if (widget->prelight)
border = &colors->spot[2];
- else
+ else
border = &colors->shade[6];
dot = &colors->text[GTK_STATE_NORMAL];
}
@@ -1448,25 +1499,25 @@ clearlooks_gummy_draw_checkbox (cairo_t *cr,
if (widget->xthickness > 2 && widget->ythickness > 2)
{
- widget->style_functions->draw_inset (cr, &widget->parentbg, 0.5, 0.5,
- width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
-
+ widget->style_functions->draw_inset (cr, &widget->parentbg, 0, 0,
+ width, height, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
+
/* Draw the rectangle for the checkbox itself */
- ge_cairo_rounded_rectangle (cr, 1.5, 1.5,
- width-3, height-3, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
+ ge_cairo_rounded_rectangle (cr, 1.5, 1.5,
+ width-3, height-3, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
}
else
{
/* Draw the rectangle for the checkbox itself */
- ge_cairo_rounded_rectangle (cr, 0.5, 0.5,
- width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
+ ge_cairo_rounded_rectangle (cr, 0.5, 0.5,
+ width-1, height-1, (widget->radius > 0)? 1 : 0, CR_CORNER_ALL);
}
-
+
if (!widget->disabled)
- {
+ {
if (widget->prelight)
clearlooks_set_mixed_color (cr, &colors->base[0], &colors->spot[1], 0.5);
- else
+ else
ge_cairo_set_color (cr, &colors->base[0]);
cairo_fill_preserve (cr);
}
@@ -1491,7 +1542,6 @@ clearlooks_gummy_draw_checkbox (cairo_t *cr,
cairo_curve_to (cr, 0.5 + (width*0.4), (height*0.7),
0.5 + (width*0.5), (height*0.4),
0.5 + (width*0.70), (height*0.25));
-
}
ge_cairo_set_color (cr, dot);
@@ -1499,26 +1549,160 @@ clearlooks_gummy_draw_checkbox (cairo_t *cr,
}
}
+static void
+clearlooks_gummy_draw_focus (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const FocusParameters *focus,
+ int x, int y, int width, int height)
+{
+ CairoColor fill = focus->color;
+ CairoColor fill_shade1, fill_shade2, fill_shade3;
+ CairoColor border;
+ CairoColor parentbg = widget->parentbg;
+
+ /* Default values */
+ double xoffset = 1.5;
+ double yoffset = 1.5;
+ double radius = widget->radius-1.0;
+ double border_alpha = 0.64;
+ double fill_alpha = 0.18;
+ double shadow_alpha = 0.5;
+ boolean focus_fill = TRUE;
+ boolean focus_border = TRUE;
+ boolean focus_shadow = FALSE;
+
+ ge_shade_color (&fill, 0.65, &border);
+ ge_shade_color (&fill, 1.18, &fill_shade1);
+ ge_shade_color (&fill, 1.02, &fill_shade2);
+ ge_shade_color (&fill, 0.84, &fill_shade3);
+
+ /* Do some useful things to adjust focus */
+ switch (focus->type)
+ {
+ case CL_FOCUS_BUTTON:
+ xoffset = -1.5-(focus->padding);
+ yoffset = -1.5-(focus->padding);
+ radius++;
+ border_alpha = 0.9;
+ fill_alpha = 0.12;
+ if (!widget->active)
+ focus_shadow = TRUE;
+ break;
+ case CL_FOCUS_BUTTON_FLAT:
+ xoffset = -1.5-(focus->padding);
+ yoffset = -1.5-(focus->padding);
+ radius++;
+ if (widget->active || widget->prelight)
+ {
+ border_alpha = 0.9;
+ fill_alpha = 0.12;
+ if (!widget->active)
+ focus_shadow = TRUE;
+ }
+ break;
+ case CL_FOCUS_LABEL:
+ xoffset = 0.5;
+ yoffset = 0.5;
+ break;
+ case CL_FOCUS_TREEVIEW:
+ parentbg = colors->base[widget->state_type];
+ xoffset = -1.5;
+ yoffset = -1.5;
+ fill_alpha = 0.08;
+ focus_border = FALSE;
+ break;
+ case CL_FOCUS_TREEVIEW_DND:
+ parentbg = colors->base[widget->state_type];
+ break;
+ case CL_FOCUS_TREEVIEW_HEADER:
+ cairo_translate (cr, -1, 0);
+ break;
+ case CL_FOCUS_TREEVIEW_ROW:
+ parentbg = colors->base[widget->state_type];
+ xoffset = -2.5; /* hack to hide vertical lines */
+ yoffset = 0.5;
+ radius = CLAMP (radius, 0.0, 2.0);
+ border_alpha = 0.7;
+ focus_fill = FALSE;
+ break;
+ case CL_FOCUS_TAB:
+ /* In current GTK+ focus and active cannot happen together, but we are robust against it.
+ * IF the application sets the state to ACTIVE while drawing the tabs focus. */
+ if (widget->focus && !widget->active)
+ return;
+ break;
+ case CL_FOCUS_SCALE:
+ break;
+ case CL_FOCUS_UNKNOWN:
+ /* Fallback to classic function, dots */
+ clearlooks_draw_focus (cr, colors, widget, focus, x, y, width, height);
+ return;
+ break;
+ default:
+ break;
+ };
+
+ cairo_translate (cr, x, y);
+ cairo_set_line_width (cr, focus->line_width);
+
+ ge_cairo_rounded_rectangle (cr, xoffset, yoffset, width-(xoffset*2), height-(yoffset*2), radius, widget->corners);
+
+ if (focus_fill)
+ {
+ cairo_pattern_t *pattern;
+
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.0, fill_shade1.r, fill_shade1.g, fill_shade1.b, fill_alpha);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.5, fill_shade2.r, fill_shade2.g, fill_shade2.b, fill_alpha);
+ cairo_pattern_add_color_stop_rgba (pattern, 0.5, fill.r, fill.g, fill.b, fill_alpha);
+ cairo_pattern_add_color_stop_rgba (pattern, 1.0, fill_shade3.r, fill_shade3.g, fill_shade3.b, fill_alpha);
+ cairo_set_source (cr, pattern);
+ cairo_fill_preserve (cr);
+
+ cairo_pattern_destroy (pattern);
+ }
+
+ if (focus_border)
+ {
+ clearlooks_set_mixed_color (cr, &parentbg, &border, border_alpha);
+ cairo_stroke (cr);
+ }
+
+ if (focus_shadow)
+ {
+ if (radius > 0)
+ radius++;
+ ge_cairo_rounded_rectangle (cr, xoffset-1, yoffset-1, width-(xoffset*2)+2, height-(yoffset*2)+2, radius, widget->corners);
+ clearlooks_set_mixed_color (cr, &parentbg, &fill, shadow_alpha);
+ cairo_stroke (cr);
+ }
+}
+
void
-clearlooks_register_style_gummy (ClearlooksStyleFunctions *functions)
+clearlooks_register_style_gummy (ClearlooksStyleFunctions *functions, ClearlooksStyleConstants *constants)
{
- functions->draw_button = clearlooks_gummy_draw_button;
- functions->draw_entry = clearlooks_gummy_draw_entry;
- functions->draw_progressbar_trough = clearlooks_gummy_draw_progressbar_trough;
- functions->draw_progressbar_fill = clearlooks_gummy_draw_progressbar_fill;
- functions->draw_scale_trough = clearlooks_gummy_draw_scale_trough;
- functions->draw_tab = clearlooks_gummy_draw_tab;
- functions->draw_separator = clearlooks_gummy_draw_separator;
- functions->draw_slider = clearlooks_gummy_draw_slider;
- functions->draw_slider_button = clearlooks_gummy_draw_slider_button;
- functions->draw_scrollbar_stepper = clearlooks_gummy_draw_scrollbar_stepper;
- functions->draw_scrollbar_slider = clearlooks_gummy_draw_scrollbar_slider;
- functions->draw_list_view_header = clearlooks_gummy_draw_list_view_header;
- functions->draw_toolbar = clearlooks_gummy_draw_toolbar;
- functions->draw_menuitem = clearlooks_gummy_draw_menuitem;
- functions->draw_menubaritem = clearlooks_gummy_draw_menubaritem;
- functions->draw_selected_cell = clearlooks_gummy_draw_selected_cell;
- functions->draw_statusbar = clearlooks_gummy_draw_statusbar;
- functions->draw_checkbox = clearlooks_gummy_draw_checkbox;
- functions->draw_radiobutton = clearlooks_gummy_draw_radiobutton;
+ functions->draw_button = clearlooks_gummy_draw_button;
+ functions->draw_entry = clearlooks_gummy_draw_entry;
+ functions->draw_progressbar_trough = clearlooks_gummy_draw_progressbar_trough;
+ functions->draw_progressbar_fill = clearlooks_gummy_draw_progressbar_fill;
+ functions->draw_scale_trough = clearlooks_gummy_draw_scale_trough;
+ functions->draw_tab = clearlooks_gummy_draw_tab;
+ functions->draw_separator = clearlooks_gummy_draw_separator;
+ functions->draw_slider = clearlooks_gummy_draw_slider;
+ functions->draw_slider_button = clearlooks_gummy_draw_slider_button;
+ functions->draw_scrollbar_stepper = clearlooks_gummy_draw_scrollbar_stepper;
+ functions->draw_scrollbar_slider = clearlooks_gummy_draw_scrollbar_slider;
+ functions->draw_list_view_header = clearlooks_gummy_draw_list_view_header;
+ functions->draw_toolbar = clearlooks_gummy_draw_toolbar;
+ functions->draw_menuitem = clearlooks_gummy_draw_menuitem;
+ functions->draw_menubaritem = clearlooks_gummy_draw_menubaritem;
+ functions->draw_selected_cell = clearlooks_gummy_draw_selected_cell;
+ functions->draw_statusbar = clearlooks_gummy_draw_statusbar;
+ functions->draw_checkbox = clearlooks_gummy_draw_checkbox;
+ functions->draw_radiobutton = clearlooks_gummy_draw_radiobutton;
+ functions->draw_focus = clearlooks_gummy_draw_focus;
+
+ constants->topleft_highlight_shade = 1.3;
+ constants->topleft_highlight_alpha = 0.4;
}
diff --git a/libs/clearlooks/clearlooks_draw_inverted.c b/libs/clearlooks/clearlooks_draw_inverted.c
index 2e8ee3bcd7..1bfff6d206 100644
--- a/libs/clearlooks/clearlooks_draw_inverted.c
+++ b/libs/clearlooks/clearlooks_draw_inverted.c
@@ -30,29 +30,6 @@
static void
-clearlooks_draw_top_left_highlight (cairo_t *cr,
- const CairoColor *color,
- const WidgetParameters *params,
- int width, int height, gdouble radius)
-{
- CairoColor hilight;
-
- double light_top = params->ythickness-1,
- light_bottom = height - params->ythickness - 1,
- light_left = params->xthickness-1,
- light_right = width - params->xthickness - 1;
-
- ge_shade_color (color, 1.3, &hilight);
- cairo_move_to (cr, light_left, light_bottom - (int)radius/2);
-
- ge_cairo_rounded_corner (cr, light_left, light_top, radius, params->corners & CR_CORNER_TOPLEFT);
-
- cairo_line_to (cr, light_right - (int)radius/2, light_top);
- cairo_set_source_rgba (cr, hilight.r, hilight.g, hilight.b, 0.7);
- cairo_stroke (cr);
-}
-
-static void
clearlooks_set_border_gradient (cairo_t *cr, const CairoColor *color, double hilight, int width, int height)
{
cairo_pattern_t *pattern;
@@ -101,9 +78,7 @@ clearlooks_inverted_draw_button (cairo_t *cr,
if (params->xthickness == 3 || params->ythickness == 3)
{
- cairo_translate (cr, 0.5, 0.5);
- params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width-1, height-1, radius+1, params->corners);
- cairo_translate (cr, -0.5, -0.5);
+ params->style_functions->draw_inset (cr, &params->parentbg, 0, 0, width, height, radius+1, params->corners);
}
ge_cairo_rounded_rectangle (cr, xoffset+1, yoffset+1,
@@ -185,15 +160,17 @@ clearlooks_inverted_draw_button (cairo_t *cr,
/* Draw the "shadow" */
if (!params->active)
{
- cairo_translate (cr, 0.5, 0.5);
/* Draw right shadow */
- cairo_move_to (cr, width-params->xthickness, params->ythickness - 1);
- cairo_line_to (cr, width-params->xthickness, height - params->ythickness - 1);
+ cairo_move_to (cr, width-xoffset-1.5, yoffset + radius);
+ cairo_line_to (cr, width-xoffset-1.5, height - yoffset - radius);
cairo_set_source_rgba (cr, shadow.r, shadow.g, shadow.b, 0.1);
cairo_stroke (cr);
/* Draw topleft shadow */
- clearlooks_draw_top_left_highlight (cr, fill, params, width, height, radius);
+ params->style_functions->draw_top_left_highlight (cr, fill, params,
+ xoffset+1, yoffset+1,
+ width-2*(xoffset+1), height-2*(yoffset+1),
+ radius, params->corners);
}
cairo_restore (cr);
}
@@ -436,6 +413,7 @@ clearlooks_inverted_draw_tab (cairo_t *cr,
double radius;
double strip_size;
+ double length;
radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
@@ -454,6 +432,7 @@ clearlooks_inverted_draw_tab (cairo_t *cr,
if (tab->gap_side == CL_GAP_TOP || tab->gap_side == CL_GAP_BOTTOM)
{
height += 3.0;
+ length = height;
strip_size = 2.0/height; /* 2 pixel high strip */
if (tab->gap_side == CL_GAP_TOP)
@@ -462,6 +441,7 @@ clearlooks_inverted_draw_tab (cairo_t *cr,
else
{
width += 3.0;
+ length = width;
strip_size = 2.0/width;
if (tab->gap_side == CL_GAP_LEFT)
@@ -496,10 +476,23 @@ clearlooks_inverted_draw_tab (cairo_t *cr,
if (params->active)
{
- pattern = cairo_pattern_create_linear ( tab->gap_side == CL_GAP_LEFT ? width-1 : 0,
- tab->gap_side == CL_GAP_TOP ? height-2 : 1,
- tab->gap_side == CL_GAP_RIGHT ? width : 0,
- tab->gap_side == CL_GAP_BOTTOM ? height : 0 );
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (0, height-2, 0, 0);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (0, 1, 0, height);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-2, 0, 1, 0);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (1, 0, width-2, 0);
+ break;
+ default:
+ pattern = NULL;
+ }
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
@@ -516,10 +509,23 @@ clearlooks_inverted_draw_tab (cairo_t *cr,
else
{
/* Draw shade */
- pattern = cairo_pattern_create_linear ( tab->gap_side == CL_GAP_LEFT ? width-2 : 0,
- tab->gap_side == CL_GAP_TOP ? height-2 : 0,
- tab->gap_side == CL_GAP_RIGHT ? width : 0,
- tab->gap_side == CL_GAP_BOTTOM ? height : 0 );
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (0, height-2, 0, 0);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (0, 0, 0, height);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-2, 0, 0, 0);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (0, 0, width, 0);
+ break;
+ default:
+ pattern = NULL;
+ }
ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
@@ -542,10 +548,23 @@ clearlooks_inverted_draw_tab (cairo_t *cr,
}
else
{
- pattern = cairo_pattern_create_linear ( tab->gap_side == CL_GAP_LEFT ? width-2 : 2,
- tab->gap_side == CL_GAP_TOP ? height-2 : 2,
- tab->gap_side == CL_GAP_RIGHT ? width : 2,
- tab->gap_side == CL_GAP_BOTTOM ? height : 2 );
+ switch (tab->gap_side)
+ {
+ case CL_GAP_TOP:
+ pattern = cairo_pattern_create_linear (2, height-2, 2, 2);
+ break;
+ case CL_GAP_BOTTOM:
+ pattern = cairo_pattern_create_linear (2, 2, 2, height);
+ break;
+ case CL_GAP_LEFT:
+ pattern = cairo_pattern_create_linear (width-2, 2, 2, 2);
+ break;
+ case CL_GAP_RIGHT:
+ pattern = cairo_pattern_create_linear (2, 2, width, 2);
+ break;
+ default:
+ pattern = NULL;
+ }
cairo_pattern_add_color_stop_rgb (pattern, 0.0, stripe_border->r, stripe_border->g, stripe_border->b);
cairo_pattern_add_color_stop_rgb (pattern, strip_size, stripe_border->r, stripe_border->g, stripe_border->b);
@@ -581,7 +600,7 @@ clearlooks_inverted_draw_slider (cairo_t *cr,
border = &colors->shade[6];
/* fill the widget */
- cairo_rectangle (cr, 0.5, 0.5, width-2, height-2);
+ cairo_rectangle (cr, 1.0, 1.0, width-2, height-2);
/* Fake light */
if (!params->disabled)
@@ -599,20 +618,20 @@ clearlooks_inverted_draw_slider (cairo_t *cr,
else
{
ge_cairo_set_color (cr, fill);
- cairo_rectangle (cr, 0.5, 0.5, width-2, height-2);
+ cairo_rectangle (cr, 1.0, 1.0, width-2, height-2);
cairo_fill (cr);
}
/* Set the clip */
cairo_save (cr);
- cairo_rectangle (cr, 0.5, 0.5, 6, height-2);
- cairo_rectangle (cr, width-7.5, 0.5, 6 , height-2);
+ cairo_rectangle (cr, 1.0, 1.0, 6, height-2);
+ cairo_rectangle (cr, width-7.0, 1.0, 6, height-2);
cairo_clip_preserve (cr);
cairo_new_path (cr);
/* Draw the handles */
- ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, params->corners);
+ ge_cairo_rounded_rectangle (cr, 1.0, 1.0, width-1, height-1, radius, params->corners);
pattern = cairo_pattern_create_linear (0.5, 0.5, 0.5, 0.5+height);
if (params->prelight)
@@ -635,7 +654,7 @@ clearlooks_inverted_draw_slider (cairo_t *cr,
cairo_restore (cr);
/* Draw the border */
- ge_cairo_rounded_rectangle (cr, 0, 0, width-1, height-1, radius, params->corners);
+ ge_cairo_inner_rounded_rectangle (cr, 0, 0, width, height, radius, params->corners);
if (params->prelight || params->disabled)
ge_cairo_set_color (cr, border);
else
@@ -645,11 +664,11 @@ clearlooks_inverted_draw_slider (cairo_t *cr,
/* Draw handle lines */
if (width > 14)
{
- cairo_move_to (cr, 6, 0.5);
- cairo_line_to (cr, 6, height-1);
+ cairo_move_to (cr, 6.5, 1.0);
+ cairo_line_to (cr, 6.5, height-1);
- cairo_move_to (cr, width-7, 0.5);
- cairo_line_to (cr, width-7, height-1);
+ cairo_move_to (cr, width-6.5, 1.0);
+ cairo_line_to (cr, width-6.5, height-1);
cairo_set_line_width (cr, 1.0);
cairo_set_source_rgba (cr, border->r,
@@ -661,27 +680,6 @@ clearlooks_inverted_draw_slider (cairo_t *cr,
}
static void
-clearlooks_inverted_draw_slider_button (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *params,
- const SliderParameters *slider,
- int x, int y, int width, int height)
-{
- double radius = MIN (params->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
- cairo_set_line_width (cr, 1.0);
-
- if (!slider->horizontal)
- ge_cairo_exchange_axis (cr, &x, &y, &width, &height);
- cairo_translate (cr, x+0.5, y+0.5);
-
- params->style_functions->draw_shadow (cr, colors, radius, width-1, height-1);
- params->style_functions->draw_slider (cr, colors, params, 1, 1, width-2, height-2);
-
- if (width > 24)
- params->style_functions->draw_gripdots (cr, colors, 0, 0, width-2, height-2, 3, 3, 0);
-}
-
-static void
clearlooks_inverted_draw_list_view_header (cairo_t *cr,
const ClearlooksColors *colors,
const WidgetParameters *params,
@@ -703,7 +701,7 @@ clearlooks_inverted_draw_list_view_header (cairo_t *cr,
cairo_set_line_width (cr, 1.0);
/* Draw highlight */
- if (header->order == CL_ORDER_FIRST)
+ if (header->order & CL_ORDER_FIRST)
{
cairo_move_to (cr, 0.5, height-1);
cairo_line_to (cr, 0.5, 0.5);
@@ -733,8 +731,8 @@ clearlooks_inverted_draw_list_view_header (cairo_t *cr,
cairo_pattern_destroy (pattern);
/* Draw resize grip */
- if ((params->ltr && header->order != CL_ORDER_LAST) ||
- (!params->ltr && header->order != CL_ORDER_FIRST) || header->resizable)
+ if ((params->ltr && !(header->order & CL_ORDER_LAST)) ||
+ (!params->ltr && !(header->order & CL_ORDER_FIRST)) || header->resizable)
{
SeparatorParameters separator;
separator.horizontal = FALSE;
@@ -761,7 +759,6 @@ clearlooks_inverted_draw_scrollbar_stepper (cairo_t *cr,
CairoColor border;
CairoColor s1, s2, s3;
cairo_pattern_t *pattern;
- ShadowParameters shadow;
double radius = MIN (widget->radius, MIN ((width - 2.0) / 2.0, (height - 2.0) / 2.0));
ge_shade_color(&colors->shade[6], 1.05, &border);
@@ -801,19 +798,11 @@ clearlooks_inverted_draw_scrollbar_stepper (cairo_t *cr,
cairo_fill (cr);
cairo_pattern_destroy (pattern);
- clearlooks_draw_top_left_highlight (cr, &s1, widget, width, height, radius);
+ widget->style_functions->draw_top_left_highlight (cr, &s1, widget, 1, 1, width-2, height-2, radius, corners);
ge_cairo_rounded_rectangle (cr, 0.5, 0.5, width-1, height-1, radius, corners);
clearlooks_set_border_gradient (cr, &border, 1.2, (scrollbar->horizontal ? 0 : width), (scrollbar->horizontal ? height: 0));
cairo_stroke (cr);
-
- cairo_translate (cr, 0.5, 0.5);
- shadow.shadow = CL_SHADOW_OUT;
- shadow.corners = corners;
- /*
- clearlooks_draw_highlight_and_shade (cr, &shadow,
- width,
- height, params->radius);*/
}
static void
@@ -909,7 +898,7 @@ clearlooks_inverted_draw_scrollbar_slider (cairo_t *cr,
cairo_fill(cr);
cairo_pattern_destroy(pattern);
- clearlooks_draw_top_left_highlight (cr, &s2, widget, width, height, 0);
+ widget->style_functions->draw_top_left_highlight (cr, &s2, widget, 1, 1, width-2, height-2, 0, widget->corners);
clearlooks_set_border_gradient (cr, &border, 1.2, 0, height);
ge_cairo_stroke_rectangle (cr, 0.5, 0.5, width-1, height-1);
@@ -985,11 +974,10 @@ clearlooks_inverted_draw_selected_cell (cairo_t *cr,
}
void
-clearlooks_register_style_inverted (ClearlooksStyleFunctions *functions)
+clearlooks_register_style_inverted (ClearlooksStyleFunctions *functions, ClearlooksStyleConstants *constants)
{
functions->draw_button = clearlooks_inverted_draw_button;
functions->draw_slider = clearlooks_inverted_draw_slider;
- functions->draw_slider_button = clearlooks_inverted_draw_slider_button;
functions->draw_progressbar_fill = clearlooks_inverted_draw_progressbar_fill;
functions->draw_menuitem = clearlooks_inverted_draw_menuitem;
functions->draw_menubaritem = clearlooks_inverted_draw_menubaritem;
@@ -998,5 +986,8 @@ clearlooks_register_style_inverted (ClearlooksStyleFunctions *functions)
functions->draw_scrollbar_stepper = clearlooks_inverted_draw_scrollbar_stepper;
functions->draw_scrollbar_slider = clearlooks_inverted_draw_scrollbar_slider;
functions->draw_selected_cell = clearlooks_inverted_draw_selected_cell;
+
+ constants->topleft_highlight_shade = 1.3;
+ constants->topleft_highlight_alpha = 0.7;
}
diff --git a/libs/clearlooks/clearlooks_rc_style.c b/libs/clearlooks/clearlooks_rc_style.c
index f486453339..14d405286f 100644
--- a/libs/clearlooks/clearlooks_rc_style.c
+++ b/libs/clearlooks/clearlooks_rc_style.c
@@ -1,5 +1,7 @@
/* Clearlooks theme engine
- * Copyright (C) 2005 Richard Stellingwerff.
+ * Copyright (C) 2005 Richard Stellingwerff
+ * Copyright (C) 2007 Benjamin Berg
+ * Copyright (C) 2007 Andrea Cimitan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -22,35 +24,32 @@
* Modified by Kulyk Nazar <schamane@myeburg.net>
*/
+#include <string.h>
+#include <widget-information.h>
#include "clearlooks_style.h"
#include "clearlooks_rc_style.h"
#include "animation.h"
-static void clearlooks_rc_style_init (ClearlooksRcStyle *style);
#ifdef HAVE_ANIMATION
static void clearlooks_rc_style_finalize (GObject *object);
#endif
-static void clearlooks_rc_style_class_init (ClearlooksRcStyleClass *klass);
static GtkStyle *clearlooks_rc_style_create_style (GtkRcStyle *rc_style);
static guint clearlooks_rc_style_parse (GtkRcStyle *rc_style,
- GtkSettings *settings,
- GScanner *scanner);
+ GtkSettings *settings,
+ GScanner *scanner);
static void clearlooks_rc_style_merge (GtkRcStyle *dest,
- GtkRcStyle *src);
-
-
-static GtkRcStyleClass *clearlooks_parent_rc_class;
-
-GType clearlooks_type_rc_style = 0;
+ GtkRcStyle *src);
enum
{
- TOKEN_SCROLLBARCOLOR = G_TOKEN_LAST + 1,
+ TOKEN_FOCUSCOLOR = G_TOKEN_LAST + 1,
+ TOKEN_SCROLLBARCOLOR,
TOKEN_COLORIZESCROLLBAR,
TOKEN_CONTRAST,
TOKEN_SUNKENMENU,
TOKEN_PROGRESSBARSTYLE,
+ TOKEN_RELIEFSTYLE,
TOKEN_MENUBARSTYLE,
TOKEN_TOOLBARSTYLE,
TOKEN_MENUITEMSTYLE,
@@ -58,6 +57,7 @@ enum
TOKEN_ANIMATION,
TOKEN_STYLE,
TOKEN_RADIUS,
+ TOKEN_HINT,
TOKEN_CLASSIC,
TOKEN_GLOSSY,
@@ -65,60 +65,42 @@ enum
TOKEN_GUMMY,
TOKEN_TRUE,
- TOKEN_FALSE
-};
+ TOKEN_FALSE,
-static struct
-{
- const gchar *name;
- guint token;
-}
-clearlooks_gtk2_rc_symbols[] =
-{
- { "scrollbar_color", TOKEN_SCROLLBARCOLOR },
- { "colorize_scrollbar", TOKEN_COLORIZESCROLLBAR },
- { "contrast", TOKEN_CONTRAST },
- { "sunkenmenubar", TOKEN_SUNKENMENU },
- { "progressbarstyle", TOKEN_PROGRESSBARSTYLE },
- { "menubarstyle", TOKEN_MENUBARSTYLE },
- { "toolbarstyle", TOKEN_TOOLBARSTYLE },
- { "menuitemstyle", TOKEN_MENUITEMSTYLE },
- { "listviewitemstyle", TOKEN_LISTVIEWITEMSTYLE },
- { "animation", TOKEN_ANIMATION },
- { "style", TOKEN_STYLE },
- { "radius", TOKEN_RADIUS },
-
- { "CLASSIC", TOKEN_CLASSIC },
- { "GLOSSY", TOKEN_GLOSSY },
- { "INVERTED", TOKEN_INVERTED },
- { "GUMMY", TOKEN_GUMMY },
-
- { "TRUE", TOKEN_TRUE },
- { "FALSE", TOKEN_FALSE }
+ TOKEN_LAST
};
+static gchar* clearlooks_rc_symbols =
+ "focus_color\0"
+ "scrollbar_color\0"
+ "colorize_scrollbar\0"
+ "contrast\0"
+ "sunkenmenubar\0"
+ "progressbarstyle\0"
+ "reliefstyle\0"
+ "menubarstyle\0"
+ "toolbarstyle\0"
+ "menuitemstyle\0"
+ "listviewitemstyle\0"
+ "animation\0"
+ "style\0"
+ "radius\0"
+ "hint\0"
+
+ "CLASSIC\0"
+ "GLOSSY\0"
+ "INVERTED\0"
+ "GUMMY\0"
+
+ "TRUE\0"
+ "FALSE\0";
+
+G_DEFINE_DYNAMIC_TYPE (ClearlooksRcStyle, clearlooks_rc_style, GTK_TYPE_RC_STYLE)
void
-clearlooks_rc_style_register_type (GTypeModule *module)
+clearlooks_rc_style_register_types (GTypeModule *module)
{
- static const GTypeInfo object_info =
- {
- sizeof (ClearlooksRcStyleClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) clearlooks_rc_style_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ClearlooksRcStyle),
- 0, /* n_preallocs */
- (GInstanceInitFunc) clearlooks_rc_style_init,
- NULL
- };
-
- clearlooks_type_rc_style = g_type_module_register_type (module,
- GTK_TYPE_RC_STYLE,
- "ClearlooksRcStyle",
- &object_info, 0);
+ clearlooks_rc_style_register_type (module);
}
static void
@@ -129,11 +111,13 @@ clearlooks_rc_style_init (ClearlooksRcStyle *clearlooks_rc)
clearlooks_rc->flags = 0;
clearlooks_rc->contrast = 1.0;
+ clearlooks_rc->reliefstyle = 0;
clearlooks_rc->menubarstyle = 0;
clearlooks_rc->toolbarstyle = 0;
clearlooks_rc->animation = FALSE;
clearlooks_rc->colorize_scrollbar = FALSE;
clearlooks_rc->radius = 3.0;
+ clearlooks_rc->hint = 0;
}
#ifdef HAVE_ANIMATION
@@ -143,8 +127,8 @@ clearlooks_rc_style_finalize (GObject *object)
/* cleanup all the animation stuff */
clearlooks_animation_cleanup ();
- if (G_OBJECT_CLASS (clearlooks_parent_rc_class)->finalize != NULL)
- G_OBJECT_CLASS (clearlooks_parent_rc_class)->finalize(object);
+ if (G_OBJECT_CLASS (clearlooks_rc_style_parent_class)->finalize != NULL)
+ G_OBJECT_CLASS (clearlooks_rc_style_parent_class)->finalize (object);
}
#endif
@@ -157,8 +141,6 @@ clearlooks_rc_style_class_init (ClearlooksRcStyleClass *klass)
GObjectClass *g_object_class = G_OBJECT_CLASS (klass);
#endif
- clearlooks_parent_rc_class = g_type_class_peek_parent (klass);
-
rc_style_class->parse = clearlooks_rc_style_parse;
rc_style_class->create_style = clearlooks_rc_style_create_style;
rc_style_class->merge = clearlooks_rc_style_merge;
@@ -168,10 +150,15 @@ clearlooks_rc_style_class_init (ClearlooksRcStyleClass *klass)
#endif
}
+static void
+clearlooks_rc_style_class_finalize (ClearlooksRcStyleClass *klass)
+{
+}
+
static guint
clearlooks_gtk2_rc_parse_boolean (GtkSettings *settings,
- GScanner *scanner,
- gboolean *retval)
+ GScanner *scanner,
+ gboolean *retval)
{
guint token;
token = g_scanner_get_next_token(scanner);
@@ -193,8 +180,9 @@ clearlooks_gtk2_rc_parse_boolean (GtkSettings *settings,
static guint
clearlooks_gtk2_rc_parse_color(GtkSettings *settings,
- GScanner *scanner,
- GdkColor *color)
+ GScanner *scanner,
+ GtkRcStyle *style,
+ GdkColor *color)
{
guint token;
@@ -205,7 +193,7 @@ clearlooks_gtk2_rc_parse_color(GtkSettings *settings,
if (token != G_TOKEN_EQUAL_SIGN)
return G_TOKEN_EQUAL_SIGN;
- return gtk_rc_parse_color (scanner, color);
+ return gtk_rc_parse_color_full (scanner, style, color);
}
static guint
@@ -233,12 +221,12 @@ clearlooks_gtk2_rc_parse_double (GtkSettings *settings,
static guint
clearlooks_gtk2_rc_parse_int (GtkSettings *settings,
- GScanner *scanner,
- guint8 *progressbarstyle)
+ GScanner *scanner,
+ guint8 *progressbarstyle)
{
guint token;
- /* Skip 'sunkenmenubar' */
+ /* Skip option name */
token = g_scanner_get_next_token(scanner);
token = g_scanner_get_next_token(scanner);
@@ -271,7 +259,7 @@ clearlooks_gtk2_rc_parse_style (GtkSettings *settings,
return G_TOKEN_EQUAL_SIGN;
token = g_scanner_get_next_token (scanner);
-
+
switch (token)
{
case TOKEN_CLASSIC:
@@ -319,16 +307,14 @@ clearlooks_gtk2_rc_parse_dummy (GtkSettings *settings,
static guint
clearlooks_rc_style_parse (GtkRcStyle *rc_style,
- GtkSettings *settings,
- GScanner *scanner)
-
+ GtkSettings *settings,
+ GScanner *scanner)
{
static GQuark scope_id = 0;
ClearlooksRcStyle *clearlooks_style = CLEARLOOKS_RC_STYLE (rc_style);
guint old_scope;
guint token;
- guint i;
/* Set up a new scope in this scanner. */
@@ -344,13 +330,18 @@ clearlooks_rc_style_parse (GtkRcStyle *rc_style,
* (in some previous call to clearlooks_rc_style_parse for the
* same scanner.
*/
+ if (!g_scanner_lookup_symbol(scanner, clearlooks_rc_symbols)) {
+ gchar *current_symbol = clearlooks_rc_symbols;
+ gint i = G_TOKEN_LAST + 1;
- if (!g_scanner_lookup_symbol(scanner, clearlooks_gtk2_rc_symbols[0].name))
- {
- for (i = 0; i < G_N_ELEMENTS (clearlooks_gtk2_rc_symbols); i++)
- g_scanner_scope_add_symbol(scanner, scope_id,
- clearlooks_gtk2_rc_symbols[i].name,
- GINT_TO_POINTER(clearlooks_gtk2_rc_symbols[i].token));
+ /* Add our symbols */
+ while ((current_symbol[0] != '\0') && (i < TOKEN_LAST)) {
+ g_scanner_scope_add_symbol(scanner, scope_id, current_symbol, GINT_TO_POINTER (i));
+
+ current_symbol += strlen(current_symbol) + 1;
+ i++;
+ }
+ g_assert (i == TOKEN_LAST && current_symbol[0] == '\0');
}
/* We're ready to go, now parse the top level */
@@ -360,8 +351,12 @@ clearlooks_rc_style_parse (GtkRcStyle *rc_style,
{
switch (token)
{
+ case TOKEN_FOCUSCOLOR:
+ token = clearlooks_gtk2_rc_parse_color (settings, scanner, rc_style, &clearlooks_style->focus_color);
+ clearlooks_style->flags |= CL_FLAG_FOCUS_COLOR;
+ break;
case TOKEN_SCROLLBARCOLOR:
- token = clearlooks_gtk2_rc_parse_color (settings, scanner, &clearlooks_style->scrollbar_color);
+ token = clearlooks_gtk2_rc_parse_color (settings, scanner, rc_style, &clearlooks_style->scrollbar_color);
clearlooks_style->flags |= CL_FLAG_SCROLLBAR_COLOR;
break;
case TOKEN_COLORIZESCROLLBAR:
@@ -372,6 +367,10 @@ clearlooks_rc_style_parse (GtkRcStyle *rc_style,
token = clearlooks_gtk2_rc_parse_double (settings, scanner, &clearlooks_style->contrast);
clearlooks_style->flags |= CL_FLAG_CONTRAST;
break;
+ case TOKEN_RELIEFSTYLE:
+ token = clearlooks_gtk2_rc_parse_int (settings, scanner, &clearlooks_style->reliefstyle);
+ clearlooks_style->flags |= CL_FLAG_RELIEFSTYLE;
+ break;
case TOKEN_MENUBARSTYLE:
token = clearlooks_gtk2_rc_parse_int (settings, scanner, &clearlooks_style->menubarstyle);
clearlooks_style->flags |= CL_FLAG_MENUBARSTYLE;
@@ -392,6 +391,10 @@ clearlooks_rc_style_parse (GtkRcStyle *rc_style,
token = clearlooks_gtk2_rc_parse_double (settings, scanner, &clearlooks_style->radius);
clearlooks_style->flags |= CL_FLAG_RADIUS;
break;
+ case TOKEN_HINT:
+ token = ge_rc_parse_hint (scanner, &clearlooks_style->hint);
+ clearlooks_style->flags |= CL_FLAG_HINT;
+ break;
/* stuff to ignore */
case TOKEN_SUNKENMENU:
@@ -428,12 +431,12 @@ clearlooks_rc_style_parse (GtkRcStyle *rc_style,
static void
clearlooks_rc_style_merge (GtkRcStyle *dest,
- GtkRcStyle *src)
+ GtkRcStyle *src)
{
ClearlooksRcStyle *dest_w, *src_w;
ClearlooksRcFlags flags;
- clearlooks_parent_rc_class->merge (dest, src);
+ GTK_RC_STYLE_CLASS (clearlooks_rc_style_parent_class)->merge (dest, src);
if (!CLEARLOOKS_IS_RC_STYLE (src))
return;
@@ -447,10 +450,14 @@ clearlooks_rc_style_merge (GtkRcStyle *dest,
dest_w->style = src_w->style;
if (flags & CL_FLAG_CONTRAST)
dest_w->contrast = src_w->contrast;
+ if (flags & CL_FLAG_RELIEFSTYLE)
+ dest_w->reliefstyle = src_w->reliefstyle;
if (flags & CL_FLAG_MENUBARSTYLE)
dest_w->menubarstyle = src_w->menubarstyle;
if (flags & CL_FLAG_TOOLBARSTYLE)
dest_w->toolbarstyle = src_w->toolbarstyle;
+ if (flags & CL_FLAG_FOCUS_COLOR)
+ dest_w->focus_color = src_w->focus_color;
if (flags & CL_FLAG_SCROLLBAR_COLOR)
dest_w->scrollbar_color = src_w->scrollbar_color;
if (flags & CL_FLAG_COLORIZE_SCROLLBAR)
@@ -459,6 +466,8 @@ clearlooks_rc_style_merge (GtkRcStyle *dest,
dest_w->animation = src_w->animation;
if (flags & CL_FLAG_RADIUS)
dest_w->radius = src_w->radius;
+ if (flags & CL_FLAG_HINT)
+ dest_w->hint = src_w->hint;
dest_w->flags |= src_w->flags;
}
diff --git a/libs/clearlooks/clearlooks_rc_style.h b/libs/clearlooks/clearlooks_rc_style.h
index a80a846000..e48143bf40 100644
--- a/libs/clearlooks/clearlooks_rc_style.h
+++ b/libs/clearlooks/clearlooks_rc_style.h
@@ -1,5 +1,7 @@
-/* Clearlooks Theme Engine
- * Copyright (C) 2005 Richard Stellingwerff.
+/* Clearlooks theme engine
+ * Copyright (C) 2005 Richard Stellingwerff
+ * Copyright (C) 2007 Benjamin Berg
+ * Copyright (C) 2007 Andrea Cimitan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -25,12 +27,13 @@
#include <gtk/gtkrc.h>
#include "clearlooks_types.h"
+#ifndef CLEARLOOKS_RC_STYLE_H
+#define CLEARLOOKS_RC_STYLE_H
+
typedef struct _ClearlooksRcStyle ClearlooksRcStyle;
typedef struct _ClearlooksRcStyleClass ClearlooksRcStyleClass;
-GE_INTERNAL extern GType clearlooks_type_rc_style;
-
-#define CLEARLOOKS_TYPE_RC_STYLE clearlooks_type_rc_style
+#define CLEARLOOKS_TYPE_RC_STYLE (clearlooks_rc_style_get_type ())
#define CLEARLOOKS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), CLEARLOOKS_TYPE_RC_STYLE, ClearlooksRcStyle))
#define CLEARLOOKS_RC_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLEARLOOKS_TYPE_RC_STYLE, ClearlooksRcStyleClass))
#define CLEARLOOKS_IS_RC_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), CLEARLOOKS_TYPE_RC_STYLE))
@@ -40,15 +43,19 @@ GE_INTERNAL extern GType clearlooks_type_rc_style;
/* XXX: needs fixing! */
typedef enum {
CL_FLAG_STYLE = 1 << 0,
- CL_FLAG_SCROLLBAR_COLOR = 1 << 1,
- CL_FLAG_COLORIZE_SCROLLBAR = 1 << 2,
- CL_FLAG_CONTRAST = 1 << 3,
- CL_FLAG_MENUBARSTYLE = 1 << 4,
- CL_FLAG_TOOLBARSTYLE = 1 << 5,
- CL_FLAG_ANIMATION = 1 << 6,
- CL_FLAG_RADIUS = 1 << 7
+ CL_FLAG_FOCUS_COLOR = 1 << 1,
+ CL_FLAG_SCROLLBAR_COLOR = 1 << 2,
+ CL_FLAG_COLORIZE_SCROLLBAR = 1 << 3,
+ CL_FLAG_CONTRAST = 1 << 4,
+ CL_FLAG_RELIEFSTYLE = 1 << 5,
+ CL_FLAG_MENUBARSTYLE = 1 << 6,
+ CL_FLAG_TOOLBARSTYLE = 1 << 7,
+ CL_FLAG_ANIMATION = 1 << 8,
+ CL_FLAG_RADIUS = 1 << 9,
+ CL_FLAG_HINT = 1 << 10
} ClearlooksRcFlags;
+
struct _ClearlooksRcStyle
{
GtkRcStyle parent_instance;
@@ -57,18 +64,24 @@ struct _ClearlooksRcStyle
ClearlooksStyles style;
+ GdkColor focus_color;
GdkColor scrollbar_color;
gboolean colorize_scrollbar;
double contrast;
+ guint8 reliefstyle;
guint8 menubarstyle;
guint8 toolbarstyle;
gboolean animation;
double radius;
+ GQuark hint;
};
struct _ClearlooksRcStyleClass
{
- GtkRcStyleClass parent_class;
+ GtkRcStyleClass parent_class;
};
-GE_INTERNAL void clearlooks_rc_style_register_type (GTypeModule *module);
+GE_INTERNAL void clearlooks_rc_style_register_types (GTypeModule *module);
+GE_INTERNAL GType clearlooks_rc_style_get_type (void);
+
+#endif /* CLEARLOOKS_RC_STYLE_H */
diff --git a/libs/clearlooks/clearlooks_style.c b/libs/clearlooks/clearlooks_style.c
index 48b6647df3..4a7a75e072 100644
--- a/libs/clearlooks/clearlooks_style.c
+++ b/libs/clearlooks/clearlooks_style.c
@@ -1,6 +1,7 @@
/* Clearlooks theme engine
- * Copyright (C) 2005 Richard Stellingwerff.
- * Copyright (C) 2007 Benjamin Berg <benjamin@sipsolutions.net>.
+ * Copyright (C) 2005 Richard Stellingwerff
+ * Copyright (C) 2007 Benjamin Berg
+ * Copyright (C) 2007 Andrea Cimitan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -33,6 +34,7 @@
/* #define DEBUG 1 */
#define DETAIL(xx) ((detail) && (!strcmp(xx, detail)))
+#define CHECK_HINT(xx) (ge_check_hint ((xx), CLEARLOOKS_RC_STYLE ((style)->rc_style)->hint, widget))
#define DRAW_ARGS GtkStyle *style, \
GdkWindow *window, \
@@ -50,10 +52,9 @@
#include "animation.h"
#endif
-#define STYLE_FUNCTION(function) (clearlooks_style_class->style_functions[CLEARLOOKS_STYLE (style)->style].function)
+#define STYLE_FUNCTION(function) (CLEARLOOKS_STYLE_GET_CLASS (style)->style_functions[CLEARLOOKS_STYLE (style)->style].function)
-static ClearlooksStyleClass *clearlooks_style_class;
-static GtkStyleClass *clearlooks_parent_class;
+G_DEFINE_DYNAMIC_TYPE (ClearlooksStyle, clearlooks_style, GTK_TYPE_STYLE)
static void
clearlooks_set_widget_parameters (const GtkWidget *widget,
@@ -61,25 +62,23 @@ clearlooks_set_widget_parameters (const GtkWidget *widget,
GtkStateType state_type,
WidgetParameters *params)
{
- params->style_functions = &(clearlooks_style_class->style_functions[CLEARLOOKS_STYLE (style)->style]);
-
- params->active = (state_type == GTK_STATE_ACTIVE);
- params->prelight = (state_type == GTK_STATE_PRELIGHT);
- params->disabled = (state_type == GTK_STATE_INSENSITIVE);
- params->state_type = (ClearlooksStateType)state_type;
- params->corners = CR_CORNER_ALL;
- params->ltr = ge_widget_is_ltr ((GtkWidget*)widget);
- params->focus = widget && GTK_WIDGET_HAS_FOCUS (widget);
- params->is_default = widget && GE_WIDGET_HAS_DEFAULT (widget);
- params->enable_glow = FALSE;
- params->radius = CLEARLOOKS_STYLE (style)->radius;
-
- if (!params->active && widget && GE_IS_TOGGLE_BUTTON (widget))
- params->active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
-
- params->xthickness = style->xthickness;
- params->ythickness = style->ythickness;
-
+ params->style_functions = &(CLEARLOOKS_STYLE_GET_CLASS (style)->style_functions[CLEARLOOKS_STYLE (style)->style]);
+ params->style_constants = &(CLEARLOOKS_STYLE_GET_CLASS (style)->style_constants[CLEARLOOKS_STYLE (style)->style]);
+
+ params->active = (state_type == GTK_STATE_ACTIVE);
+ params->prelight = (state_type == GTK_STATE_PRELIGHT);
+ params->disabled = (state_type == GTK_STATE_INSENSITIVE);
+ params->state_type = (ClearlooksStateType)state_type;
+ params->corners = CR_CORNER_ALL;
+ params->ltr = ge_widget_is_ltr ((GtkWidget*)widget);
+ params->focus = widget && GTK_WIDGET_HAS_FOCUS (widget);
+ params->is_default = widget && GE_WIDGET_HAS_DEFAULT (widget);
+ params->enable_shadow = FALSE;
+ params->radius = CLEARLOOKS_STYLE (style)->radius;
+
+ params->xthickness = style->xthickness;
+ params->ythickness = style->ythickness;
+
/* This is used in GtkEntry to fake transparency. The reason to do this
* is that the entry has it's entire background filled with base[STATE].
* This is not a very good solution as it will eg. fail if one changes
@@ -91,7 +90,7 @@ clearlooks_set_widget_parameters (const GtkWidget *widget,
static void
clearlooks_style_draw_flat_box (DRAW_ARGS)
{
- if (detail &&
+ if (detail &&
state_type == GTK_STATE_SELECTED && (
!strncmp ("cell_even", detail, 9) ||
!strncmp ("cell_odd", detail, 8)))
@@ -141,10 +140,10 @@ clearlooks_style_draw_flat_box (DRAW_ARGS)
}
else
{
- clearlooks_parent_class->draw_flat_box (style, window, state_type,
- shadow_type,
- area, widget, detail,
- x, y, width, height);
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_flat_box (style, window, state_type,
+ shadow_type,
+ area, widget, detail,
+ x, y, width, height);
}
}
@@ -158,65 +157,83 @@ clearlooks_style_draw_shadow (DRAW_ARGS)
CHECK_ARGS
SANITIZE_SIZE
- if ((DETAIL ("entry") && !(widget && widget->parent && GE_IS_TREE_VIEW (widget->parent))) ||
- (DETAIL ("frame") && ge_is_in_combo_box (widget)))
+ /* The "frame" thing is a hack because of GtkCombo. */
+ if ((DETAIL ("entry") && !CHECK_HINT (GE_HINT_TREEVIEW)) ||
+ (DETAIL ("frame") && CHECK_HINT (GE_HINT_COMBOBOX_ENTRY)))
{
WidgetParameters params;
-
- clearlooks_set_widget_parameters (widget, style, state_type, &params);
/* Override the entries state type, because we are too lame to handle this via
* the focus ring, and GtkEntry doesn't even set the INSENSITIVE state ... */
if (state_type == GTK_STATE_NORMAL && widget && GE_IS_ENTRY (widget))
- params.state_type = GTK_WIDGET_STATE (widget);
+ state_type = GTK_WIDGET_STATE (widget);
- if (widget && (ge_is_in_combo_box (widget) || GE_IS_SPIN_BUTTON (widget)))
+ clearlooks_set_widget_parameters (widget, style, state_type, &params);
+
+ if (CHECK_HINT (GE_HINT_COMBOBOX_ENTRY) || CHECK_HINT (GE_HINT_SPINBUTTON))
{
width += style->xthickness;
if (!params.ltr)
x -= style->xthickness;
-
+
if (params.ltr)
params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
else
params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
}
+ /* Fill the background as it is initilized to base[NORMAL].
+ * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513471
+ * The fill only happens if no hint has been added by some application
+ * that is faking GTK+ widgets. */
+ if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint"))
+ {
+ cairo_rectangle (cr, 0, 0, width, height);
+ ge_cairo_set_color (cr, &params.parentbg);
+ cairo_fill (cr);
+ }
+
STYLE_FUNCTION (draw_entry) (cr, &clearlooks_style->colors, &params,
- x, y, width, height);
+ x, y, width, height);
}
- else if (DETAIL ("frame") && widget && GE_IS_STATUSBAR (widget->parent))
+ else if (DETAIL ("frame") && CHECK_HINT (GE_HINT_STATUSBAR))
{
WidgetParameters params;
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
gtk_style_apply_default_background (style, window, TRUE, state_type,
area, x, y, width, height);
-
- STYLE_FUNCTION (draw_statusbar) (cr, colors, &params,
- x, y, width, height);
+ if (shadow_type != GTK_SHADOW_NONE)
+ STYLE_FUNCTION (draw_statusbar) (cr, colors, &params,
+ x, y, width, height);
}
- else if (DETAIL ("frame"))
+ else if (DETAIL ("frame") || DETAIL ("calendar"))
{
WidgetParameters params;
FrameParameters frame;
frame.shadow = shadow_type;
- frame.gap_x = -1; /* No gap will be drawn */
+ frame.gap_x = -1; /* No gap will be drawn */
frame.border = &colors->shade[4];
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
params.corners = CR_CORNER_NONE;
-
+
if (widget && !g_str_equal ("XfcePanelWindow", gtk_widget_get_name (gtk_widget_get_toplevel (widget))))
STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
- x, y, width, height);
+ x, y, width, height);
}
else if (DETAIL ("scrolled_window") || DETAIL ("viewport") || detail == NULL)
{
- CairoColor *border = (CairoColor*)&colors->shade[5];
+ CairoColor border;
+
+ if (CLEARLOOKS_STYLE (style)->style == CL_STYLE_CLASSIC)
+ ge_shade_color ((CairoColor*)&colors->bg[0], 0.78, &border);
+ else
+ border = colors->shade[5];
+
cairo_rectangle (cr, x+0.5, y+0.5, width-1, height-1);
- ge_cairo_set_color (cr, border);
+ ge_cairo_set_color (cr, &border);
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
}
@@ -230,18 +247,18 @@ clearlooks_style_draw_shadow (DRAW_ARGS)
frame.border = &colors->shade[5];
clearlooks_set_widget_parameters (widget, style, state_type, &params);
params.corners = CR_CORNER_ALL;
-
+
STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame, x, y, width, height);
}
-
+
cairo_destroy (cr);
}
-static void
+static void
clearlooks_style_draw_box_gap (DRAW_ARGS,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
+ GtkPositionType gap_side,
+ gint gap_x,
+ gint gap_width)
{
ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
ClearlooksColors *colors = &clearlooks_style->colors;
@@ -257,38 +274,30 @@ clearlooks_style_draw_box_gap (DRAW_ARGS,
WidgetParameters params;
FrameParameters frame;
gboolean start, end;
-
+
frame.shadow = shadow_type;
frame.gap_side = gap_side;
frame.gap_x = gap_x;
frame.gap_width = gap_width;
frame.border = &colors->shade[5];
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
clearlooks_get_notebook_tab_position (widget, &start, &end);
params.corners = CR_CORNER_ALL;
- switch (gap_side) {
- case GTK_POS_LEFT:
- if (start)
- params.corners ^= CR_CORNER_TOPLEFT;
- if (end)
- params.corners ^= CR_CORNER_BOTTOMLEFT;
- break;
- case GTK_POS_RIGHT:
- if (start)
- params.corners ^= CR_CORNER_TOPRIGHT;
- if (end)
- params.corners ^= CR_CORNER_BOTTOMRIGHT;
- break;
+ switch (gap_side)
+ {
case GTK_POS_TOP:
- if (ge_widget_is_ltr (widget)) {
+ if (ge_widget_is_ltr (widget))
+ {
if (start)
params.corners ^= CR_CORNER_TOPLEFT;
if (end)
params.corners ^= CR_CORNER_TOPRIGHT;
- } else {
+ }
+ else
+ {
if (start)
params.corners ^= CR_CORNER_TOPRIGHT;
if (end)
@@ -296,37 +305,52 @@ clearlooks_style_draw_box_gap (DRAW_ARGS,
}
break;
case GTK_POS_BOTTOM:
- if (ge_widget_is_ltr (widget)) {
+ if (ge_widget_is_ltr (widget))
+ {
if (start)
params.corners ^= CR_CORNER_BOTTOMLEFT;
if (end)
params.corners ^= CR_CORNER_BOTTOMRIGHT;
- } else {
+ }
+ else
+ {
if (start)
params.corners ^= CR_CORNER_BOTTOMRIGHT;
if (end)
params.corners ^= CR_CORNER_BOTTOMLEFT;
}
break;
+ case GTK_POS_LEFT:
+ if (start)
+ params.corners ^= CR_CORNER_TOPLEFT;
+ if (end)
+ params.corners ^= CR_CORNER_BOTTOMLEFT;
+ break;
+ case GTK_POS_RIGHT:
+ if (start)
+ params.corners ^= CR_CORNER_TOPRIGHT;
+ if (end)
+ params.corners ^= CR_CORNER_BOTTOMRIGHT;
+ break;
}
/* Fill the background with bg[NORMAL] */
ge_cairo_rounded_rectangle (cr, x, y, width, height, params.radius, params.corners);
ge_cairo_set_color (cr, &colors->bg[GTK_STATE_NORMAL]);
cairo_fill (cr);
-
+
STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
- x, y, width, height);
+ x, y, width, height);
}
else
{
- clearlooks_parent_class->draw_box_gap (style, window, state_type, shadow_type,
- area, widget, detail,
- x, y, width, height,
- gap_side, gap_x, gap_width);
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_box_gap (style, window, state_type, shadow_type,
+ area, widget, detail,
+ x, y, width, height,
+ gap_side, gap_x, gap_width);
}
-
- cairo_destroy (cr);
+
+ cairo_destroy (cr);
}
static void
@@ -340,61 +364,69 @@ clearlooks_style_draw_extension (DRAW_ARGS, GtkPositionType gap_side)
SANITIZE_SIZE
cr = ge_gdk_drawable_to_cairo (window, area);
-
+
if (DETAIL ("tab"))
{
WidgetParameters params;
TabParameters tab;
-
+ FocusParameters focus;
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+
tab.gap_side = (ClearlooksGapSide)gap_side;
-
+
switch (gap_side)
{
+ case CL_GAP_TOP:
+ params.corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT;
+ break;
case CL_GAP_BOTTOM:
params.corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
break;
- case CL_GAP_TOP:
- params.corners = CR_CORNER_BOTTOMLEFT | CR_CORNER_BOTTOMRIGHT;
+ case CL_GAP_LEFT:
+ params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
break;
case CL_GAP_RIGHT:
params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
break;
- case CL_GAP_LEFT:
- params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
}
-
+
+ /* Focus color */
+ if (clearlooks_style->has_focus_color)
+ {
+ ge_gdk_color_to_cairo (&clearlooks_style->focus_color, &focus.color);
+ focus.has_color = TRUE;
+ }
+ else
+ focus.color = colors->bg[GTK_STATE_SELECTED];
+
+ tab.focus = focus;
+
STYLE_FUNCTION(draw_tab) (cr, colors, &params, &tab,
- x, y, width, height);
+ x, y, width, height);
}
else
{
- clearlooks_parent_class->draw_extension (style, window, state_type, shadow_type, area,
- widget, detail, x, y, width, height,
- gap_side);
-
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_extension (style, window, state_type, shadow_type, area,
+ widget, detail, x, y, width, height,
+ gap_side);
}
-
+
cairo_destroy (cr);
}
-static void
+static void
clearlooks_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
{
ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
ClearlooksColors *colors = &clearlooks_style->colors;
cairo_t *cr;
- gboolean is_horizontal;
-
+
CHECK_ARGS
SANITIZE_SIZE
-
+
cr = ge_gdk_drawable_to_cairo (window, area);
-
- /* Evil hack to work around broken orientation for toolbars */
- is_horizontal = (width > height);
-
+
if (DETAIL ("handlebox"))
{
WidgetParameters params;
@@ -402,24 +434,10 @@ clearlooks_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
clearlooks_set_widget_parameters (widget, style, state_type, &params);
handle.type = CL_HANDLE_TOOLBAR;
- handle.horizontal = is_horizontal;
-
- /* Is this ever true? -Daniel */
- if (GE_IS_TOOLBAR (widget) && shadow_type != GTK_SHADOW_NONE)
- {
- ToolbarParameters toolbar;
+ handle.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
- clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y);
-
- toolbar.style = clearlooks_style->toolbarstyle;
-
- cairo_save (cr);
- STYLE_FUNCTION(draw_toolbar) (cr, colors, &params, &toolbar, x, y, width, height);
- cairo_restore (cr);
- }
-
STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle,
- x, y, width, height);
+ x, y, width, height);
}
else if (DETAIL ("paned"))
{
@@ -428,10 +446,10 @@ clearlooks_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
clearlooks_set_widget_parameters (widget, style, state_type, &params);
handle.type = CL_HANDLE_SPLITTER;
- handle.horizontal = orientation == GTK_ORIENTATION_HORIZONTAL;
-
+ handle.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
+
STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle,
- x, y, width, height);
+ x, y, width, height);
}
else
{
@@ -440,24 +458,10 @@ clearlooks_style_draw_handle (DRAW_ARGS, GtkOrientation orientation)
clearlooks_set_widget_parameters (widget, style, state_type, &params);
handle.type = CL_HANDLE_TOOLBAR;
- handle.horizontal = is_horizontal;
-
- /* Is this ever true? -Daniel */
- if (GE_IS_TOOLBAR (widget) && shadow_type != GTK_SHADOW_NONE)
- {
- ToolbarParameters toolbar;
+ handle.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
- clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y);
-
- toolbar.style = clearlooks_style->toolbarstyle;
-
- cairo_save (cr);
- STYLE_FUNCTION(draw_toolbar) (cr, colors, &params, &toolbar, x, y, width, height);
- cairo_restore (cr);
- }
-
STYLE_FUNCTION(draw_handle) (cr, colors, &params, &handle,
- x, y, width, height);
+ x, y, width, height);
}
cairo_destroy (cr);
@@ -476,76 +480,77 @@ clearlooks_style_draw_box (DRAW_ARGS)
CHECK_ARGS
SANITIZE_SIZE
- if (DETAIL ("menubar") && !ge_is_panel_widget_item(widget))
+ if (DETAIL ("menubar"))
{
WidgetParameters params;
MenuBarParameters menubar;
-
+ gboolean horizontal;
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
menubar.style = clearlooks_style->menubarstyle;
- STYLE_FUNCTION(draw_menubar) (cr, colors, &params, &menubar,
- x, y, width, height);
+ horizontal = height < 2*width;
+ /* This is not that great. Ideally we would have a nice vertical menubar. */
+ if ((shadow_type != GTK_SHADOW_NONE) && horizontal)
+ STYLE_FUNCTION(draw_menubar) (cr, colors, &params, &menubar,
+ x, y, width, height);
}
- else if (DETAIL ("button") && widget && widget->parent &&
- (GE_IS_TREE_VIEW(widget->parent) ||
- GE_IS_CLIST (widget->parent) ||
- ge_object_is_a (G_OBJECT(widget->parent), "ETree"))) /* ECanvas inside ETree */
+ else if (DETAIL ("button") && CHECK_HINT (GE_HINT_TREEVIEW_HEADER))
{
WidgetParameters params;
ListViewHeaderParameters header;
-
+
gint columns, column_index;
gboolean resizable = TRUE;
-
- /* XXX: This makes unknown treeview header CL_ORDER_MIDDLE, in need for something nicer */
+
+ /* XXX: This makes unknown treeview header "middle", in need for something nicer */
columns = 3;
column_index = 1;
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+
params.corners = CR_CORNER_NONE;
-
+
if (GE_IS_TREE_VIEW (widget->parent))
{
clearlooks_treeview_get_header_index (GTK_TREE_VIEW(widget->parent),
- widget, &column_index, &columns,
- &resizable);
+ widget, &column_index, &columns,
+ &resizable);
}
else if (GE_IS_CLIST (widget->parent))
{
clearlooks_clist_get_header_index (GTK_CLIST(widget->parent),
- widget, &column_index, &columns);
+ widget, &column_index, &columns);
}
-
+
header.resizable = resizable;
-
+
+ header.order = 0;
if (column_index == 0)
- header.order = params.ltr ? CL_ORDER_FIRST : CL_ORDER_LAST;
- else if (column_index == columns-1)
- header.order = params.ltr ? CL_ORDER_LAST : CL_ORDER_FIRST;
- else
- header.order = CL_ORDER_MIDDLE;
-
+ header.order |= params.ltr ? CL_ORDER_FIRST : CL_ORDER_LAST;
+ if (column_index == columns-1)
+ header.order |= params.ltr ? CL_ORDER_LAST : CL_ORDER_FIRST;
+
gtk_style_apply_default_background (style, window, FALSE, state_type, area, x, y, width, height);
-
+
STYLE_FUNCTION(draw_list_view_header) (cr, colors, &params, &header,
- x, y, width, height);
+ x, y, width, height);
}
else if (DETAIL ("button") || DETAIL ("buttondefault"))
{
WidgetParameters params;
ShadowParameters shadow = { CR_CORNER_ALL, CL_SHADOW_NONE } ;
clearlooks_set_widget_parameters (widget, style, state_type, &params);
+ params.active = shadow_type == GTK_SHADOW_IN;
- if (ge_is_in_combo_box(widget))
+ if (CHECK_HINT (GE_HINT_COMBOBOX_ENTRY))
{
if (params.ltr)
params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
else
params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
-
+
shadow.shadow = CL_SHADOW_IN;
if (params.xthickness > 2)
@@ -553,19 +558,15 @@ clearlooks_style_draw_box (DRAW_ARGS)
if (params.ltr)
x--;
width++;
- }
+ }
}
else
{
- params.corners = CR_CORNER_ALL;
- /* if (!(ge_is_combo_box (widget, FALSE))) */
- params.enable_glow = TRUE;
- }
-
- if (GE_IS_TOGGLE_BUTTON (widget) &&
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
- params.active = TRUE;
-
+ params.corners = CR_CORNER_ALL;
+ if (clearlooks_style->reliefstyle != 0)
+ params.enable_shadow = TRUE;
+ }
+
STYLE_FUNCTION(draw_button) (cr, &clearlooks_style->colors, &params,
x, y, width, height);
}
@@ -575,14 +576,14 @@ clearlooks_style_draw_box (DRAW_ARGS)
{
WidgetParameters params;
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+
if (style->xthickness == 3)
{
width++;
if (params.ltr)
x--;
}
-
+
if (DETAIL ("spinbutton_up"))
{
height+=2;
@@ -598,84 +599,139 @@ clearlooks_style_draw_box (DRAW_ARGS)
else
params.corners = CR_CORNER_BOTTOMLEFT;
}
-
+
STYLE_FUNCTION(draw_spinbutton_down) (cr, &clearlooks_style->colors, &params, x, y, width, height);
}
}
else if (DETAIL ("spinbutton"))
{
WidgetParameters params;
-
+
+ /* The "spinbutton" box is always drawn with state NORMAL, even if it is insensitive.
+ * So work around this here. */
+ if (state_type == GTK_STATE_NORMAL && widget && GE_IS_ENTRY (widget))
+ state_type = GTK_WIDGET_STATE (widget);
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+
if (params.ltr)
params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
else
params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
-
+
if (style->xthickness == 3)
{
if (params.ltr)
x--;
width++;
}
-
+
STYLE_FUNCTION(draw_spinbutton) (cr, &clearlooks_style->colors, &params,
- x, y, width, height);
+ x, y, width, height);
}
- else if (detail && g_str_has_prefix (detail, "trough") && GE_IS_SCALE (widget))
+ else if (detail && g_str_has_prefix (detail, "trough") && CHECK_HINT (GE_HINT_SCALE))
{
WidgetParameters params;
SliderParameters slider;
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
params.corners = CR_CORNER_NONE;
-
+
slider.lower = DETAIL ("trough-lower");
slider.fill_level = DETAIL ("trough-fill-level") || DETAIL ("trough-fill-level-full");
- slider.horizontal = (GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL);
-
+ if (CHECK_HINT (GE_HINT_HSCALE))
+ slider.horizontal = TRUE;
+ else if (CHECK_HINT (GE_HINT_VSCALE))
+ slider.horizontal = FALSE;
+ else /* Fallback based on the size... */
+ slider.horizontal = width >= height;
+
STYLE_FUNCTION(draw_scale_trough) (cr, &clearlooks_style->colors,
- &params, &slider,
- x, y, width, height);
+ &params, &slider,
+ x, y, width, height);
}
- else if (DETAIL ("trough") && widget && GE_IS_PROGRESS_BAR (widget))
+ else if (DETAIL ("trough") && CHECK_HINT (GE_HINT_PROGRESSBAR))
{
WidgetParameters params;
-
- clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
- STYLE_FUNCTION(draw_progressbar_trough) (cr, colors, &params,
- x, y, width, height);
+
+ clearlooks_set_widget_parameters (widget, style, state_type, &params);
+
+ /* Fill the background as it is initilized to base[NORMAL].
+ * Relevant GTK+ bug: http://bugzilla.gnome.org/show_bug.cgi?id=513476
+ * The fill only happens if no hint has been added by some application
+ * that is faking GTK+ widgets. */
+ if (!widget || !g_object_get_data(G_OBJECT (widget), "transparent-bg-hint"))
+ {
+ cairo_rectangle (cr, 0, 0, width, height);
+ ge_cairo_set_color (cr, &params.parentbg);
+ cairo_fill (cr);
+ }
+ STYLE_FUNCTION(draw_progressbar_trough) (cr, colors, &params,
+ x, y, width, height);
}
- else if (DETAIL ("trough") && widget && (GE_IS_VSCROLLBAR (widget) || GE_IS_HSCROLLBAR (widget)))
+ else if (DETAIL ("trough") && CHECK_HINT (GE_HINT_SCROLLBAR))
{
WidgetParameters params;
ScrollBarParameters scrollbar;
-
+ gboolean trough_under_steppers = TRUE;
+ ClearlooksStepper steppers;
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
- params.corners = CR_CORNER_NONE;
-
+ params.corners = CR_CORNER_ALL;
+
scrollbar.horizontal = TRUE;
scrollbar.junction = clearlooks_scrollbar_get_junction (widget);
- if (GE_IS_RANGE (widget))
- scrollbar.horizontal = GTK_RANGE (widget)->orientation == GTK_ORIENTATION_HORIZONTAL;
-
- if (scrollbar.horizontal)
- {
- x += 2;
- width -= 4;
- }
- else
+ steppers = clearlooks_scrollbar_visible_steppers (widget);
+
+ if (CHECK_HINT (GE_HINT_HSCROLLBAR))
+ scrollbar.horizontal = TRUE;
+ else if (CHECK_HINT (GE_HINT_VSCROLLBAR))
+ scrollbar.horizontal = FALSE;
+ else /* Fallback based on the size ... */
+ scrollbar.horizontal = width >= height;
+
+ if (widget)
+ gtk_widget_style_get (widget,
+ "trough-under-steppers", &trough_under_steppers,
+ NULL);
+
+ if (trough_under_steppers)
{
- y += 2;
- height -= 4;
+ /* If trough under steppers is set, then we decrease the size
+ * slightly. The size is decreased so that the trough is not
+ * visible underneath the steppers. This is not really needed
+ * as one can use the trough-under-steppers style property,
+ * but it needs to exist for backward compatibility. */
+ if (scrollbar.horizontal)
+ {
+ if (steppers & (CL_STEPPER_A | CL_STEPPER_B))
+ {
+ x += 2;
+ width -= 2;
+ }
+ if (steppers & (CL_STEPPER_C | CL_STEPPER_D))
+ {
+ width -= 2;
+ }
+ }
+ else
+ {
+ if (steppers & (CL_STEPPER_A | CL_STEPPER_B))
+ {
+ y += 2;
+ height -= 2;
+ }
+ if (steppers & (CL_STEPPER_C | CL_STEPPER_D))
+ {
+ height -= 2;
+ }
+ }
}
-
+
STYLE_FUNCTION(draw_scrollbar_trough) (cr, colors, &params, &scrollbar,
- x, y, width, height);
+ x, y, width, height);
}
else if (DETAIL ("bar"))
{
@@ -685,10 +741,10 @@ clearlooks_style_draw_box (DRAW_ARGS)
#ifdef HAVE_ANIMATION
if(clearlooks_style->animation && CL_IS_PROGRESS_BAR (widget))
- {
+ {
gboolean activity_mode = GTK_PROGRESS (widget)->activity_mode;
-
- if (!activity_mode)
+
+ if (!activity_mode)
clearlooks_animation_progressbar_add ((gpointer)widget);
}
@@ -709,7 +765,7 @@ clearlooks_style_draw_box (DRAW_ARGS)
progressbar.value = 0;
progressbar.pulsing = FALSE;
}
-
+
if (!params.ltr)
{
if (progressbar.orientation == GTK_PROGRESS_LEFT_TO_RIGHT)
@@ -753,51 +809,52 @@ clearlooks_style_draw_box (DRAW_ARGS)
tmp.height += 2;
}
}
-
+
cairo_reset_clip (cr);
gdk_cairo_rectangle (cr, &tmp);
cairo_clip (cr);
}
-
+
STYLE_FUNCTION(draw_progressbar_fill) (cr, colors, &params, &progressbar,
- x, y, width, height,
- 10 - (int)(elapsed * 10.0) % 10);
+ x, y, width, height,
+ 10 - (int)(elapsed * 10.0) % 10);
}
else if (DETAIL ("optionmenu"))
{
WidgetParameters params;
OptionMenuParameters optionmenu;
-
+
GtkRequisition indicator_size;
GtkBorder indicator_spacing;
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
- params.enable_glow = TRUE;
+
+ if (clearlooks_style->reliefstyle != 0)
+ params.enable_shadow = TRUE;
ge_option_menu_get_props (widget, &indicator_size, &indicator_spacing);
-
+
if (ge_widget_is_ltr (widget))
optionmenu.linepos = width - (indicator_size.width + indicator_spacing.left + indicator_spacing.right) - 1;
else
optionmenu.linepos = (indicator_size.width + indicator_spacing.left + indicator_spacing.right) + 1;
-
+
STYLE_FUNCTION(draw_optionmenu) (cr, colors, &params, &optionmenu,
- x, y, width, height);
+ x, y, width, height);
}
else if (DETAIL ("menuitem"))
{
WidgetParameters params;
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
- if (widget && GE_IS_MENU_BAR (widget->parent))
+
+ if (CHECK_HINT (GE_HINT_MENUBAR))
{
params.corners = CR_CORNER_TOPLEFT | CR_CORNER_TOPRIGHT;
height += 1;
STYLE_FUNCTION(draw_menubaritem) (cr, colors, &params, x, y, width, height);
}
else
- {
+ {
params.corners = CR_CORNER_ALL;
STYLE_FUNCTION(draw_menuitem) (cr, colors, &params, x, y, width, height);
}
@@ -808,59 +865,70 @@ clearlooks_style_draw_box (DRAW_ARGS)
ScrollBarParameters scrollbar;
ScrollBarStepperParameters stepper;
GdkRectangle this_rectangle;
-
+
this_rectangle.x = x;
this_rectangle.y = y;
this_rectangle.width = width;
this_rectangle.height = height;
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
params.corners = CR_CORNER_NONE;
-
+
scrollbar.has_color = FALSE;
scrollbar.horizontal = TRUE;
scrollbar.junction = clearlooks_scrollbar_get_junction (widget);
- if (clearlooks_style->colorize_scrollbar || clearlooks_style->has_scrollbar_color) {
+ if (clearlooks_style->colorize_scrollbar || clearlooks_style->has_scrollbar_color)
scrollbar.has_color = TRUE;
- }
scrollbar.horizontal = DETAIL ("hscrollbar");
-
+
stepper.stepper = clearlooks_scrollbar_get_stepper (widget, &this_rectangle);
STYLE_FUNCTION(draw_scrollbar_stepper) (cr, colors, &params, &scrollbar, &stepper,
- x, y, width, height);
+ x, y, width, height);
}
else if (DETAIL ("toolbar") || DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin"))
{
WidgetParameters params;
ToolbarParameters toolbar;
+ gboolean horizontal;
clearlooks_set_widget_parameters (widget, style, state_type, &params);
clearlooks_set_toolbar_parameters (&toolbar, widget, window, x, y);
toolbar.style = clearlooks_style->toolbarstyle;
- /* Only draw the shadows on horizontal toolbars */
- if (shadow_type != GTK_SHADOW_NONE && height < 2*width )
+ if ((DETAIL ("handlebox_bin") || DETAIL ("dockitem_bin")) && GE_IS_BIN (widget))
+ {
+ GtkWidget* child = gtk_bin_get_child ((GtkBin*) widget);
+ /* This is to draw the correct shadow on the handlebox.
+ * We need to draw it here, as otherwise the handle will not get the
+ * background. */
+ if (GE_IS_TOOLBAR (child))
+ gtk_widget_style_get (child, "shadow-type", &shadow_type, NULL);
+ }
+
+ horizontal = height < 2*width;
+ /* This is not that great. Ideally we would have a nice vertical toolbar. */
+ if ((shadow_type != GTK_SHADOW_NONE) && horizontal)
STYLE_FUNCTION(draw_toolbar) (cr, colors, &params, &toolbar, x, y, width, height);
}
else if (DETAIL ("trough"))
{
-
+ /* Nothing? Why benjamin? */
}
else if (DETAIL ("menu"))
{
WidgetParameters params;
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+
STYLE_FUNCTION(draw_menu_frame) (cr, colors, &params, x, y, width, height);
}
else if (DETAIL ("hseparator") || DETAIL ("vseparator"))
{
- const gchar *new_detail = detail;
+ gchar *new_detail = (gchar*) detail;
/* Draw a normal separator, we just use this because it gives more control
* over sizing (currently). */
@@ -869,19 +937,21 @@ clearlooks_style_draw_box (DRAW_ARGS)
if (GE_IS_MENU_ITEM (widget))
new_detail = "menuitem";
- if (DETAIL ("hseparator")) {
+ if (DETAIL ("hseparator"))
+ {
gtk_paint_hline (style, window, state_type, area, widget, new_detail,
x, x + width - 1, y + height/2);
- } else
+ }
+ else
gtk_paint_vline (style, window, state_type, area, widget, new_detail,
y, y + height - 1, x + width/2);
}
else
{
- clearlooks_parent_class->draw_box (style, window, state_type, shadow_type, area,
- widget, detail, x, y, width, height);
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_box (style, window, state_type, shadow_type, area,
+ widget, detail, x, y, width, height);
}
-
+
cairo_destroy (cr);
}
@@ -897,24 +967,24 @@ clearlooks_style_draw_slider (DRAW_ARGS, GtkOrientation orientation)
CHECK_ARGS
SANITIZE_SIZE
-
+
if (DETAIL ("hscale") || DETAIL ("vscale"))
{
WidgetParameters params;
SliderParameters slider;
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+
slider.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
slider.lower = FALSE;
slider.fill_level = FALSE;
-
+
if (clearlooks_style->style == CL_STYLE_GLOSSY) /* XXX! */
params.corners = CR_CORNER_ALL;
-
+
STYLE_FUNCTION(draw_slider_button) (cr, &clearlooks_style->colors,
- &params, &slider,
- x, y, width, height);
+ &params, &slider,
+ x, y, width, height);
}
else if (DETAIL ("slider"))
{
@@ -928,7 +998,8 @@ clearlooks_style_draw_slider (DRAW_ARGS, GtkOrientation orientation)
scrollbar.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
scrollbar.junction = clearlooks_scrollbar_get_junction (widget);
- if (clearlooks_style->colorize_scrollbar) {
+ if (clearlooks_style->colorize_scrollbar)
+ {
scrollbar.color = colors->spot[1];
scrollbar.has_color = TRUE;
}
@@ -943,14 +1014,14 @@ clearlooks_style_draw_slider (DRAW_ARGS, GtkOrientation orientation)
if ((clearlooks_style->style == CL_STYLE_GLOSSY || clearlooks_style->style == CL_STYLE_GUMMY)
&& !scrollbar.has_color)
scrollbar.color = colors->bg[0];
-
+
STYLE_FUNCTION(draw_scrollbar_slider) (cr, colors, &params, &scrollbar,
x, y, width, height);
}
else
{
- clearlooks_parent_class->draw_slider (style, window, state_type, shadow_type, area,
- widget, detail, x, y, width, height, orientation);
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_slider (style, window, state_type, shadow_type, area,
+ widget, detail, x, y, width, height, orientation);
}
cairo_destroy (cr);
@@ -964,18 +1035,18 @@ clearlooks_style_draw_option (DRAW_ARGS)
WidgetParameters params;
CheckboxParameters checkbox;
cairo_t *cr;
-
+
CHECK_ARGS
SANITIZE_SIZE
cr = ge_gdk_drawable_to_cairo (window, area);
colors = &clearlooks_style->colors;
-
+
checkbox.shadow_type = shadow_type;
checkbox.in_menu = (widget && GTK_IS_MENU(widget->parent));
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+
STYLE_FUNCTION(draw_radiobutton) (cr, colors, &params, &checkbox, x, y, width, height);
cairo_destroy (cr);
@@ -993,19 +1064,19 @@ clearlooks_style_draw_check (DRAW_ARGS)
SANITIZE_SIZE
cr = ge_gdk_drawable_to_cairo (window, area);
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
-
+
params.corners = CR_CORNER_ALL;
-
+
checkbox.shadow_type = shadow_type;
checkbox.in_cell = DETAIL("cellcheck");
checkbox.in_menu = (widget && widget->parent && GTK_IS_MENU(widget->parent));
STYLE_FUNCTION(draw_checkbox) (cr, &clearlooks_style->colors, &params, &checkbox,
- x, y, width, height);
-
+ x, y, width, height);
+
cairo_destroy (cr);
}
@@ -1035,7 +1106,7 @@ clearlooks_style_draw_vline (GtkStyle *style,
* (and even if, a normal one should be better on menu bars) */
STYLE_FUNCTION(draw_separator) (cr, colors, NULL, &separator,
x, y1, 2, y2-y1+1);
-
+
cairo_destroy (cr);
}
@@ -1060,24 +1131,24 @@ clearlooks_style_draw_hline (GtkStyle *style,
colors = &clearlooks_style->colors;
cr = ge_gdk_drawable_to_cairo (window, area);
-
+
separator.horizontal = TRUE;
-
+
if (!DETAIL ("menuitem"))
STYLE_FUNCTION(draw_separator) (cr, colors, NULL, &separator,
x1, y, x2-x1+1, 2);
else
STYLE_FUNCTION(draw_menu_item_separator) (cr, colors, NULL, &separator,
- x1, y, x2-x1+1, 2);
-
+ x1, y, x2-x1+1, 2);
+
cairo_destroy (cr);
}
-static void
+static void
clearlooks_style_draw_shadow_gap (DRAW_ARGS,
- GtkPositionType gap_side,
- gint gap_x,
- gint gap_width)
+ GtkPositionType gap_side,
+ gint gap_x,
+ gint gap_width)
{
ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
const ClearlooksColors *colors;
@@ -1088,47 +1159,47 @@ clearlooks_style_draw_shadow_gap (DRAW_ARGS,
cr = ge_gdk_drawable_to_cairo (window, area);
colors = &clearlooks_style->colors;
-
+
if (DETAIL ("frame"))
{
WidgetParameters params;
FrameParameters frame;
-
+
frame.shadow = shadow_type;
frame.gap_side = gap_side;
frame.gap_x = gap_x;
frame.gap_width = gap_width;
frame.border = &colors->shade[5];
-
+
clearlooks_set_widget_parameters (widget, style, state_type, &params);
params.corners = CR_CORNER_ALL;
-
+
STYLE_FUNCTION(draw_frame) (cr, colors, &params, &frame,
- x, y, width, height);
+ x, y, width, height);
}
else
{
- clearlooks_parent_class->draw_shadow_gap (style, window, state_type, shadow_type, area,
- widget, detail, x, y, width, height,
- gap_side, gap_x, gap_width);
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_shadow_gap (style, window, state_type, shadow_type, area,
+ widget, detail, x, y, width, height,
+ gap_side, gap_x, gap_width);
}
-
+
cairo_destroy (cr);
}
static void
clearlooks_style_draw_resize_grip (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- GdkWindowEdge edge,
- gint x,
- gint y,
- gint width,
- gint height)
+ GdkWindow *window,
+ GtkStateType state_type,
+ GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ GdkWindowEdge edge,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
ClearlooksColors *colors = &clearlooks_style->colors;
@@ -1145,10 +1216,10 @@ clearlooks_style_draw_resize_grip (GtkStyle *style,
cr = ge_gdk_drawable_to_cairo (window, area);
- clearlooks_set_widget_parameters (widget, style, state_type, &params);
+ clearlooks_set_widget_parameters (widget, style, state_type, &params);
STYLE_FUNCTION(draw_resize_grip) (cr, colors, &params, &grip,
- x, y, width, height);
+ x, y, width, height);
cairo_destroy (cr);
}
@@ -1159,17 +1230,17 @@ clearlooks_style_draw_tab (DRAW_ARGS)
ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
ClearlooksColors *colors = &clearlooks_style->colors;
WidgetParameters params;
- ArrowParameters arrow;
+ ArrowParameters arrow;
cairo_t *cr;
CHECK_ARGS
SANITIZE_SIZE
-
+
cr = ge_gdk_drawable_to_cairo (window, area);
clearlooks_set_widget_parameters (widget, style, state_type, &params);
arrow.type = CL_ARROW_COMBO;
- arrow.direction = CL_DIRECTION_DOWN;
+ arrow.direction = CL_DIRECTION_DOWN;
STYLE_FUNCTION(draw_arrow) (cr, colors, &params, &arrow, x, y, width, height);
@@ -1178,18 +1249,18 @@ clearlooks_style_draw_tab (DRAW_ARGS)
static void
clearlooks_style_draw_arrow (GtkStyle *style,
- GdkWindow *window,
- GtkStateType state_type,
- GtkShadowType shadow,
- GdkRectangle *area,
- GtkWidget *widget,
- const gchar *detail,
- GtkArrowType arrow_type,
- gboolean fill,
- gint x,
- gint y,
- gint width,
- gint height)
+ GdkWindow *window,
+ GtkStateType state_type,
+ GtkShadowType shadow,
+ GdkRectangle *area,
+ GtkWidget *widget,
+ const gchar *detail,
+ GtkArrowType arrow_type,
+ gboolean fill,
+ gint x,
+ gint y,
+ gint width,
+ gint height)
{
ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
ClearlooksColors *colors = &clearlooks_style->colors;
@@ -1200,7 +1271,8 @@ clearlooks_style_draw_arrow (GtkStyle *style,
CHECK_ARGS
SANITIZE_SIZE
- if (arrow_type == GTK_ARROW_NONE) {
+ if (arrow_type == GTK_ARROW_NONE)
+ {
cairo_destroy (cr);
return;
}
@@ -1208,12 +1280,12 @@ clearlooks_style_draw_arrow (GtkStyle *style,
clearlooks_set_widget_parameters (widget, style, state_type, &params);
arrow.type = CL_ARROW_NORMAL;
arrow.direction = (ClearlooksDirection)arrow_type;
-
+
if (ge_is_combo_box (widget, FALSE) && !ge_is_combo_box_entry (widget))
{
arrow.type = CL_ARROW_COMBO;
}
-
+
/* I have no idea why, but the arrow of GtkCombo is larger than in other places.
* Subtracting 3 seems to fix this. */
if (widget && widget->parent && GE_IS_COMBO (widget->parent->parent))
@@ -1224,30 +1296,34 @@ clearlooks_style_draw_arrow (GtkStyle *style,
x += 2;
width -= 3;
}
-
+
STYLE_FUNCTION(draw_arrow) (cr, colors, &params, &arrow, x, y, width, height);
-
+
cairo_destroy (cr);
}
static void
clearlooks_style_init_from_rc (GtkStyle * style,
- GtkRcStyle * rc_style)
+ GtkRcStyle * rc_style)
{
ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
-
- clearlooks_parent_class->init_from_rc (style, rc_style);
-
+
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->init_from_rc (style, rc_style);
+
g_assert ((CLEARLOOKS_RC_STYLE (rc_style)->style >= 0) && (CLEARLOOKS_RC_STYLE (rc_style)->style < CL_NUM_STYLES));
- clearlooks_style->style = CLEARLOOKS_RC_STYLE (rc_style)->style;
-
- clearlooks_style->menubarstyle = CLEARLOOKS_RC_STYLE (rc_style)->menubarstyle;
- clearlooks_style->toolbarstyle = CLEARLOOKS_RC_STYLE (rc_style)->toolbarstyle;
+ clearlooks_style->style = CLEARLOOKS_RC_STYLE (rc_style)->style;
+
+ clearlooks_style->reliefstyle = CLEARLOOKS_RC_STYLE (rc_style)->reliefstyle;
+ clearlooks_style->menubarstyle = CLEARLOOKS_RC_STYLE (rc_style)->menubarstyle;
+ clearlooks_style->toolbarstyle = CLEARLOOKS_RC_STYLE (rc_style)->toolbarstyle;
+ clearlooks_style->has_focus_color = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_FOCUS_COLOR;
clearlooks_style->has_scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->flags & CL_FLAG_SCROLLBAR_COLOR;
- clearlooks_style->colorize_scrollbar = CLEARLOOKS_RC_STYLE (rc_style)->colorize_scrollbar;
- clearlooks_style->animation = CLEARLOOKS_RC_STYLE (rc_style)->animation;
- clearlooks_style->radius = CLAMP (CLEARLOOKS_RC_STYLE (rc_style)->radius, 0.0, 10.0);
+ clearlooks_style->colorize_scrollbar = CLEARLOOKS_RC_STYLE (rc_style)->colorize_scrollbar;
+ clearlooks_style->animation = CLEARLOOKS_RC_STYLE (rc_style)->animation;
+ clearlooks_style->radius = CLAMP (CLEARLOOKS_RC_STYLE (rc_style)->radius, 0.0, 10.0);
+ if (clearlooks_style->has_focus_color)
+ clearlooks_style->focus_color = CLEARLOOKS_RC_STYLE (rc_style)->focus_color;
if (clearlooks_style->has_scrollbar_color)
clearlooks_style->scrollbar_color = CLEARLOOKS_RC_STYLE (rc_style)->scrollbar_color;
}
@@ -1261,25 +1337,37 @@ clearlooks_style_realize (GtkStyle * style)
CairoColor bg_normal;
double contrast;
int i;
-
- clearlooks_parent_class->realize (style);
+
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->realize (style);
contrast = CLEARLOOKS_RC_STYLE (style->rc_style)->contrast;
-
+
/* Lighter to darker */
ge_gdk_color_to_cairo (&style->bg[GTK_STATE_NORMAL], &bg_normal);
for (i = 0; i < 9; i++)
{
- ge_shade_color(&bg_normal, (shades[i]-0.7) * contrast + 0.7, &clearlooks_style->colors.shade[i]);
+ ge_shade_color (&bg_normal, (shades[i] < 1.0) ?
+ (shades[i]/contrast) : (shades[i]*contrast),
+ &clearlooks_style->colors.shade[i]);
}
-
+
ge_gdk_color_to_cairo (&style->bg[GTK_STATE_SELECTED], &spot_color);
-
- ge_shade_color(&spot_color, 1.42, &clearlooks_style->colors.spot[0]);
- ge_shade_color(&spot_color, 1.05, &clearlooks_style->colors.spot[1]);
- ge_shade_color(&spot_color, 0.65, &clearlooks_style->colors.spot[2]);
-
+
+ /* Andrea Cimitan wants something like the following to handle dark themes.
+ * However, these two lines are broken currently, as ge_hsb_from_color expects
+ * a CairoColor and not GdkColor
+ * ge_hsb_from_color (&style->bg[GTK_STATE_SELECTED], &hue_spot, &saturation_spot, &brightness_spot);
+ * ge_hsb_from_color (&style->bg[GTK_STATE_NORMAL], &hue_bg, &saturation_bg, &brightness_bg);
+ */
+
+ /* Here to place some checks for dark themes.
+ * We should use a different shade value for spot[2]. */
+
+ ge_shade_color (&spot_color, 1.25, &clearlooks_style->colors.spot[0]);
+ ge_shade_color (&spot_color, 1.05, &clearlooks_style->colors.spot[1]);
+ ge_shade_color (&spot_color, 0.65, &clearlooks_style->colors.spot[2]);
+
for (i=0; i<5; i++)
{
ge_gdk_color_to_cairo (&style->fg[i], &clearlooks_style->colors.fg[i]);
@@ -1291,90 +1379,170 @@ clearlooks_style_realize (GtkStyle * style)
static void
clearlooks_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state_type,
- GdkRectangle *area, GtkWidget *widget, const gchar *detail,
- gint x, gint y, gint width, gint height)
+ GdkRectangle *area, GtkWidget *widget, const gchar *detail,
+ gint x, gint y, gint width, gint height)
{
+ ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
+ ClearlooksColors *colors = &clearlooks_style->colors;
+ WidgetParameters params;
+ FocusParameters focus;
+ guint8* dash_list;
+
cairo_t *cr;
- gboolean free_dash_list = FALSE;
- gint line_width = 1;
- gint8 *dash_list = (gint8 *)"\1\1";
- if (widget)
- {
- gtk_widget_style_get (widget,
- "focus-line-width", &line_width,
- "focus-line-pattern",
- (gchar *) & dash_list, NULL);
+ CHECK_ARGS
+ SANITIZE_SIZE
- free_dash_list = TRUE;
- }
+ cr = gdk_cairo_create (window);
- if (detail && !strcmp (detail, "add-mode"))
+ clearlooks_set_widget_parameters (widget, style, state_type, &params);
+
+ /* Corners */
+ params.corners = CR_CORNER_ALL;
+ if (CHECK_HINT (GE_HINT_COMBOBOX_ENTRY))
{
- if (free_dash_list)
- g_free (dash_list);
+ if (params.ltr)
+ params.corners = CR_CORNER_TOPRIGHT | CR_CORNER_BOTTOMRIGHT;
+ else
+ params.corners = CR_CORNER_TOPLEFT | CR_CORNER_BOTTOMLEFT;
- dash_list = (gint8 *)"\4\4";
- free_dash_list = FALSE;
+ if (params.xthickness > 2)
+ {
+ if (params.ltr)
+ x--;
+ width++;
+ }
}
- CHECK_ARGS
- SANITIZE_SIZE
-
- cr = gdk_cairo_create (window);
+ focus.has_color = FALSE;
+ focus.interior = FALSE;
+ focus.line_width = 1;
+ focus.padding = 1;
+ dash_list = NULL;
- if (detail && !strcmp (detail, "colorwheel_light"))
- cairo_set_source_rgb (cr, 0., 0., 0.);
- else if (detail && !strcmp (detail, "colorwheel_dark"))
- cairo_set_source_rgb (cr, 1., 1., 1.);
+ if (widget)
+ {
+ gtk_widget_style_get (widget,
+ "focus-line-width", &focus.line_width,
+ "focus-line-pattern", &dash_list,
+ "focus-padding", &focus.padding,
+ "interior-focus", &focus.interior,
+ NULL);
+ }
+ if (dash_list)
+ focus.dash_list = dash_list;
else
- ge_cairo_set_gdk_color_with_alpha (cr, &style->fg[state_type],
- 0.7);
+ focus.dash_list = (guint8*) g_strdup ("\1\1");
- cairo_set_line_width (cr, line_width);
+ /* Focus type */
+ if (DETAIL("button"))
+ {
+ if (CHECK_HINT (GE_HINT_TREEVIEW_HEADER))
+ {
+ focus.type = CL_FOCUS_TREEVIEW_HEADER;
+ }
+ else
+ {
+ GtkReliefStyle relief = GTK_RELIEF_NORMAL;
+ /* Check for the shadow type. */
+ if (widget && GTK_IS_BUTTON (widget))
+ g_object_get (G_OBJECT (widget), "relief", &relief, NULL);
- if (dash_list[0])
+ if (relief == GTK_RELIEF_NORMAL)
+ focus.type = CL_FOCUS_BUTTON;
+ else
+ focus.type = CL_FOCUS_BUTTON_FLAT;
+
+ /* This is a workaround for the bogus focus handling that
+ * clearlooks has currently.
+ * I truely dislike putting it here, but I guess it is better
+ * then having such a visible bug. It should be removed in the
+ * next unstable release cycle. -- Benjamin */
+ if (ge_object_is_a (G_OBJECT (widget), "ButtonWidget"))
+ focus.type = CL_FOCUS_LABEL;
+ }
+ }
+ else if (detail && g_str_has_prefix (detail, "treeview"))
{
- gint n_dashes = strlen ((gchar *)dash_list);
- gdouble *dashes = g_new (gdouble, n_dashes);
- gdouble total_length = 0;
- gdouble dash_offset;
- gint i;
+ /* Focus in a treeview, and that means a lot of different detail strings. */
+ if (g_str_has_prefix (detail, "treeview-drop-indicator"))
+ focus.type = CL_FOCUS_TREEVIEW_DND;
+ else
+ focus.type = CL_FOCUS_TREEVIEW_ROW;
- for (i = 0; i < n_dashes; i++)
+ if (g_str_has_suffix (detail, "left"))
+ {
+ focus.continue_side = CL_CONT_RIGHT;
+ }
+ else if (g_str_has_suffix (detail, "right"))
+ {
+ focus.continue_side = CL_CONT_LEFT;
+ }
+ else if (g_str_has_suffix (detail, "middle"))
{
- dashes[i] = dash_list[i];
- total_length += dash_list[i];
+ focus.continue_side = CL_CONT_LEFT | CL_CONT_RIGHT;
+ }
+ else
+ {
+ /* This may either mean no continuation, or unknown ...
+ * if it is unknown we assume it continues on both sides */
+ gboolean row_ending_details = FALSE;
+
+ /* Try to get the style property. */
+ if (widget)
+ gtk_widget_style_get (widget,
+ "row-ending-details", &row_ending_details,
+ NULL);
+
+ if (row_ending_details)
+ focus.continue_side = CL_CONT_NONE;
+ else
+ focus.continue_side = CL_CONT_LEFT | CL_CONT_RIGHT;
}
- /* The dash offset here aligns the pattern to integer pixels
- * by starting the dash at the right side of the left border
- * Negative dash offsets in cairo don't work
- * (https://bugs.freedesktop.org/show_bug.cgi?id=2729)
- */
- dash_offset = -line_width / 2.;
- while (dash_offset < 0)
- dash_offset += total_length;
-
- cairo_set_dash (cr, dashes, n_dashes, dash_offset);
- g_free (dashes);
+ }
+ else if (detail && g_str_has_prefix (detail, "trough") && CHECK_HINT (GE_HINT_SCALE))
+ {
+ focus.type = CL_FOCUS_SCALE;
+ }
+ else if (DETAIL("tab"))
+ {
+ focus.type = CL_FOCUS_TAB;
+ }
+ else if (detail && g_str_has_prefix (detail, "colorwheel"))
+ {
+ if (DETAIL ("colorwheel_dark"))
+ focus.type = CL_FOCUS_COLOR_WHEEL_DARK;
+ else
+ focus.type = CL_FOCUS_COLOR_WHEEL_LIGHT;
+ }
+ else if (DETAIL("checkbutton") || DETAIL("radiobutton"))
+ {
+ focus.type = CL_FOCUS_LABEL; /* Let's call it "LABEL" :) */
+ }
+ else if (CHECK_HINT (GE_HINT_TREEVIEW))
+ {
+ focus.type = CL_FOCUS_TREEVIEW; /* Treeview without content is focused. */
+ }
+ else
+ {
+ focus.type = CL_FOCUS_UNKNOWN; /* Custom widgets (Beagle) and something unknown */
}
- if (area)
+ /* Focus color */
+ if (clearlooks_style->has_focus_color)
{
- gdk_cairo_rectangle (cr, area);
- cairo_clip (cr);
+ ge_gdk_color_to_cairo (&clearlooks_style->focus_color, &focus.color);
+ focus.has_color = TRUE;
}
+ else
+ focus.color = colors->bg[GTK_STATE_SELECTED];
- cairo_rectangle (cr,
- x + line_width / 2.,
- y + line_width / 2.,
- width - line_width, height - line_width);
- cairo_stroke (cr);
- cairo_destroy (cr);
+ STYLE_FUNCTION(draw_focus) (cr, colors, &params, &focus, x, y, width, height);
+
+ g_free (focus.dash_list);
- if (free_dash_list)
- g_free (dash_list);
+ cairo_destroy (cr);
}
static void
@@ -1382,24 +1550,27 @@ clearlooks_style_copy (GtkStyle * style, GtkStyle * src)
{
ClearlooksStyle * cl_style = CLEARLOOKS_STYLE (style);
ClearlooksStyle * cl_src = CLEARLOOKS_STYLE (src);
-
+
cl_style->colors = cl_src->colors;
+ cl_style->reliefstyle = cl_src->reliefstyle;
cl_style->menubarstyle = cl_src->menubarstyle;
cl_style->toolbarstyle = cl_src->toolbarstyle;
+ cl_style->focus_color = cl_src->focus_color;
+ cl_style->has_focus_color = cl_src->has_focus_color;
cl_style->scrollbar_color = cl_src->scrollbar_color;
cl_style->has_scrollbar_color = cl_src->has_scrollbar_color;
cl_style->colorize_scrollbar = cl_src->colorize_scrollbar;
cl_style->animation = cl_src->animation;
cl_style->radius = cl_src->radius;
cl_style->style = cl_src->style;
-
- clearlooks_parent_class->copy (style, src);
+
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->copy (style, src);
}
static void
clearlooks_style_unrealize (GtkStyle * style)
{
- clearlooks_parent_class->unrealize (style);
+ GTK_STYLE_CLASS (clearlooks_style_parent_class)->unrealize (style);
}
static GdkPixbuf *
@@ -1424,11 +1595,13 @@ set_transparency (const GdkPixbuf *pixbuf, gdouble alpha_percent)
rowstride = gdk_pixbuf_get_rowstride (target);
data = gdk_pixbuf_get_pixels (target);
- for (y = 0; y < height; y++) {
- for (x = 0; x < width; x++) {
+ for (y = 0; y < height; y++)
+ {
+ for (x = 0; x < width; x++)
+ {
/* The "4" is the number of chars per pixel, in this case, RGBA,
the 3 means "skip to the alpha" */
- current = data + (y * rowstride) + (x * 4) + 3;
+ current = data + (y * rowstride) + (x * 4) + 3;
*(current) = (guchar) (*(current) * alpha_percent);
}
}
@@ -1442,23 +1615,26 @@ scale_or_ref (GdkPixbuf *src,
int height)
{
if (width == gdk_pixbuf_get_width (src) &&
- height == gdk_pixbuf_get_height (src)) {
+ height == gdk_pixbuf_get_height (src))
+ {
return g_object_ref (src);
- } else {
+ }
+ else
+ {
return gdk_pixbuf_scale_simple (src,
- width, height,
- GDK_INTERP_BILINEAR);
+ width, height,
+ GDK_INTERP_BILINEAR);
}
}
static void
clearlooks_style_draw_layout (GtkStyle * style,
- GdkWindow * window,
- GtkStateType state_type,
- gboolean use_text,
- GdkRectangle * area,
- GtkWidget * widget,
- const gchar * detail, gint x, gint y, PangoLayout * layout)
+ GdkWindow * window,
+ GtkStateType state_type,
+ gboolean use_text,
+ GdkRectangle * area,
+ GtkWidget * widget,
+ const gchar * detail, gint x, gint y, PangoLayout * layout)
{
GdkGC *gc;
@@ -1470,7 +1646,8 @@ clearlooks_style_draw_layout (GtkStyle * style,
if (area)
gdk_gc_set_clip_rectangle (gc, area);
- if (state_type == GTK_STATE_INSENSITIVE) {
+ if (state_type == GTK_STATE_INSENSITIVE)
+ {
ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
ClearlooksColors *colors = &clearlooks_style->colors;
@@ -1484,7 +1661,7 @@ clearlooks_style_draw_layout (GtkStyle * style,
ge_shade_color (&params.parentbg, 1.2, &temp);
else
ge_shade_color (&colors->bg[widget->state], 1.2, &temp);
-
+
etched.red = (int) (temp.r * 65535);
etched.green = (int) (temp.g * 65535);
etched.blue = (int) (temp.b * 65535);
@@ -1501,12 +1678,12 @@ clearlooks_style_draw_layout (GtkStyle * style,
static GdkPixbuf *
clearlooks_style_draw_render_icon (GtkStyle *style,
- const GtkIconSource *source,
- GtkTextDirection direction,
- GtkStateType state,
- GtkIconSize size,
- GtkWidget *widget,
- const char *detail)
+ const GtkIconSource *source,
+ GtkTextDirection direction,
+ GtkStateType state,
+ GtkIconSize size,
+ GtkWidget *widget,
+ const char *detail)
{
int width = 1;
int height = 1;
@@ -1515,30 +1692,35 @@ clearlooks_style_draw_render_icon (GtkStyle *style,
GdkPixbuf *base_pixbuf;
GdkScreen *screen;
GtkSettings *settings;
-
+
/* Oddly, style can be NULL in this function, because
* GtkIconSet can be used without a style and if so
* it uses this function.
*/
-
+
base_pixbuf = gtk_icon_source_get_pixbuf (source);
-
+
g_return_val_if_fail (base_pixbuf != NULL, NULL);
-
- if (widget && gtk_widget_has_screen (widget)) {
+
+ if (widget && gtk_widget_has_screen (widget))
+ {
screen = gtk_widget_get_screen (widget);
settings = gtk_settings_get_for_screen (screen);
- } else if (style->colormap) {
+ }
+ else if (style->colormap)
+ {
screen = gdk_colormap_get_screen (style->colormap);
settings = gtk_settings_get_for_screen (screen);
- } else {
+ }
+ else
+ {
settings = gtk_settings_get_default ();
GTK_NOTE (MULTIHEAD,
g_warning ("Using the default screen for gtk_default_render_icon()"));
}
-
-
- if (size != (GtkIconSize) -1 && !gtk_icon_size_lookup_for_settings (settings, size, &width, &height)) {
+
+ if (size != (GtkIconSize) -1 && !gtk_icon_size_lookup_for_settings (settings, size, &width, &height))
+ {
g_warning (G_STRLOC ": invalid icon size '%d'", size);
return NULL;
}
@@ -1550,30 +1732,40 @@ clearlooks_style_draw_render_icon (GtkStyle *style,
scaled = scale_or_ref (base_pixbuf, width, height);
else
scaled = g_object_ref (base_pixbuf);
-
+
/* If the state was wildcarded, then generate a state. */
- if (gtk_icon_source_get_state_wildcarded (source)) {
- if (state == GTK_STATE_INSENSITIVE) {
+ if (gtk_icon_source_get_state_wildcarded (source))
+ {
+ if (state == GTK_STATE_INSENSITIVE)
+ {
stated = set_transparency (scaled, 0.3);
- gdk_pixbuf_saturate_and_pixelate (stated, stated,
- 0.1, FALSE);
-
+ gdk_pixbuf_saturate_and_pixelate (stated, stated, 0.1, FALSE);
+
g_object_unref (scaled);
- } else if (state == GTK_STATE_PRELIGHT) {
- stated = gdk_pixbuf_copy (scaled);
-
- gdk_pixbuf_saturate_and_pixelate (scaled, stated,
- 1.2, FALSE);
-
+ }
+ else if (state == GTK_STATE_PRELIGHT)
+ {
+ stated = gdk_pixbuf_copy (scaled);
+
+ gdk_pixbuf_saturate_and_pixelate (scaled, stated, 1.2, FALSE);
+
g_object_unref (scaled);
- } else {
+ }
+ else
+ {
stated = scaled;
}
}
else
stated = scaled;
-
- return stated;
+
+ return stated;
+}
+
+void
+clearlooks_style_register_types (GTypeModule *module)
+{
+ clearlooks_style_register_type (module);
}
static void
@@ -1585,9 +1777,6 @@ static void
clearlooks_style_class_init (ClearlooksStyleClass * klass)
{
GtkStyleClass *style_class = GTK_STYLE_CLASS (klass);
-
- clearlooks_style_class = CLEARLOOKS_STYLE_CLASS (klass);
- clearlooks_parent_class = g_type_class_peek_parent (klass);
style_class->copy = clearlooks_style_copy;
style_class->realize = clearlooks_style_realize;
@@ -1612,36 +1801,26 @@ clearlooks_style_class_init (ClearlooksStyleClass * klass)
style_class->draw_layout = clearlooks_style_draw_layout;
style_class->render_icon = clearlooks_style_draw_render_icon;
- clearlooks_register_style_classic (&clearlooks_style_class->style_functions[CL_STYLE_CLASSIC]);
- clearlooks_style_class->style_functions[CL_STYLE_GLOSSY] = clearlooks_style_class->style_functions[CL_STYLE_CLASSIC];
- clearlooks_register_style_glossy (&clearlooks_style_class->style_functions[CL_STYLE_GLOSSY]);
- clearlooks_style_class->style_functions[CL_STYLE_INVERTED] = clearlooks_style_class->style_functions[CL_STYLE_CLASSIC];
- clearlooks_register_style_inverted (&clearlooks_style_class->style_functions[CL_STYLE_INVERTED]);
- clearlooks_style_class->style_functions[CL_STYLE_GUMMY] = clearlooks_style_class->style_functions[CL_STYLE_CLASSIC];
- clearlooks_register_style_gummy (&clearlooks_style_class->style_functions[CL_STYLE_GUMMY]);
-}
+ clearlooks_register_style_classic (&klass->style_functions[CL_STYLE_CLASSIC],
+ &klass->style_constants[CL_STYLE_CLASSIC]);
-GType clearlooks_type_style = 0;
+ klass->style_functions[CL_STYLE_GLOSSY] = klass->style_functions[CL_STYLE_CLASSIC];
+ klass->style_constants[CL_STYLE_GLOSSY] = klass->style_constants[CL_STYLE_CLASSIC];
+ clearlooks_register_style_glossy (&klass->style_functions[CL_STYLE_GLOSSY],
+ &klass->style_constants[CL_STYLE_GLOSSY]);
-void
-clearlooks_style_register_type (GTypeModule * module)
+ klass->style_functions[CL_STYLE_INVERTED] = klass->style_functions[CL_STYLE_CLASSIC];
+ klass->style_constants[CL_STYLE_INVERTED] = klass->style_constants[CL_STYLE_CLASSIC];
+ clearlooks_register_style_inverted (&klass->style_functions[CL_STYLE_INVERTED],
+ &klass->style_constants[CL_STYLE_INVERTED]);
+
+ klass->style_functions[CL_STYLE_GUMMY] = klass->style_functions[CL_STYLE_CLASSIC];
+ klass->style_constants[CL_STYLE_GUMMY] = klass->style_constants[CL_STYLE_CLASSIC];
+ clearlooks_register_style_gummy (&klass->style_functions[CL_STYLE_GUMMY],
+ &klass->style_constants[CL_STYLE_GUMMY]);
+}
+
+static void
+clearlooks_style_class_finalize (ClearlooksStyleClass *klass)
{
- static const GTypeInfo object_info =
- {
- sizeof (ClearlooksStyleClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) clearlooks_style_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (ClearlooksStyle),
- 0, /* n_preallocs */
- (GInstanceInitFunc) clearlooks_style_init,
- NULL
- };
-
- clearlooks_type_style = g_type_module_register_type (module,
- GTK_TYPE_STYLE,
- "ClearlooksStyle",
- &object_info, 0);
}
diff --git a/libs/clearlooks/clearlooks_style.h b/libs/clearlooks/clearlooks_style.h
index 78f3ca1675..d524df5ddf 100644
--- a/libs/clearlooks/clearlooks_style.h
+++ b/libs/clearlooks/clearlooks_style.h
@@ -1,6 +1,7 @@
-/* Clearlooks Engine
+/* Clearlooks theme engine
* Copyright (C) 2005 Richard Stellingwerff.
- * Copyright (C) 2006 Benjamin Berg
+ * Copyright (C) 2007 Benjamin Berg
+ * Copyright (C) 2007 Andrea Cimitan
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
@@ -21,6 +22,7 @@
* and by Alexander Larsson <alexl@redhat.com>
* Modified by Richard Stellingwerff <remenic@gmail.com>
*/
+
#include <gtk/gtkstyle.h>
#ifndef CLEARLOOKS_STYLE_H
@@ -32,9 +34,7 @@
typedef struct _ClearlooksStyle ClearlooksStyle;
typedef struct _ClearlooksStyleClass ClearlooksStyleClass;
-GE_INTERNAL extern GType clearlooks_type_style;
-
-#define CLEARLOOKS_TYPE_STYLE clearlooks_type_style
+#define CLEARLOOKS_TYPE_STYLE (clearlooks_style_get_type ())
#define CLEARLOOKS_STYLE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), CLEARLOOKS_TYPE_STYLE, ClearlooksStyle))
#define CLEARLOOKS_STYLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CLEARLOOKS_TYPE_STYLE, ClearlooksStyleClass))
#define CLEARLOOKS_IS_STYLE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), CLEARLOOKS_TYPE_STYLE))
@@ -48,9 +48,12 @@ struct _ClearlooksStyle
ClearlooksColors colors;
ClearlooksStyles style;
-
+
+ guint8 reliefstyle;
guint8 menubarstyle;
guint8 toolbarstyle;
+ GdkColor focus_color;
+ gboolean has_focus_color;
GdkColor scrollbar_color;
gboolean colorize_scrollbar;
gboolean has_scrollbar_color;
@@ -63,8 +66,10 @@ struct _ClearlooksStyleClass
GtkStyleClass parent_class;
ClearlooksStyleFunctions style_functions[CL_NUM_STYLES];
+ ClearlooksStyleConstants style_constants[CL_NUM_STYLES];
};
-GE_INTERNAL void clearlooks_style_register_type (GTypeModule *module);
+GE_INTERNAL void clearlooks_style_register_types (GTypeModule *module);
+GE_INTERNAL GType clearlooks_style_get_type (void);
#endif /* CLEARLOOKS_STYLE_H */
diff --git a/libs/clearlooks/clearlooks_theme_main.c b/libs/clearlooks/clearlooks_theme_main.c
index c042fdbac0..b68cfe4119 100644
--- a/libs/clearlooks/clearlooks_theme_main.c
+++ b/libs/clearlooks/clearlooks_theme_main.c
@@ -7,8 +7,8 @@
GE_EXPORT void
theme_init (GTypeModule *module)
{
- clearlooks_rc_style_register_type (module);
- clearlooks_style_register_type (module);
+ clearlooks_rc_style_register_types (module);
+ clearlooks_style_register_types (module);
}
GE_EXPORT void
diff --git a/libs/clearlooks/clearlooks_types.h b/libs/clearlooks/clearlooks_types.h
index 7caf8a3208..5d5757f95a 100644
--- a/libs/clearlooks/clearlooks_types.h
+++ b/libs/clearlooks/clearlooks_types.h
@@ -6,6 +6,7 @@
typedef unsigned char boolean;
typedef unsigned char uint8;
typedef struct _ClearlooksStyleFunctions ClearlooksStyleFunctions;
+typedef struct _ClearlooksStyleConstants ClearlooksStyleConstants;
typedef enum
{
@@ -16,7 +17,6 @@ typedef enum
CL_NUM_STYLES = 4
} ClearlooksStyles;
-
typedef enum
{
CL_STATE_NORMAL,
@@ -43,13 +43,19 @@ typedef enum
typedef enum
{
- CL_ORDER_FIRST,
- CL_ORDER_MIDDLE,
- CL_ORDER_LAST
+ CL_ORDER_FIRST = 1 << 0,
+ CL_ORDER_LAST = 1 << 1,
} ClearlooksOrder;
typedef enum
{
+ CL_CONT_NONE = 0,
+ CL_CONT_LEFT = 1 << 0,
+ CL_CONT_RIGHT = 1 << 1
+} ClearlooksContinue;
+
+typedef enum
+{
CL_ORIENTATION_LEFT_TO_RIGHT,
CL_ORIENTATION_RIGHT_TO_LEFT,
CL_ORIENTATION_BOTTOM_TO_TOP,
@@ -87,6 +93,23 @@ typedef enum
typedef enum
{
+ CL_FOCUS_BUTTON,
+ CL_FOCUS_BUTTON_FLAT,
+ CL_FOCUS_LABEL,
+ CL_FOCUS_TREEVIEW,
+ CL_FOCUS_TREEVIEW_HEADER,
+ CL_FOCUS_TREEVIEW_ROW,
+ CL_FOCUS_TREEVIEW_DND,
+ CL_FOCUS_SCALE,
+ CL_FOCUS_TAB,
+ CL_FOCUS_COLOR_WHEEL_DARK,
+ CL_FOCUS_COLOR_WHEEL_LIGHT,
+ CL_FOCUS_UNKNOWN
+} ClearlooksFocusType;
+
+
+typedef enum
+{
CL_DIRECTION_UP,
CL_DIRECTION_DOWN,
CL_DIRECTION_LEFT,
@@ -138,7 +161,7 @@ typedef struct
boolean focus;
boolean is_default;
boolean ltr;
- boolean enable_glow;
+ boolean enable_shadow;
gfloat radius;
@@ -151,10 +174,23 @@ typedef struct
CairoColor parentbg;
ClearlooksStyleFunctions *style_functions;
+ ClearlooksStyleConstants *style_constants;
} WidgetParameters;
typedef struct
{
+ ClearlooksFocusType type;
+ ClearlooksContinue continue_side;
+ CairoColor color;
+ boolean has_color;
+ gint line_width;
+ gint padding;
+ guint8* dash_list;
+ boolean interior;
+} FocusParameters;
+
+typedef struct
+{
boolean lower;
boolean horizontal;
boolean fill_level;
@@ -184,12 +220,13 @@ typedef struct
typedef struct
{
ClearlooksGapSide gap_side;
+ FocusParameters focus;
} TabParameters;
typedef struct
{
CairoCorners corners;
- ClearlooksShadowType shadow;
+ ClearlooksShadowType shadow;
} ShadowParameters;
typedef struct
@@ -206,7 +243,7 @@ typedef struct
typedef struct
{
CairoColor color;
- ClearlooksJunction junction; /* On which sides the slider junctions */
+ ClearlooksJunction junction; /* On which sides the slider junctions */
boolean horizontal;
boolean has_color;
} ScrollBarParameters;
@@ -219,7 +256,7 @@ typedef struct
typedef struct
{
- ClearlooksStepper stepper; /* Which stepper to draw */
+ ClearlooksStepper stepper; /* Which stepper to draw */
} ScrollBarStepperParameters;
typedef struct
@@ -251,193 +288,211 @@ typedef struct
boolean topmost;
} ToolbarParameters;
+struct _ClearlooksStyleConstants
+{
+ gdouble topleft_highlight_shade;
+ gdouble topleft_highlight_alpha;
+};
+
struct _ClearlooksStyleFunctions
{
- void (*draw_button) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_top_left_highlight) (cairo_t *cr,
+ const CairoColor *color,
+ const WidgetParameters *params,
+ int x, int y, int width, int height,
+ gdouble radius,
+ CairoCorners corners);
+
+ void (*draw_button) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_scale_trough) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const SliderParameters *slider,
+ void (*draw_scale_trough) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const SliderParameters *slider,
int x, int y, int width, int height);
- void (*draw_progressbar_trough) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_progressbar_trough) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_progressbar_fill) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_progressbar_fill) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
const ProgressBarParameters *progressbar,
int x, int y, int width, int height, gint offset);
- void (*draw_slider_button) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const SliderParameters *slider,
+ void (*draw_slider_button) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const SliderParameters *slider,
int x, int y, int width, int height);
- void (*draw_entry) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_entry) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_spinbutton) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_spinbutton) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_spinbutton_down) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_spinbutton_down) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_optionmenu) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_optionmenu) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
const OptionMenuParameters *optionmenu,
int x, int y, int width, int height);
-
- void (*draw_inset) (cairo_t *cr,
- const CairoColor *bg_color,
+
+ void (*draw_inset) (cairo_t *cr,
+ const CairoColor *bg_color,
double x, double y, double w, double h,
double radius, uint8 corners);
- void (*draw_menubar) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const MenuBarParameters *menubar,
+ void (*draw_menubar) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const MenuBarParameters *menubar,
int x, int y, int width, int height);
- void (*draw_tab) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const TabParameters *tab,
+ void (*draw_tab) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const TabParameters *tab,
int x, int y, int width, int height);
- void (*draw_frame) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const FrameParameters *frame,
+ void (*draw_frame) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const FrameParameters *frame,
int x, int y, int width, int height);
- void (*draw_separator) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const SeparatorParameters *separator,
+ void (*draw_separator) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const SeparatorParameters *separator,
int x, int y, int width, int height);
- void (*draw_menu_item_separator) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const SeparatorParameters *separator,
+ void (*draw_menu_item_separator) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const SeparatorParameters *separator,
int x, int y, int width, int height);
- void (*draw_list_view_header) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const ListViewHeaderParameters *header,
+ void (*draw_list_view_header) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const ListViewHeaderParameters *header,
int x, int y, int width, int height);
- void (*draw_toolbar) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const ToolbarParameters *toolbar,
+ void (*draw_toolbar) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const ToolbarParameters *toolbar,
int x, int y, int width, int height);
- void (*draw_menuitem) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_menuitem) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_menubaritem) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_menubaritem) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_selected_cell) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_selected_cell) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_scrollbar_stepper) (cairo_t *cr,
+ void (*draw_scrollbar_stepper) (cairo_t *cr,
const ClearlooksColors *colors,
const WidgetParameters *widget,
const ScrollBarParameters *scrollbar,
const ScrollBarStepperParameters *stepper,
int x, int y, int width, int height);
- void (*draw_scrollbar_slider) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_scrollbar_slider) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
const ScrollBarParameters *scrollbar,
int x, int y, int width, int height);
- void (*draw_scrollbar_trough) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_scrollbar_trough) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
const ScrollBarParameters *scrollbar,
int x, int y, int width, int height);
- void (*draw_statusbar) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_statusbar) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_menu_frame) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_menu_frame) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_tooltip) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_tooltip) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
- void (*draw_handle) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const HandleParameters *handle,
+ void (*draw_handle) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const HandleParameters *handle,
int x, int y, int width, int height);
- void (*draw_resize_grip) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_resize_grip) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
const ResizeGripParameters *grip,
int x, int y, int width, int height);
- void (*draw_arrow) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
- const ArrowParameters *arrow,
+ void (*draw_arrow) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const ArrowParameters *arrow,
+ int x, int y, int width, int height);
+
+ void (*draw_focus) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const FocusParameters *focus,
int x, int y, int width, int height);
-
- void (*draw_checkbox) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+
+ void (*draw_checkbox) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
const CheckboxParameters *checkbox,
int x, int y, int width, int height);
- void (*draw_radiobutton) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_radiobutton) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
const CheckboxParameters *checkbox,
int x, int y, int width, int height);
/* Style internal functions */
/* XXX: Only used by slider_button, inline it? */
- void (*draw_shadow) (cairo_t *cr,
- const ClearlooksColors *colors,
- gfloat radius,
- int width, int height);
-
- void (*draw_slider) (cairo_t *cr,
- const ClearlooksColors *colors,
- const WidgetParameters *widget,
+ void (*draw_shadow) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ gfloat radius, int width, int height);
+
+ void (*draw_slider) (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
int x, int y, int width, int height);
void (*draw_gripdots) (cairo_t *cr,
@@ -447,9 +502,9 @@ struct _ClearlooksStyleFunctions
};
-#define CLEARLOOKS_RECTANGLE_SET(rect, _x, _y, _w, _h) rect.x = _x; \
- rect.y = _y; \
- rect.width = _w; \
- rect.height = _h;
+#define CLEARLOOKS_RECTANGLE_SET(rect, _x, _y, _w, _h) (rect).x = (_x); \
+ (rect).y = (_y); \
+ (rect).width = (_w); \
+ (rect).height = (_h);
#endif /* CLEARLOOKS_TYPES_H */
diff --git a/libs/clearlooks/config.h b/libs/clearlooks/config.h
index 4326e37ec1..cfafc0134f 100644
--- a/libs/clearlooks/config.h
+++ b/libs/clearlooks/config.h
@@ -1,9 +1,13 @@
-/* engines/clearlooks/src/config.h. Generated from config.h.in by configure. */
-/* engines/clearlooks/src/config.h.in. Generated from configure.ac by autoheader. */
+/* engines/support/config.h. Generated from config.h.in by configure. */
+/* engines/support/config.h.in. Generated from configure.ac by autoheader. */
/* always defined to indicate that i18n is enabled */
#define ENABLE_NLS 1
+/* Defines whether to enable runtime widget checks as a fallback to hints from
+ the theme. */
+#define ENABLE_WIDGET_CHECKS 1
+
/* Gettext package */
#define GETTEXT_PACKAGE "gtk-engines"
@@ -55,6 +59,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
/* Name of package */
#define PACKAGE "gtk-engines"
@@ -65,16 +72,16 @@
#define PACKAGE_NAME "gtk-engines"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "gtk-engines 2.12.2"
+#define PACKAGE_STRING "gtk-engines 2.16.0"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "gtk-engines"
/* Define to the version of this package. */
-#define PACKAGE_VERSION "2.12.2"
+#define PACKAGE_VERSION "2.16.0"
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Version number of package */
-#define VERSION "2.12.2"
+#define VERSION "2.16.0"
diff --git a/libs/clearlooks/ge-support.h b/libs/clearlooks/ge-support.h
index e0a42b6c3d..bce9ced038 100644
--- a/libs/clearlooks/ge-support.h
+++ b/libs/clearlooks/ge-support.h
@@ -5,5 +5,4 @@
#include "cairo-support.h"
#include "widget-information.h"
-
#endif /* GE_SUPPORT_H */
diff --git a/libs/clearlooks/general-support.h b/libs/clearlooks/general-support.h
index 25999e2d31..4d31946152 100644
--- a/libs/clearlooks/general-support.h
+++ b/libs/clearlooks/general-support.h
@@ -1,3 +1,5 @@
+#ifndef __GENERAL_SUPPORT_H
+#define __GENERAL_SUPPORT_H
#include <gmodule.h>
#include <glib.h>
@@ -37,3 +39,5 @@
# define GE_EXPORT __global
# define GE_INTERNAL __hidden
#endif
+
+#endif /* __GENERAL_SUPPORT_H */
diff --git a/libs/clearlooks/support.c b/libs/clearlooks/support.c
index 6d4d8a286d..ec35ef754b 100644
--- a/libs/clearlooks/support.c
+++ b/libs/clearlooks/support.c
@@ -66,14 +66,34 @@ clearlooks_get_parent_bg (const GtkWidget *widget, CairoColor *color)
GtkStateType state_type;
const GtkWidget *parent;
GdkColor *gcolor;
+ gboolean stop;
if (widget == NULL)
return;
parent = widget->parent;
+ stop = FALSE;
- while (parent && GTK_WIDGET_NO_WINDOW (parent) && !((GTK_IS_NOTEBOOK (parent)) || (GTK_IS_TOOLBAR (parent))))
- parent = parent->parent;
+ while (parent && !stop)
+ {
+ stop = FALSE;
+
+ stop |= !GTK_WIDGET_NO_WINDOW (parent);
+ stop |= GTK_IS_NOTEBOOK (parent) &&
+ gtk_notebook_get_show_tabs (GTK_NOTEBOOK (parent)) &&
+ gtk_notebook_get_show_border (GTK_NOTEBOOK (parent));
+
+ if (GTK_IS_TOOLBAR (parent))
+ {
+ GtkShadowType shadow = GTK_SHADOW_OUT;
+ gtk_widget_style_get (GTK_WIDGET (parent), "shadow-type", &shadow, NULL);
+
+ stop |= (shadow != GTK_SHADOW_NONE);
+ }
+
+ if (!stop)
+ parent = parent->parent;
+ }
if (parent == NULL)
return;
@@ -151,8 +171,10 @@ clearlooks_scrollbar_visible_steppers (GtkWidget *widget)
{
ClearlooksStepper steppers = 0;
+ /* If this is not a range widget, assume that the primary steppers
+ * are present. */
if (!GE_IS_RANGE (widget))
- return 0;
+ return CL_STEPPER_A | CL_STEPPER_D;
if (GTK_RANGE (widget)->has_stepper_a)
steppers |= CL_STEPPER_A;
@@ -183,20 +205,29 @@ clearlooks_scrollbar_get_junction (GtkWidget *widget)
if (adj->value <= adj->lower &&
(GTK_RANGE (widget)->has_stepper_a || GTK_RANGE (widget)->has_stepper_b))
{
- junction |= CL_JUNCTION_BEGIN;
+ if (!gtk_range_get_inverted (GTK_RANGE (widget)))
+ junction |= CL_JUNCTION_BEGIN;
+ else
+ junction |= CL_JUNCTION_END;
}
if (adj->value >= adj->upper - adj->page_size &&
(GTK_RANGE (widget)->has_stepper_c || GTK_RANGE (widget)->has_stepper_d))
{
- junction |= CL_JUNCTION_END;
+ if (!gtk_range_get_inverted (GTK_RANGE (widget)))
+ junction |= CL_JUNCTION_END;
+ else
+ junction |= CL_JUNCTION_BEGIN;
}
return junction;
}
void
-clearlooks_set_toolbar_parameters (ToolbarParameters *toolbar, GtkWidget *widget, GdkWindow *window, gint x, gint y)
+clearlooks_set_toolbar_parameters (ToolbarParameters *toolbar,
+ GtkWidget *widget,
+ GdkWindow *window,
+ gint x, gint y)
{
toolbar->topmost = FALSE;
diff --git a/libs/clearlooks/widget-information.c b/libs/clearlooks/widget-information.c
index cbeb00e291..8972d7a009 100644
--- a/libs/clearlooks/widget-information.c
+++ b/libs/clearlooks/widget-information.c
@@ -2,9 +2,169 @@
#include "general-support.h"
#include "widget-information.h"
+#include "config.h"
#include <math.h>
#include <string.h>
+static gchar ge_widget_hints[] =
+ "treeview\0"
+ "treeview-header\0"
+ "statusbar\0"
+ "comboboxentry\0"
+ "spinbutton\0"
+ "scale\0"
+ "vscale\0"
+ "hscale\0"
+ "scrollbar\0"
+ "vscrollbar\0"
+ "hscrollbar\0"
+ "progressbar\0"
+ "menubar\0";
+
+gboolean
+ge_check_hint (GEHint hint,
+ GQuark style_hint,
+ GtkWidget *widget)
+{
+ static GEHint quark_hint_lookup[GE_HINT_COUNT] = {0};
+
+ g_assert ((hint >= 0) && (hint < GE_HINT_COUNT));
+
+ /* Initilize lookup table */
+ if (G_UNLIKELY (quark_hint_lookup[0] == 0))
+ {
+ guint i = 0;
+ gchar *cur_hint_str = ge_widget_hints;
+ while ((i < GE_HINT_COUNT) && cur_hint_str[0])
+ {
+ /* Can't use _from_static_string as the engine may be unloaded. */
+ quark_hint_lookup[i] = g_quark_from_string (cur_hint_str);
+ cur_hint_str += strlen(cur_hint_str) + 1;
+ i++;
+ }
+ g_assert (i == GE_HINT_COUNT && cur_hint_str[0] == '\0');
+ }
+
+
+ if (quark_hint_lookup[hint] == style_hint)
+ return TRUE;
+
+
+ /* Try to decide based on other hints, eg. hscale is also a scale. */
+ if (hint == GE_HINT_SCALE)
+ if (ge_check_hint (GE_HINT_VSCALE, style_hint, widget) ||
+ ge_check_hint (GE_HINT_HSCALE, style_hint, widget))
+ return TRUE;
+ if (hint == GE_HINT_SCROLLBAR)
+ if (ge_check_hint (GE_HINT_VSCROLLBAR, style_hint, widget) ||
+ ge_check_hint (GE_HINT_HSCROLLBAR, style_hint, widget))
+ return TRUE;
+ if (hint == GE_HINT_TREEVIEW)
+ if (ge_check_hint (GE_HINT_TREEVIEW_HEADER, style_hint, widget))
+ return TRUE;
+
+
+ /* These may be caused by applications so we never want to disable them.
+ * TODO: This does not catch the case where the theme uses appears-as-list
+ * and the application turns it off again. Though this case
+ * is even less likely. */
+ switch (hint) {
+ case GE_HINT_COMBOBOX_ENTRY:
+ if (widget && ge_object_is_a (G_OBJECT (widget), "GtkComboBox"))
+ {
+ gboolean appears_as_list = FALSE;
+
+ gtk_widget_style_get (widget, "appears-as-list", &appears_as_list, NULL);
+
+ if (appears_as_list)
+ return TRUE;
+ }
+ break;
+ default:
+ break;
+ }
+
+
+#ifdef ENABLE_WIDGET_CHECKS
+ /* If a style_hint *was* set, and nothing matched, just give up right away.
+ * A theme shall either support it fully, or not at all. */
+ if (style_hint != 0)
+ return FALSE;
+
+ /* No widget? Just give up. Nothing we can do. */
+ if (widget == NULL)
+ return FALSE;
+
+ /* Try to do something based on the passed in widget pointer. */
+ switch (hint) {
+ case GE_HINT_TREEVIEW:
+ if (widget->parent && (ge_object_is_a (G_OBJECT (widget->parent), "GtkTreeView")))
+ return TRUE;
+ break;
+ case GE_HINT_TREEVIEW_HEADER:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkButton") && widget->parent &&
+ (ge_object_is_a (G_OBJECT (widget->parent), "GtkTreeView") || ge_object_is_a (G_OBJECT (widget->parent), "GtkCList") ||
+ ge_object_is_a (G_OBJECT (widget->parent), "GtkCTree")))
+ return TRUE;
+ if (widget->parent && ge_object_is_a (G_OBJECT (widget->parent), "ETreeView"))
+ return TRUE;
+ break;
+ case GE_HINT_COMBOBOX_ENTRY:
+ if (ge_is_in_combo_box (widget))
+ return TRUE;
+ break;
+ case GE_HINT_SPINBUTTON:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkSpinButton"))
+ return TRUE;
+ break;
+ case GE_HINT_STATUSBAR:
+ if (widget->parent && ge_object_is_a (G_OBJECT (widget), "GtkStatusbar"))
+ return TRUE;
+ break;
+ case GE_HINT_SCALE:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkScale"))
+ return TRUE;
+ break;
+ case GE_HINT_HSCALE:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkHScale"))
+ return TRUE;
+ break;
+ case GE_HINT_VSCALE:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkVScale"))
+ return TRUE;
+ break;
+ case GE_HINT_SCROLLBAR:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkScrollbar"))
+ return TRUE;
+ break;
+ case GE_HINT_HSCROLLBAR:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkHScrollbar"))
+ return TRUE;
+ break;
+ case GE_HINT_VSCROLLBAR:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkVScrollbar"))
+ return TRUE;
+ break;
+ case GE_HINT_PROGRESSBAR:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkProgressBar"))
+ return TRUE;
+ break;
+ case GE_HINT_MENUBAR:
+ if (ge_object_is_a (G_OBJECT (widget), "GtkMenuBar") ||
+ ge_object_is_a (G_OBJECT (widget->parent), "GtkMenuBar"))
+ return TRUE;
+ break;
+
+ default:
+ break;
+ }
+
+#endif
+
+
+ return FALSE;
+}
+
/* Widget Type Lookups/Macros
Based on/modified from functions in
@@ -40,21 +200,14 @@ ge_is_combo_box_entry (GtkWidget * widget)
}
return result;
}
-
+
static gboolean
ge_combo_box_is_using_list (GtkWidget * widget)
{
gboolean result = FALSE;
if (GE_IS_COMBO_BOX (widget))
- {
- gboolean *tmp = NULL;
-
- gtk_widget_style_get (widget, "appears-as-list", &result, NULL);
-
- if (tmp)
- result = *tmp;
- }
+ gtk_widget_style_get (widget, "appears-as-list", &result, NULL);
return result;
}
@@ -242,8 +395,8 @@ ge_find_combo_box_widget_parent (GtkWidget * widget)
***********************************************/
void
ge_option_menu_get_props (GtkWidget * widget,
- GtkRequisition * indicator_size,
- GtkBorder * indicator_spacing)
+ GtkRequisition * indicator_size,
+ GtkBorder * indicator_spacing)
{
GtkRequisition default_size = { 9, 5 };
GtkBorder default_spacing = { 7, 5, 2, 2 };
@@ -293,7 +446,6 @@ ge_button_get_default_border (GtkWidget *widget,
}
}
-
gboolean
ge_widget_is_ltr (GtkWidget *widget)
{
@@ -310,3 +462,26 @@ ge_widget_is_ltr (GtkWidget *widget)
else
return TRUE;
}
+
+guint
+ge_rc_parse_hint (GScanner *scanner,
+ GQuark *quark)
+{
+ guint token;
+
+ /* Skip 'hint' */
+ token = g_scanner_get_next_token(scanner);
+
+ token = g_scanner_get_next_token(scanner);
+ if (token != G_TOKEN_EQUAL_SIGN)
+ return G_TOKEN_EQUAL_SIGN;
+
+ token = g_scanner_get_next_token(scanner);
+ if (token != G_TOKEN_STRING)
+ return G_TOKEN_STRING;
+
+ *quark = g_quark_from_string (scanner->value.v_string);
+
+ return G_TOKEN_NONE;
+}
+
diff --git a/libs/clearlooks/widget-information.h b/libs/clearlooks/widget-information.h
index 55da859d78..7b9b2ab334 100644
--- a/libs/clearlooks/widget-information.h
+++ b/libs/clearlooks/widget-information.h
@@ -1,18 +1,45 @@
+#ifndef WIDGET_INFORMATION_H
+#define WIDGET_INFORMATION_H
+
+#include "general-support.h"
+#include <glib.h>
+#include <gtk/gtkwidget.h>
+
+typedef enum {
+ GE_HINT_TREEVIEW,
+ GE_HINT_TREEVIEW_HEADER,
+ GE_HINT_STATUSBAR,
+ GE_HINT_COMBOBOX_ENTRY,
+ GE_HINT_SPINBUTTON,
+ GE_HINT_SCALE,
+ GE_HINT_VSCALE,
+ GE_HINT_HSCALE,
+ GE_HINT_SCROLLBAR,
+ GE_HINT_VSCROLLBAR,
+ GE_HINT_HSCROLLBAR,
+ GE_HINT_PROGRESSBAR,
+ GE_HINT_MENUBAR,
+ GE_HINT_COUNT
+} GEHint;
+
+/* ALL OF THE FOLLOWING SHOULD DIE ...
+ * instead the hint system will be used, and a huge switch ;-) */
+
/* Object Type Lookups/Macros
Based on/modified from functions in
Smooth-Engine.
*/
-#define GE_IS_WIDGET(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkWidget"))
-#define GE_IS_CONTAINER(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkContainer"))
-#define GE_IS_BIN(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkBin"))
+#define GE_IS_WIDGET(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkWidget"))
+#define GE_IS_CONTAINER(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkContainer"))
+#define GE_IS_BIN(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkBin"))
-#define GE_IS_ARROW(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkArrow"))
+#define GE_IS_ARROW(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkArrow"))
-#define GE_IS_SEPARATOR(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkSeparator"))
-#define GE_IS_VSEPARATOR(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkVSeparator"))
-#define GE_IS_HSEPARATOR(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkHSeparator"))
+#define GE_IS_SEPARATOR(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkSeparator"))
+#define GE_IS_VSEPARATOR(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkVSeparator"))
+#define GE_IS_HSEPARATOR(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkHSeparator"))
#define GE_IS_HANDLE_BOX(object) ((object) && ge_object_is_a ((GObject*)(object), "GtkHandleBox"))
#define GE_IS_HANDLE_BOX_ITEM(object) ((object) && GE_IS_HANDLE_BOX(object->parent))
@@ -73,6 +100,9 @@
#define GE_WIDGET_HAS_DEFAULT(object) ((object) && GE_IS_WIDGET(object) && GTK_WIDGET_HAS_DEFAULT(object))
+
+GE_INTERNAL gboolean ge_check_hint (GEHint hint, GQuark style_hint, GtkWidget *widget);
+
GE_INTERNAL gboolean ge_object_is_a (const GObject * object, const gchar * type_name);
GE_INTERNAL gboolean ge_is_combo_box_entry (GtkWidget * widget);
@@ -97,3 +127,6 @@ GE_INTERNAL void ge_button_get_default_border (GtkWidget *widget,
GE_INTERNAL gboolean ge_widget_is_ltr (GtkWidget *widget);
+GE_INTERNAL guint ge_rc_parse_hint (GScanner *scanner, GQuark *quark);
+
+#endif /* WIDGET_INFORMATION_H */