API: Change semantics of gtk_container_get_child_path()

Include the child widget path in the returned path now. This allows
customizing the path of the current widgets - like adding flags to child
widgets (and maybe siblings in the future).
This commit is contained in:
Benjamin Otte 2011-05-25 22:21:15 +02:00
parent b0616c8225
commit a6daba5e78
5 changed files with 14 additions and 7 deletions

View File

@ -2334,6 +2334,8 @@ gtk_container_real_get_path_for_child (GtkContainer *container,
g_list_free_1 (cur);
}
gtk_widget_path_append_for_widget (path, child);
return path;
}
@ -3362,7 +3364,7 @@ _gtk_container_get_reallocate_redraws (GtkContainer *container)
* @child: a child of @container
*
* Returns a newly created widget path representing all the widget hierarchy
* from the toplevel down to @child (this one not being included).
* from the toplevel down to and including @child.
*
* Returns: A newly created #GtkWidgetPath
**/

View File

@ -384,7 +384,9 @@ gtk_frame_get_path_for_child (GtkContainer *container,
path = GTK_CONTAINER_CLASS (gtk_frame_parent_class)->get_path_for_child (container, child);
if (child == priv->label_widget)
gtk_widget_path_iter_add_class (path, -1, GTK_STYLE_CLASS_FRAME);
gtk_widget_path_iter_add_class (path,
gtk_widget_path_length (path) - 2,
GTK_STYLE_CLASS_FRAME);
return path;
}

View File

@ -4454,7 +4454,6 @@ gtk_notebook_get_path_for_child (GtkContainer *container,
GtkNotebook *notebook;
GtkNotebookPage *page;
GtkWidgetPath *path;
GtkRegionFlags flags;
GList *c;
path = GTK_CONTAINER_CLASS (gtk_notebook_parent_class)->get_path_for_child (container, widget);
@ -4474,8 +4473,10 @@ gtk_notebook_get_path_for_child (GtkContainer *container,
if (!c)
return path;
flags = _gtk_notebook_get_tab_flags (notebook, page);
gtk_widget_path_iter_add_region (path, -1, GTK_STYLE_REGION_TAB, flags);
gtk_widget_path_iter_add_region (path,
gtk_widget_path_length (path) - 2,
GTK_STYLE_REGION_TAB,
_gtk_notebook_get_tab_flags (notebook, page));
return path;
}

View File

@ -8540,6 +8540,8 @@ gtk_tree_view_get_path_for_child (GtkContainer *container,
break;
}
gtk_widget_path_append_for_widget (path, child);
return path;
}

View File

@ -14312,9 +14312,9 @@ gtk_widget_get_path (GtkWidget *widget)
* situation.
*/
widget->priv->path = gtk_widget_path_new ();
}
gtk_widget_path_append_for_widget (widget->priv->path, widget);
gtk_widget_path_append_for_widget (widget->priv->path, widget);
}
if (widget->priv->context)
gtk_style_context_set_path (widget->priv->context,