[egg-list-box] flow-box: render focus



commit 465696f4b095ee1fb777c08af7aa5f1725de8215
Author: Matthias Clasen <mclasen redhat com>
Date:   Wed Feb 20 21:32:53 2013 -0500

    flow-box: render focus
    
    Render a focus rectangle around the cursor item, like EggListBox
    does.

 egg-flow-box.c |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/egg-flow-box.c b/egg-flow-box.c
index 1a87525..1b275e7 100644
--- a/egg-flow-box.c
+++ b/egg-flow-box.c
@@ -2842,7 +2842,7 @@ egg_flow_box_real_draw (GtkWidget *widget,
   state = gtk_widget_get_state_flags (widget);
   gtk_render_background (context, cr, (gdouble) 0, (gdouble) 0, (gdouble) allocation.width, (gdouble) 
allocation.height);
 
-  for (iter = g_sequence_get_begin_iter (box->priv->children);
+  for (iter = g_sequence_get_begin_iter (priv->children);
        !g_sequence_iter_is_end (iter);
        iter = g_sequence_iter_next (iter))
     {
@@ -2884,6 +2884,19 @@ egg_flow_box_real_draw (GtkWidget *widget,
         }
     }
 
+  if (gtk_widget_has_visible_focus (GTK_WIDGET (box)) && priv->cursor_child != NULL)
+    {
+      gtk_style_context_get_style (context,
+                                   "focus-padding", &focus_pad,
+                                   NULL);
+      gtk_render_focus (context, cr,
+                        priv->cursor_child->area.x + focus_pad,
+                        priv->cursor_child->area.y + focus_pad,
+                        priv->cursor_child->area.width - 2 * focus_pad,
+                        priv->cursor_child->area.height - 2 * focus_pad);
+    }
+
+
   GTK_WIDGET_CLASS (egg_flow_box_parent_class)->draw ((GtkWidget *) G_TYPE_CHECK_INSTANCE_CAST (box, 
GTK_TYPE_CONTAINER, GtkContainer), cr);
 
   return TRUE;


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