Re: Notebook tab labels
- From: Lars Hamann <lars gtk org>
- To: gtk-devel-list redhat com
- Subject: Re: Notebook tab labels
- Date: Wed, 4 Aug 1999 01:00:03 +0200
On Tue, Aug 03, 1999 at 02:29:11PM -0400, Owen Taylor wrote:
[...]
> The way that tab labels have worked in the past is
> that the notebook would automatically _show_
> them when a tab label was added to a notebook.
>
> However, in some circumstances, this automatic show
> would not happen, and then the notebook would map
> !VISIBLE tab labels. Which, with recent changes
> produces nasty warnings.
>
> For a container to automatically show its children
> is simply not correct. However, I don't we can't
> change this within the 1.2 branch. So, I'm planning
> to fix this up as best as possible:
>
> - Change the notebook code so that it always
> shows tab labels added to it. (Not just sometimes)
>
> - Fix the case that was producing the warnings so
> that it doesn't try to map !VISIBLE widgets.
> (This is necessary, because an application could
> conceivably hide a tab label after adding it
> to a notebook)
The problem now is, that gtk_widget_hide (notebook_page);
should hide a hole page plus its tab_label. It's an easy
way to hide a notebook page without introducing new
functions like gtk_notebook_hide/show_page. Unfortunately
tab_label is not a child of notebook_page, so if someone
toggles the visibility of a page, notebook has to toggle
the visibility of its tab_label too.
An easy fix for Bug#1805 is the patch like :
--- gtknotebook.c.orig Wed Aug 4 00:31:07 1999
+++ gtknotebook.c Wed Aug 4 00:28:40 1999
@@ -2948,7 +2948,12 @@
if (GTK_WIDGET_REALIZED (notebook) &&
page->tab_label && !GTK_WIDGET_MAPPED (page->tab_label))
- gtk_widget_map (page->tab_label);
+ {
+ if (!GTK_WIDGET_VISIBLE (page->tab_label))
+ gtk_widget_show (page->tab_label);
+ else
+ gtk_widget_map (page->tab_label);
+ }
}
if (children)
@@ -3016,7 +3021,12 @@
if (GTK_WIDGET_REALIZED (notebook) && page->tab_label &&
!GTK_WIDGET_MAPPED (page->tab_label))
- gtk_widget_map (page->tab_label);
+ {
+ if (!GTK_WIDGET_VISIBLE (page->tab_label))
+ gtk_widget_show (page->tab_label);
+ else
+ gtk_widget_map (page->tab_label);
+ }
}
}
gtk_notebook_set_shape (notebook);
I did not test a signal handler for the show and hide signals of
a page, but I think that might work a bit better.
> But for 1.4, I think the automatic show needs to
> go. Either this could be done as a simple documented
> source-incompatible change, or it could be done
> as part of a larger change that has been proposed -
> making all widgets default to VISIBLE.
If we change the current behavior we have to present
another way to hide whole pages (page + tab_label).
So we would need gtk_notebook_show/hide_page and a
visibility flag in GtkNotebookPage.
bye,
Lars
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]