Re: Notebook problems [patch]




Remco van de Meent <oloon-gtk-list@cal052204.student.utwente.nl> writes:

> Problem: 
>   when pressing a button, a notebook should be added. This happens indeed.
>   But, the label IN the notebook isn't displayed...
> 
> 
> We ripped some of the testgtk.c code to test some things, and it looks like
> a bug in gtk.

Yep... the container is responsible for making sure the new child is
realized and mapped if necessary. So the following code needs to be added:

*** gtk+970916/gtk/gtknotebook.c.ots	Sat Sep 20 12:56:46 1997
--- gtk+970916/gtk/gtknotebook.c	Sat Sep 20 13:14:05 1997
***************
*** 196,201 ****
--- 196,220 ----
    gtk_widget_set_parent (child, GTK_WIDGET (notebook));
    gtk_widget_set_parent (tab_label, GTK_WIDGET (notebook));
  
+   if (GTK_WIDGET_VISIBLE (notebook))
+     {
+       if (GTK_WIDGET_REALIZED (notebook) &&
+ 	  !GTK_WIDGET_REALIZED (child))
+ 	gtk_widget_realize (child);
+       
+       if (GTK_WIDGET_MAPPED (notebook) &&
+ 	  !GTK_WIDGET_MAPPED (child) && notebook->cur_page == page)
+ 	gtk_widget_map (child);
+ 
+       if (GTK_WIDGET_REALIZED (notebook) &&
+ 	  !GTK_WIDGET_REALIZED (tab_label))
+ 	gtk_widget_realize (tab_label);
+       
+       if (GTK_WIDGET_MAPPED (notebook) &&
+ 	  !GTK_WIDGET_MAPPED (tab_label))
+ 	gtk_widget_map (tab_label);
+     }
+ 
    if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (notebook))
      gtk_widget_queue_resize (child);
  }



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