[gtk+] inspector: Add a way to highlight widgets



commit 538b987bc55fe634e7343f722cac0d8763a15eae
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue May 20 21:43:00 2014 -0400

    inspector: Add a way to highlight widgets
    
    In contrast to the flashing, where we blink the widget a
    few times, this is explicitly turned on and off.
    
    It will be used for indicating widgets that are part of
    a size group, in the next commit.

 gtk/inspector/inspect-button.c |   16 +++++++++++++++-
 gtk/inspector/window.h         |    6 +++++-
 2 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/gtk/inspector/inspect-button.c b/gtk/inspector/inspect-button.c
index fe438ff..c455396 100644
--- a/gtk/inspector/inspect-button.c
+++ b/gtk/inspector/inspect-button.c
@@ -299,7 +299,7 @@ draw_flash (GtkWidget          *widget,
 {
   GtkAllocation alloc;
 
-  if (iw->flash_count % 2 == 0)
+  if (iw && iw->flash_count % 2 == 0)
     return FALSE;
 
   if (GTK_IS_WINDOW (widget))
@@ -359,4 +359,18 @@ gtk_inspector_flash_widget (GtkInspectorWindow *iw,
   iw->flash_cnx = g_timeout_add (150, (GSourceFunc) on_flash_timeout, iw);
 }
 
+void
+gtk_inspector_start_highlight (GtkWidget *widget)
+{
+  g_signal_connect_after (widget, "draw", G_CALLBACK (draw_flash), NULL);
+  gtk_widget_queue_draw (widget);
+}
+
+void
+gtk_inspector_stop_highlight (GtkWidget *widget)
+{
+  g_signal_handlers_disconnect_by_func (widget, draw_flash, NULL);
+  gtk_widget_queue_draw (widget);
+}
+
 /* vim: set et sw=2 ts=2: */
diff --git a/gtk/inspector/window.h b/gtk/inspector/window.h
index 2621f26..1349f95 100644
--- a/gtk/inspector/window.h
+++ b/gtk/inspector/window.h
@@ -50,6 +50,7 @@ typedef struct
   GtkWidget *classes_list;
   GtkWidget *widget_css_editor;
   GtkWidget *object_hierarchy;
+  GtkWidget *size_groups;
   GtkWidget *data_list;
   GtkWidget *actions;
 
@@ -75,7 +76,10 @@ GType      gtk_inspector_window_get_type    (void);
 GtkWidget *gtk_inspector_window_new         (void);
 
 void       gtk_inspector_flash_widget       (GtkInspectorWindow *iw,
-                                             GtkWidget      *widget);
+                                             GtkWidget          *widget);
+void       gtk_inspector_start_highlight    (GtkWidget          *widget);
+void       gtk_inspector_stop_highlight     (GtkWidget          *widget);
+                                            
 
 G_END_DECLS
 


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