summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Janik <timj@gtk.org>1998-09-03 02:38:53 +0000
committerTim Janik <timj@src.gnome.org>1998-09-03 02:38:53 +0000
commit698c89e5c4164fdf0014f2608f9ae32594cf0202 (patch)
treecce60ec913464dae4b88596a73782c73a9eb09b9
parentaf9c5dede49caaf6d0dd82853b653eba5fdd7a7e (diff)
downloadgdk-pixbuf-698c89e5c4164fdf0014f2608f9ae32594cf0202.tar.gz
GTK_MENU_DIR_CHILD: check for the existance of
Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org> * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current): GTK_MENU_DIR_CHILD: check for the existance of menu_shell->active_menu_item before accessing its child. GTK_MENU_DIR_PREV: GTK_MENU_DIR_NEXT: if we haven't had an active item and still don't, make a default selection. Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org> * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate the children with _forall for sensitivity changes and with _foreach on pure state changes. this fixes a lot of the old inclusions of internal widgets into _foreach calls. * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall do the work. don't walk the subtrees of first level children. * gtk/gtktreeitem.c: provide a _forall implementation, which walks the subtrees as well for include_internals. * gtk/gtkmenuitem.c: provide a _forall implementation, which walks the submenus as well for include_internals. * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and implemented gtk_scrolled_window_forall, which will iterate over the viewport and the scrollbars for gtk_container_forall or iterate over the viewports children for gtk_container_foreach. * gtk/gtktoolbar.c: * gtk/gtktable.c: * gtk/gtkpaned.c: * gtk/gtkpacker.c: * gtk/gtkmenushell.c: * gtk/gtklist.c: * gtk/gtkfixed.c: * gtk/gtkclist.c: * gtk/gtkbox.c: * gtk/gtkbin.c: * gtk/gtknotebook.c: removed the old gtk_*_foreach functions and provided gtk_*_forall. * gtk/gtknotebook.c: (gtk_notebook_real_switch_page): expose tabs. (gtk_notebook_page_num): new function to return the page number of a distinct child. (gtk_notebook_focus): minor fixups. foxus handling is still screwed under some circumstances. * gtk/gtktreeitem.c: (gtk_real_tree_item_select): (gtk_real_tree_item_deselect): major fixes. some general fixups wrt queue_redraw, and tree items not being NO_WINDOW widgets. * gtk/gtklistitem.c: (gtk_real_list_item_select): (gtk_real_list_item_deselect): (gtk_real_list_item_toggle): removed unneccessary queue_redraw calls. Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org> * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and automatically popup the menu on space bar. Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org> * gtk/gtkcontainer.h: * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class method), which acts similar to gtk_container_foreach(), but iterates over internal children. the GtkContainer::foreach signal vanished in favour of a new class method ->forall() that optionally includes internal widgets. * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation but a _forall implementation, since all child widgets we have are internal ones. (column_button_create): set the parent window prior to gtk_widget_set_parent(). * gtk/gtkwidget.c: exchanged all calls to gtk_container_foreach() with gtk_container_forall(). * gtk/gtkwidget.h: * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through the GtkWidget::composite_child argument. to have a widget created with the flag initially, two new functions got added to wrap a widgets creation: gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag(). Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org> * gtk/gtktooltips.h: * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as gtk_tooltips_force_window(), so tooltips->tip_window can be accessed prior to the first tip being set. don't put an extra reference on the window, since it is a toplevel, it wont get destroyed from anywhere else. * overall macro and GtkType fixups.
-rw-r--r--ChangeLog104
-rw-r--r--ChangeLog.pre-2-0104
-rw-r--r--ChangeLog.pre-2-10104
-rw-r--r--ChangeLog.pre-2-2104
-rw-r--r--ChangeLog.pre-2-4104
-rw-r--r--ChangeLog.pre-2-6104
-rw-r--r--ChangeLog.pre-2-8104
-rw-r--r--gtk/gtk.defs1
-rw-r--r--gtk/gtkbin.c12
-rw-r--r--gtk/gtkbox.c12
-rw-r--r--gtk/gtkclist.c48
-rw-r--r--gtk/gtkcontainer.c136
-rw-r--r--gtk/gtkcontainer.h6
-rw-r--r--gtk/gtkfixed.c26
-rw-r--r--gtk/gtkfixed.h11
-rw-r--r--gtk/gtkitem.c8
-rw-r--r--gtk/gtkitem.h17
-rw-r--r--gtk/gtklist.c20
-rw-r--r--gtk/gtklistitem.c3
-rw-r--r--gtk/gtkmenu.c51
-rw-r--r--gtk/gtkmenuitem.c56
-rw-r--r--gtk/gtkmenushell.c29
-rw-r--r--gtk/gtknotebook.c81
-rw-r--r--gtk/gtknotebook.h4
-rw-r--r--gtk/gtkoptionmenu.c39
-rw-r--r--gtk/gtkpacker.c14
-rw-r--r--gtk/gtkpaned.c154
-rw-r--r--gtk/gtkscrolledwindow.c27
-rw-r--r--gtk/gtktable.c12
-rw-r--r--gtk/gtktoolbar.c28
-rw-r--r--gtk/gtktooltips.c46
-rw-r--r--gtk/gtktooltips.h40
-rw-r--r--gtk/gtktree.c15
-rw-r--r--gtk/gtktreeitem.c225
-rw-r--r--gtk/gtktypebuiltins_evals.c1
-rw-r--r--gtk/gtkwidget.c144
-rw-r--r--gtk/gtkwidget.h24
37 files changed, 1473 insertions, 545 deletions
diff --git a/ChangeLog b/ChangeLog
index 4a8789bf8..d1777e1f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,107 @@
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 4a8789bf8..d1777e1f6 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,107 @@
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 4a8789bf8..d1777e1f6 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,107 @@
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 4a8789bf8..d1777e1f6 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,107 @@
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 4a8789bf8..d1777e1f6 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,107 @@
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 4a8789bf8..d1777e1f6 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,107 @@
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 4a8789bf8..d1777e1f6 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,107 @@
+Thu Sep 3 04:22:20 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkmenushell.c (gtk_real_menu_shell_move_current):
+ GTK_MENU_DIR_CHILD: check for the existance of
+ menu_shell->active_menu_item before accessing its child.
+ GTK_MENU_DIR_PREV:
+ GTK_MENU_DIR_NEXT: if we haven't had an active item and still
+ don't, make a default selection.
+
+Wed Sep 2 00:28:58 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_propagate_state): iterate
+ the children with _forall for sensitivity changes and with
+ _foreach on pure state changes. this fixes a lot of the
+ old inclusions of internal widgets into _foreach calls.
+
+ * gtk/gtktree.c: removed gtk_tree_foreach, let gtk_tree_forall
+ do the work. don't walk the subtrees of first level children.
+
+ * gtk/gtktreeitem.c: provide a _forall implementation,
+ which walks the subtrees as well for include_internals.
+
+ * gtk/gtkmenuitem.c: provide a _forall implementation, which walks
+ the submenus as well for include_internals.
+
+ * gtk/gtkscrolledwindow.c: removed gtk_scrolled_window_foreach and
+ implemented gtk_scrolled_window_forall, which will iterate over
+ the viewport and the scrollbars for gtk_container_forall or
+ iterate over the viewports children for gtk_container_foreach.
+
+ * gtk/gtktoolbar.c:
+ * gtk/gtktable.c:
+ * gtk/gtkpaned.c:
+ * gtk/gtkpacker.c:
+ * gtk/gtkmenushell.c:
+ * gtk/gtklist.c:
+ * gtk/gtkfixed.c:
+ * gtk/gtkclist.c:
+ * gtk/gtkbox.c:
+ * gtk/gtkbin.c:
+ * gtk/gtknotebook.c:
+ removed the old gtk_*_foreach functions and provided gtk_*_forall.
+
+ * gtk/gtknotebook.c:
+ (gtk_notebook_real_switch_page): expose tabs.
+ (gtk_notebook_page_num): new function to return the page number
+ of a distinct child.
+ (gtk_notebook_focus): minor fixups. foxus handling is still screwed
+ under some circumstances.
+
+ * gtk/gtktreeitem.c:
+ (gtk_real_tree_item_select):
+ (gtk_real_tree_item_deselect): major fixes.
+ some general fixups wrt queue_redraw, and tree items not being
+ NO_WINDOW widgets.
+
+ * gtk/gtklistitem.c:
+ (gtk_real_list_item_select):
+ (gtk_real_list_item_deselect):
+ (gtk_real_list_item_toggle):
+ removed unneccessary queue_redraw calls.
+
+Wed Aug 30 09:42:07 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkoptionmenu.c: allow optionmenus to have the focus and
+ automatically popup the menu on space bar.
+
+Wed Aug 26 06:40:34 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkcontainer.h:
+ * gtk/gtkcontainer.c: implemented gtk_container_forall() (as a class
+ method), which acts similar to gtk_container_foreach(), but iterates
+ over internal children. the GtkContainer::foreach signal vanished in
+ favour of a new class method ->forall() that optionally includes
+ internal widgets.
+
+ * gtk/gtkclist.c (gtk_clist_init): provide no _foreach implementation
+ but a _forall implementation, since all child widgets we have are
+ internal ones.
+ (column_button_create): set the parent window prior
+ to gtk_widget_set_parent().
+
+ * gtk/gtkwidget.c:
+ exchanged all calls to gtk_container_foreach() with
+ gtk_container_forall().
+
+ * gtk/gtkwidget.h:
+ * gtk/gtkwidget.c: added the GTK_COMPOSITE_CHILD, exported through
+ the GtkWidget::composite_child argument. to have a widget created
+ with the flag initially, two new functions got added to wrap a widgets
+ creation:
+ gtk_widget_push_composite_flag() and gtk_widget_pop_composite_flag().
+
+Wed Aug 25 23:37:39 1998 Tim Janik <timj@gtk.org>
+
+ * gtk/gtktooltips.h:
+ * gtk/gtktooltips.c: exported gtk_tooltips_create_window() as
+ gtk_tooltips_force_window(), so tooltips->tip_window can be accessed
+ prior to the first tip being set.
+ don't put an extra reference on the window, since it is a toplevel,
+ it wont get destroyed from anywhere else.
+
+ * overall macro and GtkType fixups.
+
1998-09-02 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkcolorsel.c: Replaced "foo == TRUE" and "foo == FALSE"
diff --git a/gtk/gtk.defs b/gtk/gtk.defs
index 318334539..e8d0092a3 100644
--- a/gtk/gtk.defs
+++ b/gtk/gtk.defs
@@ -412,6 +412,7 @@
(has-default GTK_HAS_DEFAULT)
(has-grab GTK_HAS_GRAB)
(rc-style GTK_RC_STYLE)
+ (composite-child GTK_COMPOSITE_CHILD)
(basic GTK_BASIC))
; enumerations from "../gdk/gdkprivate.h"
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index 4c3972bdf..6362eb53d 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -31,7 +31,8 @@ static void gtk_bin_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_bin_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_bin_foreach (GtkContainer *container,
+static void gtk_bin_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static GtkType gtk_bin_child_type (GtkContainer*container);
@@ -85,7 +86,7 @@ gtk_bin_class_init (GtkBinClass *class)
container_class->add = gtk_bin_add;
container_class->remove = gtk_bin_remove;
- container_class->foreach = gtk_bin_foreach;
+ container_class->forall = gtk_bin_forall;
container_class->child_type = gtk_bin_child_type;
}
@@ -261,9 +262,10 @@ gtk_bin_remove (GtkContainer *container,
}
static void
-gtk_bin_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_bin_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkBin *bin;
diff --git a/gtk/gtkbox.c b/gtk/gtkbox.c
index 4eeab6779..652c735aa 100644
--- a/gtk/gtkbox.c
+++ b/gtk/gtkbox.c
@@ -51,7 +51,8 @@ static void gtk_box_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_box_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_box_foreach (GtkContainer *container,
+static void gtk_box_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_box_set_child_arg (GtkContainer *container,
@@ -124,7 +125,7 @@ gtk_box_class_init (GtkBoxClass *class)
container_class->add = gtk_box_add;
container_class->remove = gtk_box_remove;
- container_class->foreach = gtk_box_foreach;
+ container_class->forall = gtk_box_forall;
container_class->child_type = gtk_box_child_type;
container_class->set_child_arg = gtk_box_set_child_arg;
container_class->get_child_arg = gtk_box_get_child_arg;
@@ -746,9 +747,10 @@ gtk_box_remove (GtkContainer *container,
}
static void
-gtk_box_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_box_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkBox *box;
GtkBoxChild *child;
diff --git a/gtk/gtkclist.c b/gtk/gtkclist.c
index 8474d8a99..2a0776e1c 100644
--- a/gtk/gtkclist.c
+++ b/gtk/gtkclist.c
@@ -194,9 +194,10 @@ static gint get_selection_info (GtkCList * clist,
gint * column);
/* GtkContainer Methods */
-static void gtk_clist_foreach (GtkContainer * container,
- GtkCallback callback,
- gpointer callback_data);
+static void gtk_clist_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
/* Drawing */
static void draw_row (GtkCList * clist,
@@ -530,7 +531,7 @@ gtk_clist_class_init (GtkCListClass * klass)
/* container_class->add = NULL; use the default GtkContainerClass warning */
/* container_class->remove = NULL; use the default GtkContainerClass warning */
- container_class->foreach = gtk_clist_foreach;
+ container_class->forall = gtk_clist_forall;
container_class->focus = gtk_clist_focus;
container_class->set_focus_child = gtk_clist_set_focus_child;
@@ -3339,14 +3340,14 @@ gtk_clist_size_allocate (GtkWidget * widget,
/*
* GTKCONTAINER
- * gtk_clist_foreach
+ * gtk_clist_forall
*/
static void
-gtk_clist_foreach (GtkContainer * container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_clist_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
- gint i;
GtkCList *clist;
g_return_if_fail (container != NULL);
@@ -3354,17 +3355,22 @@ gtk_clist_foreach (GtkContainer * container,
g_return_if_fail (callback != NULL);
clist = GTK_CLIST (container);
-
- /* callback for the column buttons */
- for (i = 0; i < clist->columns; i++)
- if (clist->column[i].button)
- (*callback) (clist->column[i].button, callback_data);
-
- /* callbacks for the scrollbars */
- if (clist->vscrollbar)
- (*callback) (clist->vscrollbar, callback_data);
- if (clist->hscrollbar)
- (*callback) (clist->hscrollbar, callback_data);
+
+ if (include_internals)
+ {
+ guint i;
+
+ /* callback for the column buttons */
+ for (i = 0; i < clist->columns; i++)
+ if (clist->column[i].button)
+ (*callback) (clist->column[i].button, callback_data);
+
+ /* callbacks for the scrollbars */
+ if (clist->vscrollbar)
+ (*callback) (clist->vscrollbar, callback_data);
+ if (clist->hscrollbar)
+ (*callback) (clist->hscrollbar, callback_data);
+ }
}
/*
@@ -4182,9 +4188,9 @@ column_button_create (GtkCList * clist,
GtkWidget *button;
button = clist->column[column].button = gtk_button_new ();
- gtk_widget_set_parent (button, GTK_WIDGET (clist));
if (GTK_WIDGET_REALIZED (clist) && clist->title_window)
gtk_widget_set_parent_window (clist->column[column].button, clist->title_window);
+ gtk_widget_set_parent (button, GTK_WIDGET (clist));
gtk_signal_connect (GTK_OBJECT (button), "clicked",
(GtkSignalFunc) column_button_clicked,
diff --git a/gtk/gtkcontainer.c b/gtk/gtkcontainer.c
index 2bcc30b83..80e770115 100644
--- a/gtk/gtkcontainer.c
+++ b/gtk/gtkcontainer.c
@@ -28,7 +28,6 @@ enum {
ADD,
REMOVE,
CHECK_RESIZE,
- FOREACH,
FOCUS,
SET_FOCUS_CHILD,
LAST_SIGNAL
@@ -178,14 +177,6 @@ gtk_container_class_init (GtkContainerClass *class)
GTK_SIGNAL_OFFSET (GtkContainerClass, check_resize),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
- container_signals[FOREACH] =
- gtk_signal_new ("foreach",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (GtkContainerClass, foreach),
- gtk_marshal_NONE__C_CALLBACK,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_C_CALLBACK);
container_signals[FOCUS] =
gtk_signal_new ("focus",
GTK_RUN_LAST,
@@ -207,18 +198,14 @@ gtk_container_class_init (GtkContainerClass *class)
object_class->get_arg = gtk_container_get_arg;
object_class->set_arg = gtk_container_set_arg;
object_class->destroy = gtk_container_destroy;
-
- /* Other container classes should overwrite show_all and hide_all,
- * for the purpose of showing internal children also, which are not
- * accessable through gtk_container_foreach.
- */
+
widget_class->show_all = gtk_container_show_all;
widget_class->hide_all = gtk_container_hide_all;
-
+
class->add = gtk_container_add_unimplemented;
class->remove = gtk_container_remove_unimplemented;
class->check_resize = gtk_container_real_check_resize;
- class->foreach = NULL;
+ class->forall = NULL;
class->focus = gtk_container_real_focus;
class->set_focus_child = gtk_container_real_set_focus_child;
class->child_type = NULL;
@@ -621,8 +608,7 @@ gtk_container_destroy (GtkObject *object)
}
gtk_container_clear_resize_widgets (container);
- gtk_container_foreach (container,
- (GtkCallback) gtk_widget_destroy, NULL);
+ gtk_container_foreach (container, (GtkCallback) gtk_widget_destroy, NULL);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -1103,17 +1089,37 @@ gtk_container_resize_children (GtkContainer *container)
}
void
+gtk_container_forall (GtkContainer *container,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ GtkContainerClass *class;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (container));
+ g_return_if_fail (callback != NULL);
+
+ class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
+
+ if (class->forall)
+ class->forall (container, TRUE, callback, callback_data);
+}
+
+void
gtk_container_foreach (GtkContainer *container,
GtkCallback callback,
gpointer callback_data)
{
+ GtkContainerClass *class;
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (callback != NULL);
- gtk_signal_emit (GTK_OBJECT (container),
- container_signals[FOREACH],
- callback, callback_data);
+ class = GTK_CONTAINER_CLASS (GTK_OBJECT (container)->klass);
+
+ if (class->forall)
+ class->forall (container, FALSE, callback, callback_data);
}
typedef struct _GtkForeachData GtkForeachData;
@@ -1292,9 +1298,10 @@ gtk_container_real_focus (GtkContainer *container,
g_return_val_if_fail (container != NULL, FALSE);
g_return_val_if_fail (GTK_IS_CONTAINER (container), FALSE);
- /* Fail if the container is insensitive
+ /* Fail if the container is inappropriate for focus movement
*/
- if (!GTK_WIDGET_SENSITIVE (container))
+ if (!GTK_WIDGET_DRAWABLE (container) ||
+ !GTK_WIDGET_SENSITIVE (container))
return FALSE;
return_val = FALSE;
@@ -1308,25 +1315,32 @@ gtk_container_real_focus (GtkContainer *container,
{
/* Get a list of the containers children
*/
- children = gtk_container_children (container);
+ children = NULL;
+ gtk_container_forall (container,
+ gtk_container_children_callback,
+ &children);
+ children = g_list_reverse (children);
+ /* children = gtk_container_children (container); */
if (children)
{
- /* Remove any children which are insensitive
+ /* Remove any children which are inappropriate for focus movement
*/
tmp_list = children;
while (tmp_list)
{
- if (!GTK_WIDGET_SENSITIVE (tmp_list->data))
+ if (GTK_WIDGET_SENSITIVE (tmp_list->data) &&
+ GTK_WIDGET_DRAWABLE (tmp_list->data) &&
+ (GTK_IS_CONTAINER (tmp_list->data) || GTK_WIDGET_CAN_FOCUS (tmp_list->data)))
+ tmp_list = tmp_list->next;
+ else
{
tmp_list2 = tmp_list;
tmp_list = tmp_list->next;
-
+
children = g_list_remove_link (children, tmp_list2);
g_list_free_1 (tmp_list2);
}
- else
- tmp_list = tmp_list->next;
}
switch (direction)
@@ -1668,14 +1682,14 @@ gtk_container_focus_move (GtkContainer *container,
{
focus_child = NULL;
- if (GTK_WIDGET_VISIBLE (child) &&
+ if (GTK_WIDGET_DRAWABLE (child) &&
GTK_IS_CONTAINER (child) &&
!GTK_WIDGET_HAS_FOCUS (child))
if (gtk_container_focus (GTK_CONTAINER (child), direction))
return TRUE;
}
}
- else if (GTK_WIDGET_VISIBLE (child))
+ else if (GTK_WIDGET_DRAWABLE (child))
{
if (GTK_IS_CONTAINER (child))
{
@@ -1704,41 +1718,6 @@ gtk_container_children_callback (GtkWidget *widget,
*children = g_list_prepend (*children, widget);
}
-static void
-gtk_container_show_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CONTAINER (widget));
- container = GTK_CONTAINER (widget);
-
- /* First show children, then self.
- This makes sure that toplevel windows get shown as last widget.
- Otherwise the user would see the widgets get
- visible one after another.
- */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
- gtk_widget_show (widget);
-}
-
-
-static void
-gtk_container_hide_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_CONTAINER (widget));
- container = GTK_CONTAINER (widget);
-
- /* First hide self, then children.
- This is the reverse order of gtk_container_show_all.
- */
- gtk_widget_hide (widget);
- gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
-}
-
void
gtk_container_set_focus_vadjustment (GtkContainer *container,
GtkAdjustment *adjustment)
@@ -1774,3 +1753,28 @@ gtk_container_set_focus_hadjustment (GtkContainer *container,
adjustment,
(GtkDestroyNotify) gtk_object_unref);
}
+
+
+static void
+gtk_container_show_all (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (widget));
+
+ gtk_container_foreach (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_show_all,
+ NULL);
+ gtk_widget_show (widget);
+}
+
+static void
+gtk_container_hide_all (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_CONTAINER (widget));
+
+ gtk_widget_hide (widget);
+ gtk_container_foreach (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_hide_all,
+ NULL);
+}
diff --git a/gtk/gtkcontainer.h b/gtk/gtkcontainer.h
index aecd268f4..0f79446cb 100644
--- a/gtk/gtkcontainer.h
+++ b/gtk/gtkcontainer.h
@@ -71,7 +71,8 @@ struct _GtkContainerClass
void (* remove) (GtkContainer *container,
GtkWidget *widget);
void (* check_resize) (GtkContainer *container);
- void (* foreach) (GtkContainer *container,
+ void (* forall) (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callbabck_data);
gint (* focus) (GtkContainer *container,
@@ -206,6 +207,9 @@ gchar* gtk_container_child_args_collect (GtkType object_type,
gchar* gtk_container_child_arg_get_info (GtkType object_type,
const gchar *arg_name,
GtkArgInfo **info_p);
+void gtk_container_forall (GtkContainer *container,
+ GtkCallback callback,
+ gpointer callback_data);
/* Deprecated methods */
diff --git a/gtk/gtkfixed.c b/gtk/gtkfixed.c
index b59cb781c..9b88198de 100644
--- a/gtk/gtkfixed.c
+++ b/gtk/gtkfixed.c
@@ -38,19 +38,20 @@ static void gtk_fixed_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_fixed_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_fixed_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data);
+static void gtk_fixed_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
static GtkType gtk_fixed_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
-guint
+GtkType
gtk_fixed_get_type (void)
{
- static guint fixed_type = 0;
+ static GtkType fixed_type = 0;
if (!fixed_type)
{
@@ -66,7 +67,7 @@ gtk_fixed_get_type (void)
(GtkClassInitFunc) NULL,
};
- fixed_type = gtk_type_unique (gtk_container_get_type (), &fixed_info);
+ fixed_type = gtk_type_unique (GTK_TYPE_CONTAINER, &fixed_info);
}
return fixed_type;
@@ -83,7 +84,7 @@ gtk_fixed_class_init (GtkFixedClass *class)
widget_class = (GtkWidgetClass*) class;
container_class = (GtkContainerClass*) class;
- parent_class = gtk_type_class (gtk_container_get_type ());
+ parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
widget_class->map = gtk_fixed_map;
widget_class->unmap = gtk_fixed_unmap;
@@ -95,7 +96,7 @@ gtk_fixed_class_init (GtkFixedClass *class)
container_class->add = gtk_fixed_add;
container_class->remove = gtk_fixed_remove;
- container_class->foreach = gtk_fixed_foreach;
+ container_class->forall = gtk_fixed_forall;
container_class->child_type = gtk_fixed_child_type;
}
@@ -119,7 +120,7 @@ gtk_fixed_new (void)
{
GtkFixed *fixed;
- fixed = gtk_type_new (gtk_fixed_get_type ());
+ fixed = gtk_type_new (GTK_TYPE_FIXED);
return GTK_WIDGET (fixed);
}
@@ -465,9 +466,10 @@ gtk_fixed_remove (GtkContainer *container,
}
static void
-gtk_fixed_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_fixed_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkFixed *fixed;
GtkFixedChild *child;
diff --git a/gtk/gtkfixed.h b/gtk/gtkfixed.h
index a2b686808..cffbc5e7b 100644
--- a/gtk/gtkfixed.h
+++ b/gtk/gtkfixed.h
@@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_FIXED(obj) GTK_CHECK_CAST (obj, gtk_fixed_get_type (), GtkFixed)
-#define GTK_FIXED_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_fixed_get_type (), GtkFixedClass)
-#define GTK_IS_FIXED(obj) GTK_CHECK_TYPE (obj, gtk_fixed_get_type ())
+#define GTK_TYPE_FIXED (gtk_fixed_get_type ())
+#define GTK_FIXED(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FIXED, GtkFixed))
+#define GTK_FIXED_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FIXED, GtkFixedClass))
+#define GTK_IS_FIXED(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FIXED))
+#define GTK_IS_FIXED_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FIXED))
typedef struct _GtkFixed GtkFixed;
@@ -58,7 +61,7 @@ struct _GtkFixedChild
};
-guint gtk_fixed_get_type (void);
+GtkType gtk_fixed_get_type (void);
GtkWidget* gtk_fixed_new (void);
void gtk_fixed_put (GtkFixed *fixed,
GtkWidget *widget,
diff --git a/gtk/gtkitem.c b/gtk/gtkitem.c
index a4a6f6a7b..825614d0b 100644
--- a/gtk/gtkitem.c
+++ b/gtk/gtkitem.c
@@ -42,10 +42,10 @@ static gint gtk_item_leave (GtkWidget *widget,
static guint item_signals[LAST_SIGNAL] = { 0 };
-guint
+GtkType
gtk_item_get_type (void)
{
- static guint item_type = 0;
+ static GtkType item_type = 0;
if (!item_type)
{
@@ -61,7 +61,7 @@ gtk_item_get_type (void)
(GtkClassInitFunc) NULL,
};
- item_type = gtk_type_unique (gtk_bin_get_type (), &item_info);
+ item_type = gtk_type_unique (GTK_TYPE_BIN, &item_info);
}
return item_type;
@@ -146,6 +146,7 @@ gtk_item_map (GtkWidget *widget)
g_return_if_fail (GTK_IS_ITEM (widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
+
gdk_window_show (widget->window);
bin = GTK_BIN (widget);
@@ -163,6 +164,7 @@ gtk_item_unmap (GtkWidget *widget)
g_return_if_fail (GTK_IS_ITEM (widget));
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
+
gdk_window_hide (widget->window);
}
diff --git a/gtk/gtkitem.h b/gtk/gtkitem.h
index f607a1550..1c036d1ec 100644
--- a/gtk/gtkitem.h
+++ b/gtk/gtkitem.h
@@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_ITEM(obj) GTK_CHECK_CAST (obj, gtk_item_get_type (), GtkItem)
-#define GTK_ITEM_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_item_get_type (), GtkItemClass)
-#define GTK_IS_ITEM(obj) GTK_CHECK_TYPE (obj, gtk_item_get_type ())
+#define GTK_TYPE_ITEM (gtk_item_get_type ())
+#define GTK_ITEM(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_ITEM, GtkItem))
+#define GTK_ITEM_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_ITEM, GtkItemClass))
+#define GTK_IS_ITEM(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_ITEM))
+#define GTK_IS_ITEM_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_ITEM))
typedef struct _GtkItem GtkItem;
@@ -52,10 +55,10 @@ struct _GtkItemClass
};
-guint gtk_item_get_type (void);
-void gtk_item_select (GtkItem *item);
-void gtk_item_deselect (GtkItem *item);
-void gtk_item_toggle (GtkItem *item);
+GtkType gtk_item_get_type (void);
+void gtk_item_select (GtkItem *item);
+void gtk_item_deselect (GtkItem *item);
+void gtk_item_toggle (GtkItem *item);
#ifdef __cplusplus
diff --git a/gtk/gtklist.c b/gtk/gtklist.c
index 1889f361a..6ce42f730 100644
--- a/gtk/gtklist.c
+++ b/gtk/gtklist.c
@@ -56,7 +56,8 @@ static void gtk_list_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_list_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_list_foreach (GtkContainer *container,
+static void gtk_list_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -102,7 +103,7 @@ static guint hadjustment_key_id = 0;
GtkType
gtk_list_get_type (void)
{
- static guint list_type = 0;
+ static GtkType list_type = 0;
if (!list_type)
{
@@ -118,7 +119,7 @@ gtk_list_get_type (void)
(GtkClassInitFunc) NULL,
};
- list_type = gtk_type_unique (gtk_container_get_type (), &list_info);
+ list_type = gtk_type_unique (GTK_TYPE_CONTAINER, &list_info);
}
return list_type;
@@ -135,7 +136,7 @@ gtk_list_class_init (GtkListClass *class)
widget_class = (GtkWidgetClass*) class;
container_class = (GtkContainerClass*) class;
- parent_class = gtk_type_class (gtk_container_get_type ());
+ parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
vadjustment_key_id = g_quark_from_static_string (vadjustment_key);
hadjustment_key_id = g_quark_from_static_string (hadjustment_key);
@@ -182,7 +183,7 @@ gtk_list_class_init (GtkListClass *class)
container_class->add = gtk_list_add;
container_class->remove = gtk_list_remove;
- container_class->foreach = gtk_list_foreach;
+ container_class->forall = gtk_list_forall;
container_class->child_type = gtk_list_child_type;
container_class->set_focus_child = gtk_list_set_focus_child;
container_class->focus = gtk_list_focus;
@@ -225,7 +226,7 @@ gtk_list_init (GtkList *list)
GtkWidget*
gtk_list_new (void)
{
- return GTK_WIDGET (gtk_type_new (gtk_list_get_type ()));
+ return GTK_WIDGET (gtk_type_new (GTK_TYPE_LIST));
}
static void
@@ -1285,9 +1286,10 @@ gtk_list_remove (GtkContainer *container,
}
static void
-gtk_list_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_list_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkList *list;
GtkWidget *child;
diff --git a/gtk/gtklistitem.c b/gtk/gtklistitem.c
index 0793bc8f4..d81ad3719 100644
--- a/gtk/gtklistitem.c
+++ b/gtk/gtklistitem.c
@@ -620,7 +620,6 @@ gtk_real_list_item_select (GtkItem *item)
g_return_if_fail (GTK_IS_LIST_ITEM (item));
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
}
static void
@@ -633,7 +632,6 @@ gtk_real_list_item_deselect (GtkItem *item)
return;
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
- gtk_widget_queue_draw (GTK_WIDGET (item));
}
static void
@@ -656,7 +654,6 @@ gtk_real_list_item_toggle (GtkItem *item)
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
else
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
}
}
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index 0e2f21552..f1462b9f2 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -57,8 +57,8 @@ static gint gtk_menu_key_press (GtkWidget *widget,
static gint gtk_menu_motion_notify (GtkWidget *widget,
GdkEventMotion *event);
static void gtk_menu_deactivate (GtkMenuShell *menu_shell);
-static void gtk_menu_show_all (GtkWidget *widget);
-static void gtk_menu_hide_all (GtkWidget *widget);
+static void gtk_menu_show_all (GtkWidget *widget);
+static void gtk_menu_hide_all (GtkWidget *widget);
static void gtk_menu_position (GtkMenu *menu);
static void gtk_menu_reparent (GtkMenu *menu,
GtkWidget *new_parent,
@@ -119,7 +119,7 @@ gtk_menu_class_init (GtkMenuClass *class)
widget_class->key_press_event = gtk_menu_key_press;
widget_class->motion_notify_event = gtk_menu_motion_notify;
widget_class->show_all = gtk_menu_show_all;
- widget_class->hide_all = gtk_menu_hide_all;
+ widget_class->hide_all = gtk_menu_hide_all;
menu_shell_class->submenu_placement = GTK_LEFT_RIGHT;
menu_shell_class->deactivate = gtk_menu_deactivate;
@@ -989,33 +989,6 @@ gtk_menu_deactivate (GtkMenuShell *menu_shell)
static void
-gtk_menu_show_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
- container = GTK_CONTAINER (widget);
-
- /* Show children, but not self. */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
-}
-
-
-static void
-gtk_menu_hide_all (GtkWidget *widget)
-{
- GtkContainer *container;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_MENU (widget));
- container = GTK_CONTAINER (widget);
-
- /* Hide children, but not self. */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
-}
-
-static void
gtk_menu_position (GtkMenu *menu)
{
GtkWidget *widget;
@@ -1072,8 +1045,8 @@ gtk_menu_reparent (GtkMenu *menu,
{
GtkObject *object = GTK_OBJECT (menu);
GtkWidget *widget = GTK_WIDGET (menu);
-
gboolean was_floating = GTK_OBJECT_FLOATING (object);
+
gtk_object_ref (object);
gtk_object_sink (object);
@@ -1093,7 +1066,23 @@ gtk_menu_reparent (GtkMenu *menu,
gtk_object_unref (object);
}
+static void
+gtk_menu_show_all (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_MENU (widget));
+ /* Show children, but not self. */
+ gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_show_all, NULL);
+}
+static void
+gtk_menu_hide_all (GtkWidget *widget)
+{
+ g_return_if_fail (widget != NULL);
+ g_return_if_fail (GTK_IS_MENU (widget));
+ /* Hide children, but not self. */
+ gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_hide_all, NULL);
+}
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index ba79c57db..59abb8bfe 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -61,6 +61,10 @@ static void gtk_menu_item_position_menu (GtkMenu *menu,
gpointer user_data);
static void gtk_menu_item_show_all (GtkWidget *widget);
static void gtk_menu_item_hide_all (GtkWidget *widget);
+static void gtk_menu_item_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
static GtkItemClass *parent_class;
static guint menu_item_signals[LAST_SIGNAL] = { 0 };
@@ -97,10 +101,12 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
GtkItemClass *item_class;
object_class = (GtkObjectClass*) klass;
widget_class = (GtkWidgetClass*) klass;
+ container_class = (GtkContainerClass*) klass;
item_class = (GtkItemClass*) klass;
parent_class = gtk_type_class (gtk_item_get_type ());
@@ -131,7 +137,9 @@ gtk_menu_item_class_init (GtkMenuItemClass *klass)
widget_class->draw = gtk_menu_item_draw;
widget_class->expose_event = gtk_menu_item_expose;
widget_class->show_all = gtk_menu_item_show_all;
- widget_class->hide_all = gtk_menu_item_hide_all;
+ widget_class->hide_all = gtk_menu_item_hide_all;
+
+ container_class->forall = gtk_menu_item_forall;
item_class->select = gtk_real_menu_item_select;
item_class->deselect = gtk_real_menu_item_deselect;
@@ -706,39 +714,61 @@ gtk_menu_item_right_justify(GtkMenuItem *menuitem)
menuitem->right_justify = 1;
}
+
static void
gtk_menu_item_show_all (GtkWidget *widget)
{
- GtkContainer *container;
- GtkMenuItem *menu_item;
+ GtkMenuItem *menu_item;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- container = GTK_CONTAINER (widget);
+
menu_item = GTK_MENU_ITEM (widget);
- /* Show children, traverse to submenu, show self. */
- gtk_container_foreach (container, (GtkCallback) gtk_widget_show_all, NULL);
+ /* show children including submenu */
if (menu_item->submenu)
gtk_widget_show_all (menu_item->submenu);
+ gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_show_all, NULL);
+
gtk_widget_show (widget);
}
-
static void
gtk_menu_item_hide_all (GtkWidget *widget)
{
- GtkContainer *container;
- GtkMenuItem *menu_item;
+ GtkMenuItem *menu_item;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_MENU_ITEM (widget));
- container = GTK_CONTAINER (widget);
- menu_item = GTK_MENU_ITEM (widget);
- /* Reverse order of gtk_menu_item_show_all */
gtk_widget_hide (widget);
+
+ menu_item = GTK_MENU_ITEM (widget);
+
+ /* hide children including submenu */
+ gtk_container_foreach (GTK_CONTAINER (widget), (GtkCallback) gtk_widget_hide_all, NULL);
if (menu_item->submenu)
gtk_widget_hide_all (menu_item->submenu);
- gtk_container_foreach (container, (GtkCallback) gtk_widget_hide_all, NULL);
+}
+
+static void
+gtk_menu_item_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ GtkBin *bin;
+ GtkMenuItem *menu_item;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_MENU_ITEM (container));
+ g_return_if_fail (callback != NULL);
+
+ bin = GTK_BIN (container);
+ menu_item = GTK_MENU_ITEM (container);
+
+ if (bin->child)
+ (* callback) (bin->child, callback_data);
+ if (include_internals && menu_item->submenu)
+ (* callback) (menu_item->submenu, callback_data);
}
diff --git a/gtk/gtkmenushell.c b/gtk/gtkmenushell.c
index 333e1c129..a6a3bb20d 100644
--- a/gtk/gtkmenushell.c
+++ b/gtk/gtkmenushell.c
@@ -118,7 +118,8 @@ static void gtk_menu_shell_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_menu_shell_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_menu_shell_foreach (GtkContainer *container,
+static void gtk_menu_shell_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_real_menu_shell_deactivate (GtkMenuShell *menu_shell);
@@ -229,7 +230,7 @@ gtk_menu_shell_class_init (GtkMenuShellClass *klass)
container_class->add = gtk_menu_shell_add;
container_class->remove = gtk_menu_shell_remove;
- container_class->foreach = gtk_menu_shell_foreach;
+ container_class->forall = gtk_menu_shell_forall;
container_class->child_type = gtk_menu_shell_child_type;
klass->submenu_placement = GTK_TOP_BOTTOM;
@@ -692,9 +693,10 @@ gtk_menu_shell_remove (GtkContainer *container,
}
static void
-gtk_menu_shell_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_menu_shell_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkMenuShell *menu_shell;
GtkWidget *child;
@@ -897,6 +899,9 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
GtkMenuDirectionType direction)
{
GtkMenuShell *parent_menu_shell = NULL;
+ gboolean had_selection;
+
+ had_selection = menu_shell->active_menu_item != NULL;
if (menu_shell->parent_menu_shell)
parent_menu_shell = GTK_MENU_SHELL (menu_shell->parent_menu_shell);
@@ -915,7 +920,8 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
break;
case GTK_MENU_DIR_CHILD:
- if (GTK_BIN (menu_shell->active_menu_item)->child &&
+ if (menu_shell->active_menu_item &&
+ GTK_BIN (menu_shell->active_menu_item)->child &&
GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu)
{
menu_shell = GTK_MENU_SHELL (GTK_MENU_ITEM (menu_shell->active_menu_item)->submenu);
@@ -934,14 +940,23 @@ gtk_real_menu_shell_move_current (GtkMenuShell *menu_shell,
gtk_menu_shell_move_selected (parent_menu_shell, 1);
}
break;
-
+
case GTK_MENU_DIR_PREV:
gtk_menu_shell_move_selected (menu_shell, -1);
+ if (!had_selection &&
+ !menu_shell->active_menu_item &&
+ menu_shell->children)
+ gtk_menu_shell_select_item (menu_shell, g_list_last (menu_shell->children)->data);
break;
case GTK_MENU_DIR_NEXT:
gtk_menu_shell_move_selected (menu_shell, 1);
+ if (!had_selection &&
+ !menu_shell->active_menu_item &&
+ menu_shell->children)
+ gtk_menu_shell_select_item (menu_shell, menu_shell->children->data);
break;
}
+
}
static void
diff --git a/gtk/gtknotebook.c b/gtk/gtknotebook.c
index 7f8ea7ed4..71b69cd7e 100644
--- a/gtk/gtknotebook.c
+++ b/gtk/gtknotebook.c
@@ -112,7 +112,8 @@ static void gtk_notebook_remove (GtkContainer *container,
static void gtk_notebook_real_remove (GtkNotebook *notebook,
GList *list,
guint page_num);
-static void gtk_notebook_foreach (GtkContainer *container,
+static void gtk_notebook_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_notebook_switch_page (GtkNotebook *notebook,
@@ -149,7 +150,7 @@ static void gtk_notebook_calc_tabs (GtkNotebook *notebook,
static void gtk_notebook_expose_tabs (GtkNotebook *notebook);
static void gtk_notebook_switch_focus_tab (GtkNotebook *notebook,
GList *new_child);
-static void gtk_real_notebook_switch_page (GtkNotebook *notebook,
+static void gtk_notebook_real_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num);
static void gtk_notebook_menu_switch_page (GtkWidget *widget,
@@ -256,14 +257,14 @@ gtk_notebook_class_init (GtkNotebookClass *class)
container_class->add = gtk_notebook_add;
container_class->remove = gtk_notebook_remove;
- container_class->foreach = gtk_notebook_foreach;
+ container_class->forall = gtk_notebook_forall;
container_class->focus = gtk_notebook_focus;
container_class->set_focus_child = gtk_notebook_set_focus_child;
container_class->get_child_arg = gtk_notebook_get_child_arg;
container_class->set_child_arg = gtk_notebook_set_child_arg;
container_class->child_type = gtk_notebook_child_type;
- class->switch_page = gtk_real_notebook_switch_page;
+ class->switch_page = gtk_notebook_real_switch_page;
}
static void
@@ -780,6 +781,33 @@ gtk_notebook_remove (GtkContainer *container,
}
}
+gint
+gtk_notebook_page_num (GtkNotebook *notebook,
+ GtkWidget *child)
+{
+ GList *children;
+ gint num;
+
+ g_return_val_if_fail (notebook != NULL, -1);
+ g_return_val_if_fail (GTK_IS_NOTEBOOK (notebook), -1);
+
+ num = 0;
+ children = notebook->children;
+ while (children)
+ {
+ GtkNotebookPage *page;
+
+ page = children->data;
+ if (page->child == child)
+ return num;
+
+ children = children->next;
+ num++;
+ }
+
+ return -1;
+}
+
static void
gtk_notebook_real_remove (GtkNotebook *notebook,
GList *list,
@@ -1061,12 +1089,12 @@ gtk_notebook_reorder_child (GtkNotebook *notebook,
}
static void
-gtk_notebook_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_notebook_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkNotebook *notebook;
- GtkNotebookPage *page;
GList *children;
g_return_if_fail (container != NULL);
@@ -1074,13 +1102,22 @@ gtk_notebook_foreach (GtkContainer *container,
g_return_if_fail (callback != NULL);
notebook = GTK_NOTEBOOK (container);
-
+
children = notebook->children;
while (children)
{
+ GtkNotebookPage *page;
+
page = children->data;
children = children->next;
(* callback) (page->child, callback_data);
+ if (include_internals)
+ {
+ if (page->tab_label)
+ (* callback) (page->tab_label, callback_data);
+ if (page->menu_label)
+ (* callback) (page->menu_label, callback_data);
+ }
}
}
@@ -1155,7 +1192,7 @@ gtk_notebook_set_tab_pos (GtkNotebook *notebook,
void
gtk_notebook_set_show_tabs (GtkNotebook *notebook,
- gint show_tabs)
+ gboolean show_tabs)
{
GtkNotebookPage *page;
GList *children;
@@ -1163,6 +1200,8 @@ gtk_notebook_set_show_tabs (GtkNotebook *notebook,
g_return_if_fail (notebook != NULL);
g_return_if_fail (GTK_IS_NOTEBOOK (notebook));
+ show_tabs = show_tabs != FALSE;
+
if (notebook->show_tabs == show_tabs)
return;
@@ -2261,7 +2300,7 @@ gtk_notebook_draw_arrow (GtkNotebook *notebook, guint arrow)
}
static void
-gtk_real_notebook_switch_page (GtkNotebook *notebook,
+gtk_notebook_real_switch_page (GtkNotebook *notebook,
GtkNotebookPage *page,
guint page_num)
{
@@ -2283,7 +2322,8 @@ gtk_real_notebook_switch_page (GtkNotebook *notebook,
g_list_find (notebook->children, notebook->cur_page);
gtk_notebook_pages_allocate (notebook, &GTK_WIDGET (notebook)->allocation);
-
+ gtk_notebook_expose_tabs (notebook);
+
if (GTK_WIDGET_MAPPED (notebook))
{
if (GTK_WIDGET_REALIZED (notebook->cur_page->child))
@@ -3129,7 +3169,9 @@ gtk_notebook_focus (GtkContainer *container,
notebook = GTK_NOTEBOOK (container);
- if (!GTK_WIDGET_SENSITIVE (container) || !notebook->children)
+ if (!GTK_WIDGET_DRAWABLE (notebook) ||
+ !GTK_WIDGET_SENSITIVE (container) ||
+ !notebook->children)
return FALSE;
focus_child = container->focus_child;
@@ -3137,12 +3179,12 @@ gtk_notebook_focus (GtkContainer *container,
if (!notebook->show_tabs)
{
- if (GTK_WIDGET_VISIBLE (notebook->cur_page->child))
+ if (GTK_WIDGET_DRAWABLE (notebook->cur_page->child) &&
+ GTK_WIDGET_SENSITIVE (notebook->cur_page->child))
{
if (GTK_IS_CONTAINER (notebook->cur_page->child))
{
- if (gtk_container_focus
- (GTK_CONTAINER (notebook->cur_page->child), direction))
+ if (gtk_container_focus (GTK_CONTAINER (notebook->cur_page->child), direction))
return TRUE;
}
else if (GTK_WIDGET_CAN_FOCUS (notebook->cur_page->child))
@@ -3165,7 +3207,7 @@ gtk_notebook_focus (GtkContainer *container,
if (focus_child && old_page && focus_child == old_page->child &&
notebook->child_has_focus)
{
- if (GTK_WIDGET_VISIBLE (old_page->child))
+ if (GTK_WIDGET_DRAWABLE (old_page->child))
{
if (GTK_IS_CONTAINER (old_page->child) &&
!GTK_WIDGET_HAS_FOCUS (old_page->child))
@@ -3204,8 +3246,7 @@ gtk_notebook_focus (GtkContainer *container,
case GTK_DIR_LEFT:
case GTK_DIR_UP:
if (!notebook->focus_tab)
- gtk_notebook_switch_focus_tab
- (notebook, g_list_last (notebook->children));
+ gtk_notebook_switch_focus_tab (notebook, g_list_last (notebook->children));
else
gtk_notebook_switch_focus_tab (notebook, notebook->focus_tab->prev);
@@ -3222,7 +3263,7 @@ gtk_notebook_focus (GtkContainer *container,
if (return_val)
{
- if (!GTK_WIDGET_HAS_FOCUS (container) )
+ if (!GTK_WIDGET_HAS_FOCUS (container))
gtk_widget_grab_focus (GTK_WIDGET (container));
if (GTK_WIDGET_MAPPED (page->tab_label))
diff --git a/gtk/gtknotebook.h b/gtk/gtknotebook.h
index 2efb2a227..361ce08c5 100644
--- a/gtk/gtknotebook.h
+++ b/gtk/gtknotebook.h
@@ -117,6 +117,8 @@ void gtk_notebook_insert_page_menu (GtkNotebook *notebook,
void gtk_notebook_remove_page (GtkNotebook *notebook,
gint page_num);
gint gtk_notebook_current_page (GtkNotebook *notebook);
+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);
@@ -127,7 +129,7 @@ void gtk_notebook_reorder_child (GtkNotebook *notebook,
void gtk_notebook_set_tab_pos (GtkNotebook *notebook,
GtkPositionType pos);
void gtk_notebook_set_show_tabs (GtkNotebook *notebook,
- gint show_tabs);
+ gboolean show_tabs);
void gtk_notebook_set_show_border (GtkNotebook *notebook,
gint show_border);
void gtk_notebook_set_scrollable (GtkNotebook *notebook,
diff --git a/gtk/gtkoptionmenu.c b/gtk/gtkoptionmenu.c
index 9a29d5e17..aadbc7e15 100644
--- a/gtk/gtkoptionmenu.c
+++ b/gtk/gtkoptionmenu.c
@@ -20,6 +20,7 @@
#include "gtkmenuitem.h"
#include "gtkoptionmenu.h"
#include "gtksignal.h"
+#include "gdk/gdkkeysyms.h"
#define CHILD_LEFT_SPACING 5
@@ -46,6 +47,8 @@ static gint gtk_option_menu_expose (GtkWidget *widget,
GdkEventExpose *event);
static gint gtk_option_menu_button_press (GtkWidget *widget,
GdkEventButton *event);
+static gint gtk_option_menu_key_press (GtkWidget *widget,
+ GdkEventKey *event);
static void gtk_option_menu_deactivate (GtkMenuShell *menu_shell,
GtkOptionMenu *option_menu);
static void gtk_option_menu_update_contents (GtkOptionMenu *option_menu);
@@ -59,6 +62,7 @@ static void gtk_option_menu_show_all (GtkWidget *widget);
static void gtk_option_menu_hide_all (GtkWidget *widget);
static GtkType gtk_option_menu_child_type (GtkContainer *container);
+
static GtkButtonClass *parent_class = NULL;
@@ -106,11 +110,11 @@ gtk_option_menu_class_init (GtkOptionMenuClass *class)
object_class->destroy = gtk_option_menu_destroy;
widget_class->draw = gtk_option_menu_draw;
- widget_class->draw_focus = NULL;
widget_class->size_request = gtk_option_menu_size_request;
widget_class->size_allocate = gtk_option_menu_size_allocate;
widget_class->expose_event = gtk_option_menu_expose;
widget_class->button_press_event = gtk_option_menu_button_press;
+ widget_class->key_press_event = gtk_option_menu_key_press;
widget_class->show_all = gtk_option_menu_show_all;
widget_class->hide_all = gtk_option_menu_hide_all;
@@ -126,7 +130,8 @@ gtk_option_menu_child_type (GtkContainer *container)
static void
gtk_option_menu_init (GtkOptionMenu *option_menu)
{
- GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_FOCUS);
+ GTK_WIDGET_SET_FLAGS (option_menu, GTK_CAN_FOCUS);
+ GTK_WIDGET_UNSET_FLAGS (option_menu, GTK_CAN_DEFAULT);
option_menu->menu = NULL;
option_menu->menu_item = NULL;
@@ -372,6 +377,7 @@ gtk_option_menu_draw (GtkWidget *widget,
child = GTK_BIN (widget)->child;
if (child && gtk_widget_intersect (child, area, &child_area))
gtk_widget_draw (child, &child_area);
+ gtk_widget_draw_focus (widget);
}
}
@@ -434,6 +440,7 @@ gtk_option_menu_expose (GtkWidget *widget,
gtk_widget_event (child, (GdkEvent*) &child_event);
#endif /* 0 */
+ gtk_widget_draw_focus (widget);
}
return FALSE;
@@ -449,10 +456,11 @@ gtk_option_menu_button_press (GtkWidget *widget,
g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
+ option_menu = GTK_OPTION_MENU (widget);
+
if ((event->type == GDK_BUTTON_PRESS) &&
(event->button == 1))
{
- option_menu = GTK_OPTION_MENU (widget);
gtk_option_menu_remove_contents (option_menu);
gtk_menu_popup (GTK_MENU (option_menu->menu), NULL, NULL,
gtk_option_menu_position, option_menu,
@@ -462,6 +470,31 @@ gtk_option_menu_button_press (GtkWidget *widget,
return FALSE;
}
+static gint
+gtk_option_menu_key_press (GtkWidget *widget,
+ GdkEventKey *event)
+{
+ GtkOptionMenu *option_menu;
+
+ g_return_val_if_fail (widget != NULL, FALSE);
+ g_return_val_if_fail (GTK_IS_OPTION_MENU (widget), FALSE);
+ g_return_val_if_fail (event != NULL, FALSE);
+
+ option_menu = GTK_OPTION_MENU (widget);
+
+ switch (event->keyval)
+ {
+ case GDK_space:
+ gtk_option_menu_remove_contents (option_menu);
+ gtk_menu_popup (GTK_MENU (option_menu->menu), NULL, NULL,
+ gtk_option_menu_position, option_menu,
+ 0, event->time);
+ break;
+ }
+
+ return FALSE;
+}
+
static void
gtk_option_menu_deactivate (GtkMenuShell *menu_shell,
GtkOptionMenu *option_menu)
diff --git a/gtk/gtkpacker.c b/gtk/gtkpacker.c
index 83f0eb2ac..6d30b5ae3 100644
--- a/gtk/gtkpacker.c
+++ b/gtk/gtkpacker.c
@@ -131,7 +131,8 @@ static void gtk_packer_container_add (GtkContainer *container,
GtkWidget *child);
static void gtk_packer_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_packer_foreach (GtkContainer *container,
+static void gtk_packer_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_packer_set_arg (GtkObject *object,
@@ -223,7 +224,7 @@ gtk_packer_class_init (GtkPackerClass *klass)
container_class->add = gtk_packer_container_add;
container_class->remove = gtk_packer_remove;
- container_class->foreach = gtk_packer_foreach;
+ container_class->forall = gtk_packer_forall;
container_class->child_type = gtk_packer_child_type;
container_class->get_child_arg = gtk_packer_get_child_arg;
container_class->set_child_arg = gtk_packer_set_child_arg;
@@ -1272,9 +1273,10 @@ gtk_packer_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
}
static void
-gtk_packer_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_packer_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkPacker *packer;
GtkPackerChild *child;
@@ -1286,7 +1288,7 @@ gtk_packer_foreach (GtkContainer *container,
packer = GTK_PACKER (container);
- children = g_list_first(packer->children);
+ children = g_list_first (packer->children);
while (children != NULL)
{
child = children->data;
diff --git a/gtk/gtkpaned.c b/gtk/gtkpaned.c
index ac8209ba1..e30b9747e 100644
--- a/gtk/gtkpaned.c
+++ b/gtk/gtkpaned.c
@@ -26,12 +26,13 @@ static void gtk_paned_map (GtkWidget *widget);
static void gtk_paned_unmap (GtkWidget *widget);
static void gtk_paned_unrealize (GtkWidget *widget);
static gint gtk_paned_expose (GtkWidget *widget,
- GdkEventExpose *event);
+ GdkEventExpose *event);
static void gtk_paned_add (GtkContainer *container,
- GtkWidget *widget);
+ GtkWidget *widget);
static void gtk_paned_remove (GtkContainer *container,
- GtkWidget *widget);
-static void gtk_paned_foreach (GtkContainer *container,
+ GtkWidget *widget);
+static void gtk_paned_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static GtkType gtk_paned_child_type (GtkContainer *container);
@@ -40,11 +41,11 @@ static GtkType gtk_paned_child_type (GtkContainer *container);
static GtkContainerClass *parent_class = NULL;
-guint
+GtkType
gtk_paned_get_type (void)
{
- static guint paned_type = 0;
-
+ static GtkType paned_type = 0;
+
if (!paned_type)
{
GtkTypeInfo paned_info =
@@ -58,10 +59,10 @@ gtk_paned_get_type (void)
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
- paned_type = gtk_type_unique (gtk_container_get_type (), &paned_info);
+
+ paned_type = gtk_type_unique (GTK_TYPE_CONTAINER, &paned_info);
}
-
+
return paned_type;
}
@@ -71,22 +72,22 @@ gtk_paned_class_init (GtkPanedClass *class)
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkContainerClass *container_class;
-
+
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
container_class = (GtkContainerClass*) class;
-
- parent_class = gtk_type_class (gtk_container_get_type ());
-
+
+ parent_class = gtk_type_class (GTK_TYPE_CONTAINER);
+
widget_class->realize = gtk_paned_realize;
widget_class->map = gtk_paned_map;
widget_class->unmap = gtk_paned_unmap;
widget_class->unrealize = gtk_paned_unrealize;
widget_class->expose_event = gtk_paned_expose;
-
+
container_class->add = gtk_paned_add;
container_class->remove = gtk_paned_remove;
- container_class->foreach = gtk_paned_foreach;
+ container_class->forall = gtk_paned_forall;
container_class->child_type = gtk_paned_child_type;
}
@@ -103,17 +104,17 @@ static void
gtk_paned_init (GtkPaned *paned)
{
GTK_WIDGET_UNSET_FLAGS (paned, GTK_NO_WINDOW);
-
+
paned->child1 = NULL;
paned->child2 = NULL;
paned->handle = NULL;
paned->xor_gc = NULL;
-
+
paned->handle_size = 10;
paned->gutter_size = 6;
paned->position_set = FALSE;
paned->in_drag = FALSE;
-
+
paned->handle_xpos = -1;
paned->handle_ypos = -1;
}
@@ -125,13 +126,13 @@ gtk_paned_realize (GtkWidget *widget)
GtkPaned *paned;
GdkWindowAttr attributes;
gint attributes_mask;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PANED (widget));
-
+
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
paned = GTK_PANED (widget);
-
+
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
@@ -142,11 +143,11 @@ gtk_paned_realize (GtkWidget *widget)
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
-
+
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
&attributes, attributes_mask);
gdk_window_set_user_data (widget->window, paned);
-
+
attributes.x = paned->handle_xpos;
attributes.y = paned->handle_ypos;
attributes.width = paned->handle_size;
@@ -157,32 +158,32 @@ gtk_paned_realize (GtkWidget *widget)
GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK);
attributes_mask |= GDK_WA_CURSOR;
-
+
paned->handle = gdk_window_new (widget->window,
&attributes, attributes_mask);
gdk_window_set_user_data (paned->handle, paned);
-
+
widget->style = gtk_style_attach (widget->style, widget->window);
-
+
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
gtk_style_set_background (widget->style, paned->handle, GTK_STATE_NORMAL);
-
+
gdk_window_show (paned->handle);
}
-
+
static void
gtk_paned_map (GtkWidget *widget)
{
GtkPaned *paned;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PANED (widget));
-
+
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
paned = GTK_PANED (widget);
-
+
gdk_window_show (widget->window);
-
+
if (paned->child1 &&
GTK_WIDGET_VISIBLE (paned->child1) &&
!GTK_WIDGET_MAPPED (paned->child1))
@@ -198,9 +199,9 @@ gtk_paned_unmap (GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PANED (widget));
-
+
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
-
+
gdk_window_hide (widget->window);
}
@@ -208,18 +209,18 @@ static void
gtk_paned_unrealize (GtkWidget *widget)
{
GtkPaned *paned;
-
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_PANED (widget));
-
+
paned = GTK_PANED (widget);
-
+
if (paned->xor_gc)
{
gdk_gc_destroy (paned->xor_gc);
paned->xor_gc = NULL;
}
-
+
if (paned->handle)
{
gdk_window_set_user_data (paned->handle, NULL);
@@ -228,7 +229,7 @@ gtk_paned_unrealize (GtkWidget *widget)
gdk_cursor_destroy (paned->cursor);
paned->cursor = NULL;
}
-
+
if (GTK_WIDGET_CLASS (parent_class)->unrealize)
(* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
}
@@ -239,15 +240,15 @@ gtk_paned_expose (GtkWidget *widget,
{
GtkPaned *paned;
GdkEventExpose child_event;
-
+
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
-
+
if (GTK_WIDGET_DRAWABLE (widget))
{
paned = GTK_PANED (widget);
-
+
/* An expose event for the handle */
if (event->window == paned->handle)
{
@@ -266,12 +267,12 @@ gtk_paned_expose (GtkWidget *widget,
GTK_WIDGET_NO_WINDOW (paned->child1) &&
gtk_widget_intersect (paned->child1, &event->area, &child_event.area))
gtk_widget_event (paned->child1, (GdkEvent*) &child_event);
-
+
if (paned->child2 &&
GTK_WIDGET_NO_WINDOW (paned->child2) &&
gtk_widget_intersect (paned->child2, &event->area, &child_event.area))
gtk_widget_event (paned->child2, (GdkEvent*) &child_event);
-
+
/* redraw the groove if necessary */
if (gdk_rectangle_intersect (&paned->groove_rectangle,
&event->area,
@@ -287,11 +288,11 @@ gtk_paned_add1 (GtkPaned *paned,
GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
-
+
if (!paned->child1)
{
gtk_widget_set_parent (widget, GTK_WIDGET (paned));
-
+
if (GTK_WIDGET_VISIBLE (widget->parent))
{
if (GTK_WIDGET_REALIZED (widget->parent) &&
@@ -302,9 +303,9 @@ gtk_paned_add1 (GtkPaned *paned,
!GTK_WIDGET_MAPPED (widget))
gtk_widget_map (widget);
}
-
+
paned->child1 = widget;
-
+
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (paned))
gtk_widget_queue_resize (widget);
}
@@ -315,11 +316,11 @@ gtk_paned_add2 (GtkPaned *paned,
GtkWidget *widget)
{
g_return_if_fail (widget != NULL);
-
+
if (!paned->child2)
{
gtk_widget_set_parent (widget, GTK_WIDGET (paned));
-
+
if (GTK_WIDGET_VISIBLE (widget->parent))
{
if (GTK_WIDGET_REALIZED (widget->parent) &&
@@ -330,9 +331,9 @@ gtk_paned_add2 (GtkPaned *paned,
!GTK_WIDGET_MAPPED (widget))
gtk_widget_map (widget);
}
-
+
paned->child2 = widget;
-
+
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (paned))
gtk_widget_queue_resize (widget);
}
@@ -343,13 +344,13 @@ gtk_paned_add (GtkContainer *container,
GtkWidget *widget)
{
GtkPaned *paned;
-
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_PANED (container));
g_return_if_fail (widget != NULL);
-
+
paned = GTK_PANED (container);
-
+
if (!paned->child1)
gtk_paned_add1 (GTK_PANED (container),widget);
else if (!paned->child2)
@@ -362,47 +363,48 @@ gtk_paned_remove (GtkContainer *container,
{
GtkPaned *paned;
gboolean was_visible;
-
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_PANED (container));
g_return_if_fail (widget != NULL);
-
+
paned = GTK_PANED (container);
was_visible = GTK_WIDGET_VISIBLE (widget);
if (paned->child1 == widget)
{
gtk_widget_unparent (widget);
-
+
paned->child1 = NULL;
-
+
if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
else if (paned->child2 == widget)
{
gtk_widget_unparent (widget);
-
+
paned->child2 = NULL;
-
+
if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
}
}
static void
-gtk_paned_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_paned_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkPaned *paned;
-
+
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_PANED (container));
g_return_if_fail (callback != NULL);
-
+
paned = GTK_PANED (container);
-
+
if (paned->child1)
(* callback) (paned->child1, callback_data);
if (paned->child2)
@@ -410,9 +412,13 @@ gtk_paned_foreach (GtkContainer *container,
}
void
-gtk_paned_handle_size (GtkPaned *paned, guint16 size)
+gtk_paned_handle_size (GtkPaned *paned,
+ guint16 size)
{
gint x,y;
+
+ g_return_if_fail (paned != NULL);
+ g_return_if_fail (GTK_IS_PANED (paned));
if (paned->handle)
{
@@ -422,16 +428,18 @@ gtk_paned_handle_size (GtkPaned *paned, guint16 size)
y + paned->handle_size / 2 - size / 2,
size, size);
}
-
paned->handle_size = size;
}
void
-gtk_paned_gutter_size (GtkPaned *paned, guint16 size)
+gtk_paned_gutter_size (GtkPaned *paned,
+ guint16 size)
{
- paned->gutter_size = size;
+ g_return_if_fail (paned != NULL);
+ g_return_if_fail (GTK_IS_PANED (paned));
+ paned->gutter_size = size;
+
if (GTK_WIDGET_VISIBLE (GTK_WIDGET (paned)))
gtk_widget_queue_resize (GTK_WIDGET (paned));
}
-
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index eddc77831..944cc81ec 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -52,7 +52,8 @@ static void gtk_scrolled_window_add (GtkContainer *cont
GtkWidget *widget);
static void gtk_scrolled_window_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_scrolled_window_foreach (GtkContainer *container,
+static void gtk_scrolled_window_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_scrolled_window_viewport_allocate (GtkWidget *widget,
@@ -127,7 +128,7 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
container_class->add = gtk_scrolled_window_add;
container_class->remove = gtk_scrolled_window_remove;
- container_class->foreach = gtk_scrolled_window_foreach;
+ container_class->forall = gtk_scrolled_window_forall;
class->scrollbar_spacing = 5;
}
@@ -594,9 +595,10 @@ gtk_scrolled_window_remove (GtkContainer *container,
}
static void
-gtk_scrolled_window_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_scrolled_window_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkScrolledWindow *scrolled_window;
@@ -606,11 +608,16 @@ gtk_scrolled_window_foreach (GtkContainer *container,
scrolled_window = GTK_SCROLLED_WINDOW (container);
- if (scrolled_window->viewport)
- (* callback) (scrolled_window->viewport, callback_data);
-
- (* callback) (scrolled_window->vscrollbar, callback_data);
- (* callback) (scrolled_window->hscrollbar, callback_data);
+ if (include_internals)
+ {
+ if (scrolled_window->viewport)
+ (* callback) (scrolled_window->viewport, callback_data);
+
+ (* callback) (scrolled_window->vscrollbar, callback_data);
+ (* callback) (scrolled_window->hscrollbar, callback_data);
+ }
+ else if (scrolled_window->viewport)
+ gtk_container_foreach (GTK_CONTAINER (scrolled_window->viewport), callback, callback_data);
}
static void
diff --git a/gtk/gtktable.c b/gtk/gtktable.c
index dfc782c07..08e048f26 100644
--- a/gtk/gtktable.c
+++ b/gtk/gtktable.c
@@ -59,7 +59,8 @@ static void gtk_table_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_table_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_table_foreach (GtkContainer *container,
+static void gtk_table_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_table_get_arg (GtkObject *object,
@@ -157,7 +158,7 @@ gtk_table_class_init (GtkTableClass *class)
container_class->add = gtk_table_add;
container_class->remove = gtk_table_remove;
- container_class->foreach = gtk_table_foreach;
+ container_class->forall = gtk_table_forall;
container_class->child_type = gtk_table_child_type;
container_class->set_child_arg = gtk_table_set_child_arg;
container_class->get_child_arg = gtk_table_get_child_arg;
@@ -860,9 +861,10 @@ gtk_table_remove (GtkContainer *container,
}
static void
-gtk_table_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_table_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkTable *table;
GtkTableChild *child;
diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c
index 6e62117ad..8457d6c7d 100644
--- a/gtk/gtktoolbar.c
+++ b/gtk/gtktoolbar.c
@@ -52,7 +52,8 @@ static void gtk_toolbar_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_toolbar_remove (GtkContainer *container,
GtkWidget *widget);
-static void gtk_toolbar_foreach (GtkContainer *container,
+static void gtk_toolbar_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
static void gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
@@ -134,7 +135,7 @@ gtk_toolbar_class_init (GtkToolbarClass *class)
container_class->add = gtk_toolbar_add;
container_class->remove = gtk_toolbar_remove;
- container_class->foreach = gtk_toolbar_foreach;
+ container_class->forall = gtk_toolbar_forall;
container_class->focus = NULL;
class->orientation_changed = gtk_real_toolbar_orientation_changed;
@@ -543,9 +544,10 @@ gtk_toolbar_remove (GtkContainer *container,
}
static void
-gtk_toolbar_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_toolbar_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkToolbar *toolbar;
GList *children;
@@ -736,7 +738,13 @@ gtk_toolbar_insert_element (GtkToolbar *toolbar,
g_return_val_if_fail (toolbar != NULL, NULL);
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), NULL);
- g_return_val_if_fail ((type != GTK_TOOLBAR_CHILD_WIDGET) || (widget != NULL), NULL);
+ if (type == GTK_TOOLBAR_CHILD_WIDGET)
+ {
+ g_return_val_if_fail (widget != NULL, NULL);
+ g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
+ }
+ else
+ g_return_val_if_fail (widget == NULL, NULL);
child = g_new (GtkToolbarChild, 1);
child->type = type;
@@ -841,6 +849,9 @@ void
gtk_toolbar_set_orientation (GtkToolbar *toolbar,
GtkOrientation orientation)
{
+ g_return_if_fail (toolbar != NULL);
+ g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
+
gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[ORIENTATION_CHANGED], orientation);
}
@@ -848,6 +859,9 @@ void
gtk_toolbar_set_style (GtkToolbar *toolbar,
GtkToolbarStyle style)
{
+ g_return_if_fail (toolbar != NULL);
+ g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
+
gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
}
@@ -904,7 +918,7 @@ gtk_toolbar_set_button_relief (GtkToolbar *toolbar,
}
GtkReliefStyle
-gtk_toolbar_get_button_relief (GtkToolbar *toolbar)
+gtk_toolbar_get_button_relief (GtkToolbar *toolbar)
{
g_return_val_if_fail (toolbar != NULL, GTK_RELIEF_NORMAL);
g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_RELIEF_NORMAL);
diff --git a/gtk/gtktooltips.c b/gtk/gtktooltips.c
index 4800af1d8..d74d5f6f9 100644
--- a/gtk/gtktooltips.c
+++ b/gtk/gtktooltips.c
@@ -43,16 +43,15 @@ static void gtk_tooltips_widget_remove (GtkWidget *widget,
static void gtk_tooltips_set_active_widget (GtkTooltips *tooltips,
GtkWidget *widget);
static gint gtk_tooltips_timeout (gpointer data);
-static void gtk_tooltips_create_window (GtkTooltips *tooltips);
static void gtk_tooltips_draw_tips (GtkTooltips *tooltips);
static GtkDataClass *parent_class;
static const gchar *tooltips_data_key = "_GtkTooltipsData";
-guint
+GtkType
gtk_tooltips_get_type (void)
{
- static guint tooltips_type = 0;
+ static GtkType tooltips_type = 0;
if (!tooltips_type)
{
@@ -68,7 +67,7 @@ gtk_tooltips_get_type (void)
(GtkClassInitFunc) NULL,
};
- tooltips_type = gtk_type_unique (gtk_data_get_type (), &tooltips_info);
+ tooltips_type = gtk_type_unique (GTK_TYPE_DATA, &tooltips_info);
}
return tooltips_type;
@@ -80,7 +79,7 @@ gtk_tooltips_class_init (GtkTooltipsClass *class)
GtkObjectClass *object_class;
object_class = (GtkObjectClass*) class;
- parent_class = gtk_type_class (gtk_data_get_type ());
+ parent_class = gtk_type_class (GTK_TYPE_DATA);
object_class->destroy = gtk_tooltips_destroy;
}
@@ -103,7 +102,7 @@ gtk_tooltips_init (GtkTooltips *tooltips)
GtkTooltips *
gtk_tooltips_new (void)
{
- return gtk_type_new (gtk_tooltips_get_type ());
+ return gtk_type_new (GTK_TYPE_TOOLTIPS);
}
static void
@@ -154,12 +153,8 @@ gtk_tooltips_destroy (GtkObject *object)
}
}
- if (tooltips->tip_window != NULL)
- {
- gtk_widget_destroy (tooltips->tip_window);
- gtk_widget_unref (tooltips->tip_window);
- tooltips->tip_window = NULL;
- }
+ if (tooltips->tip_window)
+ gtk_widget_destroy (tooltips->tip_window);
if (tooltips->gc != NULL)
{
@@ -168,13 +163,22 @@ gtk_tooltips_destroy (GtkObject *object)
}
}
-static void
-gtk_tooltips_create_window (GtkTooltips *tooltips)
+void
+gtk_tooltips_force_window (GtkTooltips *tooltips)
{
- tooltips->tip_window = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_widget_ref (tooltips->tip_window);
- gtk_window_set_policy (GTK_WINDOW (tooltips->tip_window), FALSE, FALSE, TRUE);
- gtk_widget_realize (tooltips->tip_window);
+ g_return_if_fail (tooltips != NULL);
+ g_return_if_fail (GTK_IS_TOOLTIPS (tooltips));
+
+ if (!tooltips->tip_window)
+ {
+ tooltips->tip_window = gtk_window_new (GTK_WINDOW_POPUP);
+ gtk_window_set_policy (GTK_WINDOW (tooltips->tip_window), FALSE, FALSE, TRUE);
+ gtk_widget_realize (tooltips->tip_window);
+ gtk_signal_connect (GTK_OBJECT (tooltips->tip_window),
+ "destroy",
+ gtk_widget_destroyed,
+ &tooltips->tip_window);
+ }
}
static void
@@ -184,8 +188,8 @@ gtk_tooltips_layout_text (GtkTooltips *tooltips, GtkTooltipsData *data)
gint i, row_width, window_width = 0;
size_t len;
- if (tooltips->tip_window == NULL)
- gtk_tooltips_create_window (tooltips);
+ if (!tooltips->tip_window)
+ gtk_tooltips_force_window (tooltips);
g_list_foreach (data->row, gtk_tooltips_free_string, 0);
if (data->row)
@@ -384,7 +388,7 @@ gtk_tooltips_draw_tips (GtkTooltips * tooltips)
GList *el;
if (!tooltips->tip_window)
- gtk_tooltips_create_window (tooltips);
+ gtk_tooltips_force_window (tooltips);
else if (GTK_WIDGET_VISIBLE (tooltips->tip_window))
gtk_widget_hide (tooltips->tip_window);
diff --git a/gtk/gtktooltips.h b/gtk/gtktooltips.h
index 77ffc92ee..85aaa366c 100644
--- a/gtk/gtktooltips.h
+++ b/gtk/gtktooltips.h
@@ -25,11 +25,14 @@
#ifdef __cplusplus
extern "C" {
+#pragma }
#endif /* __cplusplus */
-#define GTK_TOOLTIPS(obj) GTK_CHECK_CAST (obj, gtk_tooltips_get_type (), GtkTooltips)
-#define GTK_TOOLTIPS_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_tooltips_get_type (), GtkTooltipsClass)
-#define GTK_IS_TOOLTIPS(obj) GTK_CHECK_TYPE (obj, gtk_tooltips_get_type ())
+#define GTK_TYPE_TOOLTIPS (gtk_tooltips_get_type ())
+#define GTK_TOOLTIPS(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_TOOLTIPS, GtkTooltips))
+#define GTK_TOOLTIPS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_TOOLTIPS, GtkTooltipsClass))
+#define GTK_IS_TOOLTIPS(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_TOOLTIPS))
+#define GTK_IS_TOOLTIPS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_TOOLTIPS))
typedef struct _GtkTooltips GtkTooltips;
typedef struct _GtkTooltipsClass GtkTooltipsClass;
@@ -68,21 +71,22 @@ struct _GtkTooltipsClass
GtkDataClass parent_class;
};
-GtkType gtk_tooltips_get_type (void);
-GtkTooltips* gtk_tooltips_new (void);
-
-void gtk_tooltips_enable (GtkTooltips *tooltips);
-void gtk_tooltips_disable (GtkTooltips *tooltips);
-void gtk_tooltips_set_delay (GtkTooltips *tooltips,
- guint delay);
-void gtk_tooltips_set_tip (GtkTooltips *tooltips,
- GtkWidget *widget,
- const gchar *tip_text,
- const gchar *tip_private);
-void gtk_tooltips_set_colors (GtkTooltips *tooltips,
- GdkColor *background,
- GdkColor *foreground);
-GtkTooltipsData* gtk_tooltips_data_get (GtkWidget *widget);
+GtkType gtk_tooltips_get_type (void);
+GtkTooltips* gtk_tooltips_new (void);
+
+void gtk_tooltips_enable (GtkTooltips *tooltips);
+void gtk_tooltips_disable (GtkTooltips *tooltips);
+void gtk_tooltips_set_delay (GtkTooltips *tooltips,
+ guint delay);
+void gtk_tooltips_set_tip (GtkTooltips *tooltips,
+ GtkWidget *widget,
+ const gchar *tip_text,
+ const gchar *tip_private);
+void gtk_tooltips_set_colors (GtkTooltips *tooltips,
+ GdkColor *background,
+ GdkColor *foreground);
+GtkTooltipsData* gtk_tooltips_data_get (GtkWidget *widget);
+void gtk_tooltips_force_window (GtkTooltips *tooltips);
diff --git a/gtk/gtktree.c b/gtk/gtktree.c
index 6b7ad8a23..2f70b4c7f 100644
--- a/gtk/gtktree.c
+++ b/gtk/gtktree.c
@@ -51,7 +51,8 @@ static void gtk_tree_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_tree_add (GtkContainer *container,
GtkWidget *widget);
-static void gtk_tree_foreach (GtkContainer *container,
+static void gtk_tree_forall (GtkContainer *container,
+ gboolean include_internals,
GtkCallback callback,
gpointer callback_data);
@@ -145,7 +146,7 @@ gtk_tree_class_init (GtkTreeClass *class)
container_class->add = gtk_tree_add;
container_class->remove =
(void (*)(GtkContainer *, GtkWidget *)) gtk_tree_remove_item;
- container_class->foreach = gtk_tree_foreach;
+ container_class->forall = gtk_tree_forall;
container_class->child_type = gtk_tree_child_type;
class->selection_changed = NULL;
@@ -521,9 +522,10 @@ gtk_tree_expose (GtkWidget *widget,
}
static void
-gtk_tree_foreach (GtkContainer *container,
- GtkCallback callback,
- gpointer callback_data)
+gtk_tree_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
{
GtkTree *tree;
GtkWidget *child;
@@ -543,9 +545,6 @@ gtk_tree_foreach (GtkContainer *container,
children = children->next;
(* callback) (child, callback_data);
-
- if(GTK_TREE_ITEM(child)->subtree)
- (* callback)(GTK_TREE_ITEM(child)->subtree, callback_data);
}
}
diff --git a/gtk/gtktreeitem.c b/gtk/gtktreeitem.c
index 1e05d71a6..aa7a11298 100644
--- a/gtk/gtktreeitem.c
+++ b/gtk/gtktreeitem.c
@@ -67,6 +67,11 @@ static gint gtk_tree_item_focus_in (GtkWidget *widget,
GdkEventFocus *event);
static gint gtk_tree_item_focus_out (GtkWidget *widget,
GdkEventFocus *event);
+static void gtk_tree_item_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data);
+
static void gtk_real_tree_item_select (GtkItem *item);
static void gtk_real_tree_item_deselect (GtkItem *item);
static void gtk_real_tree_item_toggle (GtkItem *item);
@@ -85,7 +90,6 @@ static void gtk_tree_item_add_pixmaps (GtkTreeItem *tree_item);
static void gtk_tree_item_remove_pixmaps (GtkTreeItem *tree_item);
static GtkItemClass *parent_class = NULL;
-static GtkContainerClass *container_class = NULL;
static guint tree_item_signals[LAST_SIGNAL] = { 0 };
GtkType
@@ -118,6 +122,7 @@ gtk_tree_item_class_init (GtkTreeItemClass *class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
+ GtkContainerClass *container_class;
GtkItemClass *item_class;
object_class = (GtkObjectClass*) class;
@@ -158,14 +163,14 @@ gtk_tree_item_class_init (GtkTreeItemClass *class)
widget_class->map = gtk_tree_item_map;
widget_class->unmap = gtk_tree_item_unmap;
+ container_class->forall = gtk_tree_item_forall;
+
item_class->select = gtk_real_tree_item_select;
item_class->deselect = gtk_real_tree_item_deselect;
item_class->toggle = gtk_real_tree_item_toggle;
class->expand = gtk_real_tree_item_expand;
class->collapse = gtk_real_tree_item_collapse;
-
- container_class = (GtkContainerClass*) parent_class;
}
/* callback for event box mouse event */
@@ -303,7 +308,7 @@ gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
/* show subtree button */
if (tree_item->pixmaps_box)
- gtk_widget_show(tree_item->pixmaps_box);
+ gtk_widget_show (tree_item->pixmaps_box);
/* set parent widget */
gtk_widget_set_parent(subtree, GTK_WIDGET(tree_item)->parent);
@@ -319,7 +324,7 @@ gtk_tree_item_set_subtree (GtkTreeItem *tree_item,
gtk_widget_map (GTK_WIDGET(subtree));
}
- if(tree_item->expanded)
+ if (tree_item->expanded)
gtk_widget_show(subtree);
else
gtk_widget_hide(subtree);
@@ -501,8 +506,8 @@ gtk_tree_item_size_request (GtkWidget *widget,
requisition->width += item->pixmaps_box->requisition.width + DEFAULT_DELTA +
GTK_TREE(widget->parent)->current_indent;
- requisition->height += MAX(bin->child->requisition.height,
- item->pixmaps_box->requisition.height);
+ requisition->height += MAX (bin->child->requisition.height,
+ item->pixmaps_box->requisition.height);
}
}
@@ -557,7 +562,7 @@ gtk_tree_item_size_allocate (GtkWidget *widget,
}
static void
-gtk_tree_item_draw_lines(GtkWidget *widget)
+gtk_tree_item_draw_lines (GtkWidget *widget)
{
GtkTreeItem* item;
GtkTree* tree;
@@ -571,17 +576,16 @@ gtk_tree_item_draw_lines(GtkWidget *widget)
/* draw vertical line */
lx1 = item->pixmaps_box->allocation.width;
- lx1 = lx2 = ( lx1 / 2 ) + ( lx1 % 2 ) +
- GTK_CONTAINER(widget)->border_width + 1 + tree->current_indent;
+ lx1 = lx2 = ((lx1 / 2) + (lx1 % 2) +
+ GTK_CONTAINER (widget)->border_width + 1 + tree->current_indent);
ly1 = 0;
ly2 = widget->allocation.height;
- if(g_list_last(tree->children)->data == (gpointer)widget)
+ if (g_list_last (tree->children)->data == widget)
ly2 = (ly2 / 2) + (ly2 % 2);
- if(tree != tree->root_tree)
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx1, ly1, lx2, ly2);
+ if (tree != tree->root_tree)
+ gdk_draw_line (widget->window, widget->style->black_gc, lx1, ly1, lx2, ly2);
/* draw vertical line for subtree connecting */
if(g_list_last(tree->children)->data != (gpointer)widget)
@@ -589,34 +593,34 @@ gtk_tree_item_draw_lines(GtkWidget *widget)
lx2 += DEFAULT_DELTA;
- if(item->subtree && item->expanded)
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx2, ly2, lx2, widget->allocation.height);
+ if (item->subtree && item->expanded)
+ gdk_draw_line (widget->window, widget->style->black_gc,
+ lx2, ly2, lx2, widget->allocation.height);
/* draw horizontal line */
ly1 = ly2;
lx2 += 2;
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx1, ly1, lx2, ly2);
+ gdk_draw_line (widget->window, widget->style->black_gc,
+ lx1, ly1, lx2, ly2);
lx2 -= DEFAULT_DELTA+2;
ly1 = 0;
ly2 = widget->allocation.height;
- if(tree != tree->root_tree)
+ if (tree != tree->root_tree)
{
- item = GTK_TREE_ITEM(tree->tree_owner);
- tree = GTK_TREE(GTK_WIDGET(tree)->parent);
- while(tree != tree->root_tree) {
- lx1 = lx2 -= tree->indent_value;
-
- if(g_list_last(tree->children)->data != (gpointer)item)
- gdk_draw_line(widget->window, widget->style->black_gc,
- lx1, ly1, lx2, ly2);
- item = GTK_TREE_ITEM(tree->tree_owner);
- tree = GTK_TREE(GTK_WIDGET(tree)->parent);
- }
+ item = GTK_TREE_ITEM (tree->tree_owner);
+ tree = GTK_TREE (GTK_WIDGET (tree)->parent);
+ while (tree != tree->root_tree)
+ {
+ lx1 = lx2 -= tree->indent_value;
+
+ if (g_list_last (tree->children)->data != item)
+ gdk_draw_line (widget->window, widget->style->black_gc, lx1, ly1, lx2, ly2);
+ item = GTK_TREE_ITEM (tree->tree_owner);
+ tree = GTK_TREE (GTK_WIDGET (tree)->parent);
+ }
}
}
@@ -638,55 +642,56 @@ gtk_tree_item_draw (GtkWidget *widget,
tree_item = GTK_TREE_ITEM(widget);
/* draw left size of tree item */
- item_area.x = 0; item_area.y = 0;
- item_area.width = tree_item->pixmaps_box->allocation.width+DEFAULT_DELTA +
- (GTK_TREE(widget->parent)->current_indent + 2);
+ item_area.x = 0;
+ item_area.y = 0;
+ item_area.width = (tree_item->pixmaps_box->allocation.width + DEFAULT_DELTA +
+ GTK_TREE (widget->parent)->current_indent + 2);
item_area.height = widget->allocation.height;
- if(gdk_rectangle_intersect(&item_area, area, &child_area)) {
-
- if (!GTK_WIDGET_IS_SENSITIVE (widget))
- gtk_style_set_background (widget->style, widget->window,
- GTK_STATE_INSENSITIVE);
- else if(GTK_TREE(widget->parent)->view_mode == GTK_TREE_VIEW_LINE &&
- widget->state == GTK_STATE_SELECTED)
- gtk_style_set_background (widget->style, widget->window, widget->state);
- else
- gdk_window_set_background (widget->window,
- &widget->style->base[GTK_STATE_NORMAL]);
-
- gdk_window_clear_area (widget->window,
- child_area.x, child_area.y,
- child_area.width, child_area.height);
-
-/* gtk_tree_item_draw_lines(widget); */
-
- if (tree_item->pixmaps_box &&
- GTK_WIDGET_VISIBLE(tree_item->pixmaps_box) &&
- gtk_widget_intersect (tree_item->pixmaps_box, area, &child_area))
- gtk_widget_draw (tree_item->pixmaps_box, &child_area);
- }
-
+ if (gdk_rectangle_intersect (&item_area, area, &child_area))
+ {
+ if (!GTK_WIDGET_IS_SENSITIVE (widget))
+ gtk_style_set_background (widget->style, widget->window,
+ GTK_STATE_INSENSITIVE);
+ else if(GTK_TREE(widget->parent)->view_mode == GTK_TREE_VIEW_LINE &&
+ widget->state == GTK_STATE_SELECTED)
+ gtk_style_set_background (widget->style, widget->window, widget->state);
+ else
+ gdk_window_set_background (widget->window,
+ &widget->style->base[GTK_STATE_NORMAL]);
+
+ gdk_window_clear_area (widget->window,
+ child_area.x, child_area.y,
+ child_area.width, child_area.height);
+
+ /* gtk_tree_item_draw_lines(widget); */
+
+ if (tree_item->pixmaps_box &&
+ GTK_WIDGET_VISIBLE(tree_item->pixmaps_box) &&
+ gtk_widget_intersect (tree_item->pixmaps_box, area, &child_area))
+ gtk_widget_draw (tree_item->pixmaps_box, &child_area);
+ }
+
/* draw right side */
- if(gtk_widget_intersect (bin->child, area, &child_area)) {
-
- if (!GTK_WIDGET_IS_SENSITIVE (widget))
- gtk_style_set_background (widget->style, widget->window,
- GTK_STATE_INSENSITIVE);
- else if (widget->state == GTK_STATE_NORMAL)
- gdk_window_set_background(widget->window, &widget->style->base[GTK_STATE_NORMAL]);
- else
- gtk_style_set_background (widget->style, widget->window, widget->state);
-
+ if (gtk_widget_intersect (bin->child, area, &child_area))
+ {
+ if (!GTK_WIDGET_IS_SENSITIVE (widget))
+ gtk_style_set_background (widget->style, widget->window,
+ GTK_STATE_INSENSITIVE);
+ else if (widget->state == GTK_STATE_NORMAL)
+ gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
+ else
+ gtk_style_set_background (widget->style, widget->window, widget->state);
+
gdk_window_clear_area (widget->window, child_area.x, child_area.y,
child_area.width+1, child_area.height);
-
+
if (bin->child &&
GTK_WIDGET_VISIBLE(bin->child) &&
gtk_widget_intersect (bin->child, area, &child_area))
gtk_widget_draw (bin->child, &child_area);
}
-
+
gtk_widget_draw_focus (widget);
}
}
@@ -713,10 +718,10 @@ gtk_tree_item_draw_focus (GtkWidget *widget)
dx = 0;
- if(GTK_TREE(widget->parent)->view_mode == GTK_TREE_VIEW_ITEM)
- dx = GTK_TREE_ITEM(widget)->pixmaps_box->allocation.width + DEFAULT_DELTA +
- GTK_TREE(widget->parent)->current_indent+1;
-
+ if (GTK_TREE(widget->parent)->view_mode == GTK_TREE_VIEW_ITEM)
+ dx = (GTK_TREE_ITEM(widget)->pixmaps_box->allocation.width + DEFAULT_DELTA +
+ GTK_TREE(widget->parent)->current_indent + 1);
+
gdk_draw_rectangle (widget->window, gc, FALSE, dx, 0,
widget->allocation.width - 1 - dx,
widget->allocation.height - 1);
@@ -794,39 +799,37 @@ gtk_tree_item_focus_out (GtkWidget *widget,
static void
gtk_real_tree_item_select (GtkItem *item)
{
+ GtkTreeItem *tree_item;
+ GtkWidget *widget;
+
g_return_if_fail (item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (item));
- if (GTK_WIDGET (item)->state == GTK_STATE_SELECTED
- || !GTK_WIDGET_IS_SENSITIVE(item))
- return;
-
- if(GTK_TREE(GTK_WIDGET(item)->parent)->view_mode == GTK_TREE_VIEW_LINE)
- gtk_widget_set_state (GTK_TREE_ITEM (item)->pixmaps_box, GTK_STATE_SELECTED);
+ tree_item = GTK_TREE_ITEM (item);
+ widget = GTK_WIDGET (item);
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
+ if (!widget->parent || GTK_TREE (widget->parent)->view_mode == GTK_TREE_VIEW_LINE)
+ gtk_widget_set_state (GTK_TREE_ITEM (item)->pixmaps_box, GTK_STATE_SELECTED);
}
static void
gtk_real_tree_item_deselect (GtkItem *item)
{
+ GtkTreeItem *tree_item;
+ GtkWidget *widget;
+
g_return_if_fail (item != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (item));
- if (GTK_WIDGET (item)->state == GTK_STATE_NORMAL)
- return;
+ tree_item = GTK_TREE_ITEM (item);
+ widget = GTK_WIDGET (item);
- if(GTK_WIDGET_MAPPED(GTK_WIDGET (item)))
- {
- gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
-
- if(GTK_TREE(GTK_WIDGET(item)->parent)->view_mode == GTK_TREE_VIEW_LINE)
- gtk_widget_set_state (GTK_TREE_ITEM (item)->pixmaps_box, GTK_STATE_NORMAL);
+ gtk_widget_set_state (widget, GTK_STATE_NORMAL);
- gtk_widget_queue_draw (GTK_WIDGET (item));
- }
+ if (!widget->parent || GTK_TREE (widget->parent)->view_mode == GTK_TREE_VIEW_LINE)
+ gtk_widget_set_state (tree_item->pixmaps_box, GTK_STATE_NORMAL);
}
static void
@@ -852,7 +855,6 @@ gtk_real_tree_item_toggle (GtkItem *item)
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_NORMAL);
else
gtk_widget_set_state (GTK_WIDGET (item), GTK_STATE_SELECTED);
- gtk_widget_queue_draw (GTK_WIDGET (item));
}
}
@@ -1029,14 +1031,12 @@ gtk_tree_item_map (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TREE_ITEM (widget));
- GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
bin = GTK_BIN (widget);
item = GTK_TREE_ITEM(widget);
- if (!GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_show (widget->window);
- else
- gtk_widget_queue_draw (widget);
+ GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
+
+ gdk_window_show (widget->window);
if(item->pixmaps_box &&
GTK_WIDGET_VISIBLE (item->pixmaps_box) &&
@@ -1062,14 +1062,7 @@ gtk_tree_item_unmap (GtkWidget *widget)
bin = GTK_BIN (widget);
item = GTK_TREE_ITEM(widget);
- if (GTK_WIDGET_NO_WINDOW (widget))
- gdk_window_clear_area (widget->window,
- widget->allocation.x,
- widget->allocation.y,
- widget->allocation.width,
- widget->allocation.height);
- else
- gdk_window_hide (widget->window);
+ gdk_window_hide (widget->window);
if(item->pixmaps_box &&
GTK_WIDGET_VISIBLE (item->pixmaps_box) &&
@@ -1081,3 +1074,25 @@ gtk_tree_item_unmap (GtkWidget *widget)
GTK_WIDGET_MAPPED (bin->child))
gtk_widget_unmap (bin->child);
}
+
+static void
+gtk_tree_item_forall (GtkContainer *container,
+ gboolean include_internals,
+ GtkCallback callback,
+ gpointer callback_data)
+{
+ GtkBin *bin;
+ GtkTreeItem *tree_item;
+
+ g_return_if_fail (container != NULL);
+ g_return_if_fail (GTK_IS_TREE_ITEM (container));
+ g_return_if_fail (callback != NULL);
+
+ bin = GTK_BIN (container);
+ tree_item = GTK_TREE_ITEM (container);
+
+ if (bin->child)
+ (* callback) (bin->child, callback_data);
+ if (include_internals && tree_item->subtree)
+ (* callback) (tree_item->subtree, callback_data);
+}
diff --git a/gtk/gtktypebuiltins_evals.c b/gtk/gtktypebuiltins_evals.c
index 6bbef5a4b..2d7581326 100644
--- a/gtk/gtktypebuiltins_evals.c
+++ b/gtk/gtktypebuiltins_evals.c
@@ -435,6 +435,7 @@ static GtkEnumValue _gtk_widget_flags_values[] = {
{ GTK_HAS_DEFAULT, "GTK_HAS_DEFAULT", "has-default" },
{ GTK_HAS_GRAB, "GTK_HAS_GRAB", "has-grab" },
{ GTK_RC_STYLE, "GTK_RC_STYLE", "rc-style" },
+ { GTK_COMPOSITE_CHILD, "GTK_COMPOSITE_CHILD", "composite-child" },
{ GTK_BASIC, "GTK_BASIC", "basic" },
{ 0, NULL, NULL }
};
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ef1975664..40055f249 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -103,6 +103,7 @@ enum {
ARG_HAS_FOCUS,
ARG_CAN_DEFAULT,
ARG_HAS_DEFAULT,
+ ARG_COMPOSITE_CHILD,
ARG_STYLE,
ARG_EVENTS,
ARG_EXTENSION_EVENTS
@@ -115,6 +116,7 @@ struct _GtkStateData
GtkStateType state;
guint state_restoration : 1;
guint parent_sensitive : 1;
+ guint use_forall : 1;
};
static void gtk_widget_class_init (GtkWidgetClass *klass);
@@ -178,7 +180,7 @@ static GtkStyle *gtk_default_style = NULL;
static GSList *colormap_stack = NULL;
static GSList *visual_stack = NULL;
static GSList *style_stack = NULL;
-
+static guint composite_child_stack = 0;
static GSList *gtk_widget_redraw_queue = NULL;
static const gchar *aux_info_key = "gtk-aux-info";
@@ -266,6 +268,7 @@ gtk_widget_class_init (GtkWidgetClass *klass)
gtk_object_add_arg_type ("GtkWidget::has_focus", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_FOCUS);
gtk_object_add_arg_type ("GtkWidget::can_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CAN_DEFAULT);
gtk_object_add_arg_type ("GtkWidget::has_default", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_HAS_DEFAULT);
+ gtk_object_add_arg_type ("GtkWidget::composite_child", GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_COMPOSITE_CHILD);
gtk_object_add_arg_type ("GtkWidget::style", GTK_TYPE_STYLE, GTK_ARG_READWRITE, ARG_STYLE);
gtk_object_add_arg_type ("GtkWidget::events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EVENTS);
gtk_object_add_arg_type ("GtkWidget::extension_events", GTK_TYPE_GDK_EVENT_MASK, GTK_ARG_READWRITE, ARG_EXTENSION_EVENTS);
@@ -664,9 +667,9 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->activate_signal = 0;
klass->show = gtk_widget_real_show;
+ klass->show_all = gtk_widget_show;
klass->hide = gtk_widget_real_hide;
- klass->show_all = gtk_widget_real_show;
- klass->hide_all = gtk_widget_real_hide;
+ klass->hide_all = gtk_widget_hide;
klass->map = gtk_widget_real_map;
klass->unmap = gtk_widget_real_unmap;
klass->realize = gtk_widget_real_realize;
@@ -780,6 +783,12 @@ gtk_widget_set_arg (GtkObject *object,
if (GTK_VALUE_BOOL (*arg))
gtk_widget_grab_default (widget);
break;
+ case ARG_COMPOSITE_CHILD:
+ if (GTK_VALUE_BOOL(*arg))
+ GTK_WIDGET_SET_FLAGS (widget, GTK_COMPOSITE_CHILD);
+ else
+ GTK_WIDGET_UNSET_FLAGS (widget, GTK_COMPOSITE_CHILD);
+ break;
case ARG_STYLE:
gtk_widget_set_style (widget, (GtkStyle*) GTK_VALUE_BOXED (*arg));
break;
@@ -873,6 +882,9 @@ gtk_widget_get_arg (GtkObject *object,
case ARG_HAS_DEFAULT:
GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_HAS_DEFAULT (widget) != FALSE);
break;
+ case ARG_COMPOSITE_CHILD:
+ GTK_VALUE_BOOL (*arg) = (GTK_WIDGET_COMPOSITE_CHILD (widget) != FALSE);
+ break;
case ARG_STYLE:
GTK_VALUE_BOXED (*arg) = (gpointer) gtk_widget_get_style (widget);
break;
@@ -923,7 +935,10 @@ gtk_widget_init (GtkWidget *widget)
widget->window = NULL;
widget->parent = NULL;
- GTK_WIDGET_SET_FLAGS (widget, GTK_SENSITIVE | GTK_PARENT_SENSITIVE);
+ GTK_WIDGET_SET_FLAGS (widget,
+ GTK_SENSITIVE |
+ GTK_PARENT_SENSITIVE |
+ (composite_child_stack ? GTK_COMPOSITE_CHILD : 0));
widget->style = gtk_widget_peek_style ();
gtk_style_ref (widget->style);
@@ -1404,54 +1419,32 @@ gtk_widget_hide_on_delete (GtkWidget *widget)
return TRUE;
}
-/*****************************************
- * gtk_widget_show_all:
- *
- * Shows the widget and all children.
- *
- * Container classes overwrite
- * show_all and hide_all to call
- * show_all (hide_all) on both themselves
- * and on their child widgets.
- *
- * arguments:
- *
- * results:
- *****************************************/
-
void
gtk_widget_show_all (GtkWidget *widget)
{
- GtkWidgetClass *widget_class;
-
+ GtkWidgetClass *class;
+
g_return_if_fail (widget != NULL);
-
- /* show_all shouldn't be invoked through a signal,
- because in this case it would be quite slow - there would
- be a show and show_all signal emitted for every child widget.
- */
- widget_class = GTK_WIDGET_CLASS(GTK_OBJECT(widget)->klass);
- widget_class->show_all (widget);
-}
+ g_return_if_fail (GTK_IS_WIDGET (widget));
-/*****************************************
- * gtk_widget_hide_all:
- *
- * Hides the widget and all children.
- * See gtk_widget_show_all.
- *
- * arguments:
- *
- * results:
- *****************************************/
+ class = GTK_WIDGET_CLASS (GTK_OBJECT (widget)->klass);
+
+ if (class->show_all)
+ class->show_all (widget);
+}
void
gtk_widget_hide_all (GtkWidget *widget)
{
+ GtkWidgetClass *class;
+
g_return_if_fail (widget != NULL);
- g_assert (widget->parent);
+ g_return_if_fail (GTK_IS_WIDGET (widget));
+
+ class = GTK_WIDGET_CLASS (GTK_OBJECT (widget)->klass);
- GTK_WIDGET_CLASS (GTK_OBJECT (widget)->klass)->hide_all (widget);
+ if (class->hide_all)
+ class->hide_all (widget);
}
/*****************************************
@@ -1733,9 +1726,9 @@ gtk_widget_draw_children (GtkWidget *widget)
g_return_if_fail (widget != NULL);
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_draw_children_recurse,
- NULL);
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_draw_children_recurse,
+ NULL);
}
/*****************************************
@@ -2174,9 +2167,9 @@ gtk_widget_reparent_container_child(GtkWidget *widget,
gdk_window_ref (widget->window);
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_reparent_container_child,
- client_data);
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_reparent_container_child,
+ client_data);
}
else
gdk_window_reparent (widget->window,
@@ -2225,9 +2218,9 @@ gtk_widget_reparent (GtkWidget *widget,
if (GTK_WIDGET_NO_WINDOW (widget))
{
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_reparent_container_child,
- gtk_widget_get_parent_window (widget));
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_reparent_container_child,
+ gtk_widget_get_parent_window (widget));
else
{
GdkWindow *parent_window;
@@ -2484,6 +2477,7 @@ gtk_widget_set_state (GtkWidget *widget,
data.state = state;
data.state_restoration = FALSE;
+ data.use_forall = FALSE;
if (widget->parent)
data.parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (widget->parent) != FALSE);
else
@@ -2529,6 +2523,7 @@ gtk_widget_set_sensitive (GtkWidget *widget,
data.state = GTK_WIDGET_STATE (widget);
}
data.state_restoration = TRUE;
+ data.use_forall = TRUE;
if (widget->parent)
data.parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (widget->parent) != FALSE);
@@ -2572,6 +2567,7 @@ gtk_widget_set_parent (GtkWidget *widget,
data.state = GTK_WIDGET_STATE (widget);
data.state_restoration = FALSE;
data.parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (parent) != FALSE);
+ data.use_forall = GTK_WIDGET_IS_SENSITIVE (parent) != GTK_WIDGET_IS_SENSITIVE (widget);
gtk_widget_propagate_state (widget, &data);
@@ -2760,9 +2756,9 @@ gtk_widget_set_style_recurse (GtkWidget *widget,
gtk_widget_set_rc_style (widget);
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- gtk_widget_set_style_recurse,
- NULL);
+ gtk_container_forall (GTK_CONTAINER (widget),
+ gtk_widget_set_style_recurse,
+ NULL);
}
void
@@ -3285,6 +3281,19 @@ gtk_widget_push_visual (GdkVisual *visual)
visual_stack = g_slist_prepend (visual_stack, visual);
}
+void
+gtk_widget_push_composite (void)
+{
+ composite_child_stack++;
+}
+
+void
+gtk_widget_pop_composite (void)
+{
+ if (composite_child_stack)
+ composite_child_stack--;
+}
+
/*****************************************
* gtk_widget_pop_colormap:
*
@@ -3639,9 +3648,9 @@ gtk_widget_real_unrealize (GtkWidget *widget)
/* Unrealize afterwards to improve visual effect */
if (GTK_IS_CONTAINER (widget))
- gtk_container_foreach (GTK_CONTAINER (widget),
- (GtkCallback) gtk_widget_unrealize,
- NULL);
+ gtk_container_forall (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_unrealize,
+ NULL);
}
/*****************************************
@@ -3749,18 +3758,6 @@ gtk_widget_peek_visual (void)
return gtk_widget_get_default_visual ();
}
-/*************************************************************
- * gtk_widget_propagate_state:
- * Propagate a change in the widgets state down the tree
- *
- * arguments:
- * widget
- * GtkStateData: state
- * parent_sensitive
- *
- * results:
- *************************************************************/
-
static void
gtk_widget_propagate_state (GtkWidget *widget,
GtkStateData *data)
@@ -3823,9 +3820,14 @@ gtk_widget_propagate_state (GtkWidget *widget,
{
data->parent_sensitive = (GTK_WIDGET_IS_SENSITIVE (widget) != FALSE);
data->state = GTK_WIDGET_STATE (widget);
- gtk_container_foreach (GTK_CONTAINER (widget),
- (GtkCallback) gtk_widget_propagate_state,
- data);
+ if (data->use_forall)
+ gtk_container_forall (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_propagate_state,
+ data);
+ else
+ gtk_container_foreach (GTK_CONTAINER (widget),
+ (GtkCallback) gtk_widget_propagate_state,
+ data);
}
gtk_widget_unref (widget);
}
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index abb559b18..b60449d9c 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -50,7 +50,8 @@ typedef enum
GTK_HAS_DEFAULT = 1 << 14,
GTK_HAS_GRAB = 1 << 15,
GTK_RC_STYLE = 1 << 16,
- GTK_BASIC = 1 << 17
+ GTK_COMPOSITE_CHILD = 1 << 17,
+ GTK_BASIC = 1 << 18
} GtkWidgetFlags;
/* Macro for casting a pointer to a GtkWidget or GtkWidgetClass pointer.
@@ -86,8 +87,9 @@ typedef enum
#define GTK_WIDGET_CAN_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_CAN_DEFAULT) != 0)
#define GTK_WIDGET_HAS_DEFAULT(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_DEFAULT) != 0)
#define GTK_WIDGET_HAS_GRAB(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_HAS_GRAB) != 0)
-#define GTK_WIDGET_BASIC(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_BASIC) != 0)
#define GTK_WIDGET_RC_STYLE(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_RC_STYLE) != 0)
+#define GTK_WIDGET_COMPOSITE_CHILD(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_COMPOSITE_CHILD) != 0)
+#define GTK_WIDGET_BASIC(wid) ((GTK_WIDGET_FLAGS (wid) & GTK_BASIC) != 0)
/* Macros for setting and clearing widget flags.
*/
@@ -234,9 +236,9 @@ struct _GtkWidgetClass
/* basics */
void (* show) (GtkWidget *widget);
+ void (* show_all) (GtkWidget *widget);
void (* hide) (GtkWidget *widget);
- void (* show_all) (GtkWidget *widget);
- void (* hide_all) (GtkWidget *widget);
+ void (* hide_all) (GtkWidget *widget);
void (* map) (GtkWidget *widget);
void (* unmap) (GtkWidget *widget);
void (* realize) (GtkWidget *widget);
@@ -498,12 +500,14 @@ void gtk_widget_reset_rc_styles (GtkWidget *widget);
* This will override the values that got set by the
* gtk_widget_set_default_* () functions.
*/
-void gtk_widget_push_style (GtkStyle *style);
-void gtk_widget_push_colormap (GdkColormap *cmap);
-void gtk_widget_push_visual (GdkVisual *visual);
-void gtk_widget_pop_style (void);
-void gtk_widget_pop_colormap (void);
-void gtk_widget_pop_visual (void);
+void gtk_widget_push_style (GtkStyle *style);
+void gtk_widget_push_colormap (GdkColormap *cmap);
+void gtk_widget_push_visual (GdkVisual *visual);
+void gtk_widget_push_composite_flag (void);
+void gtk_widget_pop_composite_flag (void);
+void gtk_widget_pop_style (void);
+void gtk_widget_pop_colormap (void);
+void gtk_widget_pop_visual (void);
/* Set certain default values to be used at widget creation time.
*/