fail silently for toplevels. if resize_mode changes to GTK_RESIZE_PARENT,

Fri Jun 19 06:18:19 1998  Tim Janik  <timj@gtk.org>

        * gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
        for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
        resize widget list before queuing the container for a new reize.
        (gtk_container_need_resize): changed return value to FALSE, since this
        used to indicate that no further resizes are needed.
        (gtk_container_set_arg):
        (gtk_container_get_arg):
        (gtk_container_class_init): implemented GtkContainer::resize_mode
        argument.

        (gtk_container_resize_children): when we walk up the tree of a resize
        widget we need to stop if we are the current parent.

        * gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
        GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
        (gtk_widget_hide_all): retrive the toplevel widget from via
        gtk_widget_get_resize_container().
This commit is contained in:
Tim Janik 1998-06-19 06:56:15 +00:00 committed by Tim Janik
parent 5c5a45f9b0
commit 5c68ecbc0f
10 changed files with 195 additions and 35 deletions

View File

@ -1,3 +1,23 @@
Fri Jun 19 06:18:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
resize widget list before queuing the container for a new reize.
(gtk_container_need_resize): changed return value to FALSE, since this
used to indicate that no further resizes are needed.
(gtk_container_set_arg):
(gtk_container_get_arg):
(gtk_container_class_init): implemented GtkContainer::resize_mode
argument.
(gtk_container_resize_children): when we walk up the tree of a resize
widget we need to stop if we are the current parent.
* gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
(gtk_widget_hide_all): retrive the toplevel widget from via
gtk_widget_get_resize_container().
Thu Jun 18 23:08:36 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtklist.c (gtk_list_button_press): Only respond

View File

@ -1,3 +1,23 @@
Fri Jun 19 06:18:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
resize widget list before queuing the container for a new reize.
(gtk_container_need_resize): changed return value to FALSE, since this
used to indicate that no further resizes are needed.
(gtk_container_set_arg):
(gtk_container_get_arg):
(gtk_container_class_init): implemented GtkContainer::resize_mode
argument.
(gtk_container_resize_children): when we walk up the tree of a resize
widget we need to stop if we are the current parent.
* gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
(gtk_widget_hide_all): retrive the toplevel widget from via
gtk_widget_get_resize_container().
Thu Jun 18 23:08:36 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtklist.c (gtk_list_button_press): Only respond

View File

@ -1,3 +1,23 @@
Fri Jun 19 06:18:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
resize widget list before queuing the container for a new reize.
(gtk_container_need_resize): changed return value to FALSE, since this
used to indicate that no further resizes are needed.
(gtk_container_set_arg):
(gtk_container_get_arg):
(gtk_container_class_init): implemented GtkContainer::resize_mode
argument.
(gtk_container_resize_children): when we walk up the tree of a resize
widget we need to stop if we are the current parent.
* gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
(gtk_widget_hide_all): retrive the toplevel widget from via
gtk_widget_get_resize_container().
Thu Jun 18 23:08:36 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtklist.c (gtk_list_button_press): Only respond

View File

@ -1,3 +1,23 @@
Fri Jun 19 06:18:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
resize widget list before queuing the container for a new reize.
(gtk_container_need_resize): changed return value to FALSE, since this
used to indicate that no further resizes are needed.
(gtk_container_set_arg):
(gtk_container_get_arg):
(gtk_container_class_init): implemented GtkContainer::resize_mode
argument.
(gtk_container_resize_children): when we walk up the tree of a resize
widget we need to stop if we are the current parent.
* gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
(gtk_widget_hide_all): retrive the toplevel widget from via
gtk_widget_get_resize_container().
Thu Jun 18 23:08:36 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtklist.c (gtk_list_button_press): Only respond

View File

@ -1,3 +1,23 @@
Fri Jun 19 06:18:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
resize widget list before queuing the container for a new reize.
(gtk_container_need_resize): changed return value to FALSE, since this
used to indicate that no further resizes are needed.
(gtk_container_set_arg):
(gtk_container_get_arg):
(gtk_container_class_init): implemented GtkContainer::resize_mode
argument.
(gtk_container_resize_children): when we walk up the tree of a resize
widget we need to stop if we are the current parent.
* gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
(gtk_widget_hide_all): retrive the toplevel widget from via
gtk_widget_get_resize_container().
Thu Jun 18 23:08:36 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtklist.c (gtk_list_button_press): Only respond

View File

@ -1,3 +1,23 @@
Fri Jun 19 06:18:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
resize widget list before queuing the container for a new reize.
(gtk_container_need_resize): changed return value to FALSE, since this
used to indicate that no further resizes are needed.
(gtk_container_set_arg):
(gtk_container_get_arg):
(gtk_container_class_init): implemented GtkContainer::resize_mode
argument.
(gtk_container_resize_children): when we walk up the tree of a resize
widget we need to stop if we are the current parent.
* gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
(gtk_widget_hide_all): retrive the toplevel widget from via
gtk_widget_get_resize_container().
Thu Jun 18 23:08:36 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtklist.c (gtk_list_button_press): Only respond

View File

@ -1,3 +1,23 @@
Fri Jun 19 06:18:19 1998 Tim Janik <timj@gtk.org>
* gtk/gtkcontainer.c (gtk_container_set_resize_mode): fail silently
for toplevels. if resize_mode changes to GTK_RESIZE_PARENT, clear the
resize widget list before queuing the container for a new reize.
(gtk_container_need_resize): changed return value to FALSE, since this
used to indicate that no further resizes are needed.
(gtk_container_set_arg):
(gtk_container_get_arg):
(gtk_container_class_init): implemented GtkContainer::resize_mode
argument.
(gtk_container_resize_children): when we walk up the tree of a resize
widget we need to stop if we are the current parent.
* gtk/gtkwidget.c (gtk_widget_queue_resize): flag the resize child with
GTK_RESIZE_NEEDED for container->resize_mode==GTK_RESIZE_IMMEDIATE.
(gtk_widget_hide_all): retrive the toplevel widget from via
gtk_widget_get_resize_container().
Thu Jun 18 23:08:36 1998 Owen Taylor <otaylor@gtk.org>
* gtk/gtklist.c (gtk_list_button_press): Only respond

View File

@ -1,7 +1,7 @@
;; generated by makeenums.pl ; -*- scheme -*-
; enumerations from "../../gtk+/gtk/gtkclist.h"
; enumerations from "./gtkclist.h"
(define-enum GtkCellType
(empty GTK_CELL_EMPTY)
@ -10,7 +10,7 @@
(pixtext GTK_CELL_PIXTEXT)
(widget GTK_CELL_WIDGET))
; enumerations from "../../gtk+/gtk/gtkctree.h"
; enumerations from "./gtkctree.h"
(define-enum GtkCTreePos
(before GTK_CTREE_POS_BEFORE)
@ -22,14 +22,14 @@
(dotted GTK_CTREE_LINES_DOTTED)
(none GTK_CTREE_LINES_NONE))
; enumerations from "../../gtk+/gtk/gtkdebug.h"
; enumerations from "./gtkdebug.h"
(define-flags GtkDebugFlag
(objects GTK_DEBUG_OBJECTS)
(misc GTK_DEBUG_MISC)
(signals GTK_DEBUG_SIGNALS))
; enumerations from "../../gtk+/gtk/gtkenums.h"
; enumerations from "./gtkenums.h"
(define-flags GtkAccelFlags
(visible GTK_ACCEL_VISIBLE)
@ -211,13 +211,13 @@
(dialog GTK_WINDOW_DIALOG)
(popup GTK_WINDOW_POPUP))
; enumerations from "../../gtk+/gtk/gtkfontsel.h"
; enumerations from "./gtkfontsel.h"
(define-enum GtkFontMetricType
(ixels-metric PIXELS_METRIC)
(oints-metric POINTS_METRIC))
; enumerations from "../../gtk+/gtk/gtkobject.h"
; enumerations from "./gtkobject.h"
(define-flags GtkObjectFlags
(destroyed GTK_DESTROYED)
@ -234,7 +234,7 @@
(mask GTK_ARG_MASK)
(readwrite GTK_ARG_READWRITE))
; enumerations from "../../gtk+/gtk/gtkpacker.h"
; enumerations from "./gtkpacker.h"
(define-flags GtkPackerOptions
(expand GTK_PACK_EXPAND)
@ -266,7 +266,7 @@
(w GTK_ANCHOR_W)
(e GTK_ANCHOR_E))
; enumerations from "../../gtk+/gtk/gtkprivate.h"
; enumerations from "./gtkprivate.h"
(define-flags GtkPrivateFlags
(user-style PRIVATE_GTK_USER_STYLE)
@ -277,13 +277,13 @@
(has-shape-mask PRIVATE_GTK_HAS_SHAPE_MASK)
(in-reparent PRIVATE_GTK_IN_REPARENT))
; enumerations from "../../gtk+/gtk/gtkspinbutton.h"
; enumerations from "./gtkspinbutton.h"
(define-enum GtkSpinButtonUpdatePolicy
(always GTK_UPDATE_ALWAYS)
(if-valid GTK_UPDATE_IF_VALID))
; enumerations from "../../gtk+/gtk/gtktoolbar.h"
; enumerations from "./gtktoolbar.h"
(define-enum GtkToolbarChildType
(space GTK_TOOLBAR_CHILD_SPACE)
@ -292,13 +292,13 @@
(radiobutton GTK_TOOLBAR_CHILD_RADIOBUTTON)
(widget GTK_TOOLBAR_CHILD_WIDGET))
; enumerations from "../../gtk+/gtk/gtktree.h"
; enumerations from "./gtktree.h"
(define-enum GtkTreeViewMode
(line GTK_TREE_VIEW_LINE)
(item GTK_TREE_VIEW_ITEM))
; enumerations from "../../gtk+/gtk/gtktypeutils.h"
; enumerations from "./gtktypeutils.h"
(define-enum GtkFundamentalType
(invalid GTK_TYPE_INVALID)
@ -323,7 +323,7 @@
(c-callback GTK_TYPE_C_CALLBACK)
(object GTK_TYPE_OBJECT))
; enumerations from "../../gtk+/gtk/gtkwidget.h"
; enumerations from "./gtkwidget.h"
(define-flags GtkWidgetFlags
(toplevel GTK_TOPLEVEL)
@ -341,7 +341,7 @@
(rc-style GTK_RC_STYLE)
(basic GTK_BASIC))
; enumerations from "../../gtk+/gdk/gdkprivate.h"
; enumerations from "../gdk/gdkprivate.h"
(define-flags GdkDebugFlag
(misc GDK_DEBUG_MISC)
@ -350,7 +350,7 @@
(color-context GDK_DEBUG_COLOR_CONTEXT)
(xim GDK_DEBUG_XIM))
; enumerations from "../../gtk+/gdk/gdktypes.h"
; enumerations from "../gdk/gdktypes.h"
(define-enum GdkWindowType
(root GDK_WINDOW_ROOT)

View File

@ -35,6 +35,7 @@ enum {
enum {
ARG_0,
ARG_BORDER_WIDTH,
ARG_RESIZE_MODE,
ARG_CHILD
};
@ -168,6 +169,7 @@ gtk_container_class_init (GtkContainerClass *class)
hadjustment_key_id = g_quark_from_static_string (hadjustment_key);
gtk_object_add_arg_type ("GtkContainer::border_width", GTK_TYPE_ULONG, GTK_ARG_READWRITE, ARG_BORDER_WIDTH);
gtk_object_add_arg_type ("GtkContainer::resize_mode", GTK_TYPE_RESIZE_MODE, GTK_ARG_READWRITE, ARG_RESIZE_MODE);
gtk_object_add_arg_type ("GtkContainer::child", GTK_TYPE_WIDGET, GTK_ARG_WRITABLE, ARG_CHILD);
container_signals[ADD] =
@ -697,6 +699,9 @@ gtk_container_set_arg (GtkContainer *container,
case ARG_BORDER_WIDTH:
gtk_container_border_width (container, GTK_VALUE_ULONG (*arg));
break;
case ARG_RESIZE_MODE:
gtk_container_set_resize_mode (container, GTK_VALUE_ENUM (*arg));
break;
case ARG_CHILD:
gtk_container_add (container, GTK_WIDGET (GTK_VALUE_OBJECT (*arg)));
break;
@ -715,6 +720,9 @@ gtk_container_get_arg (GtkContainer *container,
case ARG_BORDER_WIDTH:
GTK_VALUE_ULONG (*arg) = container->border_width;
break;
case ARG_RESIZE_MODE:
GTK_VALUE_ENUM (*arg) = container->resize_mode;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
@ -819,19 +827,25 @@ gtk_container_set_resize_mode (GtkContainer *container,
{
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
g_return_if_fail (!(GTK_WIDGET_TOPLEVEL (container) &&
resize_mode == GTK_RESIZE_PARENT));
container->resize_mode = resize_mode;
if (container->resize_widgets != NULL)
g_return_if_fail (resize_mode <= GTK_RESIZE_IMMEDIATE);
if (GTK_WIDGET_TOPLEVEL (container) &&
resize_mode == GTK_RESIZE_PARENT)
resize_mode = GTK_RESIZE_QUEUE;
if (container->resize_mode != resize_mode)
{
if (resize_mode == GTK_RESIZE_IMMEDIATE)
gtk_container_check_resize (container);
else if (resize_mode == GTK_RESIZE_PARENT)
container->resize_mode = resize_mode;
if (container->resize_widgets != NULL)
{
gtk_widget_queue_resize (GTK_WIDGET (container));
container->resize_widgets = NULL;
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));
}
}
}
}
@ -849,7 +863,7 @@ gint
gtk_container_need_resize (GtkContainer *container)
{
gtk_container_check_resize (container);
return TRUE;
return FALSE;
}
static void
@ -876,7 +890,7 @@ gtk_container_real_check_resize (GtkContainer *container)
}
}
/* The window hasn't changed size but one of its children
/* The container hasn't changed size but one of its children
* queued a resize request. Which means that the allocation
* is not sufficient for the requisition of some child.
* We've already performed a size request at this point,
@ -895,12 +909,12 @@ gtk_container_resize_children (GtkContainer *container)
GSList *resize_containers;
GSList *node;
resize_widgets = container->resize_widgets;
container->resize_widgets = NULL;
g_return_if_fail (container != NULL);
g_return_if_fail (GTK_IS_CONTAINER (container));
resize_widgets = container->resize_widgets;
container->resize_widgets = NULL;
for (node = resize_widgets; node; node = node->next)
{
widget = node->data;

View File

@ -1421,7 +1421,7 @@ gtk_widget_hide_all (GtkWidget *widget)
{
GtkWidget *toplevel;
toplevel = gtk_widget_get_toplevel (widget);
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);
@ -1675,11 +1675,17 @@ gtk_widget_queue_resize (GtkWidget *widget)
break;
case GTK_RESIZE_IMMEDIATE:
container->resize_widgets =
g_slist_prepend (container->resize_widgets, widget);
gtk_container_check_resize (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);
gtk_container_check_resize (container);
}
break;
case GTK_RESIZE_PARENT:
/* Ignore */
break;
}
}
else