diff options
Diffstat (limited to 'gtk/gtktreeitem.c')
-rw-r--r-- | gtk/gtktreeitem.c | 53 |
1 files changed, 29 insertions, 24 deletions
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c index fe5fc7275e..afcd8f46fa 100644 --- a/gtk/gtktreeitem.c +++ b/gtk/gtktreeitem.c @@ -308,40 +308,36 @@ gtk_tree_item_set_subtree (GtkTreeItem *tree_item, g_return_if_fail (subtree != NULL); g_return_if_fail (GTK_IS_TREE (subtree)); - if(tree_item->subtree) { - g_warning("there is already a subtree for this tree item\n"); - return; - } + if (tree_item->subtree) + { + g_warning("there is already a subtree for this tree item\n"); + return; + } tree_item->subtree = subtree; - GTK_TREE(subtree)->tree_owner = GTK_WIDGET(tree_item); + GTK_TREE (subtree)->tree_owner = GTK_WIDGET (tree_item); /* show subtree button */ if (tree_item->pixmaps_box) gtk_widget_show (tree_item->pixmaps_box); - /* set parent widget */ - gtk_widget_set_parent(subtree, GTK_WIDGET(tree_item)->parent); + if (tree_item->expanded) + gtk_widget_show (subtree); + else + gtk_widget_hide (subtree); - if(GTK_WIDGET_VISIBLE(GTK_WIDGET(tree_item))) - { - if(GTK_WIDGET_REALIZED (GTK_WIDGET(tree_item)) && - !GTK_WIDGET_REALIZED (GTK_WIDGET(subtree))) - gtk_widget_realize (GTK_WIDGET(subtree)); + gtk_widget_set_parent (subtree, GTK_WIDGET (tree_item)->parent); - if(GTK_WIDGET_MAPPED (GTK_WIDGET(tree_item)) && - !GTK_WIDGET_MAPPED (GTK_WIDGET(subtree))) - gtk_widget_map (GTK_WIDGET(subtree)); - } + if (GTK_WIDGET_REALIZED (subtree->parent)) + gtk_widget_realize (subtree); - if (tree_item->expanded) - gtk_widget_show(subtree); - else - gtk_widget_hide(subtree); - - if (GTK_WIDGET_VISIBLE (tree_item) && GTK_WIDGET_VISIBLE (tree_item)) - gtk_widget_queue_resize (GTK_WIDGET(tree_item)); + if (GTK_WIDGET_VISIBLE (subtree->parent) && GTK_WIDGET_VISIBLE (subtree)) + { + if (GTK_WIDGET_MAPPED (subtree->parent)) + gtk_widget_map (subtree); + gtk_widget_queue_resize (subtree); + } } void @@ -531,7 +527,7 @@ gtk_tree_item_size_allocate (GtkWidget *widget, GtkBin *bin; GtkTreeItem* item; GtkAllocation child_allocation; - guint border_width; + gint border_width; int temp; g_return_if_fail (widget != NULL); @@ -587,6 +583,9 @@ gtk_tree_item_draw_lines (GtkWidget *widget) item = GTK_TREE_ITEM(widget); tree = GTK_TREE(widget->parent); + if (!tree->view_line) + return; + /* draw vertical line */ lx1 = item->pixmaps_box->allocation.width; lx1 = lx2 = ((lx1 / 2) + (lx1 % 2) + @@ -649,6 +648,12 @@ gtk_tree_item_paint (GtkWidget *widget, g_return_if_fail (GTK_IS_TREE_ITEM (widget)); g_return_if_fail (area != NULL); + /* FIXME: We should honor tree->view_mode, here - I think + * the desired effect is that when the mode is VIEW_ITEM, + * only the subitem is drawn as selected, not the entire + * line. (Like the way that the tree in Windows Explorer + * works). + */ if (GTK_WIDGET_DRAWABLE (widget)) { bin = GTK_BIN (widget); |