[gtk-theme-engine-clearlooks/gtk-style-context: 9/21] Implement render_slider().
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-theme-engine-clearlooks/gtk-style-context: 9/21] Implement render_slider().
- Date: Tue, 16 Nov 2010 12:26:38 +0000 (UTC)
commit 039545253f57e87250e2a68cc6a67d3f74d6c2b3
Author: Carlos Garnacho <carlosg gnome org>
Date: Tue Nov 16 00:53:29 2010 +0100
Implement render_slider().
src/clearlooks_engine.c | 91 +++++++++++++++++++++++++++-------------------
1 files changed, 53 insertions(+), 38 deletions(-)
---
diff --git a/src/clearlooks_engine.c b/src/clearlooks_engine.c
index 9a7d50c..94f4e2f 100644
--- a/src/clearlooks_engine.c
+++ b/src/clearlooks_engine.c
@@ -1052,74 +1052,88 @@ clearlooks_style_draw_box (DRAW_ARGS)
widget, detail, x, y, width, height);
}
}
+#endif
static void
-clearlooks_style_draw_slider (DRAW_ARGS, GtkOrientation orientation)
+clearlooks_engine_render_slider (GtkThemingEngine *engine,
+ cairo_t *cr,
+ gdouble x,
+ gdouble y,
+ gdouble width,
+ gdouble height,
+ GtkOrientation orientation)
{
- ClearlooksStyle *clearlooks_style = CLEARLOOKS_STYLE (style);
- const ClearlooksColors *colors;
-
- colors = &clearlooks_style->colors;
-
- CHECK_ARGS
-
- if (DETAIL ("hscale") || DETAIL ("vscale"))
- {
- WidgetParameters params;
- SliderParameters slider;
-
- clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
+ ClearlooksStyleFunctions *style_functions;
- slider.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
- slider.lower = FALSE;
- slider.fill_level = FALSE;
+ GE_CAIRO_INIT
- if (clearlooks_style->style == CL_STYLE_GLOSSY) /* XXX! */
- params.corners = CR_CORNER_ALL;
+ clearlooks_lookup_functions (CLEARLOOKS_ENGINE (engine),
+ &style_functions, NULL);
- STYLE_FUNCTION(draw_slider_button) (cr, &clearlooks_style->colors,
- ¶ms, &slider,
- x, y, width, height);
- }
- else if (DETAIL ("slider"))
+ if (gtk_theming_engine_has_class (engine, GTK_STYLE_CLASS_SLIDER))
{
WidgetParameters params;
ScrollBarParameters scrollbar;
+ gboolean colorize_scrollbar;
+ CairoColor *scrollbar_color;
+ ClearlooksStyle style;
+ GtkStateFlags state;
- clearlooks_set_widget_parameters (widget, style, state_type, ¶ms);
params.corners = CR_CORNER_NONE;
scrollbar.has_color = FALSE;
scrollbar.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
- scrollbar.junction = clearlooks_scrollbar_get_junction (widget);
+ scrollbar.junction = 0; //clearlooks_scrollbar_get_junction (widget);
- if (clearlooks_style->colorize_scrollbar)
+ state = gtk_theming_engine_get_state (engine);
+
+ gtk_theming_engine_get (engine, state,
+ "-clearlooks-colorize-scrollbar", &colorize_scrollbar,
+ "-clearlooks-scrollbar-color", &scrollbar_color,
+ "-clearlooks-style", &style,
+ NULL);
+
+ if (colorize_scrollbar)
{
- scrollbar.color = colors->spot[1];
+ clearlooks_lookup_spot (engine, 1, (GdkRGBA *) &scrollbar.color);
scrollbar.has_color = TRUE;
}
/* Set scrollbar color */
- if (clearlooks_style->has_scrollbar_color)
+ if (colorize_scrollbar)
{
- ge_gdk_color_to_cairo (&clearlooks_style->scrollbar_color, &scrollbar.color);
+ scrollbar.color = *scrollbar_color;
scrollbar.has_color = TRUE;
}
- if ((clearlooks_style->style == CL_STYLE_GLOSSY || clearlooks_style->style == CL_STYLE_GUMMY)
- && !scrollbar.has_color)
- scrollbar.color = colors->bg[0];
+ if ((style == CL_STYLE_GLOSSY || style == CL_STYLE_GUMMY) && !scrollbar.has_color) {
+ CairoColor *bg_color;
- STYLE_FUNCTION(draw_scrollbar_slider) (cr, colors, ¶ms, &scrollbar,
- x, y, width, height);
+ gtk_theming_engine_get (engine, state,
+ "background-color", &bg_color,
+ NULL);
+
+ scrollbar.color = *bg_color;
+ gdk_rgba_free ((GdkRGBA *) bg_color);
+ }
+
+ style_functions->draw_scrollbar_slider (cr, engine, &scrollbar,
+ x, y, width, height);
+
+ gdk_rgba_free ((GdkRGBA *) scrollbar_color);
}
else
{
- GTK_STYLE_CLASS (clearlooks_style_parent_class)->draw_slider (style, cr, state_type, shadow_type,
- widget, detail, x, y, width, height, orientation);
+ SliderParameters slider;
+
+ slider.horizontal = (orientation == GTK_ORIENTATION_HORIZONTAL);
+ slider.lower = FALSE;
+ slider.fill_level = FALSE;
+
+ style_functions->draw_slider_button (cr, engine, &slider,
+ x, y, width, height);
}
}
-#endif
static void
clearlooks_engine_render_option (GtkThemingEngine *engine,
@@ -1751,6 +1765,7 @@ clearlooks_engine_class_init (ClearlooksEngineClass * klass)
engine_class->render_arrow = clearlooks_engine_render_arrow;
engine_class->render_check = clearlooks_engine_render_check;
engine_class->render_option = clearlooks_engine_render_option;
+ engine_class->render_slider = clearlooks_engine_render_slider;
engine_class->render_layout = clearlooks_engine_render_layout;
engine_class->render_icon_pixbuf = clearlooks_engine_render_icon_pixbuf;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]