[murrine] New options focusstyle and default_button_color
- From: Andrea Cimitan <acimitan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [murrine] New options focusstyle and default_button_color
- Date: Wed, 26 May 2010 17:19:52 +0000 (UTC)
commit 505fe4ba748ac276b9fbaf503906abc5df31e965
Author: Andrea Cimitan <andrea cimitan gmail com>
Date: Wed May 26 18:17:38 2010 +0100
New options focusstyle and default_button_color
NEWS | 8 ++-
schema/murrine.xml.in.in | 23 ++++-
src/murrine_draw.c | 265 +++++++++++++++++++++++++++++++++++-----------
src/murrine_draw_rgba.c | 16 +++-
src/murrine_rc_style.c | 31 ++++--
src/murrine_rc_style.h | 63 ++++++-----
src/murrine_style.c | 40 ++++++--
src/murrine_style.h | 4 +-
src/murrine_types.h | 8 ++
9 files changed, 344 insertions(+), 114 deletions(-)
---
diff --git a/NEWS b/NEWS
index 0ad878b..e8300db 100644
--- a/NEWS
+++ b/NEWS
@@ -11,10 +11,16 @@ Changes in this release:
- New option: cellstyle = 0 to remove the border around the selected cell.
cellstyle = 1 for the border around the selected cell (as before).
- New option: comboboxstyle = 1 to colorize the GtkComboBox below the arrow.
-- New option: disable_focus = TRUE to disable focus drawing.
+- New option: default_button_color = "#ffffff" to specify a 2px border for the
+ default button.
+- New option: disable_focus = TRUE
- New option: expanderstyle = 0 to draw arrows.
expanderstyle = 1 to draw circles with plus and minus.
expanderstyle = 2 to draw buttons with plus and minus.
+- New option: focusstyle = 0 to disable focus drawing.
+ focusstyle = 1 to use dots.
+ focusstyle = 2 to use a small colored rectangle.
+ focusstyle = 3 to use a colored rectangle that touches the borders.
- New option: gradient_colors = { "#ffffff", "#ffffff", "#ffffff", "#ffffff" }
to set the colors used on the gradient of many widgets.
gradient_colors = FALSE to disable.
diff --git a/schema/murrine.xml.in.in b/schema/murrine.xml.in.in
index 8f6f428..2d68add 100644
--- a/schema/murrine.xml.in.in
+++ b/schema/murrine.xml.in.in
@@ -64,10 +64,10 @@
<precision>2</precision>
</option>
- <option type="boolean" name="disable_focus" default="FALSE">
- <_long_name>Disable Focus</_long_name>
- <_description>Disable focus drawing</_description>
+ <option type="color" name="default_button_color" default="#000000">
+ <_long_name>Default Button Color</_long_name>
<section>General</section>
+ <_description>Sets the Color of Default button 2px border</_description>
</option>
<option type="enumeration" name="expanderstyle" default="0">
@@ -90,6 +90,23 @@
<_description>Sets the Color of Focus</_description>
</option>
+ <option type="enumeration" name="focusstyle" default="2">
+ <_long_name>Focus Style</_long_name>
+ <section>General</section>
+ <enumeration value="0">
+ <label>No focus</label>
+ </enumeration>
+ <enumeration value="1">
+ <label>Dots</label>
+ </enumeration>
+ <enumeration value="2">
+ <label>Inner rectangle</label>
+ </enumeration>
+ <enumeration value="3">
+ <label>Rectangle from borders</label>
+ </enumeration>
+ </option>
+
<option type="enumeration" name="glazestyle" default="0">
<_long_name>Glaze Style</_long_name>
<section>General</section>
diff --git a/src/murrine_draw.c b/src/murrine_draw.c
index 96b4a0f..20e5e64 100644
--- a/src/murrine_draw.c
+++ b/src/murrine_draw.c
@@ -144,6 +144,7 @@ static void
murrine_draw_button (cairo_t *cr,
const MurrineColors *colors,
const WidgetParameters *widget,
+ const ButtonParameters *button,
int x, int y, int width, int height,
boolean horizontal)
{
@@ -261,6 +262,16 @@ murrine_draw_button (cairo_t *cr,
os+0.5, os+0.5, width-(os*2)-1, height-(os*2)-1,
widget->roundness, widget->corners,
mrn_gradient_new, 1.0);
+
+ if (widget->is_default && !widget->disabled && button->has_default_button_color)
+ {
+ cairo_save (cr);
+ cairo_set_line_width (cr, 2.0);
+ murrine_rounded_rectangle (cr, os, os, width-(os*2), height-(os*2), widget->roundness, widget->corners);
+ murrine_set_color_rgba (cr, &button->default_button_color, 0.4);
+ cairo_stroke (cr);
+ cairo_restore (cr);
+ }
}
static void
@@ -401,9 +412,12 @@ murrine_draw_spinbutton (cairo_t *cr,
int x, int y, int width, int height,
boolean horizontal)
{
+ ButtonParameters button;
+ button.has_default_button_color = FALSE;
+
cairo_save (cr);
-
- widget->style_functions->draw_button (cr, colors, widget, x, y, width, height, horizontal);
+
+ widget->style_functions->draw_button (cr, colors, widget, &button, x, y, width, height, horizontal);
cairo_restore (cr);
@@ -843,12 +857,19 @@ murrine_draw_combobox (cairo_t *cr,
{
default:
case 0:
- widget.style_functions->draw_button (cr, &colors, &widget, x, y, w, h, horizontal);
+ {
+ ButtonParameters button;
+ button.has_default_button_color = FALSE;
+
+ widget.style_functions->draw_button (cr, &colors, &widget, &button, x, y, w, h, horizontal);
break;
+ }
case 1:
{
WidgetParameters params = widget;
MurrineColors colors_new = colors;
+ ButtonParameters button;
+ button.has_default_button_color = FALSE;
int box_w = (widget.xthickness > 2 && widget.ythickness > 2) ? combobox->box_w : combobox->box_w-3;
int os = (widget.xthickness > 2 && widget.ythickness > 2) ? 1 : 0;
colors_new.bg[GTK_STATE_NORMAL] = colors.spot[1];
@@ -857,7 +878,7 @@ murrine_draw_combobox (cairo_t *cr,
if (combobox->as_list)
{
- params.style_functions->draw_button (cr, &colors_new, ¶ms, x, y, w, h, horizontal);
+ params.style_functions->draw_button (cr, &colors_new, ¶ms, &button, x, y, w, h, horizontal);
break;
}
@@ -867,14 +888,14 @@ murrine_draw_combobox (cairo_t *cr,
params.corners = MRN_CORNER_TOPLEFT | MRN_CORNER_BOTTOMLEFT;
cairo_rectangle (cr, x, y, w-box_w, h);
cairo_clip (cr);
- params.style_functions->draw_button (cr, &colors, ¶ms, x, y, w-box_w+1+os, h, horizontal);
+ params.style_functions->draw_button (cr, &colors, ¶ms, &button, x, y, w-box_w+1+os, h, horizontal);
}
else
{
params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
cairo_rectangle (cr, x+box_w, y, w-box_w, h);
cairo_clip (cr);
- params.style_functions->draw_button (cr, &colors, ¶ms, x+box_w-1-os, y, w-box_w+1+os, h, horizontal);
+ params.style_functions->draw_button (cr, &colors, ¶ms, &button, x+box_w-1-os, y, w-box_w+1+os, h, horizontal);
}
cairo_restore (cr);
@@ -887,14 +908,14 @@ murrine_draw_combobox (cairo_t *cr,
params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_BOTTOMRIGHT;
cairo_rectangle (cr, x+w-box_w, y, box_w, h);
cairo_clip (cr);
- params.style_functions->draw_button (cr, &colors_new, ¶ms, x+w-(box_w+os), y, box_w+os, h, horizontal);
+ params.style_functions->draw_button (cr, &colors_new, ¶ms, &button, x+w-(box_w+os), y, box_w+os, h, horizontal);
}
else
{
params.corners = MRN_CORNER_TOPLEFT | MRN_CORNER_BOTTOMLEFT;
cairo_rectangle (cr, x, y, box_w, h);
cairo_clip (cr);
- params.style_functions->draw_button (cr, &colors_new, ¶ms, x, y, box_w+os, h, horizontal);
+ params.style_functions->draw_button (cr, &colors_new, ¶ms, &button, x, y, box_w+os, h, horizontal);
}
cairo_restore (cr);
break;
@@ -909,13 +930,15 @@ murrine_draw_optionmenu (cairo_t *cr,
const OptionMenuParameters *optionmenu,
int x, int y, int width, int height)
{
+ ButtonParameters button;
+ button.has_default_button_color = FALSE;
int offset = widget->ythickness + 1;
boolean horizontal = TRUE;
if (((float)width/height<0.5) || (widget->glazestyle > 0 && width<height))
horizontal = FALSE;
- widget->style_functions->draw_button (cr, colors, widget, x, y, width, height, horizontal);
+ widget->style_functions->draw_button (cr, colors, widget, &button, x, y, width, height, horizontal);
/* Draw the separator */
MurrineRGB *dark = (MurrineRGB*)&colors->shade[6];
@@ -2690,51 +2713,6 @@ murrine_draw_resize_grip (cairo_t *cr,
}
static void
-murrine_draw_classic_focus (cairo_t *cr,
- const MurrineColors *colors,
- const WidgetParameters *widget,
- const FocusParameters *focus,
- int x, int y, int width, int height)
-{
- cairo_set_line_width (cr, focus->line_width);
-
- if (focus->has_color)
- murrine_set_color_rgb (cr, &focus->color);
- else if (focus->type == MRN_FOCUS_COLOR_WHEEL_LIGHT)
- cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
- else if (focus->type == MRN_FOCUS_COLOR_WHEEL_DARK)
- cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
- else
- murrine_set_color_rgba (cr, &colors->fg[widget->state_type], 0.7);
-
- 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);
-}
-
-static void
murrine_draw_expander_arrow (cairo_t *cr,
const MurrineColors *colors,
const WidgetParameters *widget,
@@ -2962,12 +2940,153 @@ murrine_draw_expander (cairo_t *cr,
}
}
-void
-murrine_draw_focus (cairo_t *cr,
- const MurrineColors *colors,
- const WidgetParameters *widget,
- const FocusParameters *focus,
- int x, int y, int width, int height)
+static void
+murrine_draw_focus_classic (cairo_t *cr,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const FocusParameters *focus,
+ int x, int y, int width, int height)
+{
+ cairo_set_line_width (cr, focus->line_width);
+
+ if (focus->has_color)
+ murrine_set_color_rgb (cr, &focus->color);
+ else if (focus->type == MRN_FOCUS_COLOR_WHEEL_LIGHT)
+ cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
+ else if (focus->type == MRN_FOCUS_COLOR_WHEEL_DARK)
+ cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
+ else
+ murrine_set_color_rgba (cr, &colors->fg[widget->state_type], 0.7);
+
+ 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);
+}
+
+static void
+murrine_draw_focus_border (cairo_t *cr,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const FocusParameters *focus,
+ int x, int y, int width, int height)
+{
+ MurrineRGB fill = focus->color;
+
+ /* Default values */
+ int radius = 0;
+ double xoffset = 1.0;
+ double yoffset = 1.0;
+ double border_alpha = 0.72;
+ double fill_alpha = 0.18;
+ boolean focus_fill = TRUE;
+ boolean focus_border = TRUE;
+
+ /* Do some useful things to adjust focus */
+ switch (focus->type)
+ {
+ case MRN_FOCUS_BUTTON:
+ xoffset = -(focus->padding)-2.0;
+ yoffset = -(focus->padding)-2.0;
+ radius = widget->roundness;
+ break;
+ case MRN_FOCUS_BUTTON_FLAT:
+ xoffset = -(focus->padding)-2.0;
+ yoffset = -(focus->padding)-2.0;
+ radius = widget->roundness;
+ break;
+ case MRN_FOCUS_LABEL:
+ xoffset = 0.0;
+ yoffset = 0.0;
+ radius = widget->roundness;
+ break;
+ case MRN_FOCUS_TREEVIEW:
+ xoffset = -1.0;
+ yoffset = -1.0;
+ focus_border = FALSE;
+ break;
+ case MRN_FOCUS_TREEVIEW_DND:
+ radius = widget->roundness;
+ break;
+ case MRN_FOCUS_TREEVIEW_HEADER:
+ cairo_translate (cr, -1, 0);
+ radius = widget->roundness-1;
+ break;
+ case MRN_FOCUS_TREEVIEW_ROW:
+ if (widget->state_type == GTK_STATE_SELECTED)
+ {
+ /* Fallback to classic function, dots */
+ murrine_draw_focus_classic (cr, colors, widget, focus, x, y, width, height);
+ return;
+ }
+ xoffset = 1.0;
+ yoffset = 1.0;
+ radius = widget->roundness;
+ break;
+ case MRN_FOCUS_TAB:
+ xoffset = 0.0;
+ yoffset = 0.0;
+ radius = widget->roundness-1;
+ break;
+ case MRN_FOCUS_SCALE:
+ radius = widget->roundness;
+ break;
+ case MRN_FOCUS_ICONVIEW:
+ break;
+ case MRN_FOCUS_UNKNOWN:
+ /* Fallback to classic function, dots */
+ murrine_draw_focus_classic (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);
+
+ if (focus_fill)
+ {
+ clearlooks_rounded_rectangle (cr, xoffset, yoffset, width-(xoffset*2), height-(yoffset*2), radius, widget->corners);
+ murrine_set_color_rgba (cr, &fill, fill_alpha);
+ cairo_fill (cr);
+ }
+
+ if (focus_border)
+ {
+ clearlooks_rounded_rectangle (cr, xoffset+0.5, yoffset+0.5, width-(xoffset*2)-1, height-(yoffset*2)-1, radius, widget->corners);
+ murrine_set_color_rgba (cr, &fill, border_alpha);
+ cairo_stroke (cr);
+ }
+}
+
+static void
+murrine_draw_focus_inner (cairo_t *cr,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const FocusParameters *focus,
+ int x, int y, int width, int height)
{
MurrineRGB fill = focus->color;
@@ -3014,7 +3133,7 @@ murrine_draw_focus (cairo_t *cr,
if (widget->state_type == GTK_STATE_SELECTED)
{
/* Fallback to classic function, dots */
- murrine_draw_classic_focus (cr, colors, widget, focus, x, y, width, height);
+ murrine_draw_focus_classic (cr, colors, widget, focus, x, y, width, height);
return;
}
xoffset = 1.0;
@@ -3033,7 +3152,7 @@ murrine_draw_focus (cairo_t *cr,
break;
case MRN_FOCUS_UNKNOWN:
/* Fallback to classic function, dots */
- murrine_draw_classic_focus (cr, colors, widget, focus, x, y, width, height);
+ murrine_draw_focus_classic (cr, colors, widget, focus, x, y, width, height);
return;
break;
default:
@@ -3059,6 +3178,28 @@ murrine_draw_focus (cairo_t *cr,
}
void
+murrine_draw_focus (cairo_t *cr,
+ const MurrineColors *colors,
+ const WidgetParameters *widget,
+ const FocusParameters *focus,
+ int x, int y, int width, int height)
+{
+ switch (focus->style)
+ {
+ default:
+ case 1:
+ murrine_draw_focus_classic (cr, colors, widget, focus, x, y, width, height);
+ break;
+ case 2:
+ murrine_draw_focus_inner (cr, colors, widget, focus, x, y, width, height);
+ break;
+ case 3:
+ murrine_draw_focus_border (cr, colors, widget, focus, x, y, width, height);
+ break;
+ }
+}
+
+void
murrine_register_style_murrine (MurrineStyleFunctions *functions)
{
g_assert (functions);
diff --git a/src/murrine_draw_rgba.c b/src/murrine_draw_rgba.c
index ef7a1d7..62597a7 100644
--- a/src/murrine_draw_rgba.c
+++ b/src/murrine_draw_rgba.c
@@ -144,6 +144,7 @@ static void
murrine_rgba_draw_button (cairo_t *cr,
const MurrineColors *colors,
const WidgetParameters *widget,
+ const ButtonParameters *button,
int x, int y, int width, int height,
boolean horizontal)
{
@@ -258,6 +259,16 @@ murrine_rgba_draw_button (cairo_t *cr,
os+0.5, os+0.5, width-(os*2)-1, height-(os*2)-1,
widget->roundness, widget->corners,
mrn_gradient_new, 1.0);
+
+ if (widget->is_default && !widget->disabled && button->has_default_button_color)
+ {
+ cairo_save (cr);
+ cairo_set_line_width (cr, 2.0);
+ murrine_rounded_rectangle (cr, os, os, width-(os*2), height-(os*2), widget->roundness, widget->corners);
+ murrine_set_color_rgba (cr, &button->default_button_color, 0.4);
+ cairo_stroke (cr);
+ cairo_restore (cr);
+ }
}
static void
@@ -436,9 +447,12 @@ murrine_rgba_draw_spinbutton (cairo_t *cr,
int x, int y, int width, int height,
boolean horizontal)
{
+ ButtonParameters button;
+ button.has_default_button_color = FALSE;
+
cairo_save (cr);
- widget->style_functions->draw_button (cr, colors, widget, x, y, width, height, horizontal);
+ widget->style_functions->draw_button (cr, colors, widget, &button, x, y, width, height, horizontal);
cairo_restore (cr);
diff --git a/src/murrine_rc_style.c b/src/murrine_rc_style.c
index fb61f68..a50bdc6 100644
--- a/src/murrine_rc_style.c
+++ b/src/murrine_rc_style.c
@@ -43,9 +43,10 @@ enum
TOKEN_CELLSTYLE,
TOKEN_COMBOBOXSTYLE,
TOKEN_CONTRAST,
- TOKEN_DISABLE_FOCUS,
+ TOKEN_DEFAULT_BUTTON_COLOR,
TOKEN_EXPANDERSTYLE,
TOKEN_FOCUS_COLOR,
+ TOKEN_FOCUSSTYLE,
TOKEN_GLAZESTYLE,
TOKEN_GLOW_SHADE,
TOKEN_GLOWSTYLE,
@@ -106,9 +107,10 @@ theme_symbols[] =
{ "cellstyle", TOKEN_CELLSTYLE },
{ "comboboxstyle", TOKEN_COMBOBOXSTYLE },
{ "contrast", TOKEN_CONTRAST },
- { "disable_focus", TOKEN_DISABLE_FOCUS },
+ { "default_button_color", TOKEN_DEFAULT_BUTTON_COLOR },
{ "expanderstyle", TOKEN_EXPANDERSTYLE },
{ "focus_color", TOKEN_FOCUS_COLOR },
+ { "focusstyle", TOKEN_FOCUSSTYLE },
{ "glazestyle", TOKEN_GLAZESTYLE },
{ "glow_shade", TOKEN_GLOW_SHADE },
{ "glowstyle", TOKEN_GLOWSTYLE },
@@ -175,9 +177,10 @@ murrine_rc_style_init (MurrineRcStyle *murrine_rc)
murrine_rc->colorize_scrollbar = TRUE;
murrine_rc->comboboxstyle = 0;
murrine_rc->contrast = 1.0;
- murrine_rc->disable_focus = FALSE;
murrine_rc->expanderstyle = 0;
+ murrine_rc->focusstyle = 2;
murrine_rc->has_border_colors = FALSE;
+ murrine_rc->has_default_button_color = FALSE;
murrine_rc->has_gradient_colors = FALSE;
murrine_rc->handlestyle = 0;
murrine_rc->glazestyle = 1;
@@ -650,9 +653,9 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
token = theme_parse_shade (settings, scanner, &murrine_style->contrast);
murrine_style->bflags |= MRN_FLAG_CONTRAST;
break;
- case TOKEN_DISABLE_FOCUS:
- token = theme_parse_boolean (settings, scanner, &murrine_style->disable_focus);
- murrine_style->bflags |= MRN_FLAG_DISABLE_FOCUS;
+ case TOKEN_DEFAULT_BUTTON_COLOR:
+ token = theme_parse_color (settings, scanner, rc_style, &murrine_style->default_button_color);
+ murrine_style->flags |= MRN_FLAG_DEFAULT_BUTTON_COLOR;
break;
case TOKEN_EXPANDERSTYLE:
token = theme_parse_int (settings, scanner, &murrine_style->expanderstyle);
@@ -662,6 +665,10 @@ murrine_rc_style_parse (GtkRcStyle *rc_style,
token = theme_parse_color (settings, scanner, rc_style, &murrine_style->focus_color);
murrine_style->flags |= MRN_FLAG_FOCUS_COLOR;
break;
+ case TOKEN_FOCUSSTYLE:
+ token = theme_parse_int (settings, scanner, &murrine_style->focusstyle);
+ murrine_style->flags |= MRN_FLAG_FOCUSSTYLE;
+ break;
case TOKEN_GLAZESTYLE:
token = theme_parse_int (settings, scanner, &murrine_style->glazestyle);
murrine_style->flags |= MRN_FLAG_GLAZESTYLE;
@@ -865,10 +872,20 @@ murrine_rc_style_merge (GtkRcStyle *dest,
dest_w->cellstyle = src_w->cellstyle;
if (flags & MRN_FLAG_COMBOBOXSTYLE)
dest_w->comboboxstyle = src_w->comboboxstyle;
+ if (flags & MRN_FLAG_DEFAULT_BUTTON_COLOR)
+ {
+ dest_w->has_default_button_color = src_w->has_default_button_color;
+ dest_w->default_button_color = src_w->default_button_color;
+ }
if (flags & MRN_FLAG_EXPANDERSTYLE)
dest_w->expanderstyle = src_w->expanderstyle;
if (flags & MRN_FLAG_FOCUS_COLOR)
+ {
+ dest_w->has_focus_color = src_w->has_focus_color;
dest_w->focus_color = src_w->focus_color;
+ }
+ if (flags & MRN_FLAG_FOCUSSTYLE)
+ dest_w->focusstyle = src_w->focusstyle;
if (flags & MRN_FLAG_GLAZESTYLE)
dest_w->glazestyle = src_w->glazestyle;
if (flags & MRN_FLAG_GLOW_SHADE)
@@ -929,8 +946,6 @@ murrine_rc_style_merge (GtkRcStyle *dest,
dest_w->colorize_scrollbar = src_w->colorize_scrollbar;
if (bflags & MRN_FLAG_CONTRAST)
dest_w->contrast = src_w->contrast;
- if (bflags & MRN_FLAG_DISABLE_FOCUS)
- dest_w->disable_focus = src_w->disable_focus;
if (bflags & MRN_FLAG_RGBA)
dest_w->rgba = src_w->rgba;
if (bflags & MRN_FLAG_ROUNDNESS)
diff --git a/src/murrine_rc_style.h b/src/murrine_rc_style.h
index 8517a2a..ff570d2 100644
--- a/src/murrine_rc_style.h
+++ b/src/murrine_rc_style.h
@@ -38,32 +38,34 @@ typedef enum
MRN_FLAG_ARROWSTYLE = 1 << 1,
MRN_FLAG_CELLSTYLE = 1 << 2,
MRN_FLAG_COMBOBOXSTYLE = 1 << 3,
- MRN_FLAG_FOCUS_COLOR = 1 << 4,
- MRN_FLAG_EXPANDERSTYLE = 1 << 5,
- MRN_FLAG_GLAZESTYLE = 1 << 6,
- MRN_FLAG_GLOW_SHADE = 1 << 7,
- MRN_FLAG_GLOWSTYLE = 1 << 8,
- MRN_FLAG_HANDLESTYLE = 1 << 9,
- MRN_FLAG_HIGHLIGHT_SHADE = 1 << 10,
- MRN_FLAG_LIGHTBORDER_SHADE = 1 << 11,
- MRN_FLAG_LIGHTBORDERSTYLE= 1 << 12,
- MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 13,
- MRN_FLAG_LISTVIEWSTYLE = 1 << 14,
- MRN_FLAG_MENUBARITEMSTYLE = 1 << 15,
- MRN_FLAG_MENUBARSTYLE = 1 << 16,
- MRN_FLAG_MENUITEMSTYLE = 1 << 17,
- MRN_FLAG_MENUSTYLE = 1 << 18,
- MRN_FLAG_PRELIGHT_SHADE = 1 << 19,
- MRN_FLAG_PROGRESSBARSTYLE = 1 << 20,
- MRN_FLAG_RELIEFSTYLE = 1 << 21,
- MRN_FLAG_SCROLLBARSTYLE = 1 << 22,
- MRN_FLAG_SEPARATORSTYLE = 1 << 23,
- MRN_FLAG_SLIDERSTYLE = 1 << 24,
- MRN_FLAG_SPINBUTTONSTYLE = 1 << 25,
- MRN_FLAG_STEPPERSTYLE = 1 << 26,
- MRN_FLAG_TEXTSTYLE = 1 << 27,
- MRN_FLAG_TEXT_SHADE = 1 << 28,
- MRN_FLAG_TOOLBARSTYLE = 1 << 29
+ MRN_FLAG_DEFAULT_BUTTON_COLOR = 1 << 4,
+ MRN_FLAG_FOCUS_COLOR = 1 << 5,
+ MRN_FLAG_FOCUSSTYLE = 1 << 6,
+ MRN_FLAG_EXPANDERSTYLE = 1 << 7,
+ MRN_FLAG_GLAZESTYLE = 1 << 8,
+ MRN_FLAG_GLOW_SHADE = 1 << 9,
+ MRN_FLAG_GLOWSTYLE = 1 << 10,
+ MRN_FLAG_HANDLESTYLE = 1 << 11,
+ MRN_FLAG_HIGHLIGHT_SHADE = 1 << 12,
+ MRN_FLAG_LIGHTBORDER_SHADE = 1 << 13,
+ MRN_FLAG_LIGHTBORDERSTYLE= 1 << 14,
+ MRN_FLAG_LISTVIEWHEADERSTYLE = 1 << 15,
+ MRN_FLAG_LISTVIEWSTYLE = 1 << 16,
+ MRN_FLAG_MENUBARITEMSTYLE = 1 << 17,
+ MRN_FLAG_MENUBARSTYLE = 1 << 18,
+ MRN_FLAG_MENUITEMSTYLE = 1 << 19,
+ MRN_FLAG_MENUSTYLE = 1 << 20,
+ MRN_FLAG_PRELIGHT_SHADE = 1 << 21,
+ MRN_FLAG_PROGRESSBARSTYLE = 1 << 22,
+ MRN_FLAG_RELIEFSTYLE = 1 << 23,
+ MRN_FLAG_SCROLLBARSTYLE = 1 << 24,
+ MRN_FLAG_SEPARATORSTYLE = 1 << 25,
+ MRN_FLAG_SLIDERSTYLE = 1 << 26,
+ MRN_FLAG_SPINBUTTONSTYLE = 1 << 27,
+ MRN_FLAG_STEPPERSTYLE = 1 << 28,
+ MRN_FLAG_TEXTSTYLE = 1 << 29,
+ MRN_FLAG_TEXT_SHADE = 1 << 30,
+ MRN_FLAG_TOOLBARSTYLE = 1 << 31
} MurrineRcFlags;
typedef enum
@@ -71,9 +73,8 @@ typedef enum
MRN_FLAG_ANIMATION = 1 << 0,
MRN_FLAG_COLORIZE_SCROLLBAR = 1 << 1,
MRN_FLAG_CONTRAST = 1 << 2,
- MRN_FLAG_DISABLE_FOCUS = 1 << 3,
- MRN_FLAG_RGBA = 1 << 4,
- MRN_FLAG_ROUNDNESS = 1 << 5
+ MRN_FLAG_RGBA = 1 << 3,
+ MRN_FLAG_ROUNDNESS = 1 << 4
} MurrineRcBasicFlags;
typedef enum
@@ -109,6 +110,7 @@ struct _MurrineRcStyle
guint8 cellstyle;
guint8 comboboxstyle;
guint8 expanderstyle;
+ guint8 focusstyle;
guint8 glazestyle;
guint8 glowstyle;
guint8 handlestyle;
@@ -132,13 +134,14 @@ struct _MurrineRcStyle
gboolean animation;
gboolean colorize_scrollbar;
- gboolean disable_focus;
gboolean has_border_colors;
+ gboolean has_default_button_color;
gboolean has_focus_color;
gboolean has_gradient_colors;
gboolean rgba;
GdkColor border_colors[2];
+ GdkColor default_button_color;
GdkColor focus_color;
GdkColor gradient_colors[4];
};
diff --git a/src/murrine_style.c b/src/murrine_style.c
index ba2aa4c..4e4516e 100644
--- a/src/murrine_style.c
+++ b/src/murrine_style.c
@@ -131,7 +131,7 @@ murrine_set_widget_parameters (const GtkWidget *widget,
params->state_type = (MurrineStateType)state_type;
params->corners = MRN_CORNER_ALL;
params->ltr = murrine_widget_is_ltr ((GtkWidget*)widget);
- params->focus = !MURRINE_STYLE (style)->disable_focus && widget && GTK_WIDGET_HAS_FOCUS (widget);
+ params->focus = (MURRINE_STYLE (style)->focusstyle != 0) && widget && GTK_WIDGET_HAS_FOCUS (widget);
params->is_default = widget && GTK_WIDGET_HAS_DEFAULT (widget);
params->xthickness = style->xthickness;
@@ -855,10 +855,22 @@ murrine_style_draw_box (DRAW_ARGS)
else if (DETAIL ("button"))
{
WidgetParameters params;
+ ButtonParameters button;
murrine_set_widget_parameters (widget, style, state_type, ¶ms);
params.active = shadow_type == GTK_SHADOW_IN;
+ /* Default button color */
+ if (murrine_style->has_default_button_color)
+ {
+ murrine_gdk_color_to_rgb (&murrine_style->default_button_color, &button.default_button_color.r,
+ &button.default_button_color.g,
+ &button.default_button_color.b);
+ button.has_default_button_color = TRUE;
+ }
+ else
+ button.has_default_button_color = FALSE;
+
boolean horizontal = TRUE;
if (((float)width/height<0.5) ||
(murrine_style->highlight_shade != 1.0 && murrine_style->glazestyle > 0 && width<height))
@@ -896,7 +908,7 @@ murrine_style_draw_box (DRAW_ARGS)
if (!MRN_IS_COMBO_BOX(widget->parent) ||
MRN_IS_COMBO_BOX_ENTRY (widget->parent) ||
MRN_IS_COMBO (widget->parent))
- STYLE_FUNCTION(draw_button) (cr, &murrine_style->colors, ¶ms, x, y, width, height, horizontal);
+ STYLE_FUNCTION(draw_button) (cr, &murrine_style->colors, ¶ms, &button, x, y, width, height, horizontal);
else
{
ComboBoxParameters combobox;
@@ -1273,9 +1285,12 @@ murrine_style_draw_box (DRAW_ARGS)
{
WidgetParameters params;
/* SliderParameters slider; */
+ ButtonParameters button;
murrine_set_widget_parameters (widget, style, state_type, ¶ms);
+ button.has_default_button_color = FALSE;
+
boolean horizontal = TRUE;
if (DETAIL ("vscale"))
horizontal = FALSE;
@@ -1284,7 +1299,7 @@ murrine_style_draw_box (DRAW_ARGS)
if (params.disabled)
params.reliefstyle = 0;
- STYLE_FUNCTION(draw_button) (cr, &murrine_style->colors, ¶ms, x, y, width, height, horizontal);
+ STYLE_FUNCTION(draw_button) (cr, &murrine_style->colors, ¶ms, &button, x, y, width, height, horizontal);
if (murrine_style->sliderstyle == 1)
{
@@ -1339,6 +1354,9 @@ murrine_style_draw_box (DRAW_ARGS)
if (widget && MRN_IS_MENU_BAR (widget->parent) && murrine_style->menubaritemstyle)
{
+ ButtonParameters button;
+ button.has_default_button_color = FALSE;
+
params.active = FALSE;
params.prelight = TRUE;
params.focus = TRUE;
@@ -1348,7 +1366,7 @@ murrine_style_draw_box (DRAW_ARGS)
params.reliefstyle = 0;
params.corners = MRN_CORNER_TOPRIGHT | MRN_CORNER_TOPLEFT;
- STYLE_FUNCTION(draw_button) (cr, colors, ¶ms, x, y, width, height+1, TRUE);
+ STYLE_FUNCTION(draw_button) (cr, colors, ¶ms, &button, x, y, width, height+1, TRUE);
}
}
else if (DETAIL ("hscrollbar") || DETAIL ("vscrollbar") || DETAIL ("slider") || DETAIL ("stepper"))
@@ -2128,7 +2146,7 @@ murrine_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state
SANITIZE_SIZE
/* Just return if focus drawing is disabled. */
- if (murrine_style->disable_focus)
+ if (murrine_style->focusstyle == 0)
return;
cr = gdk_cairo_create (window);
@@ -2155,6 +2173,7 @@ murrine_style_draw_focus (GtkStyle *style, GdkWindow *window, GtkStateType state
focus.interior = FALSE;
focus.line_width = 1;
focus.padding = 1;
+ focus.style = murrine_style->focusstyle;
dash_list = NULL;
if (widget)
@@ -2336,12 +2355,13 @@ murrine_style_init_from_rc (GtkStyle *style,
murrine_style->comboboxstyle = MURRINE_RC_STYLE (rc_style)->comboboxstyle;
murrine_style->contrast = MURRINE_RC_STYLE (rc_style)->contrast;
murrine_style->colorize_scrollbar = MURRINE_RC_STYLE (rc_style)->colorize_scrollbar;
- murrine_style->disable_focus = MURRINE_RC_STYLE (rc_style)->disable_focus;
murrine_style->expanderstyle = MURRINE_RC_STYLE (rc_style)->expanderstyle;
+ murrine_style->focusstyle = MURRINE_RC_STYLE (rc_style)->focusstyle;
+ murrine_style->glowstyle = MURRINE_RC_STYLE (rc_style)->glowstyle;
murrine_style->has_border_colors = MURRINE_RC_STYLE (rc_style)->has_border_colors;
+ murrine_style->has_default_button_color = MURRINE_RC_STYLE (rc_style)->flags & MRN_FLAG_DEFAULT_BUTTON_COLOR;
murrine_style->has_focus_color = MURRINE_RC_STYLE (rc_style)->flags & MRN_FLAG_FOCUS_COLOR;
murrine_style->has_gradient_colors = MURRINE_RC_STYLE (rc_style)->has_gradient_colors;
- murrine_style->glowstyle = MURRINE_RC_STYLE (rc_style)->glowstyle;
murrine_style->handlestyle = MURRINE_RC_STYLE (rc_style)->handlestyle;
murrine_style->lightborderstyle = MURRINE_RC_STYLE (rc_style)->lightborderstyle;
murrine_style->listviewheaderstyle = MURRINE_RC_STYLE (rc_style)->listviewheaderstyle;
@@ -2368,6 +2388,8 @@ murrine_style_init_from_rc (GtkStyle *style,
murrine_style->border_colors[0] = MURRINE_RC_STYLE (rc_style)->border_colors[0];
murrine_style->border_colors[1] = MURRINE_RC_STYLE (rc_style)->border_colors[1];
}
+ if (murrine_style->has_default_button_color)
+ murrine_style->default_button_color = MURRINE_RC_STYLE (rc_style)->default_button_color;
if (murrine_style->has_focus_color)
murrine_style->focus_color = MURRINE_RC_STYLE (rc_style)->focus_color;
if (murrine_style->has_gradient_colors)
@@ -2471,8 +2493,9 @@ murrine_style_copy (GtkStyle *style, GtkStyle *src)
mrn_style->colors = mrn_src->colors;
mrn_style->comboboxstyle = mrn_src->comboboxstyle;
mrn_style->contrast = mrn_src->contrast;
- mrn_style->disable_focus = mrn_src->disable_focus;
+ mrn_style->default_button_color = mrn_src->default_button_color;
mrn_style->expanderstyle = mrn_src->expanderstyle;
+ mrn_style->focusstyle = mrn_src->focusstyle;
mrn_style->focus_color = mrn_src->focus_color;
mrn_style->glazestyle = mrn_src->glazestyle;
mrn_style->glow_shade = mrn_src->glow_shade;
@@ -2487,6 +2510,7 @@ murrine_style_copy (GtkStyle *style, GtkStyle *src)
mrn_style->gradient_shades[3] = mrn_src->gradient_shades[3];
mrn_style->handlestyle = mrn_src->handlestyle;
mrn_style->has_border_colors = mrn_src->has_border_colors;
+ mrn_style->has_default_button_color = mrn_src->has_default_button_color;
mrn_style->has_focus_color = mrn_src->has_focus_color;
mrn_style->has_gradient_colors = mrn_src->has_gradient_colors;
mrn_style->highlight_shade = mrn_src->highlight_shade;
diff --git a/src/murrine_style.h b/src/murrine_style.h
index 39f118f..1fc0752 100644
--- a/src/murrine_style.h
+++ b/src/murrine_style.h
@@ -57,6 +57,7 @@ struct _MurrineStyle
guint8 cellstyle;
guint8 comboboxstyle;
guint8 expanderstyle;
+ guint8 focusstyle;
guint8 glazestyle;
guint8 glowstyle;
guint8 handlestyle;
@@ -80,13 +81,14 @@ struct _MurrineStyle
gboolean animation;
gboolean colorize_scrollbar;
- gboolean disable_focus;
gboolean has_border_colors;
+ gboolean has_default_button_color;
gboolean has_focus_color;
gboolean has_gradient_colors;
gboolean rgba;
GdkColor border_colors[2];
+ GdkColor default_button_color;
GdkColor focus_color;
GdkColor gradient_colors[4];
};
diff --git a/src/murrine_types.h b/src/murrine_types.h
index 9970c7f..5fcc4ff 100644
--- a/src/murrine_types.h
+++ b/src/murrine_types.h
@@ -206,6 +206,12 @@ typedef struct
typedef struct
{
+ MurrineRGB default_button_color;
+ boolean has_default_button_color;
+} ButtonParameters;
+
+typedef struct
+{
int style;
} CellParameters;
@@ -255,6 +261,7 @@ typedef struct
gint padding;
guint8* dash_list;
boolean interior;
+ int style;
} FocusParameters;
typedef struct
@@ -386,6 +393,7 @@ struct _MurrineStyleFunctions
void (*draw_button) (cairo_t *cr,
const MurrineColors *colors,
const WidgetParameters *widget,
+ const ButtonParameters *button,
int x, int y, int width, int height,
boolean vertical);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]