added a frame with radio buttons to select the resize_mode for the

Wed Jun 24 07:47:29 1998  Tim Janik  <timj@gtk.org>

        * gtk/testgtk.c (create_idle_test): added a frame with radio buttons
        to select the resize_mode for the idle-labels container.

        * gtk/gtkframe.h:
        * gtk/gtkframe.c: GtkType and macro corrections.

        * gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to
        support radio grouping.

Tue Jun 23 08:01:09 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize
        unconditionally if resize_mode has changed.

        * gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set
        GTK_RESIZE_QUEUE on the scrolled window.
        (gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport.

Tue Jun 23 04:20:30 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkcontainer.h:
        * gtk/gtkcontainer.c:
        (GTK_IS_RESIZE_CONTAINER): new macro to find out if
        a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT.
        (gtk_container_queue_resize): new function to queue a container for
        a *size* reallocation (doesn't affect its position, and thus its
        parent is left untouched usually).
        (gtk_container_get_resize_container): new function to retrive the next
        most resize container which is not itself queued for a resize.
        (gtk_container_idle_sizer): new function to carefully process the
        container_resize_queue since it can change during invokation of
        gtk_container_check_resize().
        (gtk_container_resize_children): total rework of this function to
        properly handle resize containers. makes a lot of assumptions whitch
        are stated in the comments.

        * gtk/gtkcontainer.c:
        (gtk_container_real_check_resize): only requeue ourselves if we are not
        a resize container.
        (gtk_container_clear_resize_widgets): care for automatic deletion of our
        resize_widgets list on size_allocate through a handler connection.

        * gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the
        focus and default widget of a window, so to take the burden from
        gtk_widget_unparent.

        * gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried
        to be clever, but actually messed up the resize_children logic and
        caused unneccessary allocations on its whole branch. besides this,
        it messed up the display by not invoking a redraw after the allocation.

        * gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so
        that it is the child again that is queued for a resize.
        (gtk_table_attach): likewise.
        (gtk_table_remove): likewise.
This commit is contained in:
Tim Janik 1998-06-24 06:25:14 +00:00 committed by Tim Janik
parent 00362c03f7
commit dbce6083ef
25 changed files with 966 additions and 277 deletions

View File

@ -2,6 +2,64 @@ Tue Jun 23 22:21:33 PDT 1998 Manish Singh <yosh@gimp.org>
* gtk-boxed.defs: s/GkWidget/GtkWidget/
Wed Jun 24 07:47:29 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_idle_test): added a frame with radio buttons
to select the resize_mode for the idle-labels container.
* gtk/gtkframe.h:
* gtk/gtkframe.c: GtkType and macro corrections.
* gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to
support radio grouping.
Tue Jun 23 08:01:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize
unconditionally if resize_mode has changed.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set
GTK_RESIZE_QUEUE on the scrolled window.
(gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport.
Tue Jun 23 04:20:30 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c:
(GTK_IS_RESIZE_CONTAINER): new macro to find out if
a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT.
(gtk_container_queue_resize): new function to queue a container for
a *size* reallocation (doesn't affect its position, and thus its
parent is left untouched usually).
(gtk_container_get_resize_container): new function to retrive the next
most resize container which is not itself queued for a resize.
(gtk_container_idle_sizer): new function to carefully process the
container_resize_queue since it can change during invokation of
gtk_container_check_resize().
(gtk_container_resize_children): total rework of this function to
properly handle resize containers. makes a lot of assumptions whitch
are stated in the comments.
* gtk/gtkcontainer.c:
(gtk_container_real_check_resize): only requeue ourselves if we are not
a resize container.
(gtk_container_clear_resize_widgets): care for automatic deletion of our
resize_widgets list on size_allocate through a handler connection.
* gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the
focus and default widget of a window, so to take the burden from
gtk_widget_unparent.
* gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried
to be clever, but actually messed up the resize_children logic and
caused unneccessary allocations on its whole branch. besides this,
it messed up the display by not invoking a redraw after the allocation.
* gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so
that it is the child again that is queued for a resize.
(gtk_table_attach): likewise.
(gtk_table_remove): likewise.
1998-06-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtk/gtkentry.h, gtk/gtkentry.c: Export the

View File

@ -2,6 +2,64 @@ Tue Jun 23 22:21:33 PDT 1998 Manish Singh <yosh@gimp.org>
* gtk-boxed.defs: s/GkWidget/GtkWidget/
Wed Jun 24 07:47:29 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_idle_test): added a frame with radio buttons
to select the resize_mode for the idle-labels container.
* gtk/gtkframe.h:
* gtk/gtkframe.c: GtkType and macro corrections.
* gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to
support radio grouping.
Tue Jun 23 08:01:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize
unconditionally if resize_mode has changed.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set
GTK_RESIZE_QUEUE on the scrolled window.
(gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport.
Tue Jun 23 04:20:30 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c:
(GTK_IS_RESIZE_CONTAINER): new macro to find out if
a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT.
(gtk_container_queue_resize): new function to queue a container for
a *size* reallocation (doesn't affect its position, and thus its
parent is left untouched usually).
(gtk_container_get_resize_container): new function to retrive the next
most resize container which is not itself queued for a resize.
(gtk_container_idle_sizer): new function to carefully process the
container_resize_queue since it can change during invokation of
gtk_container_check_resize().
(gtk_container_resize_children): total rework of this function to
properly handle resize containers. makes a lot of assumptions whitch
are stated in the comments.
* gtk/gtkcontainer.c:
(gtk_container_real_check_resize): only requeue ourselves if we are not
a resize container.
(gtk_container_clear_resize_widgets): care for automatic deletion of our
resize_widgets list on size_allocate through a handler connection.
* gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the
focus and default widget of a window, so to take the burden from
gtk_widget_unparent.
* gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried
to be clever, but actually messed up the resize_children logic and
caused unneccessary allocations on its whole branch. besides this,
it messed up the display by not invoking a redraw after the allocation.
* gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so
that it is the child again that is queued for a resize.
(gtk_table_attach): likewise.
(gtk_table_remove): likewise.
1998-06-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtk/gtkentry.h, gtk/gtkentry.c: Export the

View File

@ -2,6 +2,64 @@ Tue Jun 23 22:21:33 PDT 1998 Manish Singh <yosh@gimp.org>
* gtk-boxed.defs: s/GkWidget/GtkWidget/
Wed Jun 24 07:47:29 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_idle_test): added a frame with radio buttons
to select the resize_mode for the idle-labels container.
* gtk/gtkframe.h:
* gtk/gtkframe.c: GtkType and macro corrections.
* gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to
support radio grouping.
Tue Jun 23 08:01:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize
unconditionally if resize_mode has changed.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set
GTK_RESIZE_QUEUE on the scrolled window.
(gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport.
Tue Jun 23 04:20:30 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c:
(GTK_IS_RESIZE_CONTAINER): new macro to find out if
a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT.
(gtk_container_queue_resize): new function to queue a container for
a *size* reallocation (doesn't affect its position, and thus its
parent is left untouched usually).
(gtk_container_get_resize_container): new function to retrive the next
most resize container which is not itself queued for a resize.
(gtk_container_idle_sizer): new function to carefully process the
container_resize_queue since it can change during invokation of
gtk_container_check_resize().
(gtk_container_resize_children): total rework of this function to
properly handle resize containers. makes a lot of assumptions whitch
are stated in the comments.
* gtk/gtkcontainer.c:
(gtk_container_real_check_resize): only requeue ourselves if we are not
a resize container.
(gtk_container_clear_resize_widgets): care for automatic deletion of our
resize_widgets list on size_allocate through a handler connection.
* gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the
focus and default widget of a window, so to take the burden from
gtk_widget_unparent.
* gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried
to be clever, but actually messed up the resize_children logic and
caused unneccessary allocations on its whole branch. besides this,
it messed up the display by not invoking a redraw after the allocation.
* gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so
that it is the child again that is queued for a resize.
(gtk_table_attach): likewise.
(gtk_table_remove): likewise.
1998-06-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtk/gtkentry.h, gtk/gtkentry.c: Export the

View File

@ -2,6 +2,64 @@ Tue Jun 23 22:21:33 PDT 1998 Manish Singh <yosh@gimp.org>
* gtk-boxed.defs: s/GkWidget/GtkWidget/
Wed Jun 24 07:47:29 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_idle_test): added a frame with radio buttons
to select the resize_mode for the idle-labels container.
* gtk/gtkframe.h:
* gtk/gtkframe.c: GtkType and macro corrections.
* gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to
support radio grouping.
Tue Jun 23 08:01:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize
unconditionally if resize_mode has changed.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set
GTK_RESIZE_QUEUE on the scrolled window.
(gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport.
Tue Jun 23 04:20:30 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c:
(GTK_IS_RESIZE_CONTAINER): new macro to find out if
a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT.
(gtk_container_queue_resize): new function to queue a container for
a *size* reallocation (doesn't affect its position, and thus its
parent is left untouched usually).
(gtk_container_get_resize_container): new function to retrive the next
most resize container which is not itself queued for a resize.
(gtk_container_idle_sizer): new function to carefully process the
container_resize_queue since it can change during invokation of
gtk_container_check_resize().
(gtk_container_resize_children): total rework of this function to
properly handle resize containers. makes a lot of assumptions whitch
are stated in the comments.
* gtk/gtkcontainer.c:
(gtk_container_real_check_resize): only requeue ourselves if we are not
a resize container.
(gtk_container_clear_resize_widgets): care for automatic deletion of our
resize_widgets list on size_allocate through a handler connection.
* gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the
focus and default widget of a window, so to take the burden from
gtk_widget_unparent.
* gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried
to be clever, but actually messed up the resize_children logic and
caused unneccessary allocations on its whole branch. besides this,
it messed up the display by not invoking a redraw after the allocation.
* gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so
that it is the child again that is queued for a resize.
(gtk_table_attach): likewise.
(gtk_table_remove): likewise.
1998-06-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtk/gtkentry.h, gtk/gtkentry.c: Export the

View File

@ -2,6 +2,64 @@ Tue Jun 23 22:21:33 PDT 1998 Manish Singh <yosh@gimp.org>
* gtk-boxed.defs: s/GkWidget/GtkWidget/
Wed Jun 24 07:47:29 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_idle_test): added a frame with radio buttons
to select the resize_mode for the idle-labels container.
* gtk/gtkframe.h:
* gtk/gtkframe.c: GtkType and macro corrections.
* gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to
support radio grouping.
Tue Jun 23 08:01:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize
unconditionally if resize_mode has changed.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set
GTK_RESIZE_QUEUE on the scrolled window.
(gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport.
Tue Jun 23 04:20:30 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c:
(GTK_IS_RESIZE_CONTAINER): new macro to find out if
a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT.
(gtk_container_queue_resize): new function to queue a container for
a *size* reallocation (doesn't affect its position, and thus its
parent is left untouched usually).
(gtk_container_get_resize_container): new function to retrive the next
most resize container which is not itself queued for a resize.
(gtk_container_idle_sizer): new function to carefully process the
container_resize_queue since it can change during invokation of
gtk_container_check_resize().
(gtk_container_resize_children): total rework of this function to
properly handle resize containers. makes a lot of assumptions whitch
are stated in the comments.
* gtk/gtkcontainer.c:
(gtk_container_real_check_resize): only requeue ourselves if we are not
a resize container.
(gtk_container_clear_resize_widgets): care for automatic deletion of our
resize_widgets list on size_allocate through a handler connection.
* gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the
focus and default widget of a window, so to take the burden from
gtk_widget_unparent.
* gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried
to be clever, but actually messed up the resize_children logic and
caused unneccessary allocations on its whole branch. besides this,
it messed up the display by not invoking a redraw after the allocation.
* gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so
that it is the child again that is queued for a resize.
(gtk_table_attach): likewise.
(gtk_table_remove): likewise.
1998-06-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtk/gtkentry.h, gtk/gtkentry.c: Export the

View File

@ -2,6 +2,64 @@ Tue Jun 23 22:21:33 PDT 1998 Manish Singh <yosh@gimp.org>
* gtk-boxed.defs: s/GkWidget/GtkWidget/
Wed Jun 24 07:47:29 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_idle_test): added a frame with radio buttons
to select the resize_mode for the idle-labels container.
* gtk/gtkframe.h:
* gtk/gtkframe.c: GtkType and macro corrections.
* gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to
support radio grouping.
Tue Jun 23 08:01:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize
unconditionally if resize_mode has changed.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set
GTK_RESIZE_QUEUE on the scrolled window.
(gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport.
Tue Jun 23 04:20:30 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c:
(GTK_IS_RESIZE_CONTAINER): new macro to find out if
a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT.
(gtk_container_queue_resize): new function to queue a container for
a *size* reallocation (doesn't affect its position, and thus its
parent is left untouched usually).
(gtk_container_get_resize_container): new function to retrive the next
most resize container which is not itself queued for a resize.
(gtk_container_idle_sizer): new function to carefully process the
container_resize_queue since it can change during invokation of
gtk_container_check_resize().
(gtk_container_resize_children): total rework of this function to
properly handle resize containers. makes a lot of assumptions whitch
are stated in the comments.
* gtk/gtkcontainer.c:
(gtk_container_real_check_resize): only requeue ourselves if we are not
a resize container.
(gtk_container_clear_resize_widgets): care for automatic deletion of our
resize_widgets list on size_allocate through a handler connection.
* gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the
focus and default widget of a window, so to take the burden from
gtk_widget_unparent.
* gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried
to be clever, but actually messed up the resize_children logic and
caused unneccessary allocations on its whole branch. besides this,
it messed up the display by not invoking a redraw after the allocation.
* gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so
that it is the child again that is queued for a resize.
(gtk_table_attach): likewise.
(gtk_table_remove): likewise.
1998-06-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtk/gtkentry.h, gtk/gtkentry.c: Export the

View File

@ -2,6 +2,64 @@ Tue Jun 23 22:21:33 PDT 1998 Manish Singh <yosh@gimp.org>
* gtk-boxed.defs: s/GkWidget/GtkWidget/
Wed Jun 24 07:47:29 1998 Tim Janik <timj@gtk.org>
* gtk/testgtk.c (create_idle_test): added a frame with radio buttons
to select the resize_mode for the idle-labels container.
* gtk/gtkframe.h:
* gtk/gtkframe.c: GtkType and macro corrections.
* gtk/gtkradiobutton.c (gtk_radio_button_set_arg): new function to
support radio grouping.
Tue Jun 23 08:01:09 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): queue a resize
unconditionally if resize_mode has changed.
* gtk/gtkscrolledwindow.c (gtk_scrolled_window_init): set
GTK_RESIZE_QUEUE on the scrolled window.
(gtk_scrolled_window_construct): set GTK_RESIZE_PARENT for the vieport.
Tue Jun 23 04:20:30 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.h:
* gtk/gtkcontainer.c:
(GTK_IS_RESIZE_CONTAINER): new macro to find out if
a given gtkobject is a container with resize_mode==GTK_RESIZE_PARENT.
(gtk_container_queue_resize): new function to queue a container for
a *size* reallocation (doesn't affect its position, and thus its
parent is left untouched usually).
(gtk_container_get_resize_container): new function to retrive the next
most resize container which is not itself queued for a resize.
(gtk_container_idle_sizer): new function to carefully process the
container_resize_queue since it can change during invokation of
gtk_container_check_resize().
(gtk_container_resize_children): total rework of this function to
properly handle resize containers. makes a lot of assumptions whitch
are stated in the comments.
* gtk/gtkcontainer.c:
(gtk_container_real_check_resize): only requeue ourselves if we are not
a resize container.
(gtk_container_clear_resize_widgets): care for automatic deletion of our
resize_widgets list on size_allocate through a handler connection.
* gtk/gtkwindow.c (gtk_window_shutdown): new functionm to reset the
focus and default widget of a window, so to take the burden from
gtk_widget_unparent.
* gtk/gtkviewport.c: removed gtk_viewport_check_resize, which tried
to be clever, but actually messed up the resize_children logic and
caused unneccessary allocations on its whole branch. besides this,
it messed up the display by not invoking a redraw after the allocation.
* gtk/gtktable.c (gtk_table_set_child_arg): reverted recent change, so
that it is the child again that is queued for a resize.
(gtk_table_attach): likewise.
(gtk_table_remove): likewise.
1998-06-22 Miguel de Icaza <miguel@nuclecu.unam.mx>
* gtk/gtkentry.h, gtk/gtkentry.c: Export the

View File

@ -20,6 +20,7 @@
(define-enum GtkCTreeLineStyle
(solid GTK_CTREE_LINES_SOLID)
(dotted GTK_CTREE_LINES_DOTTED)
(tabbed GTK_CTREE_LINES_TABBED)
(none GTK_CTREE_LINES_NONE))
; enumerations from "./gtkdebug.h"
@ -283,6 +284,15 @@
(always GTK_UPDATE_ALWAYS)
(if-valid GTK_UPDATE_IF_VALID))
(define-enum GtkSpinType
(step-forward GTK_SPIN_STEP_FORWARD)
(step-backward GTK_SPIN_STEP_BACKWARD)
(page-forward GTK_SPIN_PAGE_FORWARD)
(page-backward GTK_SPIN_PAGE_BACKWARD)
(home GTK_SPIN_HOME)
(end GTK_SPIN_END)
(user-defined GTK_SPIN_USER_DEFINED))
; enumerations from "./gtktoolbar.h"
(define-enum GtkToolbarChildType

View File

@ -563,7 +563,7 @@ gtk_box_set_child_packing (GtkBox *box,
child_info->pack = GTK_PACK_START;
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (box))
gtk_widget_queue_resize (GTK_WIDGET (box));
gtk_widget_queue_resize (child);
}
}

View File

@ -20,6 +20,7 @@
#include "gtkcontainer.h"
#include "gtkprivate.h"
#include "gtksignal.h"
#include "gtkmain.h"
#include <stdarg.h>
@ -129,6 +130,7 @@ static const gchar *vadjustment_key = "gtk-vadjustment";
static guint vadjustment_key_id = 0;
static const gchar *hadjustment_key = "gtk-hadjustment";
static guint hadjustment_key_id = 0;
static GSList *container_resize_queue = NULL;
GtkType
gtk_container_get_type (void)
@ -680,6 +682,11 @@ gtk_container_destroy (GtkObject *object)
container = GTK_CONTAINER (object);
if (GTK_CONTAINER_RESIZE_PENDING (container))
{
container_resize_queue = g_slist_remove (container_resize_queue, container);
GTK_PRIVATE_UNSET_FLAG (container, GTK_RESIZE_PENDING);
}
gtk_container_clear_resize_widgets (container);
gtk_container_foreach (container,
@ -809,6 +816,11 @@ gtk_container_clear_resize_widgets (GtkContainer *container)
node = container->resize_widgets;
if (node)
gtk_signal_disconnect_by_func (GTK_OBJECT (container),
GTK_SIGNAL_FUNC (gtk_container_clear_resize_widgets),
NULL);
while (node)
{
GtkWidget *widget = node->data;
@ -837,16 +849,136 @@ gtk_container_set_resize_mode (GtkContainer *container,
{
container->resize_mode = resize_mode;
if (container->resize_widgets != NULL)
if (resize_mode == GTK_RESIZE_IMMEDIATE)
gtk_container_check_resize (container);
else
{
if (resize_mode == GTK_RESIZE_IMMEDIATE)
gtk_container_check_resize (container);
else if (resize_mode == GTK_RESIZE_PARENT)
gtk_container_clear_resize_widgets (container);
gtk_widget_queue_resize (GTK_WIDGET (container));
}
}
}
gint
gtk_container_need_resize (GtkContainer *container)
{
gtk_container_check_resize (container);
return FALSE;
}
static GtkContainer*
gtk_container_get_resize_container (GtkContainer *container)
{
GtkWidget *widget;
widget = GTK_WIDGET (container);
while (widget->parent)
{
widget = widget->parent;
if (GTK_IS_RESIZE_CONTAINER (widget) && !GTK_WIDGET_RESIZE_NEEDED (widget))
break;
}
return GTK_IS_RESIZE_CONTAINER (widget) ? (GtkContainer*) widget : NULL;
}
static gboolean
gtk_container_idle_sizer (gpointer data)
{
/* we may be invoked with a container_resize_queue of NULL, because
* queue_resize could have been adding an extra idle function while
* the queue still got processed. we better just ignore such case
* than trying to explicitely work around them with some extra flags,
* sine it doesn't cause any actual harm.
*/
while (container_resize_queue)
{
GSList *slist;
GtkWidget *widget;
slist = container_resize_queue;
container_resize_queue = slist->next;
widget = slist->data;
g_slist_free_1 (slist);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
gtk_container_check_resize (GTK_CONTAINER (widget));
}
return FALSE;
}
void
gtk_container_queue_resize (GtkContainer *container)
{
GtkContainer *resize_container;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
if (GTK_OBJECT_DESTROYED (container) ||
GTK_WIDGET_RESIZE_NEEDED (container))
return;
if (GTK_IS_RESIZE_CONTAINER (container))
gtk_container_clear_resize_widgets (container);
resize_container = gtk_container_get_resize_container (container);
if (resize_container)
{
if (GTK_WIDGET_VISIBLE (resize_container))
{
switch (resize_container->resize_mode)
{
gtk_container_clear_resize_widgets (container);
gtk_widget_queue_resize (GTK_WIDGET (container));
case GTK_RESIZE_QUEUE:
if (!GTK_CONTAINER_RESIZE_PENDING (resize_container))
{
GTK_PRIVATE_SET_FLAG (resize_container, GTK_RESIZE_PENDING);
if (container_resize_queue == NULL)
gtk_idle_add_priority (GTK_PRIORITY_INTERNAL - 1,
gtk_container_idle_sizer,
NULL);
container_resize_queue = g_slist_prepend (container_resize_queue, resize_container);
}
GTK_PRIVATE_SET_FLAG (container, GTK_RESIZE_NEEDED);
if (!resize_container->resize_widgets)
gtk_signal_connect (GTK_OBJECT (resize_container),
"size_allocate",
GTK_SIGNAL_FUNC (gtk_container_clear_resize_widgets),
NULL);
resize_container->resize_widgets =
g_slist_prepend (resize_container->resize_widgets, container);
break;
case GTK_RESIZE_IMMEDIATE:
GTK_PRIVATE_SET_FLAG (container, GTK_RESIZE_NEEDED);
if (!resize_container->resize_widgets)
gtk_signal_connect (GTK_OBJECT (resize_container),
"size_allocate",
GTK_SIGNAL_FUNC (gtk_container_clear_resize_widgets),
NULL);
resize_container->resize_widgets =
g_slist_prepend (resize_container->resize_widgets, container);
gtk_container_check_resize (resize_container);
break;
case GTK_RESIZE_PARENT:
/* Ignore */
break;
}
}
else
{
/* We need to let hidden toplevels know that something
* changed while they where hidden. For other resize containers,
* they will get resized when they are shown.
*/
if (GTK_WIDGET_TOPLEVEL (resize_container))
gtk_container_check_resize (resize_container);
}
}
}
@ -859,30 +991,29 @@ gtk_container_check_resize (GtkContainer *container)
gtk_signal_emit (GTK_OBJECT (container), container_signals[CHECK_RESIZE]);
}
gint
gtk_container_need_resize (GtkContainer *container)
{
gtk_container_check_resize (container);
return FALSE;
}
static void
gtk_container_real_check_resize (GtkContainer *container)
{
GtkWidget *widget;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
widget = GTK_WIDGET (container);
gtk_widget_size_request (widget, &widget->requisition);
if ((widget->requisition.width > widget->allocation.width) ||
(widget->requisition.height > widget->allocation.height))
if (widget->requisition.width > widget->allocation.width ||
widget->requisition.height > widget->allocation.height)
{
gtk_container_clear_resize_widgets (container);
gtk_widget_queue_resize (widget);
if (GTK_IS_RESIZE_CONTAINER (container))
{
gtk_widget_size_allocate (GTK_WIDGET (container),
&GTK_WIDGET (container)->allocation);
gtk_widget_queue_draw (GTK_WIDGET (container));
}
else
gtk_widget_queue_resize (widget);
}
else
{
@ -905,23 +1036,77 @@ void
gtk_container_resize_children (GtkContainer *container)
{
GtkWidget *widget;
GtkWidget *resize_container;
GSList *resize_widgets;
GSList *resize_containers;
GSList *node;
/* resizing invariants:
* toplevels have *always* resize_mode != GTK_RESIZE_PARENT set.
* containers with resize_mode==GTK_RESIZE_PARENT have to have resize_widgets
* set to NULL.
* containers that are flagged RESIZE_NEEDED must have resize_widgets set to
* NULL, or are toplevels (thus have ->parent set to NULL).
* widgets that are in some container->resize_widgets list must be flagged with
* RESIZE_NEEDED.
* widgets that have RESIZE_NEEDED set must be referenced in some
* GTK_IS_RESIZE_CONTAINER (container)->resize_widgets list.
* containers that have an idle sizer pending must be flagged with
* RESIZE_PENDING.
*/
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
/* we first check out if we actually need to perform a resize,
* which is not the case if we got another container queued for
* a resize in our anchestry. also we can skip the whole
* resize_widgets checks if we are a toplevel and NEED_RESIZE.
* this code implies that our allocation is sufficient for our
* requisition, since otherwise we would NEED_RESIZE.
*/
resize_container = GTK_WIDGET (container);
while (resize_container)
{
if (GTK_WIDGET_RESIZE_NEEDED (resize_container))
break;
resize_container = resize_container->parent;
}
if (resize_container)
{
/* queue_resize and size_allocate both clear our
* resize_widgets list.
*/
if (resize_container->parent)
gtk_container_queue_resize (container);
else
{
gtk_widget_size_allocate (GTK_WIDGET (container),
&GTK_WIDGET (container)->allocation);
gtk_widget_queue_draw (GTK_WIDGET (container));
}
return;
}
resize_container = GTK_WIDGET (container);
/* we now walk the anchestry for all resize widgets as long
* as they are our children and as long as their allocation
* is insufficient, since we don't need to reallocate below that.
*/
resize_widgets = container->resize_widgets;
if (resize_widgets)
gtk_signal_disconnect_by_func (GTK_OBJECT (container),
GTK_SIGNAL_FUNC (gtk_container_clear_resize_widgets),
NULL);
container->resize_widgets = NULL;
for (node = resize_widgets; node; node = node->next)
{
widget = node->data;
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
while (widget && widget->parent &&
while (widget->parent != resize_container &&
((widget->allocation.width < widget->requisition.width) ||
(widget->allocation.height < widget->requisition.height)))
widget = widget->parent;
@ -929,41 +1114,39 @@ gtk_container_resize_children (GtkContainer *container)
GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
node->data = widget;
}
/* for the newly setup resize_widgets list, we now walk each widget's
* anchestry to sort those widgets out that have RESIZE_NEEDED parents.
* we can safely stop the walk if we are the parent, since we checked
* our own anchestry already.
*/
resize_containers = NULL;
for (node = resize_widgets; node; node = node->next)
{
GtkWidget *resize_container;
GtkWidget *parent;
widget = node->data;
if (!GTK_WIDGET_RESIZE_NEEDED (widget))
continue;
resize_container = widget->parent;
parent = widget->parent;
if (resize_container)
while (parent != resize_container)
{
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
widget = resize_container->parent;
while (widget)
if (GTK_WIDGET_RESIZE_NEEDED (parent))
{
if (GTK_WIDGET_RESIZE_NEEDED (widget))
{
GTK_PRIVATE_UNSET_FLAG (resize_container, GTK_RESIZE_NEEDED);
resize_container = widget;
}
widget = widget->parent;
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
widget = parent;
}
parent = parent->parent;
}
else
resize_container = widget;
if (!g_slist_find (resize_containers, resize_container))
resize_containers = g_slist_prepend (resize_containers,
resize_container);
if (!g_slist_find (resize_containers, widget))
{
resize_containers = g_slist_prepend (resize_containers, widget);
gtk_widget_ref (widget);
}
}
g_slist_free (resize_widgets);
@ -974,6 +1157,7 @@ gtk_container_resize_children (GtkContainer *container)
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
gtk_widget_size_allocate (widget, &widget->allocation);
gtk_widget_queue_draw (widget);
gtk_widget_unref (widget);
}
g_slist_free (resize_containers);
}

View File

@ -32,11 +32,13 @@ extern "C" {
#endif /* __cplusplus */
#define GTK_TYPE_CONTAINER (gtk_container_get_type ())
#define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
#define GTK_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
#define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CONTAINER))
#define GTK_IS_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
#define GTK_TYPE_CONTAINER (gtk_container_get_type ())
#define GTK_CONTAINER(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_CONTAINER, GtkContainer))
#define GTK_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_CONTAINER, GtkContainerClass))
#define GTK_IS_CONTAINER(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_CONTAINER))
#define GTK_IS_CONTAINER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_CONTAINER))
#define GTK_IS_RESIZE_CONTAINER(widget) (GTK_IS_CONTAINER (widget) && ((GtkContainer*) (widget))->resize_mode != GTK_RESIZE_PARENT)
typedef struct _GtkContainer GtkContainer;
@ -179,8 +181,9 @@ void gtk_container_add_with_argv (GtkContainer *container,
/* Non-public methods */
void gtk_container_queue_resize (GtkContainer *container);
void gtk_container_clear_resize_widgets (GtkContainer *container);
/* Deprecated methods */
/* completely non-functional */

View File

@ -54,10 +54,10 @@ static void gtk_frame_style_set (GtkWidget *widget,
static GtkBinClass *parent_class = NULL;
guint
GtkType
gtk_frame_get_type (void)
{
static guint frame_type = 0;
static GtkType frame_type = 0;
if (!frame_type)
{

View File

@ -26,12 +26,15 @@
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
#define GTK_FRAME(obj) GTK_CHECK_CAST (obj, gtk_frame_get_type (), GtkFrame)
#define GTK_FRAME_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, gtk_frame_get_type (), GtkFrameClass)
#define GTK_IS_FRAME(obj) GTK_CHECK_TYPE (obj, gtk_frame_get_type ())
#define GTK_TYPE_FRAME (gtk_frame_get_type ())
#define GTK_FRAME(obj) (GTK_CHECK_CAST ((obj), GTK_TYPE_FRAME, GtkFrame))
#define GTK_FRAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GTK_TYPE_FRAME, GtkFrameClass))
#define GTK_IS_FRAME(obj) (GTK_CHECK_TYPE ((obj), GTK_TYPE_FRAME))
#define GTK_IS_FRAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FRAME))
typedef struct _GtkFrame GtkFrame;
@ -40,7 +43,7 @@ typedef struct _GtkFrameClass GtkFrameClass;
struct _GtkFrame
{
GtkBin bin;
gchar *label;
gint16 shadow_type;
gint16 label_width;
@ -55,7 +58,7 @@ struct _GtkFrameClass
};
guint gtk_frame_get_type (void);
GtkType gtk_frame_get_type (void);
GtkWidget* gtk_frame_new (const gchar *label);
void gtk_frame_set_label (GtkFrame *frame,
const gchar *label);

View File

@ -21,6 +21,11 @@
#include "gtksignal.h"
enum {
ARG_0,
ARG_GROUP
};
#define CHECK_BUTTON_CLASS(w) GTK_CHECK_BUTTON_CLASS (GTK_OBJECT (w)->klass)
@ -30,6 +35,12 @@ static void gtk_radio_button_destroy (GtkObject *object);
static void gtk_radio_button_clicked (GtkButton *button);
static void gtk_radio_button_draw_indicator (GtkCheckButton *check_button,
GdkRectangle *area);
static void gtk_radio_button_set_arg (GtkRadioButton *radio_button,
GtkArg *arg,
guint arg_id);
static void gtk_radio_button_get_arg (GtkRadioButton *radio_button,
GtkArg *arg,
guint arg_id);
static GtkCheckButtonClass *parent_class = NULL;
@ -49,8 +60,8 @@ gtk_radio_button_get_type (void)
sizeof (GtkRadioButtonClass),
(GtkClassInitFunc) gtk_radio_button_class_init,
(GtkObjectInitFunc) gtk_radio_button_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL,
(GtkArgSetFunc) gtk_radio_button_set_arg,
(GtkArgGetFunc) gtk_radio_button_get_arg,
};
radio_button_type = gtk_type_unique (gtk_check_button_get_type (), &radio_button_info);
@ -72,6 +83,8 @@ gtk_radio_button_class_init (GtkRadioButtonClass *class)
parent_class = gtk_type_class (gtk_check_button_get_type ());
gtk_object_add_arg_type ("GtkRadioButton::group", GTK_TYPE_RADIO_BUTTON, GTK_ARG_WRITABLE, ARG_GROUP);
object_class->destroy = gtk_radio_button_destroy;
button_class->clicked = gtk_radio_button_clicked;
@ -85,6 +98,40 @@ gtk_radio_button_init (GtkRadioButton *radio_button)
radio_button->group = g_slist_prepend (NULL, radio_button);
}
static void
gtk_radio_button_set_arg (GtkRadioButton *radio_button,
GtkArg *arg,
guint arg_id)
{
switch (arg_id)
{
GSList *slist;
case ARG_GROUP:
if (GTK_VALUE_OBJECT (*arg))
slist = gtk_radio_button_group ((GtkRadioButton*) GTK_VALUE_OBJECT (*arg));
else
slist = NULL;
gtk_radio_button_set_group (radio_button, slist);
break;
default:
break;
}
}
static void
gtk_radio_button_get_arg (GtkRadioButton *radio_button,
GtkArg *arg,
guint arg_id)
{
switch (arg_id)
{
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
void
gtk_radio_button_set_group (GtkRadioButton *radio_button,
GSList *group)

View File

@ -109,6 +109,8 @@ gtk_scrolled_window_init (GtkScrolledWindow *scrolled_window)
{
GTK_WIDGET_SET_FLAGS (scrolled_window, GTK_NO_WINDOW);
gtk_container_set_resize_mode (GTK_CONTAINER (scrolled_window), GTK_RESIZE_QUEUE);
scrolled_window->hscrollbar = NULL;
scrolled_window->vscrollbar = NULL;
scrolled_window->hscrollbar_policy = GTK_POLICY_ALWAYS;
@ -140,6 +142,7 @@ gtk_scrolled_window_construct (GtkScrolledWindow *scrolled_window,
scrolled_window->viewport = gtk_viewport_new (hadjustment, vadjustment);
hadjustment = gtk_viewport_get_hadjustment (GTK_VIEWPORT (scrolled_window->viewport));
vadjustment = gtk_viewport_get_vadjustment (GTK_VIEWPORT (scrolled_window->viewport));
gtk_container_set_resize_mode (GTK_CONTAINER (scrolled_window->viewport), GTK_RESIZE_PARENT);
gtk_signal_connect (GTK_OBJECT (hadjustment), "changed",
(GtkSignalFunc) gtk_scrolled_window_adjustment_changed,

View File

@ -293,7 +293,7 @@ gtk_table_set_child_arg (GtkContainer *container,
break;
}
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (table))
gtk_widget_queue_resize (GTK_WIDGET (table));
gtk_widget_queue_resize (child);
}
static void
@ -522,7 +522,7 @@ gtk_table_attach (GtkTable *table,
}
if (GTK_WIDGET_VISIBLE (child) && GTK_WIDGET_VISIBLE (table))
gtk_widget_queue_resize (GTK_WIDGET (table));
gtk_widget_queue_resize (child);
}
void
@ -850,7 +850,7 @@ gtk_table_remove (GtkContainer *container,
g_free (child);
if (was_visible && GTK_WIDGET_VISIBLE (container))
gtk_widget_queue_resize (GTK_WIDGET (container));
gtk_container_queue_resize (container);
break;
}
}

View File

@ -44,6 +44,7 @@ extern GtkType GTK_TYPE_SIDE_TYPE;
extern GtkType GTK_TYPE_ANCHOR_TYPE;
extern GtkType GTK_TYPE_PRIVATE_FLAGS;
extern GtkType GTK_TYPE_SPIN_BUTTON_UPDATE_POLICY;
extern GtkType GTK_TYPE_SPIN_TYPE;
extern GtkType GTK_TYPE_TOOLBAR_CHILD_TYPE;
extern GtkType GTK_TYPE_TREE_VIEW_MODE;
extern GtkType GTK_TYPE_FUNDAMENTAL_TYPE;
@ -100,4 +101,4 @@ extern GtkType GTK_TYPE_GDK_WINDOW;
extern GtkType GTK_TYPE_GDK_EVENT;
extern GtkType GTK_TYPE_GDK_COLOR;
#define GTK_TYPE_NUM_BUILTINS (99)
#define GTK_TYPE_NUM_BUILTINS (100)

View File

@ -17,6 +17,7 @@ static GtkEnumValue _gtk_c_tree_pos_values[] = {
static GtkEnumValue _gtk_c_tree_line_style_values[] = {
{ GTK_CTREE_LINES_SOLID, "GTK_CTREE_LINES_SOLID", "solid" },
{ GTK_CTREE_LINES_DOTTED, "GTK_CTREE_LINES_DOTTED", "dotted" },
{ GTK_CTREE_LINES_TABBED, "GTK_CTREE_LINES_TABBED", "tabbed" },
{ GTK_CTREE_LINES_NONE, "GTK_CTREE_LINES_NONE", "none" },
{ 0, NULL, NULL }
};
@ -308,6 +309,16 @@ static GtkEnumValue _gtk_spin_button_update_policy_values[] = {
{ GTK_UPDATE_IF_VALID, "GTK_UPDATE_IF_VALID", "if-valid" },
{ 0, NULL, NULL }
};
static GtkEnumValue _gtk_spin_type_values[] = {
{ GTK_SPIN_STEP_FORWARD, "GTK_SPIN_STEP_FORWARD", "step-forward" },
{ GTK_SPIN_STEP_BACKWARD, "GTK_SPIN_STEP_BACKWARD", "step-backward" },
{ GTK_SPIN_PAGE_FORWARD, "GTK_SPIN_PAGE_FORWARD", "page-forward" },
{ GTK_SPIN_PAGE_BACKWARD, "GTK_SPIN_PAGE_BACKWARD", "page-backward" },
{ GTK_SPIN_HOME, "GTK_SPIN_HOME", "home" },
{ GTK_SPIN_END, "GTK_SPIN_END", "end" },
{ GTK_SPIN_USER_DEFINED, "GTK_SPIN_USER_DEFINED", "user-defined" },
{ 0, NULL, NULL }
};
static GtkEnumValue _gtk_toolbar_child_type_values[] = {
{ GTK_TOOLBAR_CHILD_SPACE, "GTK_TOOLBAR_CHILD_SPACE", "space" },
{ GTK_TOOLBAR_CHILD_BUTTON, "GTK_TOOLBAR_CHILD_BUTTON", "button" },

View File

@ -88,6 +88,8 @@
GTK_TYPE_FLAGS, _gtk_private_flags_values },
{ "GtkSpinButtonUpdatePolicy", &GTK_TYPE_SPIN_BUTTON_UPDATE_POLICY,
GTK_TYPE_ENUM, _gtk_spin_button_update_policy_values },
{ "GtkSpinType", &GTK_TYPE_SPIN_TYPE,
GTK_TYPE_ENUM, _gtk_spin_type_values },
{ "GtkToolbarChildType", &GTK_TYPE_TOOLBAR_CHILD_TYPE,
GTK_TYPE_ENUM, _gtk_toolbar_child_type_values },
{ "GtkTreeViewMode", &GTK_TYPE_TREE_VIEW_MODE,

View File

@ -44,6 +44,7 @@ GtkType GTK_TYPE_SIDE_TYPE = 0;
GtkType GTK_TYPE_ANCHOR_TYPE = 0;
GtkType GTK_TYPE_PRIVATE_FLAGS = 0;
GtkType GTK_TYPE_SPIN_BUTTON_UPDATE_POLICY = 0;
GtkType GTK_TYPE_SPIN_TYPE = 0;
GtkType GTK_TYPE_TOOLBAR_CHILD_TYPE = 0;
GtkType GTK_TYPE_TREE_VIEW_MODE = 0;
GtkType GTK_TYPE_FUNDAMENTAL_TYPE = 0;

View File

@ -39,7 +39,6 @@ static void gtk_viewport_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_viewport_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_viewport_check_resize (GtkContainer *container);
static void gtk_viewport_adjustment_changed (GtkAdjustment *adjustment,
gpointer data);
static void gtk_viewport_adjustment_value_changed (GtkAdjustment *adjustment,
@ -95,7 +94,6 @@ gtk_viewport_class_init (GtkViewportClass *class)
widget_class->size_allocate = gtk_viewport_size_allocate;
container_class->add = gtk_viewport_add;
container_class->check_resize = gtk_viewport_check_resize;
}
static void
@ -632,25 +630,6 @@ gtk_viewport_size_allocate (GtkWidget *widget,
}
}
static void
gtk_viewport_check_resize (GtkContainer *container)
{
GtkBin *bin;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_VIEWPORT (container));
if (GTK_WIDGET_REALIZED (container))
{
bin = GTK_BIN (container);
gtk_widget_size_request (bin->child, &bin->child->requisition);
gtk_widget_size_allocate (GTK_WIDGET (container),
&(GTK_WIDGET (container)->allocation));
}
}
static void
gtk_viewport_adjustment_changed (GtkAdjustment *adjustment,
gpointer data)

View File

@ -193,7 +193,6 @@ static GdkColormap* gtk_widget_peek_colormap (void);
static GdkVisual* gtk_widget_peek_visual (void);
static GtkStyle* gtk_widget_peek_style (void);
static GtkWidget* gtk_widget_get_resize_container (GtkWidget *widget);
static void gtk_widget_reparent_container_child (GtkWidget *widget,
gpointer client_data);
static void gtk_widget_propagate_state (GtkWidget *widget,
@ -227,7 +226,6 @@ static GSList *visual_stack = NULL;
static GSList *style_stack = NULL;
static GSList *gtk_widget_redraw_queue = NULL;
static GSList *gtk_widget_resize_queue = NULL;
static const gchar *aux_info_key = "gtk-aux-info";
static guint aux_info_key_id = 0;
@ -1131,7 +1129,6 @@ gtk_widget_unparent (GtkWidget *widget)
{
GtkWidget *toplevel;
GtkWidget *old_parent;
GSList *tmp_list, *prev_list;
g_return_if_fail (widget != NULL);
if (widget->parent == NULL)
@ -1140,7 +1137,9 @@ gtk_widget_unparent (GtkWidget *widget)
/* keep this function in sync with gtk_menu_detach()
*/
/* unset focused and default children properly
/* unset focused and default children properly, this code
* should eventually move into some gtk_window_unparent_branch() or
* similar function.
*/
toplevel = gtk_widget_get_toplevel (widget);
if (GTK_CONTAINER (widget->parent)->focus_child == widget)
@ -1173,46 +1172,72 @@ gtk_widget_unparent (GtkWidget *widget)
gtk_window_set_default (GTK_WINDOW (toplevel), NULL);
}
/* Remove the widget and all its children from toplevel->resize_widgets
*/
toplevel = gtk_widget_get_resize_container (widget);
/* Three ways to make this prettier:
if (GTK_IS_RESIZE_CONTAINER (widget))
gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
/* Remove the widget and all its children from any ->resize_widgets list
* of all the parents in our branch. This code should move into gtkcontainer.c
* somwhen, since we mess around with ->resize_widgets, which is
* actually not of our business.
*
* Two ways to make this prettier:
* Write a g_slist_conditional_remove (GSList, gboolean (*)(gpointer))
* Change resize_widgets to a GList
* Just bite the bullet and use g_slist_remove
*/
tmp_list = GTK_CONTAINER (toplevel)->resize_widgets;
prev_list = NULL;
while (tmp_list)
toplevel = widget->parent;
while (toplevel)
{
GSList *tmp = tmp_list;
GtkWidget *child = (GtkWidget *)tmp->data;
GtkWidget *parent = child;
GSList *slist;
GSList *prev;
tmp_list = tmp_list->next;
while (parent && (parent != widget))
parent = parent->parent;
if (parent == widget)
if (!GTK_CONTAINER (toplevel)->resize_widgets)
{
GTK_PRIVATE_UNSET_FLAG (child, GTK_RESIZE_NEEDED);
if (prev_list)
prev_list->next = tmp_list;
else
GTK_CONTAINER (toplevel)->resize_widgets = tmp_list;
tmp->next = NULL;
g_slist_free_1 (tmp);
toplevel = toplevel->parent;
continue;
}
else
prev_list = tmp;
prev = NULL;
slist = GTK_CONTAINER (toplevel)->resize_widgets;
while (slist)
{
GtkWidget *child;
GtkWidget *parent;
GSList *last;
last = slist;
slist = last->next;
child = last->data;
parent = child;
while (parent && (parent != widget))
parent = parent->parent;
if (parent == widget)
{
GTK_PRIVATE_UNSET_FLAG (child, GTK_RESIZE_NEEDED);
if (prev)
prev->next = slist;
else
{
/* it is really messy to have this signal disconnection
* in gtkwidget.c, the resize_widgets invariants should
* all be taken care off by gtkcontainer.c exclusively.
*/
if (!slist)
gtk_signal_disconnect_by_func (GTK_OBJECT (toplevel),
GTK_SIGNAL_FUNC (gtk_container_clear_resize_widgets),
NULL);
GTK_CONTAINER (toplevel)->resize_widgets = slist;
}
g_slist_free_1 (last);
}
else
prev = last;
}
toplevel = toplevel->parent;
}
if (widget->window &&
@ -1417,16 +1442,6 @@ gtk_widget_hide_all (GtkWidget *widget)
g_return_if_fail (widget != NULL);
g_assert (widget->parent);
if (GTK_WIDGET_RESIZE_NEEDED (widget))
{
GtkWidget *toplevel;
toplevel = gtk_widget_get_resize_container (widget);
GTK_CONTAINER (toplevel)->resize_widgets =
g_slist_remove (GTK_CONTAINER (toplevel)->resize_widgets, widget);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_NEEDED);
}
GTK_WIDGET_CLASS (GTK_OBJECT (widget)->klass)->hide_all (widget);
}
@ -1600,104 +1615,19 @@ gtk_widget_queue_draw (GtkWidget *widget)
}
}
/*****************************************
* gtk_widget_queue_resize:
*
* arguments:
*
* results:
*****************************************/
static gint
gtk_widget_idle_sizer (void *data)
{
GSList *slist = gtk_widget_resize_queue;
GSList *node = slist;
gtk_widget_resize_queue = NULL;
while (node)
{
GtkWidget *widget = node->data;
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
gtk_container_check_resize (GTK_CONTAINER (widget));
node = node->next;
}
g_slist_free (slist);
return FALSE;
}
/* The guts here should probably be moved into gtkcontainer.c */
void
gtk_widget_queue_resize (GtkWidget *widget)
{
GtkWidget *resize_widget;
GtkContainer *container;
g_return_if_fail (widget != NULL);
if (GTK_OBJECT_DESTROYED (widget))
return;
g_return_if_fail (GTK_IS_WIDGET (widget));
resize_widget = gtk_widget_get_resize_container (widget);
if (GTK_IS_RESIZE_CONTAINER (widget))
gtk_container_clear_resize_widgets (GTK_CONTAINER (widget));
if (resize_widget)
{
container = GTK_CONTAINER (resize_widget);
if (GTK_WIDGET_VISIBLE (container))
{
switch (container->resize_mode)
{
case GTK_RESIZE_QUEUE:
if (!GTK_CONTAINER_RESIZE_PENDING (container))
{
GTK_PRIVATE_SET_FLAG (container, GTK_RESIZE_PENDING);
if (gtk_widget_resize_queue == NULL)
gtk_idle_add_priority (GTK_PRIORITY_INTERNAL - 1,
gtk_widget_idle_sizer,
NULL);
gtk_widget_resize_queue = g_slist_prepend (gtk_widget_resize_queue, container);
}
if (!GTK_WIDGET_RESIZE_NEEDED (widget))
{
GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
container->resize_widgets =
g_slist_prepend (container->resize_widgets, widget);
}
else
g_assert (g_slist_find (container->resize_widgets, widget)); /* paranoid */
break;
case GTK_RESIZE_IMMEDIATE:
if (!GTK_WIDGET_RESIZE_NEEDED (widget))
{
GTK_PRIVATE_SET_FLAG (widget, GTK_RESIZE_NEEDED);
container->resize_widgets =
g_slist_prepend (container->resize_widgets, widget);
gtk_container_check_resize (container);
}
break;
case GTK_RESIZE_PARENT:
/* Ignore */
break;
}
}
else
{
/* We need to let hidden toplevels know that something
* changed while they where hidden. For other resize containers,
* they will get resized when they are shown.
*/
if (GTK_WIDGET_TOPLEVEL (container))
gtk_container_check_resize (container);
}
}
if (widget->parent)
gtk_container_queue_resize (GTK_CONTAINER (widget->parent));
else if (GTK_WIDGET_TOPLEVEL (widget))
gtk_container_queue_resize (GTK_CONTAINER (widget));
}
/*****************************************
@ -3072,30 +3002,6 @@ gtk_widget_set_extension_events (GtkWidget *widget,
gtk_object_set_data_by_id (GTK_OBJECT (widget), extension_event_key_id, modep);
}
/*****************************************
* gtk_widget_get_resize_container:
*
* arguments:
*
* results:
*****************************************/
static GtkWidget *
gtk_widget_get_resize_container (GtkWidget *widget)
{
g_return_val_if_fail (widget != NULL, NULL);
while (widget->parent)
{
widget = widget->parent;
if (GTK_CONTAINER (widget)->resize_mode != GTK_RESIZE_PARENT)
break;
}
return GTK_IS_CONTAINER (widget) ? widget : NULL;
}
/*****************************************
* gtk_widget_get_toplevel:
*
@ -3600,12 +3506,6 @@ gtk_widget_real_destroy (GtkObject *object)
*/
widget = GTK_WIDGET (object);
if (GTK_CONTAINER_RESIZE_PENDING (widget))
{
gtk_widget_resize_queue = g_slist_remove (gtk_widget_resize_queue, widget);
GTK_PRIVATE_UNSET_FLAG (widget, GTK_RESIZE_PENDING);
}
gtk_grab_remove (widget);
gtk_selection_remove_all (widget);
@ -3700,7 +3600,7 @@ gtk_widget_real_hide (GtkWidget *widget)
gtk_widget_unmap (widget);
if (widget->parent)
gtk_widget_queue_resize (widget);
gtk_widget_queue_resize (widget->parent);
}
}
@ -3809,20 +3709,20 @@ gtk_widget_real_unrealize (GtkWidget *widget)
{
gdk_window_set_user_data (widget->window, NULL);
gdk_window_destroy (widget->window);
widget->window = NULL;
}
else
{
gdk_window_unref (widget->window);
widget->window = NULL;
}
/* Unrealize afterwards to improve visual effect */
if (GTK_IS_CONTAINER (widget))
gtk_container_foreach (GTK_CONTAINER (widget),
(GtkCallback)gtk_widget_unrealize,
(GtkCallback) gtk_widget_unrealize,
NULL);
widget->window = NULL;
}
/*****************************************

View File

@ -63,6 +63,7 @@ static void gtk_window_set_arg (GtkWindow *window,
static void gtk_window_get_arg (GtkWindow *window,
GtkArg *arg,
guint arg_id);
static void gtk_window_shutdown (GtkObject *object);
static void gtk_window_destroy (GtkObject *object);
static void gtk_window_finalize (GtkObject *object);
static void gtk_window_show (GtkWidget *widget);
@ -162,6 +163,7 @@ gtk_window_class_init (GtkWindowClass *klass)
gtk_object_class_add_signals (object_class, window_signals, LAST_SIGNAL);
object_class->shutdown = gtk_window_shutdown;
object_class->destroy = gtk_window_destroy;
object_class->finalize = gtk_window_finalize;
@ -193,6 +195,8 @@ gtk_window_init (GtkWindow *window)
GTK_WIDGET_UNSET_FLAGS (window, GTK_NO_WINDOW);
GTK_WIDGET_SET_FLAGS (window, GTK_TOPLEVEL);
gtk_container_set_resize_mode (GTK_CONTAINER (window), GTK_RESIZE_QUEUE);
window->title = NULL;
window->wmclass_name = g_strdup (gdk_progname);
window->wmclass_class = g_strdup (gdk_progclass);
@ -207,7 +211,6 @@ gtk_window_init (GtkWindow *window)
window->position = GTK_WIN_POS_NONE;
window->use_uposition = TRUE;
gtk_container_set_resize_mode (GTK_CONTAINER (window), GTK_RESIZE_QUEUE);
gtk_container_register_toplevel (GTK_CONTAINER (window));
}
@ -446,6 +449,22 @@ gtk_window_marshal_signal_2 (GtkObject *object,
(* rfunc) (object, GTK_VALUE_POINTER (args[0]), func_data);
}
static void
gtk_window_shutdown (GtkObject *object)
{
GtkWindow *window;
g_return_if_fail (object != NULL);
g_return_if_fail (GTK_IS_WINDOW (object));
window = GTK_WINDOW (object);
gtk_window_set_focus (window, NULL);
gtk_window_set_default (window, NULL);
GTK_OBJECT_CLASS (parent_class)->shutdown (object);
}
static void
gtk_window_destroy (GtkObject *object)
{
@ -454,8 +473,7 @@ gtk_window_destroy (GtkObject *object)
gtk_container_unregister_toplevel (GTK_CONTAINER (object));
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
@ -1072,7 +1090,6 @@ gtk_window_move_resize (GtkWindow *window)
allocation.height = widget->requisition.height;
gtk_widget_size_allocate (widget, &allocation);
gtk_container_clear_resize_widgets (GTK_CONTAINER (window));
}
else
{

View File

@ -6536,7 +6536,7 @@ create_timeout_test (void)
*/
static int idle = 0;
gint
static gint
idle_test (GtkWidget *label)
{
static int count = 0;
@ -6548,7 +6548,7 @@ idle_test (GtkWidget *label)
return TRUE;
}
void
static void
start_idle_test (GtkWidget *widget,
GtkWidget *label)
{
@ -6558,7 +6558,7 @@ start_idle_test (GtkWidget *widget,
}
}
void
static void
stop_idle_test (GtkWidget *widget,
gpointer data)
{
@ -6569,7 +6569,7 @@ stop_idle_test (GtkWidget *widget,
}
}
void
static void
destroy_idle_test (GtkWidget *widget,
GtkWidget **window)
{
@ -6578,15 +6578,26 @@ destroy_idle_test (GtkWidget *widget,
*window = NULL;
}
void
static void
toggle_idle_container (GtkObject *button,
GtkContainer *container)
{
gtk_container_set_resize_mode (container, (guint) gtk_object_get_user_data (button));
}
static void
create_idle_test (void)
{
static GtkWidget *window = NULL;
GtkWidget *button;
GtkWidget *label;
GtkWidget *container;
if (!window)
{
GtkWidget *frame;
GtkWidget *box;
window = gtk_dialog_new ();
gtk_signal_connect (GTK_OBJECT (window), "destroy",
@ -6598,9 +6609,59 @@ create_idle_test (void)
label = gtk_label_new ("count: 0");
gtk_misc_set_padding (GTK_MISC (label), 10, 10);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
label, TRUE, TRUE, 0);
gtk_widget_show (label);
container =
gtk_widget_new (GTK_TYPE_HBOX,
"GtkWidget::visible", TRUE,
/* "GtkContainer::child", gtk_widget_new (GTK_TYPE_HBOX,
* "GtkWidget::visible", TRUE,
*/
"GtkContainer::child", label,
/* NULL), */
NULL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
container, TRUE, TRUE, 0);
frame =
gtk_widget_new (GTK_TYPE_FRAME,
"GtkContainer::border_width", 5,
"GtkFrame::label", "Label Container",
"GtkWidget::visible", TRUE,
"GtkWidget::parent", GTK_DIALOG (window)->vbox,
NULL);
box =
gtk_widget_new (GTK_TYPE_VBOX,
"GtkWidget::visible", TRUE,
"GtkWidget::parent", frame,
NULL);
button =
gtk_widget_new (GTK_TYPE_RADIO_BUTTON,
"GtkButton::label", "Resize-Parent",
"GtkObject::user_data", (void*)GTK_RESIZE_PARENT,
"GtkObject::signal::clicked", toggle_idle_container, container,
"GtkWidget::visible", TRUE,
"GtkWidget::parent", box,
NULL);
button =
gtk_widget_new (GTK_TYPE_RADIO_BUTTON,
"GtkButton::label", "Resize-Queue",
"GtkObject::user_data", (void*)GTK_RESIZE_QUEUE,
"GtkObject::signal::clicked", toggle_idle_container, container,
"GtkRadioButton::group", button,
"GtkWidget::visible", TRUE,
"GtkWidget::parent", box,
NULL);
button =
gtk_widget_new (GTK_TYPE_RADIO_BUTTON,
"GtkButton::label", "Resize-Immediate",
"GtkObject::user_data", (void*)GTK_RESIZE_IMMEDIATE,
"GtkObject::signal::clicked", toggle_idle_container, container,
"GtkRadioButton::group", button,
"GtkWidget::visible", TRUE,
"GtkWidget::parent", box,
NULL);
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",

View File

@ -6536,7 +6536,7 @@ create_timeout_test (void)
*/
static int idle = 0;
gint
static gint
idle_test (GtkWidget *label)
{
static int count = 0;
@ -6548,7 +6548,7 @@ idle_test (GtkWidget *label)
return TRUE;
}
void
static void
start_idle_test (GtkWidget *widget,
GtkWidget *label)
{
@ -6558,7 +6558,7 @@ start_idle_test (GtkWidget *widget,
}
}
void
static void
stop_idle_test (GtkWidget *widget,
gpointer data)
{
@ -6569,7 +6569,7 @@ stop_idle_test (GtkWidget *widget,
}
}
void
static void
destroy_idle_test (GtkWidget *widget,
GtkWidget **window)
{
@ -6578,15 +6578,26 @@ destroy_idle_test (GtkWidget *widget,
*window = NULL;
}
void
static void
toggle_idle_container (GtkObject *button,
GtkContainer *container)
{
gtk_container_set_resize_mode (container, (guint) gtk_object_get_user_data (button));
}
static void
create_idle_test (void)
{
static GtkWidget *window = NULL;
GtkWidget *button;
GtkWidget *label;
GtkWidget *container;
if (!window)
{
GtkWidget *frame;
GtkWidget *box;
window = gtk_dialog_new ();
gtk_signal_connect (GTK_OBJECT (window), "destroy",
@ -6598,9 +6609,59 @@ create_idle_test (void)
label = gtk_label_new ("count: 0");
gtk_misc_set_padding (GTK_MISC (label), 10, 10);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
label, TRUE, TRUE, 0);
gtk_widget_show (label);
container =
gtk_widget_new (GTK_TYPE_HBOX,
"GtkWidget::visible", TRUE,
/* "GtkContainer::child", gtk_widget_new (GTK_TYPE_HBOX,
* "GtkWidget::visible", TRUE,
*/
"GtkContainer::child", label,
/* NULL), */
NULL);
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (window)->vbox),
container, TRUE, TRUE, 0);
frame =
gtk_widget_new (GTK_TYPE_FRAME,
"GtkContainer::border_width", 5,
"GtkFrame::label", "Label Container",
"GtkWidget::visible", TRUE,
"GtkWidget::parent", GTK_DIALOG (window)->vbox,
NULL);
box =
gtk_widget_new (GTK_TYPE_VBOX,
"GtkWidget::visible", TRUE,
"GtkWidget::parent", frame,
NULL);
button =
gtk_widget_new (GTK_TYPE_RADIO_BUTTON,
"GtkButton::label", "Resize-Parent",
"GtkObject::user_data", (void*)GTK_RESIZE_PARENT,
"GtkObject::signal::clicked", toggle_idle_container, container,
"GtkWidget::visible", TRUE,
"GtkWidget::parent", box,
NULL);
button =
gtk_widget_new (GTK_TYPE_RADIO_BUTTON,
"GtkButton::label", "Resize-Queue",
"GtkObject::user_data", (void*)GTK_RESIZE_QUEUE,
"GtkObject::signal::clicked", toggle_idle_container, container,
"GtkRadioButton::group", button,
"GtkWidget::visible", TRUE,
"GtkWidget::parent", box,
NULL);
button =
gtk_widget_new (GTK_TYPE_RADIO_BUTTON,
"GtkButton::label", "Resize-Immediate",
"GtkObject::user_data", (void*)GTK_RESIZE_IMMEDIATE,
"GtkObject::signal::clicked", toggle_idle_container, container,
"GtkRadioButton::group", button,
"GtkWidget::visible", TRUE,
"GtkWidget::parent", box,
NULL);
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",