[monet/monet-xml: 7/10] monet-gtk: set up focus and checked flags by inspectin the widget



commit 2988000df139fbdf17115cea7f982cdbfac837d6
Author: Thomas Wood <thos gnome org>
Date:   Mon Apr 5 17:43:05 2010 +0100

    monet-gtk: set up focus and checked flags by inspectin the widget

 monet-gtk/style.c |   31 ++++++++++++++++++++++++++-----
 1 files changed, 26 insertions(+), 5 deletions(-)
---
diff --git a/monet-gtk/style.c b/monet-gtk/style.c
index a330a71..e5e7cee 100644
--- a/monet-gtk/style.c
+++ b/monet-gtk/style.c
@@ -125,6 +125,7 @@ static void
 monet_params_init (GtkStyle      *style,
                    GdkWindow     *window,
                    GtkStateType   gtk_state,
+                   GtkWidget     *widget,
                    MnStyle      **mn_style,
                    cairo_t      **cr,
                    MnState       *state,
@@ -141,6 +142,26 @@ monet_params_init (GtkStyle      *style,
 
   monet_state_flags_from_gtk_state (gtk_state, state, flags);
 
+  if (widget)
+    {
+      if (GTK_WIDGET_HAS_FOCUS (widget))
+        *flags |= MN_FLAGS_FOCUS;
+
+      if (GTK_IS_TOGGLE_BUTTON (widget))
+        {
+          /* toggle butons, check boxes and radio buttons */
+          if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
+            *flags |= MN_FLAGS_CHECKED;
+        }
+      else if (GTK_IS_TOGGLE_TOOL_BUTTON (widget))
+        {
+          /* toggle tool items, radio tool items */
+          if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (widget)))
+            *flags |= MN_FLAGS_CHECKED;
+        }
+
+    }
+
   //*colors = monet_palette_from_gtk_style (style);
   *colors = NULL;
 
@@ -198,7 +219,7 @@ monet_gtk_draw_shadow (GtkStyle      *style,
   MnFlags mn_flags;
   MnStyle *mn_style;
 
-  monet_params_init (style, window, state_type,
+  monet_params_init (style, window, state_type, widget,
                      &mn_style, &cr, &mn_state, &mn_flags, &mn_palette);
 
   if (DETAIL ("entry"))
@@ -253,7 +274,7 @@ monet_gtk_draw_box (GtkStyle      *style,
   MnStyle *mn_style;
   gint int_w, int_h;
 
-  monet_params_init (style, window, state_type,
+  monet_params_init (style, window, state_type, widget,
                      &mn_style, &cr, &mn_state, &mn_flags, &mn_palette);
 
   if (width == -1 && height == -1)
@@ -327,7 +348,7 @@ monet_gtk_draw_check (GtkStyle      *style,
   MnFlags mn_flags;
   MnStyle *mn_style;
 
-  monet_params_init (style, window, state_type,
+  monet_params_init (style, window, state_type, widget,
                      &mn_style, &cr, &mn_state, &mn_flags, &mn_palette);
 
   if (shadow_type == GTK_SHADOW_IN)
@@ -359,7 +380,7 @@ monet_gtk_draw_option (GtkStyle      *style,
   MnFlags mn_flags;
   MnStyle *mn_style;
 
-  monet_params_init (style, window, state_type,
+  monet_params_init (style, window, state_type, widget,
                      &mn_style, &cr, &mn_state, &mn_flags, &mn_palette);
 
   if (shadow_type == GTK_SHADOW_IN)
@@ -459,7 +480,7 @@ monet_gtk_draw_focus (GtkStyle     *style,
                       gint          width,
                       gint          height)
 {
-  monet_gtk_style_parent_class->draw_focus (style, window, state_type, area, widget, detail, x, y, width, height);
+  /* Monet has it's own flags for focus */
 }
 /*##################################*/
 



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