forked from AuroraMiddleware/gtk
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.
This commit is contained in:
parent
65c9e2a651
commit
538b987bc5
@ -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: */
|
||||
|
@ -50,6 +50,7 @@ typedef struct
|
||||
GtkWidget *classes_list;
|
||||
GtkWidget *widget_css_editor;
|
||||
GtkWidget *object_hierarchy;
|
||||
GtkWidget *size_groups;
|
||||
GtkWidget *data_list;
|
||||
GtkWidget *actions;
|
||||
|
||||
@ -76,6 +77,9 @@ GtkWidget *gtk_inspector_window_new (void);
|
||||
|
||||
void gtk_inspector_flash_widget (GtkInspectorWindow *iw,
|
||||
GtkWidget *widget);
|
||||
void gtk_inspector_start_highlight (GtkWidget *widget);
|
||||
void gtk_inspector_stop_highlight (GtkWidget *widget);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user