[gtk-engines/gnome3: 4/5] Some entry stuff, and a broken (not enabled) arrow.
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-engines/gnome3: 4/5] Some entry stuff, and a broken (not enabled) arrow.
- Date: Fri, 2 Apr 2010 15:44:00 +0000 (UTC)
commit 89a398186f036011fe7cc9d0f39c00013a8447fc
Author: Benjamin Berg <benjamin sipsolutions net>
Date: Fri Apr 2 16:47:02 2010 +0200
Some entry stuff, and a broken (not enabled) arrow.
engines/clearlooks/src/clearlooks_draw_gnome3.c | 97 +++++++++++++++++++++--
1 files changed, 91 insertions(+), 6 deletions(-)
---
diff --git a/engines/clearlooks/src/clearlooks_draw_gnome3.c b/engines/clearlooks/src/clearlooks_draw_gnome3.c
index 23db198..dd55a3e 100644
--- a/engines/clearlooks/src/clearlooks_draw_gnome3.c
+++ b/engines/clearlooks/src/clearlooks_draw_gnome3.c
@@ -42,10 +42,14 @@ clearlooks_gnome3_draw_entry (cairo_t *cr,
{
const CairoColor *fg_color = &colors->text[params->state_type];
const CairoColor *bg_color = &colors->base[params->state_type];
+ CairoColor top_color;
if (params->focus) {
fg_color = &colors->base[GTK_STATE_SELECTED];
}
+ top_color = *fg_color;
+
+ cairo_save (cr);
cairo_set_line_width (cr, 1.0);
ge_cairo_rounded_rectangle (cr, x + 0.5, y + 0.5, width - 1,
@@ -53,8 +57,89 @@ clearlooks_gnome3_draw_entry (cairo_t *cr,
params->corners);
ge_cairo_set_color (cr, bg_color);
cairo_fill_preserve (cr);
- ge_cairo_set_color (cr, fg_color);
+
+ if (params->focus || params->disabled || params->prelight || params->active) {
+ ge_cairo_set_color (cr, fg_color);
+ cairo_stroke (cr);
+ } else {
+ cairo_pattern_t *pattern;
+ CairoColor bottom_color = colors->text[GTK_STATE_INSENSITIVE];
+
+ ge_mix_color (&top_color, &bottom_color, 0.86, &top_color);
+
+ /* Top/bottom pixel lines are outside of the gradient, there is
+ * no point. */
+ pattern = cairo_pattern_create_linear (x, y + 1, x, height - 1);
+ cairo_pattern_add_color_stop_rgb (pattern, 0.0, top_color.r, top_color.g, top_color.b);
+ cairo_pattern_add_color_stop_rgb (pattern, 1.0, bottom_color.r, bottom_color.g, bottom_color.b);
+ cairo_set_source (cr, pattern);
+ cairo_stroke (cr);
+
+ cairo_pattern_destroy (pattern);
+ }
+
+ if (!params->disabled) {
+ ge_cairo_rounded_rectangle (cr, x + 1.0, y + 1.0, width - 2,
+ height - 2, MAX(0, params->radius - 0.5),
+ params->corners);
+ cairo_clip (cr);
+ cairo_move_to (cr, x, y + 1.5);
+ cairo_line_to (cr, x + width, y + 1.5);
+ top_color.a = 0.1;
+ ge_cairo_set_color (cr, &top_color);
+ cairo_stroke (cr);
+ }
+
+ cairo_restore (cr);
+}
+
+static void
+clearlooks_gnome3_draw_arrow (cairo_t *cr,
+ const ClearlooksColors *colors,
+ const WidgetParameters *widget,
+ const ArrowParameters *arrow,
+ int x, int y, int width, int height)
+{
+ gdouble w = width, h = height;
+ gdouble rotate;
+ cairo_matrix_t matrix;
+
+ switch (arrow->direction) {
+ case CL_DIRECTION_LEFT:
+ rotate = G_PI*1.5;
+ break;
+ case CL_DIRECTION_RIGHT:
+ rotate = G_PI*0.5;
+ break;
+ case CL_DIRECTION_UP:
+ rotate = G_PI;
+ break;
+ case CL_DIRECTION_DOWN:
+ rotate = 0;
+ break;
+ default:
+ return;
+ }
+
+ cairo_save (cr);
+
+ cairo_translate (cr, x + width / 2.0, y + height / 2.0);
+ cairo_rotate (cr, -rotate);
+ cairo_get_matrix (cr, &matrix);
+ cairo_matrix_transform_distance (&matrix, &w, &h);
+
+ h = MAX(h / 2 - 2, w - 2);
+ w = h * 2;
+ cairo_move_to (cr, -w / 2 + 1, -h / 2 + 1);
+ cairo_line_to (cr, 0, h / 2 - 1);
+ cairo_line_to (cr, +w / 2 + 1, -h / 2 + 1);
+ cairo_set_line_width (cr, 2.0);
+
+ ge_cairo_set_color (cr, &colors->fg[widget->state_type]);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
cairo_stroke (cr);
+
+ cairo_restore (cr);
}
void
@@ -62,14 +147,15 @@ clearlooks_register_style_gnome3 (ClearlooksStyleFunctions *functions, Clearlook
{
g_assert (functions);
-/* functions->draw_top_left_highlight = clearlooks_draw_top_left_highlight;
+ functions->draw_entry = clearlooks_gnome3_draw_entry;
+/* functions->draw_arrow = clearlooks_gnome3_draw_arrow;
+ 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_gnome3_draw_entry;
-/* functions->draw_entry_progress = clearlooks_draw_entry_progress;
+ functions->draw_slider_button = clearlooks_draw_slider_button;
+ functions->draw_entry_progress = clearlooks_draw_entry_progress;
functions->draw_spinbutton = clearlooks_draw_spinbutton;
functions->draw_spinbutton_down = clearlooks_draw_spinbutton_down;
functions->draw_optionmenu = clearlooks_draw_optionmenu;
@@ -93,7 +179,6 @@ clearlooks_register_style_gnome3 (ClearlooksStyleFunctions *functions, Clearlook
functions->draw_icon_view_item = clearlooks_draw_icon_view_item;
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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]