Add a function to determine if a window is the focus widget within its

Wed Oct 25 14:17:43 2000  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtkwidget.[ch] (gtk_widget_is_focus): Add a function
	to determine if a window is the focus widget within
	its toplevel.

	* gtk/gtkcontainer.[ch]: Fix the return type of ::focus
	to be boolean.

	* gtk/gtkcontainer.c (gtk_container_real_focus): Move handling
	of the case where the container CAN_FOCUS to here instead
	of having it in each individual move-the-focus place.

	* gtk/gtkcontainer.c: Rewrite handling of left-right and up-down
	focusing to be geometric in a much more obvious sense. Arrowing
	around is still non-intuitive because it isn't perfect and
	because entries, etc, grab the arrow keys, but it at least
	usually will do what you expect now.

	* gtk/gtknotebook.[ch]: Many cleanups. Moved docs inline in this
	file.

	* gtk/gtknotebook.c: Change tabs to be a single item in
	the focus chain. Make movement of focus on tabs with arrow
	keys wrap around.

	* gtk/gtknotebook.c (gtk_notebook_find_child): Add
	CHECK_FIND_CHILD macro to give informative error messages
	instead of silent returns.

	* gtk/gtknotebook.c (gtk_notebook_init): Set the RECEIVES_DEFAULT
	flag since we handle GdkReturn on the tabs.

	* gtk/gtknotebook.c (gtk_notebook_expose_tabs): Invalidate
	windows rather than sending expose events directly.

	* gtk/gtknotebook.[ch] docs/Changes-2.0.txt: Move structure
	definition for GtkNotebookPage into .c file, since it is private.

	* gtk/testgtk.c (create_notebook): Add option for
	testing borderless notebook.

	* gtk/testgtk.c (page_switch): Removed egregious poking
	around in GTK+ internals.

	* docs/widget-system.txt: Remove references to GTK_REDRAW_PENDING.

	* gtk/gtkclist.[ch]: Remove key press handler, handle focusing
	properly through gtk_clist_focus. Make the title headers a
	single item in the tab-focus chain, and make left-right wrap
	around.

	* gtk/gtkwindow.c (gtk_window_focus): Add a custom
	focus method so that wrapping around works properly.

	* gtk/gtktreeview.c: Remove calls to gtk_container_set_focus_child() -
	that is handled for the widget now.
This commit is contained in:
Owen Taylor 2000-12-11 17:47:24 +00:00 committed by Owen Taylor
parent 5a188a9f13
commit 0cdc00ec0b
23 changed files with 1995 additions and 1182 deletions

View File

@ -1,3 +1,61 @@
Wed Oct 25 14:17:43 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.[ch] (gtk_widget_is_focus): Add a function
to determine if a window is the focus widget within
its toplevel.
* gtk/gtkcontainer.[ch]: Fix the return type of ::focus
to be boolean.
* gtk/gtkcontainer.c (gtk_container_real_focus): Move handling
of the case where the container CAN_FOCUS to here instead
of having it in each individual move-the-focus place.
* gtk/gtkcontainer.c: Rewrite handling of left-right and up-down
focusing to be geometric in a much more obvious sense. Arrowing
around is still non-intuitive because it isn't perfect and
because entries, etc, grab the arrow keys, but it at least
usually will do what you expect now.
* gtk/gtknotebook.[ch]: Many cleanups. Moved docs inline in this
file.
* gtk/gtknotebook.c: Change tabs to be a single item in
the focus chain. Make movement of focus on tabs with arrow
keys wrap around.
* gtk/gtknotebook.c (gtk_notebook_find_child): Add
CHECK_FIND_CHILD macro to give informative error messages
instead of silent returns.
* gtk/gtknotebook.c (gtk_notebook_init): Set the RECEIVES_DEFAULT
flag since we handle GdkReturn on the tabs.
* gtk/gtknotebook.c (gtk_notebook_expose_tabs): Invalidate
windows rather than sending expose events directly.
* gtk/gtknotebook.[ch] docs/Changes-2.0.txt: Move structure
definition for GtkNotebookPage into .c file, since it is private.
* gtk/testgtk.c (create_notebook): Add option for
testing borderless notebook.
* gtk/testgtk.c (page_switch): Removed egregious poking
around in GTK+ internals.
* docs/widget-system.txt: Remove references to GTK_REDRAW_PENDING.
* gtk/gtkclist.[ch]: Remove key press handler, handle focusing
properly through gtk_clist_focus. Make the title headers a
single item in the tab-focus chain, and make left-right wrap
around.
* gtk/gtkwindow.c (gtk_window_focus): Add a custom
focus method so that wrapping around works properly.
* gtk/gtktreeview.c: Remove calls to gtk_container_set_focus_child() -
that is handled for the widget now.
Mon Dec 11 11:41:12 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinvisible.c (gtk_invisible_init): Flag invisible
@ -149,6 +207,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
2000-12-06 Elliot Lee <sopwith@redhat.com>
* configure.in: Detect freetype properly
* modules/basic/Makefile.am, gdk/linux-fb/Makefile.am: Make use of
above.

View File

@ -1,3 +1,61 @@
Wed Oct 25 14:17:43 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.[ch] (gtk_widget_is_focus): Add a function
to determine if a window is the focus widget within
its toplevel.
* gtk/gtkcontainer.[ch]: Fix the return type of ::focus
to be boolean.
* gtk/gtkcontainer.c (gtk_container_real_focus): Move handling
of the case where the container CAN_FOCUS to here instead
of having it in each individual move-the-focus place.
* gtk/gtkcontainer.c: Rewrite handling of left-right and up-down
focusing to be geometric in a much more obvious sense. Arrowing
around is still non-intuitive because it isn't perfect and
because entries, etc, grab the arrow keys, but it at least
usually will do what you expect now.
* gtk/gtknotebook.[ch]: Many cleanups. Moved docs inline in this
file.
* gtk/gtknotebook.c: Change tabs to be a single item in
the focus chain. Make movement of focus on tabs with arrow
keys wrap around.
* gtk/gtknotebook.c (gtk_notebook_find_child): Add
CHECK_FIND_CHILD macro to give informative error messages
instead of silent returns.
* gtk/gtknotebook.c (gtk_notebook_init): Set the RECEIVES_DEFAULT
flag since we handle GdkReturn on the tabs.
* gtk/gtknotebook.c (gtk_notebook_expose_tabs): Invalidate
windows rather than sending expose events directly.
* gtk/gtknotebook.[ch] docs/Changes-2.0.txt: Move structure
definition for GtkNotebookPage into .c file, since it is private.
* gtk/testgtk.c (create_notebook): Add option for
testing borderless notebook.
* gtk/testgtk.c (page_switch): Removed egregious poking
around in GTK+ internals.
* docs/widget-system.txt: Remove references to GTK_REDRAW_PENDING.
* gtk/gtkclist.[ch]: Remove key press handler, handle focusing
properly through gtk_clist_focus. Make the title headers a
single item in the tab-focus chain, and make left-right wrap
around.
* gtk/gtkwindow.c (gtk_window_focus): Add a custom
focus method so that wrapping around works properly.
* gtk/gtktreeview.c: Remove calls to gtk_container_set_focus_child() -
that is handled for the widget now.
Mon Dec 11 11:41:12 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinvisible.c (gtk_invisible_init): Flag invisible
@ -149,6 +207,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
2000-12-06 Elliot Lee <sopwith@redhat.com>
* configure.in: Detect freetype properly
* modules/basic/Makefile.am, gdk/linux-fb/Makefile.am: Make use of
above.

View File

@ -1,3 +1,61 @@
Wed Oct 25 14:17:43 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.[ch] (gtk_widget_is_focus): Add a function
to determine if a window is the focus widget within
its toplevel.
* gtk/gtkcontainer.[ch]: Fix the return type of ::focus
to be boolean.
* gtk/gtkcontainer.c (gtk_container_real_focus): Move handling
of the case where the container CAN_FOCUS to here instead
of having it in each individual move-the-focus place.
* gtk/gtkcontainer.c: Rewrite handling of left-right and up-down
focusing to be geometric in a much more obvious sense. Arrowing
around is still non-intuitive because it isn't perfect and
because entries, etc, grab the arrow keys, but it at least
usually will do what you expect now.
* gtk/gtknotebook.[ch]: Many cleanups. Moved docs inline in this
file.
* gtk/gtknotebook.c: Change tabs to be a single item in
the focus chain. Make movement of focus on tabs with arrow
keys wrap around.
* gtk/gtknotebook.c (gtk_notebook_find_child): Add
CHECK_FIND_CHILD macro to give informative error messages
instead of silent returns.
* gtk/gtknotebook.c (gtk_notebook_init): Set the RECEIVES_DEFAULT
flag since we handle GdkReturn on the tabs.
* gtk/gtknotebook.c (gtk_notebook_expose_tabs): Invalidate
windows rather than sending expose events directly.
* gtk/gtknotebook.[ch] docs/Changes-2.0.txt: Move structure
definition for GtkNotebookPage into .c file, since it is private.
* gtk/testgtk.c (create_notebook): Add option for
testing borderless notebook.
* gtk/testgtk.c (page_switch): Removed egregious poking
around in GTK+ internals.
* docs/widget-system.txt: Remove references to GTK_REDRAW_PENDING.
* gtk/gtkclist.[ch]: Remove key press handler, handle focusing
properly through gtk_clist_focus. Make the title headers a
single item in the tab-focus chain, and make left-right wrap
around.
* gtk/gtkwindow.c (gtk_window_focus): Add a custom
focus method so that wrapping around works properly.
* gtk/gtktreeview.c: Remove calls to gtk_container_set_focus_child() -
that is handled for the widget now.
Mon Dec 11 11:41:12 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinvisible.c (gtk_invisible_init): Flag invisible
@ -149,6 +207,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
2000-12-06 Elliot Lee <sopwith@redhat.com>
* configure.in: Detect freetype properly
* modules/basic/Makefile.am, gdk/linux-fb/Makefile.am: Make use of
above.

View File

@ -1,3 +1,61 @@
Wed Oct 25 14:17:43 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.[ch] (gtk_widget_is_focus): Add a function
to determine if a window is the focus widget within
its toplevel.
* gtk/gtkcontainer.[ch]: Fix the return type of ::focus
to be boolean.
* gtk/gtkcontainer.c (gtk_container_real_focus): Move handling
of the case where the container CAN_FOCUS to here instead
of having it in each individual move-the-focus place.
* gtk/gtkcontainer.c: Rewrite handling of left-right and up-down
focusing to be geometric in a much more obvious sense. Arrowing
around is still non-intuitive because it isn't perfect and
because entries, etc, grab the arrow keys, but it at least
usually will do what you expect now.
* gtk/gtknotebook.[ch]: Many cleanups. Moved docs inline in this
file.
* gtk/gtknotebook.c: Change tabs to be a single item in
the focus chain. Make movement of focus on tabs with arrow
keys wrap around.
* gtk/gtknotebook.c (gtk_notebook_find_child): Add
CHECK_FIND_CHILD macro to give informative error messages
instead of silent returns.
* gtk/gtknotebook.c (gtk_notebook_init): Set the RECEIVES_DEFAULT
flag since we handle GdkReturn on the tabs.
* gtk/gtknotebook.c (gtk_notebook_expose_tabs): Invalidate
windows rather than sending expose events directly.
* gtk/gtknotebook.[ch] docs/Changes-2.0.txt: Move structure
definition for GtkNotebookPage into .c file, since it is private.
* gtk/testgtk.c (create_notebook): Add option for
testing borderless notebook.
* gtk/testgtk.c (page_switch): Removed egregious poking
around in GTK+ internals.
* docs/widget-system.txt: Remove references to GTK_REDRAW_PENDING.
* gtk/gtkclist.[ch]: Remove key press handler, handle focusing
properly through gtk_clist_focus. Make the title headers a
single item in the tab-focus chain, and make left-right wrap
around.
* gtk/gtkwindow.c (gtk_window_focus): Add a custom
focus method so that wrapping around works properly.
* gtk/gtktreeview.c: Remove calls to gtk_container_set_focus_child() -
that is handled for the widget now.
Mon Dec 11 11:41:12 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinvisible.c (gtk_invisible_init): Flag invisible
@ -149,6 +207,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
2000-12-06 Elliot Lee <sopwith@redhat.com>
* configure.in: Detect freetype properly
* modules/basic/Makefile.am, gdk/linux-fb/Makefile.am: Make use of
above.

View File

@ -1,3 +1,61 @@
Wed Oct 25 14:17:43 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.[ch] (gtk_widget_is_focus): Add a function
to determine if a window is the focus widget within
its toplevel.
* gtk/gtkcontainer.[ch]: Fix the return type of ::focus
to be boolean.
* gtk/gtkcontainer.c (gtk_container_real_focus): Move handling
of the case where the container CAN_FOCUS to here instead
of having it in each individual move-the-focus place.
* gtk/gtkcontainer.c: Rewrite handling of left-right and up-down
focusing to be geometric in a much more obvious sense. Arrowing
around is still non-intuitive because it isn't perfect and
because entries, etc, grab the arrow keys, but it at least
usually will do what you expect now.
* gtk/gtknotebook.[ch]: Many cleanups. Moved docs inline in this
file.
* gtk/gtknotebook.c: Change tabs to be a single item in
the focus chain. Make movement of focus on tabs with arrow
keys wrap around.
* gtk/gtknotebook.c (gtk_notebook_find_child): Add
CHECK_FIND_CHILD macro to give informative error messages
instead of silent returns.
* gtk/gtknotebook.c (gtk_notebook_init): Set the RECEIVES_DEFAULT
flag since we handle GdkReturn on the tabs.
* gtk/gtknotebook.c (gtk_notebook_expose_tabs): Invalidate
windows rather than sending expose events directly.
* gtk/gtknotebook.[ch] docs/Changes-2.0.txt: Move structure
definition for GtkNotebookPage into .c file, since it is private.
* gtk/testgtk.c (create_notebook): Add option for
testing borderless notebook.
* gtk/testgtk.c (page_switch): Removed egregious poking
around in GTK+ internals.
* docs/widget-system.txt: Remove references to GTK_REDRAW_PENDING.
* gtk/gtkclist.[ch]: Remove key press handler, handle focusing
properly through gtk_clist_focus. Make the title headers a
single item in the tab-focus chain, and make left-right wrap
around.
* gtk/gtkwindow.c (gtk_window_focus): Add a custom
focus method so that wrapping around works properly.
* gtk/gtktreeview.c: Remove calls to gtk_container_set_focus_child() -
that is handled for the widget now.
Mon Dec 11 11:41:12 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinvisible.c (gtk_invisible_init): Flag invisible
@ -149,6 +207,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
2000-12-06 Elliot Lee <sopwith@redhat.com>
* configure.in: Detect freetype properly
* modules/basic/Makefile.am, gdk/linux-fb/Makefile.am: Make use of
above.

View File

@ -1,3 +1,61 @@
Wed Oct 25 14:17:43 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.[ch] (gtk_widget_is_focus): Add a function
to determine if a window is the focus widget within
its toplevel.
* gtk/gtkcontainer.[ch]: Fix the return type of ::focus
to be boolean.
* gtk/gtkcontainer.c (gtk_container_real_focus): Move handling
of the case where the container CAN_FOCUS to here instead
of having it in each individual move-the-focus place.
* gtk/gtkcontainer.c: Rewrite handling of left-right and up-down
focusing to be geometric in a much more obvious sense. Arrowing
around is still non-intuitive because it isn't perfect and
because entries, etc, grab the arrow keys, but it at least
usually will do what you expect now.
* gtk/gtknotebook.[ch]: Many cleanups. Moved docs inline in this
file.
* gtk/gtknotebook.c: Change tabs to be a single item in
the focus chain. Make movement of focus on tabs with arrow
keys wrap around.
* gtk/gtknotebook.c (gtk_notebook_find_child): Add
CHECK_FIND_CHILD macro to give informative error messages
instead of silent returns.
* gtk/gtknotebook.c (gtk_notebook_init): Set the RECEIVES_DEFAULT
flag since we handle GdkReturn on the tabs.
* gtk/gtknotebook.c (gtk_notebook_expose_tabs): Invalidate
windows rather than sending expose events directly.
* gtk/gtknotebook.[ch] docs/Changes-2.0.txt: Move structure
definition for GtkNotebookPage into .c file, since it is private.
* gtk/testgtk.c (create_notebook): Add option for
testing borderless notebook.
* gtk/testgtk.c (page_switch): Removed egregious poking
around in GTK+ internals.
* docs/widget-system.txt: Remove references to GTK_REDRAW_PENDING.
* gtk/gtkclist.[ch]: Remove key press handler, handle focusing
properly through gtk_clist_focus. Make the title headers a
single item in the tab-focus chain, and make left-right wrap
around.
* gtk/gtkwindow.c (gtk_window_focus): Add a custom
focus method so that wrapping around works properly.
* gtk/gtktreeview.c: Remove calls to gtk_container_set_focus_child() -
that is handled for the widget now.
Mon Dec 11 11:41:12 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinvisible.c (gtk_invisible_init): Flag invisible
@ -149,6 +207,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
2000-12-06 Elliot Lee <sopwith@redhat.com>
* configure.in: Detect freetype properly
* modules/basic/Makefile.am, gdk/linux-fb/Makefile.am: Make use of
above.

View File

@ -1,3 +1,61 @@
Wed Oct 25 14:17:43 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkwidget.[ch] (gtk_widget_is_focus): Add a function
to determine if a window is the focus widget within
its toplevel.
* gtk/gtkcontainer.[ch]: Fix the return type of ::focus
to be boolean.
* gtk/gtkcontainer.c (gtk_container_real_focus): Move handling
of the case where the container CAN_FOCUS to here instead
of having it in each individual move-the-focus place.
* gtk/gtkcontainer.c: Rewrite handling of left-right and up-down
focusing to be geometric in a much more obvious sense. Arrowing
around is still non-intuitive because it isn't perfect and
because entries, etc, grab the arrow keys, but it at least
usually will do what you expect now.
* gtk/gtknotebook.[ch]: Many cleanups. Moved docs inline in this
file.
* gtk/gtknotebook.c: Change tabs to be a single item in
the focus chain. Make movement of focus on tabs with arrow
keys wrap around.
* gtk/gtknotebook.c (gtk_notebook_find_child): Add
CHECK_FIND_CHILD macro to give informative error messages
instead of silent returns.
* gtk/gtknotebook.c (gtk_notebook_init): Set the RECEIVES_DEFAULT
flag since we handle GdkReturn on the tabs.
* gtk/gtknotebook.c (gtk_notebook_expose_tabs): Invalidate
windows rather than sending expose events directly.
* gtk/gtknotebook.[ch] docs/Changes-2.0.txt: Move structure
definition for GtkNotebookPage into .c file, since it is private.
* gtk/testgtk.c (create_notebook): Add option for
testing borderless notebook.
* gtk/testgtk.c (page_switch): Removed egregious poking
around in GTK+ internals.
* docs/widget-system.txt: Remove references to GTK_REDRAW_PENDING.
* gtk/gtkclist.[ch]: Remove key press handler, handle focusing
properly through gtk_clist_focus. Make the title headers a
single item in the tab-focus chain, and make left-right wrap
around.
* gtk/gtkwindow.c (gtk_window_focus): Add a custom
focus method so that wrapping around works properly.
* gtk/gtktreeview.c: Remove calls to gtk_container_set_focus_child() -
that is handled for the widget now.
Mon Dec 11 11:41:12 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtkinvisible.c (gtk_invisible_init): Flag invisible
@ -149,6 +207,7 @@ Mon Dec 11 10:02:26 2000 Owen Taylor <otaylor@redhat.com>
2000-12-06 Elliot Lee <sopwith@redhat.com>
* configure.in: Detect freetype properly
* modules/basic/Makefile.am, gdk/linux-fb/Makefile.am: Make use of
above.

View File

@ -255,6 +255,10 @@ Incompatible Changes from GTK+-1.2 to GTK+-2.0:
void gtk_progress_bar_set_orientation (GtkProgressBar *pbar,
GtkProgressBarOrientation orientation);
* The GtkNotebookPage structure has been removed from the public header files;
this was never meant to be a public structure, and all functionality that
could be done by accessing the struct fields of this structure should be
accesible otherwise.
- GtkMenuPositionFunc has a new parameter push_in which controls how
menus placed outside the screen is handled. If this is set to true and

View File

@ -1,3 +1,8 @@
Wed Oct 25 15:19:40 2000 Owen Taylor <otaylor@redhat.com>
* gtk/tmpl/gtknotebook.sgml: Moved function docs into .c
file, fairly extensive rewriting.
Thu Nov 30 00:53:45 2000 Owen Taylor <otaylor@redhat.com>
* gtk/tmpl/gtkfilesel.sgml: Fix to say that file_selection_complete()

View File

@ -2,13 +2,21 @@
GtkNotebook
<!-- ##### SECTION Short_Description ##### -->
Set of pages with bookmarks.
A tabbed notebook container.
<!-- ##### SECTION Long_Description ##### -->
<para>
The #GtkNotebook widget is a #GtkContainer whose children are pages that
can be accessed through bookmarks. The pages are displayed all at the same
place. <!-- TODO: talk about the menu -->
can be switched between using tab labels along one edge.
</para>
<para>
There are many configuration options for #GtkNotebook. Among other
things, you can choose on which edge the tabs appear
(see gtk_notebook_set_tab_pos()), whether, if there are too many
tabs to fit the noteobook should be made bigger or scrolling
arrows added (see gtk_notebook_set_scrollable), and whether there
will be a popup menu allowing the users to switch pages.
(see gtk_notebook_enable_popup(), gtk_noteobook_disable_popup())
</para>
<!-- ##### SECTION See_Also ##### -->
@ -28,124 +36,83 @@ place. <!-- TODO: talk about the menu -->
</para>
<!-- ##### MACRO GTK_NOTEBOOK_PAGE ##### -->
<para>
Extracts the contents of the current element of #GList @_glist_ as a
#GtkNotebookPage.
</para>
@_glist_:
<!-- ##### STRUCT GtkNotebookPage ##### -->
<para>
The #GtkNotebookPage structure is used to store the pages of a notebook. It
is not an object.
The #GtkNotebookPage is an opaque implementation detail of #GtkNotebook.
</para>
@child: the contents of the page
@tab_label: the label shown in the bookmark
@menu_label: the label shown in the popup menu
@default_menu:
@default_tab:
@expand:
@fill:
@pack:
@requisition:
@allocation:
<!-- ##### FUNCTION gtk_notebook_new ##### -->
<para>
Creates a new #GtkNotebook widget
</para>
@Returns: the newly created G=#GtkNotebook
@Returns:
<!-- ##### FUNCTION gtk_notebook_append_page ##### -->
<para>
Appends to @notebook a page whose content is @child, and whose bookmark is
@tab_label.
</para>
@notebook: the notebook widget
@child: the content of the new page
@tab_label: the bookmark for the page
@notebook:
@child:
@tab_label:
<!-- ##### FUNCTION gtk_notebook_append_page_menu ##### -->
<para>
Appends to @notebook a page whose content is @child, whose bookmark is
@tab_label, and whose menu label is @menu_label.
</para>
@notebook: the notebook widget
@child: the content of the new page
@tab_label: the bookmark of the page
@menu_label: the menu label of the page
@notebook:
@child:
@tab_label:
@menu_label:
<!-- ##### FUNCTION gtk_notebook_prepend_page ##### -->
<para>
Prepends to @notebook a page whose content is @child, whose bookmark is
@tab_label, and whose menu label is @menu_label.
</para>
@notebook: the notebook widget
@child: the content of the new page
@tab_label: the bookmark of the page
@notebook:
@child: the
@tab_label:
<!-- ##### FUNCTION gtk_notebook_prepend_page_menu ##### -->
<para>
Appends to @notebook a page whose content is @child, whose bookmark is
@tab_label, and whose menu label is @menu_label.
</para>
@notebook: the notebook widget
@child: the content of the new page
@tab_label: the bookmark of the page
@menu_label: the menu label of the page
@notebook:
@child:
@tab_label:
@menu_label:
<!-- ##### FUNCTION gtk_notebook_insert_page ##### -->
<para>
Inserts in @notebook a new page whose content is @child, and whose
bookmark is @tab_label. The page is inserted just
before the page number @position, starting with 0. If @position is out of
bounds, it is assumed to be the current number of pages.
</para>
@notebook: the notebook widget
@child: the content of the new page
@tab_label: the bookmark of the page
@position: the position to insert the page
@notebook:
@child:
@tab_label:
@position:
<!-- ##### FUNCTION gtk_notebook_insert_page_menu ##### -->
<para>
Inserts in @notebook a new page whose content is @child, whose bookmark is
@tab_label, and whose menu label is @menu_label. The page is inserted just
before the page number @position, starting with 0. If @position is out of
bounds, it is assumed to be the current number of pages.
</para>
@notebook: the notebook widget
@child: the content of the new page
@tab_label: the bookmark of the page
@menu_label: the menu label of the page
@position: the position to insert the page
@notebook:
@child:
@tab_label:
@menu_label:
@position:
<!-- ##### FUNCTION gtk_notebook_remove_page ##### -->
<para>
Removes the page @page_num form @notebook. Pages are numbered starting at
zero. Negative values stand for the last page; too large values are
ignored.
</para>
@notebook: the notebook widget
@page_num: the page number
@notebook:
@page_num:
<!-- ##### MACRO gtk_notebook_current_page ##### -->
@ -157,56 +124,45 @@ Compatibility macro; in gtkcompat.h.
<!-- ##### FUNCTION gtk_notebook_page_num ##### -->
<para>
Returns the page number of @child in @notebook.
</para>
@notebook: the notebook widget
@child: the child
@Returns: the page number, or -1 if @child is not in @notebook
@notebook:
@child:
@Returns:
<!-- ##### FUNCTION gtk_notebook_set_page ##### -->
<para>
Switches to the page number @page_num. Negative values stand for the last
page; too large values are ignored.
</para>
@notebook: the notebook widget
@page_num: the page number
@notebook:
@page_num:
<!-- ##### FUNCTION gtk_notebook_next_page ##### -->
<para>
Switches to the next page. Nothing happens if the current page is the last
page.
</para>
@notebook: the notebook widget.
@notebook:
<!-- ##### FUNCTION gtk_notebook_prev_page ##### -->
<para>
Switches to the previous page. Nothing happens if the current page is the
first page.
</para>
@notebook: the notebook widget
@notebook:
<!-- ##### FUNCTION gtk_notebook_reorder_child ##### -->
<para>
Moves the page @child, so that it appears in position @position. Out of
bounds @position will be clamped.
</para>
@notebook: the notebook widget
@child: the child to deplace
@position: the new position
@notebook
@child:
@position:
<!-- ##### FUNCTION gtk_notebook_set_tab_pos ##### -->
<para>
Sets the position of the bookmarks.
</para>
@notebook: the notebook widget
@ -215,62 +171,51 @@ Sets the position of the bookmarks.
<!-- ##### FUNCTION gtk_notebook_set_show_tabs ##### -->
<para>
Sets whether to show the bookmarks or not.
</para>
@notebook: the notebook widget
@show_tabs: a boolean value
@notebook:
@show_tabs:
<!-- ##### FUNCTION gtk_notebook_set_show_border ##### -->
<para>
Sets whether to show the border of the notebook or not. Bookmarks are in the
border.
</para>
@notebook: the notebook widget
@show_border: a boolean value
@notebook:
@show_border:
<!-- ##### FUNCTION gtk_notebook_set_scrollable ##### -->
<para>
Sets whether the bookmarks area may be scrollable or not if there are too
many bookmarks to fit in the allocated area.
</para>
@notebook: the notebook widget
@scrollable: a boolean value
@notebook:
@scrollable:
<!-- ##### FUNCTION gtk_notebook_set_tab_border ##### -->
<para>
Sets whether there should be a border around the bookmarks or not.
</para>
@notebook: the notebook widget
@border_width: a boolean value
@notebook:
@border_width:
<!-- ##### FUNCTION gtk_notebook_popup_enable ##### -->
<para>
Enables the popup menu: if the user clicks with the right mouse button on
the bookmarks, a menu with all the pages will be popped up.
</para>
@notebook: the notebook widget
@notebook:
<!-- ##### FUNCTION gtk_notebook_popup_disable ##### -->
<para>
Disables the popup menu
</para>
@notebook: the notebook widget
@notebook:
<!-- ##### FUNCTION gtk_notebook_get_current_page ##### -->
<para>
Returns the page number of the current page.
</para>
@notebook: the notebook widget
@ -279,129 +224,108 @@ Returns the page number of the current page.
<!-- ##### FUNCTION gtk_notebook_get_menu_label ##### -->
<para>
Returns the menu label of the page @child. NULL is returned if @child is not
in @notebook or NULL if it has the default menu label.
</para>
@notebook: the notebook widget
@child: the page
@Returns: the menu label
@notebook:
@child:
@Returns:
<!-- ##### FUNCTION gtk_notebook_get_nth_page ##### -->
<para>
Returns the content of the page number @page_num, or NULL if @page_num is
out of bounds.
</para>
@notebook: the notebook widget
@page_num: the page number
@Returns: the content of the page
@notebook:
@page_num:
@Returns:
<!-- ##### FUNCTION gtk_notebook_get_tab_label ##### -->
<para>
Returns the menu tab of the page @child. NULL is returned if @child is not
in @notebook or NULL if it has the default tab label.
</para>
@notebook: the notebook widget
@child: the page
@Returns: the tab label
@notebook:
@child:
@Returns:
<!-- ##### FUNCTION gtk_notebook_query_tab_label_packing ##### -->
<para>
Looks for the packing attributes of the bookmarks of @child.
</para>
@notebook: the notebook widget
@child: the page
@expand: a pointer to return the expand value (or NULL)
@fill: a pointer to return the fill value (or NULL)
@pack_type: a pointer to return the pack_type (or NULL)
@notebook:
@child:
@expand:
@fill:
@pack_type:
<!-- ##### FUNCTION gtk_notebook_set_homogeneous_tabs ##### -->
<para>
Sets whether the tabs must have all the same size or not.
</para>
@notebook: the notebook widget
@homogeneous: a boolean value
@notebook:
@homogeneous:
<!-- ##### FUNCTION gtk_notebook_set_menu_label ##### -->
<para>
Changes the menu label of @child. Nothing happens if @child is not in
@notebook.
</para>
@notebook: the notebook widget
@child: the page
@menu_label: the menu label, or NULL for default
@notebook:
@child:
@menu_label:
<!-- ##### FUNCTION gtk_notebook_set_menu_label_text ##### -->
<para>
Creates a new label and sets it as the menu label of @child.
</para>
@notebook: the notebook widget
@child: the page
@menu_text: the label text
<!-- ##### FUNCTION gtk_notebook_set_tab_hborder ##### -->
<para>
Sets whether the tabs should have a horizontal border.
</para>
@notebook: the notebook widget
@tab_hborder: a boolean value
@notebook:
@tab_hborder:
<!-- ##### FUNCTION gtk_notebook_set_tab_label ##### -->
<para>
Changes the bookmark label of @child. Nothing happens if @child is not in
@notebook.
</para>
@notebook: the notebook widget
@child: the page
@tab_label: the bookmark label, or NULL for default
@notebook:
@child:
@tab_label:
<!-- ##### FUNCTION gtk_notebook_set_tab_label_packing ##### -->
<para>
Sets the packing parameters for the bookmark of @child. See
#GtkBoxPackStart for the exact meanings.
</para>
@notebook: the notebook widget
@child: the child widget
@expand: whether to expand the bookmark or not
@fill: whether the bookmark should fill the allocated area or not
@pack_type: the position of the bookmark
@notebook:
@child:
@expand:
@fill:
@pack_type:
<!-- ##### FUNCTION gtk_notebook_set_tab_label_text ##### -->
<para>
Creates a new label and sets it as the bookmark label of @child.
</para>
@notebook: the notebook widget
@child: the page
@tab_text: the label text
@notebook:
@child:
@tab_text:
<!-- ##### FUNCTION gtk_notebook_set_tab_vborder ##### -->
<para>
Sets whether the tabs should have a vertical border.
</para>
@notebook: the notebook widget
@tab_vborder: a boolean value
@notebook:
@tab_vborder:
<!-- ##### SIGNAL GtkNotebook::switch-page ##### -->
@ -420,46 +344,47 @@ The current page
<!-- ##### ARG GtkNotebook:tab_pos ##### -->
<para>
The position of the bookmarks
The edge at which the tabs for switching pages are drawn.
</para>
<!-- ##### ARG GtkNotebook:tab_border ##### -->
<para>
Whether the bookmarks have a border or not
Whether the tab labels have a border on all sides.
</para>
<!-- ##### ARG GtkNotebook:tab_hborder ##### -->
<para>
Whether the bookmarks have a horizontal border or not
Whether the tab labels have a horizontal border.
</para>
<!-- ##### ARG GtkNotebook:tab_vborder ##### -->
<para>
Whether the bookmarks have a vertical border or not
Whether the tab labels have a vertical border.
</para>
<!-- ##### ARG GtkNotebook:show_tabs ##### -->
<para>
Whether to show the bookmarks or not
Whether to show tabs for the notebook pages.
</para>
<!-- ##### ARG GtkNotebook:show_border ##### -->
<para>
Whether to show the border or not
Whether to draw a bevel around the noteobook.
</para>
<!-- ##### ARG GtkNotebook:scrollable ##### -->
<para>
Whether the bookmarks should be scrollable or not
Whether the tab label area will have arrows for scrolling if there
are too many tabs to fit in the area.
</para>
<!-- ##### ARG GtkNotebook:enable_popup ##### -->
<para>
Whether the popup menu is enabled or not
Whether the popup menu for switching pages is enabled.
</para>
<!-- ##### ARG GtkNotebook:homogeneous ##### -->
<para>
whether the tabs must have all the same size.
</para>

View File

@ -150,15 +150,6 @@ GTK_USER_STYLE:
wich share a global user style from the ones which got a certain
style assign from outside the toolkit.
GTK_REDRAW_PENDING:
Relies on GTK_WIDGET_MAPPED (widget).
[FIXME: this is not really enforced throughout the code, but should
be. it only requires a few checks for GTK_WIDGET_MAPPED and
minor changes to gtk_widget_unmap, we can then remove the check
in gtk_widget_real_destroy]
Means: there is an idle handler waiting for the widget, that
will cause a full redraw (gtk_widget_draw (widget, NULL)).
GTK_RESIZE_PENDING:
First, this is only valid for GtkContainers.
[some of the code should move to gtkcontainer.c therefore]
@ -245,7 +236,7 @@ In the following
Note:, the definition
[ GTK_WIDGET_DRAWABLE = GTK_WIDGET_VISIBLE && GTK_WIDGET_MAPPED
is made in gtkwidget.c, but by 3) and 5),
is made in gtkwidget.h, but by 3) and 5),
GTK_WIDGET_MAPPED => GTK_WIDGET_VISIBLE
]

View File

@ -198,8 +198,6 @@ static void gtk_clist_map (GtkWidget *widget);
static void gtk_clist_unmap (GtkWidget *widget);
static gint gtk_clist_expose (GtkWidget *widget,
GdkEventExpose *event);
static gint gtk_clist_key_press (GtkWidget *widget,
GdkEventKey *event);
static gint gtk_clist_button_press (GtkWidget *widget,
GdkEventButton *event);
static gint gtk_clist_button_release (GtkWidget *widget,
@ -217,6 +215,8 @@ static gint gtk_clist_focus_out (GtkWidget *widget,
GdkEventFocus *event);
static gint gtk_clist_focus (GtkContainer *container,
GtkDirectionType direction);
static void gtk_clist_set_focus_child (GtkContainer *container,
GtkWidget *child);
static void gtk_clist_style_set (GtkWidget *widget,
GtkStyle *previous_style);
static void gtk_clist_drag_begin (GtkWidget *widget,
@ -250,8 +250,6 @@ static void gtk_clist_drag_data_received (GtkWidget *widget,
guint time);
/* GtkContainer Methods */
static void gtk_clist_set_focus_child (GtkContainer *container,
GtkWidget *child);
static void gtk_clist_forall (GtkContainer *container,
gboolean include_internals,
GtkCallback callback,
@ -438,8 +436,11 @@ static GList *gtk_clist_mergesort (GtkCList *clist,
GList *list,
gint num);
/* Misc */
static gboolean title_focus (GtkCList *clist,
gint dir);
static gboolean title_focus_in (GtkCList *clist,
gint dir);
static gboolean title_focus_move (GtkCList *clist,
gint dir);
static void real_row_move (GtkCList *clist,
gint source_row,
gint dest_row);
@ -675,7 +676,6 @@ gtk_clist_class_init (GtkCListClass *klass)
widget_class->expose_event = gtk_clist_expose;
widget_class->size_request = gtk_clist_size_request;
widget_class->size_allocate = gtk_clist_size_allocate;
widget_class->key_press_event = gtk_clist_key_press;
widget_class->focus_in_event = gtk_clist_focus_in;
widget_class->focus_out_event = gtk_clist_focus_out;
widget_class->draw_focus = gtk_clist_draw_focus;
@ -921,7 +921,6 @@ gtk_clist_init (GtkCList *clist)
GTK_WIDGET_UNSET_FLAGS (clist, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (clist, GTK_CAN_FOCUS);
GTK_CLIST_SET_FLAG (clist, CLIST_CHILD_HAS_FOCUS);
GTK_CLIST_SET_FLAG (clist, CLIST_DRAW_DRAG_LINE);
GTK_CLIST_SET_FLAG (clist, CLIST_USE_DRAG_ICONS);
@ -973,6 +972,7 @@ gtk_clist_init (GtkCList *clist)
clist->undo_unselection = NULL;
clist->focus_row = -1;
clist->focus_header_column = -1;
clist->undo_anchor = -1;
clist->anchor = -1;
@ -4425,7 +4425,6 @@ gtk_clist_finalize (GObject *object)
* gtk_clist_unmap
* gtk_clist_expose
* gtk_clist_style_set
* gtk_clist_key_press
* gtk_clist_button_press
* gtk_clist_button_release
* gtk_clist_motion
@ -4466,7 +4465,6 @@ gtk_clist_realize (GtkWidget *widget)
attributes.event_mask |= (GDK_EXPOSURE_MASK |
GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_KEY_PRESS_MASK |
GDK_KEY_RELEASE_MASK);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
@ -4524,8 +4522,7 @@ gtk_clist_realize (GtkWidget *widget)
attributes.event_mask = (GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK |
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_KEY_PRESS_MASK);
GDK_POINTER_MOTION_HINT_MASK);
attributes_mask = GDK_WA_CURSOR;
attributes.cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
clist->cursor_drag = attributes.cursor;
@ -4841,34 +4838,6 @@ gtk_clist_style_set (GtkWidget *widget,
}
}
static gint
gtk_clist_key_press (GtkWidget *widget,
GdkEventKey *event)
{
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CLIST (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
if (GTK_WIDGET_CLASS (parent_class)->key_press_event &&
GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event))
return TRUE;
switch (event->keyval)
{
case GDK_Tab:
case GDK_ISO_Left_Tab:
if (event->state & GDK_SHIFT_MASK)
return gtk_container_focus (GTK_CONTAINER (widget),
GTK_DIR_TAB_BACKWARD);
else
return gtk_container_focus (GTK_CONTAINER (widget),
GTK_DIR_TAB_FORWARD);
default:
break;
}
return FALSE;
}
static gint
gtk_clist_button_press (GtkWidget *widget,
GdkEventButton *event)
@ -6196,6 +6165,7 @@ hadjustment_value_changed (GtkAdjustment *adjustment,
gpointer data)
{
GtkCList *clist;
GtkContainer *container;
GdkRectangle area;
gint i;
gint y = 0;
@ -6207,6 +6177,7 @@ hadjustment_value_changed (GtkAdjustment *adjustment,
g_return_if_fail (GTK_IS_CLIST (data));
clist = GTK_CLIST (data);
container = GTK_CONTAINER (data);
if (!GTK_WIDGET_DRAWABLE (clist) || adjustment != clist->hadjustment)
return;
@ -6250,7 +6221,7 @@ hadjustment_value_changed (GtkAdjustment *adjustment,
}
if (GTK_WIDGET_CAN_FOCUS(clist) && GTK_WIDGET_HAS_FOCUS(clist) &&
!GTK_CLIST_CHILD_HAS_FOCUS(clist) && GTK_CLIST_ADD_MODE(clist))
!container->focus_child && GTK_CLIST_ADD_MODE(clist))
{
y = ROW_TOP_YPIXEL (clist, clist->focus_row);
@ -6285,7 +6256,7 @@ hadjustment_value_changed (GtkAdjustment *adjustment,
}
if (GTK_WIDGET_CAN_FOCUS(clist) && GTK_WIDGET_HAS_FOCUS(clist) &&
!GTK_CLIST_CHILD_HAS_FOCUS(clist) && GTK_CLIST_ADD_MODE(clist))
!container->focus_child && GTK_CLIST_ADD_MODE(clist))
{
y = ROW_TOP_YPIXEL (clist, clist->focus_row);
@ -6313,7 +6284,7 @@ hadjustment_value_changed (GtkAdjustment *adjustment,
check_exposures (clist);
if (GTK_WIDGET_CAN_FOCUS(clist) && GTK_WIDGET_HAS_FOCUS(clist) &&
!GTK_CLIST_CHILD_HAS_FOCUS(clist))
!container->focus_child)
{
if (GTK_CLIST_ADD_MODE(clist))
{
@ -6503,108 +6474,114 @@ row_delete (GtkCList *clist,
}
/* FOCUS FUNCTIONS
* gtk_clist_focus_content_area
* gtk_clist_focus
* gtk_clist_draw_focus
* gtk_clist_focus_in
* gtk_clist_focus_out
* gtk_clist_set_focus_child
* title_focus
*/
static gint
static void
gtk_clist_focus_content_area (GtkCList *clist)
{
if (clist->focus_row < 0)
{
clist->focus_row = 0;
if ((clist->selection_mode == GTK_SELECTION_BROWSE ||
clist->selection_mode == GTK_SELECTION_EXTENDED) &&
!clist->selection)
gtk_signal_emit (GTK_OBJECT (clist),
clist_signals[SELECT_ROW],
clist->focus_row, -1, NULL);
}
gtk_widget_grab_focus (GTK_WIDGET (clist));
}
static gboolean
gtk_clist_focus (GtkContainer *container,
GtkDirectionType direction)
{
GtkCList *clist;
GtkWidget *focus_child;
gint old_row;
g_return_val_if_fail (container != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CLIST (container), FALSE);
GtkCList *clist = GTK_CLIST (container);
GtkWidget *focus_child = container->focus_child;
gboolean is_current_focus;
if (!GTK_WIDGET_IS_SENSITIVE (container))
return FALSE;
clist = GTK_CLIST (container);
focus_child = container->focus_child;
old_row = clist->focus_row;
is_current_focus = gtk_widget_is_focus (GTK_WIDGET (clist));
if (focus_child &&
GTK_IS_CONTAINER (focus_child) &&
GTK_WIDGET_DRAWABLE (focus_child) &&
GTK_WIDGET_IS_SENSITIVE (focus_child) &&
gtk_container_focus (GTK_CONTAINER (focus_child), direction))
return TRUE;
switch (direction)
{
case GTK_DIR_LEFT:
case GTK_DIR_RIGHT:
if (GTK_CLIST_CHILD_HAS_FOCUS(clist))
if (focus_child)
{
if (title_focus (clist, direction))
if (title_focus_move (clist, direction))
return TRUE;
gtk_container_set_focus_child (container, NULL);
return FALSE;
}
gtk_widget_grab_focus (GTK_WIDGET (container));
return TRUE;
}
else if (!is_current_focus)
{
gtk_clist_focus_content_area (clist);
return TRUE;
}
break;
case GTK_DIR_DOWN:
case GTK_DIR_TAB_FORWARD:
if (GTK_CLIST_CHILD_HAS_FOCUS(clist))
if (!focus_child && !is_current_focus)
{
gboolean tf = FALSE;
if (((focus_child && direction == GTK_DIR_DOWN) ||
!(tf = title_focus (clist, GTK_DIR_TAB_FORWARD)))
&& clist->rows)
{
if (clist->focus_row < 0)
{
clist->focus_row = 0;
if ((clist->selection_mode == GTK_SELECTION_BROWSE ||
clist->selection_mode == GTK_SELECTION_EXTENDED) &&
!clist->selection)
gtk_signal_emit (GTK_OBJECT (clist),
clist_signals[SELECT_ROW],
clist->focus_row, -1, NULL);
}
gtk_widget_grab_focus (GTK_WIDGET (container));
return TRUE;
}
if (tf)
if (title_focus_in (clist, direction))
return TRUE;
}
GTK_CLIST_SET_FLAG (clist, CLIST_CHILD_HAS_FOCUS);
if (!is_current_focus && clist->rows)
{
gtk_clist_focus_content_area (clist);
return TRUE;
}
break;
case GTK_DIR_UP:
case GTK_DIR_TAB_BACKWARD:
if (!focus_child &&
GTK_CLIST_CHILD_HAS_FOCUS(clist) && clist->rows)
if (!focus_child && is_current_focus)
{
if (clist->focus_row < 0)
{
clist->focus_row = 0;
if ((clist->selection_mode == GTK_SELECTION_BROWSE ||
clist->selection_mode == GTK_SELECTION_EXTENDED) &&
!clist->selection)
gtk_signal_emit (GTK_OBJECT (clist),
clist_signals[SELECT_ROW],
clist->focus_row, -1, NULL);
}
gtk_widget_grab_focus (GTK_WIDGET (container));
return TRUE;
if (title_focus_in (clist, direction))
return TRUE;
}
GTK_CLIST_SET_FLAG (clist, CLIST_CHILD_HAS_FOCUS);
if (title_focus (clist, direction))
return TRUE;
if (!is_current_focus && !focus_child && clist->rows)
{
gtk_clist_focus_content_area (clist);
return TRUE;
}
break;
default:
break;
}
gtk_container_set_focus_child (container, NULL);
return FALSE;
}
static void
gtk_clist_set_focus_child (GtkContainer *container,
GtkWidget *child)
{
GtkCList *clist = GTK_CLIST (container);
gint i;
for (i = 0; i < clist->columns; i++)
if (clist->column[i].button == child)
clist->focus_header_column = i;
parent_class->set_focus_child (container, child);
}
static void
gtk_clist_draw_focus (GtkWidget *widget)
{
@ -6635,7 +6612,6 @@ gtk_clist_focus_in (GtkWidget *widget,
g_return_val_if_fail (event != NULL, FALSE);
GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
GTK_CLIST_UNSET_FLAG (widget, CLIST_CHILD_HAS_FOCUS);
clist = GTK_CLIST (widget);
@ -6668,7 +6644,6 @@ gtk_clist_focus_out (GtkWidget *widget,
g_return_val_if_fail (event != NULL, FALSE);
GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
GTK_CLIST_SET_FLAG (widget, CLIST_CHILD_HAS_FOCUS);
gtk_widget_draw_focus (widget);
@ -6679,123 +6654,154 @@ gtk_clist_focus_out (GtkWidget *widget,
return FALSE;
}
static void
gtk_clist_set_focus_child (GtkContainer *container,
GtkWidget *child)
static gboolean
focus_column (GtkCList *clist, gint column, gint dir)
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CLIST (container));
GtkWidget *child = clist->column[column].button;
if (child)
if (GTK_IS_CONTAINER (child) &&
gtk_container_focus (GTK_CONTAINER (child), dir))
{
g_return_if_fail (GTK_IS_WIDGET (child));
GTK_CLIST_SET_FLAG (container, CLIST_CHILD_HAS_FOCUS);
return TRUE;
}
else if (GTK_WIDGET_CAN_FOCUS (child))
{
gtk_widget_grab_focus (child);
return TRUE;
}
parent_class->set_focus_child (container, child);
return FALSE;
}
/* Focus moved onto the headers. Focus first focusable and visible child.
* (FIXME: focus the last focused child if visible)
*/
static gboolean
title_focus (GtkCList *clist,
gint dir)
title_focus_in (GtkCList *clist, gint dir)
{
gint i;
gint left, right;
/* Check last focused column */
if (clist->focus_header_column != -1)
{
i = clist->focus_header_column;
left = COLUMN_LEFT_XPIXEL (clist, i);
right = left + clist->column[i].area.width;
if (left >= 0 && right <= clist->clist_window_width)
{
if (focus_column (clist, i, dir))
return TRUE;
}
}
/* Check fully visible columns */
for (i = 0 ; i < clist->columns ; i++)
{
left = COLUMN_LEFT_XPIXEL (clist, i);
right = left + clist->column[i].area.width;
if (left >= 0 && right <= clist->clist_window_width)
{
if (focus_column (clist, i, dir))
return TRUE;
}
}
/* Check partially visible columns */
for (i = 0 ; i < clist->columns ; i++)
{
left = COLUMN_LEFT_XPIXEL (clist, i);
right = left + clist->column[i].area.width;
if ((left < 0 && right > 0) ||
(left < clist->clist_window_width && right > clist->clist_window_width))
{
if (focus_column (clist, i, dir))
return TRUE;
}
}
return FALSE;
}
/* Move the focus right or left within the title buttons, scrolling
* as necessary to keep the focused child visible.
*/
static gboolean
title_focus_move (GtkCList *clist,
gint dir)
{
GtkWidget *focus_child;
gboolean return_val = FALSE;
gint last_column;
gint d = 1;
gint i = 0;
gint d = 0;
gint i = -1;
gint j;
if (!GTK_CLIST_SHOW_TITLES(clist))
return FALSE;
focus_child = GTK_CONTAINER (clist)->focus_child;
g_assert (focus_child);
for (last_column = clist->columns - 1;
last_column >= 0 && !clist->column[last_column].visible; last_column--)
;
/* Movement direction within headers
*/
switch (dir)
{
case GTK_DIR_TAB_BACKWARD:
case GTK_DIR_UP:
if (!focus_child || !GTK_CLIST_CHILD_HAS_FOCUS(clist))
{
if (dir == GTK_DIR_UP)
i = COLUMN_FROM_XPIXEL (clist, 0);
else
i = last_column;
focus_child = clist->column[i].button;
dir = GTK_DIR_TAB_FORWARD;
}
else
d = -1;
case GTK_DIR_RIGHT:
d = 1;
break;
case GTK_DIR_LEFT:
d = -1;
if (!focus_child)
{
i = last_column;
focus_child = clist->column[i].button;
}
break;
case GTK_DIR_RIGHT:
if (!focus_child)
{
i = 0;
focus_child = clist->column[i].button;
}
break;
}
if (focus_child)
while (i < clist->columns)
{
if (clist->column[i].button == focus_child)
{
if (clist->column[i].button &&
GTK_WIDGET_VISIBLE (clist->column[i].button) &&
GTK_IS_CONTAINER (clist->column[i].button) &&
!GTK_WIDGET_HAS_FOCUS(clist->column[i].button))
if (gtk_container_focus
(GTK_CONTAINER (clist->column[i].button), dir))
for (i = 0; i < clist->columns; i++)
if (clist->column[i].button == focus_child)
break;
g_assert (i != -1); /* Have a starting column */
j = i + d;
while (!return_val && j >= 0 && j < clist->columns)
{
if (clist->column[j].button &&
GTK_WIDGET_VISIBLE (clist->column[j].button))
{
if (focus_column (clist, j, dir))
{
return_val = TRUE;
break;
}
}
j += d;
}
/* If we didn't find it, wrap around and keep looking
*/
if (!return_val)
{
j = d > 0 ? 0 : clist->columns - 1;
while (!return_val && j != i)
{
if (clist->column[j].button &&
GTK_WIDGET_VISIBLE (clist->column[j].button))
{
if (focus_column (clist, j, dir))
{
return_val = TRUE;
i -= d;
break;
}
if (!return_val && dir == GTK_DIR_UP)
return FALSE;
i += d;
break;
}
i++;
}
j = i;
if (!return_val)
while (j >= 0 && j < clist->columns)
{
if (clist->column[j].button &&
GTK_WIDGET_VISIBLE (clist->column[j].button))
{
if (GTK_IS_CONTAINER (clist->column[j].button) &&
gtk_container_focus
(GTK_CONTAINER (clist->column[j].button), dir))
{
return_val = TRUE;
break;
}
else if (GTK_WIDGET_CAN_FOCUS (clist->column[j].button))
{
gtk_widget_grab_focus (clist->column[j].button);
return_val = TRUE;
break;
}
}
j += d;
}
}
j += d;
}
}
/* Scroll horizontally so focused column is visible
*/
if (return_val)
{
if (COLUMN_LEFT_XPIXEL (clist, j) < CELL_SPACING + COLUMN_INSET)
@ -6803,13 +6809,20 @@ title_focus (GtkCList *clist,
else if (COLUMN_LEFT_XPIXEL(clist, j) + clist->column[j].area.width >
clist->clist_window_width)
{
gint last_column;
for (last_column = clist->columns - 1;
last_column >= 0 && !clist->column[last_column].visible; last_column--);
if (j == last_column)
gtk_clist_moveto (clist, -1, j, 0, 0);
else
gtk_clist_moveto (clist, -1, j, 0, 1);
}
}
return return_val;
return TRUE; /* Even if we didn't find a new one, we can keep the
* focus in the same place.
*/
}
/* PRIVATE SCROLLING FUNCTIONS

View File

@ -46,7 +46,7 @@ enum {
GTK_CLIST_IN_DRAG = 1 << 0,
GTK_CLIST_ROW_HEIGHT_SET = 1 << 1,
GTK_CLIST_SHOW_TITLES = 1 << 2,
GTK_CLIST_CHILD_HAS_FOCUS = 1 << 3,
/* Unused */
GTK_CLIST_ADD_MODE = 1 << 4,
GTK_CLIST_AUTO_SORT = 1 << 5,
GTK_CLIST_AUTO_RESIZE_BLOCKED = 1 << 6,
@ -97,7 +97,6 @@ typedef enum
#define GTK_CLIST_IN_DRAG(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_IN_DRAG)
#define GTK_CLIST_ROW_HEIGHT_SET(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ROW_HEIGHT_SET)
#define GTK_CLIST_SHOW_TITLES(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_SHOW_TITLES)
#define GTK_CLIST_CHILD_HAS_FOCUS(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_CHILD_HAS_FOCUS)
#define GTK_CLIST_ADD_MODE(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_ADD_MODE)
#define GTK_CLIST_AUTO_SORT(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_SORT)
#define GTK_CLIST_AUTO_RESIZE_BLOCKED(clist) (GTK_CLIST_FLAGS (clist) & GTK_CLIST_AUTO_RESIZE_BLOCKED)
@ -226,6 +225,8 @@ struct _GtkCList
/* focus handling */
gint focus_row;
gint focus_header_column;
/* dragging the selection */
gint anchor;
GtkStateType anchor_state;

View File

@ -24,13 +24,15 @@
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
*/
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "gtkcontainer.h"
#include "gtkprivate.h"
#include "gtksignal.h"
#include "gtkmain.h"
#include <stdarg.h>
#include "gtkwindow.h"
enum {
ADD,
@ -59,41 +61,42 @@ struct _GtkChildArgInfo
guint seq_id;
};
static void gtk_container_base_class_init (GtkContainerClass *klass);
static void gtk_container_class_init (GtkContainerClass *klass);
static void gtk_container_init (GtkContainer *container);
static void gtk_container_destroy (GtkObject *object);
static void gtk_container_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_container_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_container_add_unimplemented (GtkContainer *container,
GtkWidget *widget);
static void gtk_container_remove_unimplemented (GtkContainer *container,
GtkWidget *widget);
static void gtk_container_real_check_resize (GtkContainer *container);
static gint gtk_container_real_focus (GtkContainer *container,
GtkDirectionType direction);
static void gtk_container_real_set_focus_child (GtkContainer *container,
GtkWidget *widget);
static gint gtk_container_focus_tab (GtkContainer *container,
GList *children,
GtkDirectionType direction);
static gint gtk_container_focus_up_down (GtkContainer *container,
GList *children,
GtkDirectionType direction);
static gint gtk_container_focus_left_right (GtkContainer *container,
GList *children,
GtkDirectionType direction);
static gint gtk_container_focus_move (GtkContainer *container,
GList *children,
GtkDirectionType direction);
static void gtk_container_children_callback (GtkWidget *widget,
gpointer client_data);
static void gtk_container_show_all (GtkWidget *widget);
static void gtk_container_hide_all (GtkWidget *widget);
static void gtk_container_base_class_init (GtkContainerClass *klass);
static void gtk_container_class_init (GtkContainerClass *klass);
static void gtk_container_init (GtkContainer *container);
static void gtk_container_destroy (GtkObject *object);
static void gtk_container_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_container_set_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void gtk_container_add_unimplemented (GtkContainer *container,
GtkWidget *widget);
static void gtk_container_remove_unimplemented (GtkContainer *container,
GtkWidget *widget);
static void gtk_container_real_check_resize (GtkContainer *container);
static gboolean gtk_container_real_focus (GtkContainer *container,
GtkDirectionType direction);
static void gtk_container_real_set_focus_child (GtkContainer *container,
GtkWidget *widget);
static gboolean gtk_container_focus_tab (GtkContainer *container,
GList *children,
GtkDirectionType direction);
static gboolean gtk_container_focus_up_down (GtkContainer *container,
GList **children,
GtkDirectionType direction);
static gboolean gtk_container_focus_left_right (GtkContainer *container,
GList **children,
GtkDirectionType direction);
static gboolean gtk_container_focus_move (GtkContainer *container,
GList *children,
GtkDirectionType direction);
static void gtk_container_children_callback (GtkWidget *widget,
gpointer client_data);
static void gtk_container_show_all (GtkWidget *widget);
static void gtk_container_hide_all (GtkWidget *widget);
static gchar* gtk_container_child_default_composite_name (GtkContainer *container,
GtkWidget *child);
@ -1182,7 +1185,7 @@ gtk_container_foreach_full (GtkContainer *container,
notify (callback_data);
}
gint
gboolean
gtk_container_focus (GtkContainer *container,
GtkDirectionType direction)
{
@ -1342,7 +1345,7 @@ gtk_container_real_set_focus_child (GtkContainer *container,
}
}
static gint
static gboolean
gtk_container_real_focus (GtkContainer *container,
GtkDirectionType direction)
{
@ -1364,8 +1367,11 @@ gtk_container_real_focus (GtkContainer *container,
if (GTK_WIDGET_CAN_FOCUS (container))
{
gtk_widget_grab_focus (GTK_WIDGET (container));
return_val = TRUE;
if (!GTK_WIDGET_HAS_FOCUS (container))
{
gtk_widget_grab_focus (GTK_WIDGET (container));
return_val = TRUE;
}
}
else
{
@ -1407,11 +1413,11 @@ gtk_container_real_focus (GtkContainer *container,
break;
case GTK_DIR_UP:
case GTK_DIR_DOWN:
return_val = gtk_container_focus_up_down (container, children, direction);
return_val = gtk_container_focus_up_down (container, &children, direction);
break;
case GTK_DIR_LEFT:
case GTK_DIR_RIGHT:
return_val = gtk_container_focus_left_right (container, children, direction);
return_val = gtk_container_focus_left_right (container, &children, direction);
break;
}
@ -1422,7 +1428,7 @@ gtk_container_real_focus (GtkContainer *container,
return return_val;
}
static gint
static gboolean
gtk_container_focus_tab (GtkContainer *container,
GList *children,
GtkDirectionType direction)
@ -1493,227 +1499,285 @@ gtk_container_focus_tab (GtkContainer *container,
return gtk_container_focus_move (container, children, direction);
}
static gboolean
old_focus_coords (GtkContainer *container, GdkRectangle *old_focus_rect)
{
GtkWidget *widget = GTK_WIDGET (container);
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
if (toplevel &&
GTK_IS_WINDOW (toplevel) && GTK_WINDOW (toplevel)->focus_widget &&
GTK_WIDGET_REALIZED (container) &&
GTK_WIDGET_REALIZED (GTK_WINDOW (toplevel)->focus_widget))
{
GtkWidget *old_focus = GTK_WINDOW (toplevel)->focus_widget;
GdkWindow *old_parent_window = old_focus->parent ? old_focus->parent->window : old_focus->window;
GdkWindow *new_parent_window = widget->window;
GdkWindow *toplevel_window = toplevel->window;
*old_focus_rect = old_focus->allocation;
/* Translate coordinates to the toplevel */
while (old_parent_window != toplevel_window)
{
gint dx, dy;
gdk_window_get_position (old_parent_window, &dx, &dy);
old_focus_rect->x += dx;
old_focus_rect->y += dy;
old_parent_window = gdk_window_get_parent (old_parent_window);
}
/* Translate coordinates back to the new container */
while (new_parent_window != toplevel_window)
{
gint dx, dy;
gdk_window_get_position (new_parent_window, &dx, &dy);
old_focus_rect->x -= dx;
old_focus_rect->y -= dy;
new_parent_window = gdk_window_get_parent (new_parent_window);
}
return TRUE;
}
return FALSE;
}
typedef struct _CompareInfo CompareInfo;
struct _CompareInfo
{
gint x;
gint y;
};
static gint
up_down_compare (gconstpointer a,
gconstpointer b,
gpointer data)
{
const GtkWidget *child1 = a;
const GtkWidget *child2 = b;
CompareInfo *compare = data;
gint y1 = child1->allocation.y + child1->allocation.height / 2;
gint y2 = child2->allocation.y + child2->allocation.height / 2;
if (y1 == y2)
{
gint x1 = abs (child1->allocation.x + child1->allocation.width / 2 - compare->x);
gint x2 = abs (child2->allocation.x + child2->allocation.width / 2 - compare->x);
if (compare->y < y1)
return (x1 < x2) ? -1 : ((x1 == x2) ? 0 : 1);
else
return (x1 < x2) ? 1 : ((x1 == x2) ? 0 : -1);
}
else
return (y1 < y2) ? -1 : 1;
}
static gboolean
gtk_container_focus_up_down (GtkContainer *container,
GList *children,
GList **children,
GtkDirectionType direction)
{
GtkWidget *child;
GtkWidget *child2;
CompareInfo compare;
GList *tmp_list;
gint dist1, dist2;
gint focus_x;
gint focus_width;
guint length;
guint i, j;
/* return failure if there isn't a focus child */
if (container->focus_child)
{
focus_width = container->focus_child->allocation.width / 2;
focus_x = container->focus_child->allocation.x + focus_width;
gint compare_x1;
gint compare_x2;
gint compare_y;
/* Delete widgets from list that don't match minimum criteria */
compare_x1 = container->focus_child->allocation.x;
compare_x2 = container->focus_child->allocation.x + container->focus_child->allocation.width;
if (direction == GTK_DIR_UP)
compare_y = container->focus_child->allocation.y;
else
compare_y = container->focus_child->allocation.y + container->focus_child->allocation.height;
tmp_list = *children;
while (tmp_list)
{
GtkWidget *child = tmp_list->data;
GList *next = tmp_list->next;
gint child_x1, child_x2;
if (child != container->focus_child)
{
child_x1 = child->allocation.x;
child_x2 = child->allocation.x + child->allocation.width;
if ((child_x2 <= compare_x1 || child_x1 >= compare_x2) /* No horizontal overlap */ ||
(direction == GTK_DIR_DOWN && child->allocation.y + child->allocation.height < compare_y) || /* Not below */
(direction == GTK_DIR_UP && child->allocation.y > compare_y)) /* Not above */
{
*children = g_list_delete_link (*children, tmp_list);
}
}
tmp_list = next;
}
compare.x = (compare_x1 + compare_x2) / 2;
compare.y = container->focus_child->allocation.y + container->focus_child->allocation.height / 2;
}
else
{
focus_width = GTK_WIDGET (container)->allocation.width;
if (GTK_WIDGET_NO_WINDOW (container))
focus_x = GTK_WIDGET (container)->allocation.x;
/* No old focus widget, need to figure out starting x,y some other way
*/
GtkWidget *widget = GTK_WIDGET (container);
GdkRectangle old_focus_rect;
if (old_focus_coords (container, &old_focus_rect))
{
compare.x = old_focus_rect.x + old_focus_rect.width / 2;
}
else
focus_x = 0;
}
length = g_list_length (children);
/* sort the children in the y direction */
for (i = 1; i < length; i++)
{
j = i;
tmp_list = g_list_nth (children, j);
child = tmp_list->data;
while (j > 0)
{
child2 = tmp_list->prev->data;
if (child->allocation.y < child2->allocation.y)
{
tmp_list->data = tmp_list->prev->data;
tmp_list = tmp_list->prev;
j--;
}
if (GTK_WIDGET_NO_WINDOW (widget))
compare.x = widget->allocation.x + widget->allocation.width / 2;
else
break;
compare.x = widget->allocation.width / 2;
}
tmp_list->data = child;
if (GTK_WIDGET_NO_WINDOW (widget))
compare.y = (direction == GTK_DIR_DOWN) ? widget->allocation.y : widget->allocation.y + widget->allocation.height;
else
compare.y = (direction == GTK_DIR_DOWN) ? 0 : + widget->allocation.height;
}
/* sort the children in distance in the x direction
* in distance from the current focus child while maintaining the
* sort in the y direction
*/
for (i = 1; i < length; i++)
{
j = i;
tmp_list = g_list_nth (children, j);
child = tmp_list->data;
dist1 = (child->allocation.x + child->allocation.width / 2) - focus_x;
while (j > 0)
{
child2 = tmp_list->prev->data;
dist2 = (child2->allocation.x + child2->allocation.width / 2) - focus_x;
if ((dist1 < dist2) &&
(child->allocation.y >= child2->allocation.y))
{
tmp_list->data = tmp_list->prev->data;
tmp_list = tmp_list->prev;
j--;
}
else
break;
}
tmp_list->data = child;
}
/* go and invalidate any widget which is too
* far from the focus widget.
*/
if (!container->focus_child &&
(direction == GTK_DIR_UP))
focus_x += focus_width;
tmp_list = children;
while (tmp_list)
{
child = tmp_list->data;
dist1 = (child->allocation.x + child->allocation.width / 2) - focus_x;
if (((direction == GTK_DIR_DOWN) && (dist1 < 0)) ||
((direction == GTK_DIR_UP) && (dist1 > 0)))
tmp_list->data = NULL;
tmp_list = tmp_list->next;
}
*children = g_list_sort_with_data (*children, up_down_compare, &compare);
if (direction == GTK_DIR_UP)
children = g_list_reverse (children);
*children = g_list_reverse (*children);
return gtk_container_focus_move (container, children, direction);
return gtk_container_focus_move (container, *children, direction);
}
static gint
left_right_compare (gconstpointer a,
gconstpointer b,
gpointer data)
{
const GtkWidget *child1 = a;
const GtkWidget *child2 = b;
CompareInfo *compare = data;
gint x1 = child1->allocation.x + child1->allocation.width / 2;
gint x2 = child2->allocation.x + child2->allocation.width / 2;
if (x1 == x2)
{
gint y1 = abs (child1->allocation.y + child1->allocation.height / 2 - compare->y);
gint y2 = abs (child2->allocation.y + child2->allocation.height / 2 - compare->y);
if (compare->x < x1)
return (y1 < y2) ? -1 : ((y1 == y2) ? 0 : 1);
else
return (y1 < y2) ? 1 : ((y1 == y2) ? 0 : -1);
}
else
return (x1 < x2) ? -1 : 1;
}
static gboolean
gtk_container_focus_left_right (GtkContainer *container,
GList *children,
GList **children,
GtkDirectionType direction)
{
GtkWidget *child;
GtkWidget *child2;
CompareInfo compare;
GList *tmp_list;
gint dist1, dist2;
gint focus_y;
gint focus_height;
guint length;
guint i, j;
/* return failure if there isn't a focus child */
if (container->focus_child)
{
focus_height = container->focus_child->allocation.height / 2;
focus_y = container->focus_child->allocation.y + focus_height;
gint compare_y1;
gint compare_y2;
gint compare_x;
/* Delete widgets from list that don't match minimum criteria */
compare_y1 = container->focus_child->allocation.y;
compare_y2 = container->focus_child->allocation.y + container->focus_child->allocation.height;
if (direction == GTK_DIR_LEFT)
compare_x = container->focus_child->allocation.x;
else
compare_x = container->focus_child->allocation.x + container->focus_child->allocation.width;
tmp_list = *children;
while (tmp_list)
{
GtkWidget *child = tmp_list->data;
GList *next = tmp_list->next;
gint child_y1, child_y2;
if (child != container->focus_child)
{
child_y1 = child->allocation.y;
child_y2 = child->allocation.y + child->allocation.height;
if ((child_y2 <= compare_y1 || child_y1 >= compare_y2) /* No vertical overlap */ ||
(direction == GTK_DIR_RIGHT && child->allocation.x + child->allocation.width < compare_x) || /* Not to left */
(direction == GTK_DIR_LEFT && child->allocation.x > compare_x)) /* Not to right */
{
*children = g_list_delete_link (*children, tmp_list);
}
}
tmp_list = next;
}
compare.y = (compare_y1 + compare_y2) / 2;
compare.x = container->focus_child->allocation.x + container->focus_child->allocation.width / 2;
}
else
{
focus_height = GTK_WIDGET (container)->allocation.height;
if (GTK_WIDGET_NO_WINDOW (container))
focus_y = GTK_WIDGET (container)->allocation.y;
/* No old focus widget, need to figure out starting x,y some other way
*/
GtkWidget *widget = GTK_WIDGET (container);
GdkRectangle old_focus_rect;
if (old_focus_coords (container, &old_focus_rect))
{
compare.y = old_focus_rect.y + old_focus_rect.height / 2;
}
else
focus_y = 0;
}
length = g_list_length (children);
/* sort the children in the x direction */
for (i = 1; i < length; i++)
{
j = i;
tmp_list = g_list_nth (children, j);
child = tmp_list->data;
while (j > 0)
{
child2 = tmp_list->prev->data;
if (child->allocation.x < child2->allocation.x)
{
tmp_list->data = tmp_list->prev->data;
tmp_list = tmp_list->prev;
j--;
}
if (GTK_WIDGET_NO_WINDOW (widget))
compare.y = widget->allocation.y + widget->allocation.height / 2;
else
break;
compare.y = widget->allocation.height / 2;
}
tmp_list->data = child;
if (GTK_WIDGET_NO_WINDOW (widget))
compare.x = (direction == GTK_DIR_RIGHT) ? widget->allocation.x : widget->allocation.x + widget->allocation.width;
else
compare.x = (direction == GTK_DIR_RIGHT) ? 0 : widget->allocation.width;
}
/* sort the children in distance in the y direction
* in distance from the current focus child while maintaining the
* sort in the x direction
*/
for (i = 1; i < length; i++)
{
j = i;
tmp_list = g_list_nth (children, j);
child = tmp_list->data;
dist1 = (child->allocation.y + child->allocation.height / 2) - focus_y;
while (j > 0)
{
child2 = tmp_list->prev->data;
dist2 = (child2->allocation.y + child2->allocation.height / 2) - focus_y;
if ((dist1 < dist2) &&
(child->allocation.x >= child2->allocation.x))
{
tmp_list->data = tmp_list->prev->data;
tmp_list = tmp_list->prev;
j--;
}
else
break;
}
tmp_list->data = child;
}
/* go and invalidate any widget which is too
* far from the focus widget.
*/
if (!container->focus_child &&
(direction == GTK_DIR_LEFT))
focus_y += focus_height;
tmp_list = children;
while (tmp_list)
{
child = tmp_list->data;
dist1 = (child->allocation.y + child->allocation.height / 2) - focus_y;
if (((direction == GTK_DIR_RIGHT) && (dist1 < 0)) ||
((direction == GTK_DIR_LEFT) && (dist1 > 0)))
tmp_list->data = NULL;
tmp_list = tmp_list->next;
}
*children = g_list_sort_with_data (*children, left_right_compare, &compare);
if (direction == GTK_DIR_LEFT)
children = g_list_reverse (children);
*children = g_list_reverse (*children);
return gtk_container_focus_move (container, children, direction);
return gtk_container_focus_move (container, *children, direction);
}
static gint
static gboolean
gtk_container_focus_move (GtkContainer *container,
GList *children,
GtkDirectionType direction)
@ -1722,7 +1786,6 @@ gtk_container_focus_move (GtkContainer *container,
GtkWidget *child;
focus_child = container->focus_child;
gtk_container_set_focus_child (container, NULL);
while (children)
{
@ -1739,8 +1802,7 @@ gtk_container_focus_move (GtkContainer *container,
focus_child = NULL;
if (GTK_WIDGET_DRAWABLE (child) &&
GTK_IS_CONTAINER (child) &&
!GTK_WIDGET_HAS_FOCUS (child))
GTK_IS_CONTAINER (child))
if (gtk_container_focus (GTK_CONTAINER (child), direction))
return TRUE;
}

View File

@ -83,7 +83,7 @@ struct _GtkContainerClass
gboolean include_internals,
GtkCallback callback,
gpointer callbabck_data);
gint (* focus) (GtkContainer *container,
gboolean (* focus) (GtkContainer *container,
GtkDirectionType direction);
void (* set_focus_child) (GtkContainer *container,
GtkWidget *widget);
@ -119,17 +119,17 @@ void gtk_container_set_resize_mode (GtkContainer *container,
void gtk_container_check_resize (GtkContainer *container);
void gtk_container_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
void gtk_container_foreach_full (GtkContainer *container,
GtkCallback callback,
GtkCallbackMarshal marshal,
gpointer callback_data,
GtkDestroyNotify notify);
GList* gtk_container_children (GtkContainer *container);
gint gtk_container_focus (GtkContainer *container,
GtkDirectionType direction);
void gtk_container_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data);
void gtk_container_foreach_full (GtkContainer *container,
GtkCallback callback,
GtkCallbackMarshal marshal,
gpointer callback_data,
GtkDestroyNotify notify);
GList* gtk_container_children (GtkContainer *container);
gboolean gtk_container_focus (GtkContainer *container,
GtkDirectionType direction);
/* Widget-level methods */

File diff suppressed because it is too large Load Diff

View File

@ -45,9 +45,6 @@ extern "C" {
#define GTK_NOTEBOOK_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GTK_TYPE_NOTEBOOK, GtkNotebookClass))
#define GTK_NOTEBOOK_PAGE(_glist_) ((GtkNotebookPage *)((GList *)(_glist_))->data)
typedef struct _GtkNotebook GtkNotebook;
typedef struct _GtkNotebookClass GtkNotebookClass;
typedef struct _GtkNotebookPage GtkNotebookPage;
@ -58,7 +55,7 @@ struct _GtkNotebook
GtkNotebookPage *cur_page;
GList *children;
GList *first_tab;
GList *first_tab; /* The first tab visible (for scrolling notebooks) */
GList *focus_tab;
GtkWidget *menu;
@ -91,22 +88,6 @@ struct _GtkNotebookClass
guint page_num);
};
struct _GtkNotebookPage
{
GtkWidget *child;
GtkWidget *tab_label;
GtkWidget *menu_label;
guint default_menu : 1;
guint default_tab : 1;
guint expand : 1;
guint fill : 1;
guint pack : 1;
GtkRequisition requisition;
GtkAllocation allocation;
};
/***********************************************************
* Creation, insertion, deletion *
***********************************************************/
@ -143,15 +124,15 @@ void gtk_notebook_remove_page (GtkNotebook *notebook,
* query, set current NoteebookPage *
***********************************************************/
gint gtk_notebook_get_current_page (GtkNotebook *notebook);
GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook,
gint page_num);
gint gtk_notebook_page_num (GtkNotebook *notebook,
GtkWidget *child);
void gtk_notebook_set_page (GtkNotebook *notebook,
gint page_num);
void gtk_notebook_next_page (GtkNotebook *notebook);
void gtk_notebook_prev_page (GtkNotebook *notebook);
gint gtk_notebook_get_current_page (GtkNotebook *notebook);
GtkWidget* gtk_notebook_get_nth_page (GtkNotebook *notebook,
gint page_num);
gint gtk_notebook_page_num (GtkNotebook *notebook,
GtkWidget *child);
void gtk_notebook_set_page (GtkNotebook *notebook,
gint page_num);
void gtk_notebook_next_page (GtkNotebook *notebook);
void gtk_notebook_prev_page (GtkNotebook *notebook);
/***********************************************************
* set Notebook, NotebookTab style *

View File

@ -1418,10 +1418,7 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
* I wonder if focussable is a real word...
*/
if (last_column == NULL)
{
gtk_container_set_focus_child (container, NULL);
return FALSE;
}
return FALSE;
/* First thing we want to handle is entering and leaving the headers.
*/
@ -1431,7 +1428,6 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
if (!focus_child)
{
focus_child = GTK_TREE_VIEW_COLUMN (last_column->data)->button;
gtk_container_set_focus_child (container, focus_child);
gtk_widget_grab_focus (focus_child);
goto cleanup;
}
@ -1446,7 +1442,6 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
if (!focus_child)
{
focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
gtk_container_set_focus_child (container, focus_child);
gtk_widget_grab_focus (focus_child);
goto cleanup;
}
@ -1461,7 +1456,6 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
if (!focus_child)
{
focus_child = GTK_TREE_VIEW_COLUMN (last_column->data)->button;
gtk_container_set_focus_child (container, focus_child);
gtk_widget_grab_focus (focus_child);
goto cleanup;
}
@ -1476,7 +1470,6 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
if (!focus_child)
{
focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
gtk_container_set_focus_child (container, focus_child);
gtk_widget_grab_focus (focus_child);
goto cleanup;
}
@ -1491,7 +1484,6 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
if (!focus_child)
{
focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
gtk_container_set_focus_child (container, focus_child);
gtk_widget_grab_focus (focus_child);
}
else
@ -1504,7 +1496,6 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
if (!focus_child)
{
focus_child = GTK_TREE_VIEW_COLUMN (first_column->data)->button;
gtk_container_set_focus_child (container, focus_child);
gtk_widget_grab_focus (focus_child);
}
else
@ -1550,7 +1541,6 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
GTK_WIDGET_CAN_FOCUS (column->button))
{
focus_child = column->button;
gtk_container_set_focus_child (container, column->button);
gtk_widget_grab_focus (column->button);
break;
}
@ -1578,10 +1568,6 @@ gtk_tree_view_header_focus (GtkTreeView *tree_view,
focus_child->allocation.x);
}
}
else
{
gtk_container_set_focus_child (container, NULL);
}
return (focus_child != NULL);
}
@ -1619,16 +1605,11 @@ gtk_tree_view_focus (GtkContainer *container,
case GTK_DIR_TAB_BACKWARD:
return (gtk_tree_view_header_focus (tree_view, direction));
case GTK_DIR_UP:
gtk_container_set_focus_child (container, NULL);
return FALSE;
case GTK_DIR_TAB_FORWARD:
case GTK_DIR_RIGHT:
case GTK_DIR_DOWN:
if (direction == GTK_DIR_DOWN)
{
gtk_container_set_focus_child (container, NULL);
}
else
if (direction != GTK_DIR_DOWN)
{
if (gtk_tree_view_header_focus (tree_view, direction))
return TRUE;

View File

@ -2856,6 +2856,32 @@ gtk_widget_real_grab_focus (GtkWidget *focus_widget)
}
}
/**
* gtk_widget_is_focus:
* @widget: a #GtkWidget
*
* Determines if the widget is the focus widget within its
* toplevel. (This does not mean that the HAS_FOCUS flag is
* necessarily set; HAS_FOCUS will only be set if the
* toplevel widget additionally has the global input focus.)
*
* Return value: %TRUE if the widget is the focus widget.
**/
gboolean
gtk_widget_is_focus (GtkWidget *widget)
{
GtkWidget *toplevel;
g_return_if_fail (GTK_IS_WIDGET (widget));
toplevel = gtk_widget_get_toplevel (widget);
if (GTK_IS_WINDOW (toplevel))
return widget == GTK_WINDOW (toplevel)->focus_widget;
else
return FALSE;
}
/**
* gtk_widget_grab_default:
* @widget: a #GtkWidget

View File

@ -493,6 +493,7 @@ gboolean gtk_widget_intersect (GtkWidget *widget,
GdkRectangle *area,
GdkRectangle *intersection);
gboolean gtk_widget_is_focus (GtkWidget *widget);
void gtk_widget_grab_focus (GtkWidget *widget);
void gtk_widget_grab_default (GtkWidget *widget);

View File

@ -126,6 +126,8 @@ static gint gtk_window_focus_out_event (GtkWidget *widget,
static gint gtk_window_client_event (GtkWidget *widget,
GdkEventClient *event);
static void gtk_window_check_resize (GtkContainer *container);
static gint gtk_window_focus (GtkContainer *container,
GtkDirectionType direction);
static void gtk_window_real_set_focus (GtkWindow *window,
GtkWidget *focus);
@ -261,6 +263,7 @@ gtk_window_class_init (GtkWindowClass *klass)
widget_class->expose_event = gtk_window_expose;
container_class->check_resize = gtk_window_check_resize;
container_class->focus = gtk_window_focus;
klass->set_focus = gtk_window_real_set_focus;
}
@ -1579,6 +1582,60 @@ gtk_window_check_resize (GtkContainer *container)
gtk_window_move_resize (window);
}
static gboolean
gtk_window_focus (GtkContainer *container,
GtkDirectionType direction)
{
GtkBin *bin = GTK_BIN (container);
GtkWindow *window = GTK_WINDOW (container);
GtkWidget *old_focus_child = container->focus_child;
GtkWidget *parent;
/* We need a special implementation here to deal properly with wrapping
* around in the tab chain without the danger of going into an
* infinite loop.
*/
if (old_focus_child)
{
if (GTK_IS_CONTAINER (old_focus_child) &&
GTK_WIDGET_DRAWABLE (old_focus_child) &&
GTK_WIDGET_IS_SENSITIVE (old_focus_child) &&
gtk_container_focus (GTK_CONTAINER (old_focus_child), direction))
return TRUE;
}
if (window->focus_widget)
{
/* Wrapped off the end, clear the focus setting for the toplpevel */
parent = window->focus_widget->parent;
while (parent)
{
gtk_container_set_focus_child (GTK_CONTAINER (parent), NULL);
parent = GTK_WIDGET (parent)->parent;
}
gtk_window_set_focus (GTK_WINDOW (container), NULL);
}
/* Now try to focus the first widget in the window */
if (GTK_WIDGET_DRAWABLE (bin->child) &&
GTK_WIDGET_IS_SENSITIVE (bin->child))
{
if (GTK_IS_CONTAINER (bin->child))
{
if (gtk_container_focus (GTK_CONTAINER (bin->child), direction))
return TRUE;
}
else if (GTK_WIDGET_CAN_FOCUS (bin->child))
{
gtk_widget_grab_focus (bin->child);
return TRUE;
}
}
return FALSE;
}
static void
gtk_window_real_set_focus (GtkWindow *window,
GtkWidget *focus)

View File

@ -6471,31 +6471,34 @@ GdkBitmap *book_closed_mask;
GtkWidget *sample_notebook;
static void
page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
set_page_pixmaps (GtkNotebook *notebook, gint page_num,
GdkPixmap *pixmap, GdkPixmap *mask)
{
GtkNotebookPage *oldpage;
GtkWidget *page_widget;
GtkWidget *pixwid;
oldpage = GTK_NOTEBOOK (widget)->cur_page;
page_widget = gtk_notebook_get_nth_page (notebook, page_num);
if (page == oldpage)
pixwid = gtk_object_get_data (GTK_OBJECT (page_widget), "tab_pixmap");
gtk_pixmap_set (GTK_PIXMAP (pixwid), pixmap, mask);
pixwid = gtk_object_get_data (GTK_OBJECT (page_widget), "menu_pixmap");
gtk_pixmap_set (GTK_PIXMAP (pixwid), pixmap, mask);
}
static void
page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
gint old_page_num = gtk_notebook_get_current_page (notebook);
if (page_num == old_page_num)
return;
pixwid = ((GtkBoxChild*)
(GTK_BOX (page->tab_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
pixwid = ((GtkBoxChild*)
(GTK_BOX (page->menu_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
if (oldpage)
{
pixwid = ((GtkBoxChild*)
(GTK_BOX (oldpage->tab_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
pixwid = ((GtkBoxChild*)
(GTK_BOX (oldpage->menu_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
}
set_page_pixmaps (notebook, page_num, book_open, book_open_mask);
if (old_page_num != -1)
set_page_pixmaps (notebook, old_page_num, book_closed, book_closed_mask);
}
static void
@ -6589,19 +6592,25 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
label_box = gtk_hbox_new (FALSE, 0);
pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
gtk_object_set_data (GTK_OBJECT (child), "tab_pixmap", pixwid);
gtk_box_pack_start (GTK_BOX (label_box), pixwid, FALSE, TRUE, 0);
gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (label_box);
menu_box = gtk_hbox_new (FALSE, 0);
pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
gtk_object_set_data (GTK_OBJECT (child), "menu_pixmap", pixwid);
gtk_box_pack_start (GTK_BOX (menu_box), pixwid, FALSE, TRUE, 0);
gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (menu_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (menu_box);
gtk_notebook_append_page_menu (notebook, child, label_box, menu_box);
}
}
@ -6628,6 +6637,7 @@ standard_notebook (GtkButton *button,
gint i;
gtk_notebook_set_show_tabs (notebook, TRUE);
gtk_notebook_set_show_border (notebook, TRUE);
gtk_notebook_set_scrollable (notebook, FALSE);
if (g_list_length (notebook->children) == 15)
for (i = 0; i < 10; i++)
@ -6641,6 +6651,20 @@ notabs_notebook (GtkButton *button,
gint i;
gtk_notebook_set_show_tabs (notebook, FALSE);
gtk_notebook_set_show_border (notebook, TRUE);
if (g_list_length (notebook->children) == 15)
for (i = 0; i < 10; i++)
gtk_notebook_remove_page (notebook, 5);
}
static void
borderless_notebook (GtkButton *button,
GtkNotebook *notebook)
{
gint i;
gtk_notebook_set_show_tabs (notebook, FALSE);
gtk_notebook_set_show_border (notebook, FALSE);
if (g_list_length (notebook->children) == 15)
for (i = 0; i < 10; i++)
gtk_notebook_remove_page (notebook, 5);
@ -6651,6 +6675,7 @@ scrollable_notebook (GtkButton *button,
GtkNotebook *notebook)
{
gtk_notebook_set_show_tabs (notebook, TRUE);
gtk_notebook_set_show_border (notebook, TRUE);
gtk_notebook_set_scrollable (notebook, TRUE);
if (g_list_length (notebook->children) == 5)
create_pages (notebook, 6, 15);
@ -6689,7 +6714,8 @@ create_notebook (void)
{
{ "Standard", standard_notebook },
{ "No tabs", notabs_notebook },
{ "Scrollable", scrollable_notebook }
{ "Borderless", borderless_notebook },
{ "Scrollable", scrollable_notebook },
};
if (!window)
@ -6753,7 +6779,7 @@ create_notebook (void)
label = gtk_label_new ("Notebook Style :");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
omenu = build_option_menu (items, 3, 0, sample_notebook);
omenu = build_option_menu (items, G_N_ELEMENTS (items), 0, sample_notebook);
gtk_box_pack_start (GTK_BOX (box2), omenu, FALSE, TRUE, 0);
button = gtk_button_new_with_label ("Show all Pages");

View File

@ -6471,31 +6471,34 @@ GdkBitmap *book_closed_mask;
GtkWidget *sample_notebook;
static void
page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
set_page_pixmaps (GtkNotebook *notebook, gint page_num,
GdkPixmap *pixmap, GdkPixmap *mask)
{
GtkNotebookPage *oldpage;
GtkWidget *page_widget;
GtkWidget *pixwid;
oldpage = GTK_NOTEBOOK (widget)->cur_page;
page_widget = gtk_notebook_get_nth_page (notebook, page_num);
if (page == oldpage)
pixwid = gtk_object_get_data (GTK_OBJECT (page_widget), "tab_pixmap");
gtk_pixmap_set (GTK_PIXMAP (pixwid), pixmap, mask);
pixwid = gtk_object_get_data (GTK_OBJECT (page_widget), "menu_pixmap");
gtk_pixmap_set (GTK_PIXMAP (pixwid), pixmap, mask);
}
static void
page_switch (GtkWidget *widget, GtkNotebookPage *page, gint page_num)
{
GtkNotebook *notebook = GTK_NOTEBOOK (widget);
gint old_page_num = gtk_notebook_get_current_page (notebook);
if (page_num == old_page_num)
return;
pixwid = ((GtkBoxChild*)
(GTK_BOX (page->tab_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
pixwid = ((GtkBoxChild*)
(GTK_BOX (page->menu_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_open, book_open_mask);
if (oldpage)
{
pixwid = ((GtkBoxChild*)
(GTK_BOX (oldpage->tab_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
pixwid = ((GtkBoxChild*)
(GTK_BOX (oldpage->menu_label)->children->data))->widget;
gtk_pixmap_set (GTK_PIXMAP (pixwid), book_closed, book_closed_mask);
}
set_page_pixmaps (notebook, page_num, book_open, book_open_mask);
if (old_page_num != -1)
set_page_pixmaps (notebook, old_page_num, book_closed, book_closed_mask);
}
static void
@ -6589,19 +6592,25 @@ create_pages (GtkNotebook *notebook, gint start, gint end)
label_box = gtk_hbox_new (FALSE, 0);
pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
gtk_object_set_data (GTK_OBJECT (child), "tab_pixmap", pixwid);
gtk_box_pack_start (GTK_BOX (label_box), pixwid, FALSE, TRUE, 0);
gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (label_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (label_box);
menu_box = gtk_hbox_new (FALSE, 0);
pixwid = gtk_pixmap_new (book_closed, book_closed_mask);
gtk_object_set_data (GTK_OBJECT (child), "menu_pixmap", pixwid);
gtk_box_pack_start (GTK_BOX (menu_box), pixwid, FALSE, TRUE, 0);
gtk_misc_set_padding (GTK_MISC (pixwid), 3, 1);
label = gtk_label_new (buffer);
gtk_box_pack_start (GTK_BOX (menu_box), label, FALSE, TRUE, 0);
gtk_widget_show_all (menu_box);
gtk_notebook_append_page_menu (notebook, child, label_box, menu_box);
}
}
@ -6628,6 +6637,7 @@ standard_notebook (GtkButton *button,
gint i;
gtk_notebook_set_show_tabs (notebook, TRUE);
gtk_notebook_set_show_border (notebook, TRUE);
gtk_notebook_set_scrollable (notebook, FALSE);
if (g_list_length (notebook->children) == 15)
for (i = 0; i < 10; i++)
@ -6641,6 +6651,20 @@ notabs_notebook (GtkButton *button,
gint i;
gtk_notebook_set_show_tabs (notebook, FALSE);
gtk_notebook_set_show_border (notebook, TRUE);
if (g_list_length (notebook->children) == 15)
for (i = 0; i < 10; i++)
gtk_notebook_remove_page (notebook, 5);
}
static void
borderless_notebook (GtkButton *button,
GtkNotebook *notebook)
{
gint i;
gtk_notebook_set_show_tabs (notebook, FALSE);
gtk_notebook_set_show_border (notebook, FALSE);
if (g_list_length (notebook->children) == 15)
for (i = 0; i < 10; i++)
gtk_notebook_remove_page (notebook, 5);
@ -6651,6 +6675,7 @@ scrollable_notebook (GtkButton *button,
GtkNotebook *notebook)
{
gtk_notebook_set_show_tabs (notebook, TRUE);
gtk_notebook_set_show_border (notebook, TRUE);
gtk_notebook_set_scrollable (notebook, TRUE);
if (g_list_length (notebook->children) == 5)
create_pages (notebook, 6, 15);
@ -6689,7 +6714,8 @@ create_notebook (void)
{
{ "Standard", standard_notebook },
{ "No tabs", notabs_notebook },
{ "Scrollable", scrollable_notebook }
{ "Borderless", borderless_notebook },
{ "Scrollable", scrollable_notebook },
};
if (!window)
@ -6753,7 +6779,7 @@ create_notebook (void)
label = gtk_label_new ("Notebook Style :");
gtk_box_pack_start (GTK_BOX (box2), label, FALSE, TRUE, 0);
omenu = build_option_menu (items, 3, 0, sample_notebook);
omenu = build_option_menu (items, G_N_ELEMENTS (items), 0, sample_notebook);
gtk_box_pack_start (GTK_BOX (box2), omenu, FALSE, TRUE, 0);
button = gtk_button_new_with_label ("Show all Pages");