[monet/monet-xml: 8/10] mn-style: draw focused widgets with a thicker border



commit 9501685e22c99defe27bf6f1c4ffee5274d8c919
Author: Thomas Wood <thos gnome org>
Date:   Mon Apr 5 17:54:24 2010 +0100

    mn-style: draw focused widgets with a thicker border

 monet/mn-style.c |   53 +++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 41 insertions(+), 12 deletions(-)
---
diff --git a/monet/mn-style.c b/monet/mn-style.c
index d6c6f57..dc231f1 100644
--- a/monet/mn-style.c
+++ b/monet/mn-style.c
@@ -330,13 +330,20 @@ mn_style_paint_entry (MnStyle   *style,
                       MnState    state,
                       MnFlags    flags)
 {
+  gdouble line_width;
+
   cairo_save (cr);
 
   colors = mn_style_find_colors (style, "entry", colors);
 
-  cairo_translate (cr, 0.5, 0.5);
-  width--; height--;
-  cairo_set_line_width (cr, 1.0);
+  if (flags & MN_FLAGS_FOCUS)
+    line_width = 2;
+  else
+    line_width = 1;
+
+  cairo_translate (cr, line_width / 2.0, line_width / 2.0);
+  cairo_set_line_width (cr, line_width);
+  width -= line_width; height -= line_width;
 
   cairo_rectangle (cr, x, y, width, height);
 
@@ -358,11 +365,18 @@ mn_style_paint_button (MnStyle   *style,
                        MnState    state,
                        MnFlags    flags)
 {
+  gdouble line_width;
+
   cairo_save (cr);
 
-  cairo_translate (cr, 0.5, 0.5);
-  cairo_set_line_width (cr, 1.0);
-  width--; height--;
+  if (flags & MN_FLAGS_FOCUS)
+    line_width = 3;
+  else
+    line_width = 1;
+
+  cairo_translate (cr, line_width / 2.0, line_width / 2.0);
+  cairo_set_line_width (cr, line_width);
+  width -= line_width; height -= line_width;
 
   cairo_rectangle (cr, x, y, width, height);
 
@@ -391,13 +405,20 @@ mn_style_paint_check_box (MnStyle   *style,
                           MnState    state,
                           MnFlags    flags)
 {
+  gdouble line_width;
+
   cairo_save (cr);
 
   colors = mn_style_find_colors (style, "check-box", colors);
 
-  cairo_translate (cr, 0.5, 0.5);
-  width--; height--;
-  cairo_set_line_width (cr, 1.0);
+  if (flags & MN_FLAGS_FOCUS)
+    line_width = 2;
+  else
+    line_width = 1;
+
+  cairo_translate (cr, line_width / 2.0, line_width / 2.0);
+  cairo_set_line_width (cr, line_width);
+  width -= line_width; height -= line_width;
 
   cairo_rectangle (cr, x, y, width, height);
 
@@ -432,13 +453,21 @@ mn_style_paint_radio_button (MnStyle   *style,
                              MnState    state,
                              MnFlags    flags)
 {
+  gdouble line_width;
+
   cairo_save (cr);
 
   colors = mn_style_find_colors (style, "radio-button", colors);
 
-  cairo_translate (cr, 0.5, 0.5);
-  width--; height--;
-  cairo_set_line_width (cr, 1.0);
+
+  if (flags & MN_FLAGS_FOCUS)
+    line_width = 2;
+  else
+    line_width = 1;
+
+  cairo_translate (cr, line_width / 2.0, line_width / 2.0);
+  cairo_set_line_width (cr, line_width);
+  width -= line_width; height -= line_width;
 
   cairo_arc (cr, x + width / 2.0, y + width / 2.0, width / 2.0, 0, 2 * M_PI);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]