+Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
+
+ * docs/Changes-1.2.txt: Edited section on the ScrolledWindow.
+
+ * gtk/gtklayout.c (gtk_layout_set_[hv]adjustment): Remove
+ some code duplication.
+
+ * gtk/gtklayout.[ch] Fixed mapping and unmapping of child windows
+ and child widgets when scrolling greater than 32k pixels.
+
+ * testgtk.c: Modified layout test to test scrolling over
+ long distances.
+
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.
+Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
+
+ * docs/Changes-1.2.txt: Edited section on the ScrolledWindow.
+
+ * gtk/gtklayout.c (gtk_layout_set_[hv]adjustment): Remove
+ some code duplication.
+
+ * gtk/gtklayout.[ch] Fixed mapping and unmapping of child windows
+ and child widgets when scrolling greater than 32k pixels.
+
+ * testgtk.c: Modified layout test to test scrolling over
+ long distances.
+
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.
+Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
+
+ * docs/Changes-1.2.txt: Edited section on the ScrolledWindow.
+
+ * gtk/gtklayout.c (gtk_layout_set_[hv]adjustment): Remove
+ some code duplication.
+
+ * gtk/gtklayout.[ch] Fixed mapping and unmapping of child windows
+ and child widgets when scrolling greater than 32k pixels.
+
+ * testgtk.c: Modified layout test to test scrolling over
+ long distances.
+
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.
+Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
+
+ * docs/Changes-1.2.txt: Edited section on the ScrolledWindow.
+
+ * gtk/gtklayout.c (gtk_layout_set_[hv]adjustment): Remove
+ some code duplication.
+
+ * gtk/gtklayout.[ch] Fixed mapping and unmapping of child windows
+ and child widgets when scrolling greater than 32k pixels.
+
+ * testgtk.c: Modified layout test to test scrolling over
+ long distances.
+
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.
+Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
+
+ * docs/Changes-1.2.txt: Edited section on the ScrolledWindow.
+
+ * gtk/gtklayout.c (gtk_layout_set_[hv]adjustment): Remove
+ some code duplication.
+
+ * gtk/gtklayout.[ch] Fixed mapping and unmapping of child windows
+ and child widgets when scrolling greater than 32k pixels.
+
+ * testgtk.c: Modified layout test to test scrolling over
+ long distances.
+
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.
+Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
+
+ * docs/Changes-1.2.txt: Edited section on the ScrolledWindow.
+
+ * gtk/gtklayout.c (gtk_layout_set_[hv]adjustment): Remove
+ some code duplication.
+
+ * gtk/gtklayout.[ch] Fixed mapping and unmapping of child windows
+ and child widgets when scrolling greater than 32k pixels.
+
+ * testgtk.c: Modified layout test to test scrolling over
+ long distances.
+
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.
+Tue Nov 24 11:31:06 1998 Owen Taylor <otaylor@redhat.com>
+
+ * docs/Changes-1.2.txt: Edited section on the ScrolledWindow.
+
+ * gtk/gtklayout.c (gtk_layout_set_[hv]adjustment): Remove
+ some code duplication.
+
+ * gtk/gtklayout.[ch] Fixed mapping and unmapping of child windows
+ and child widgets when scrolling greater than 32k pixels.
+
+ * testgtk.c: Modified layout test to test scrolling over
+ long distances.
+
Tue Nov 24 11:11:05 1998 Owen Taylor <otaylor@redhat.com>
* gtk/gtklayout.[ch]: Fixed up copyright message.
If you need to do that, use a GtkDrawingArea or (for a
toplevel) the new GtkDrawWindow widget.
-* Scrolled windows do not create an automatic viewport anymore, and
- self scrolling widgets do not provide their own scrollbars any
- further. Self scrolling widgets of the Gtk+ core currently are
- GtkViewport, GtkCList, GtkCTree, GtkText and GtkLayout. All of
- these widgets can be added to a scrolled window as normal children
- with gtk_container_add() and their scrolling abilities will be setup
- appropriatedly in an automatic manner.
- Widgets that do not implement own scrolling abilities but get added
- to a scrolled window in order to have their allocations scrollable
- inside of the scrolled window (e.g. a GtkList) have first to be added
- to a GtkViewport, and then the viewport needs to be added to the
- scrolled window.
- However, the scrolled window code provides a convenience function to
- achive this:
- gtk_scrolled_window_add_with_viewport() which will do exactly what
- it says, add a child widget to a viewport and put that viewport into
- the scrolled window.
- Scrollbar policy adjustment needs to be perfomed on the scrolled window
- with gtk_scrolled_window_set_policy() and is not longer maintained for
- the child widgets (e.g. GtkCList's gtk_clist_set_policy() got removed).
+* The ScrolledWindow widget no longer creates a Viewport
+ automatically. Instead, it has been generalized to accept
+ any "self-scrolling" widget.
+
+ The self-scrolling widgets in the Gtk+ core are GtkViewport,
+ GtkCList, GtkCTree, GtkText, and GtkLayout. All of these widgets can
+ be added to a scrolled window as normal children with
+ gtk_container_add() and scrollbars will be set up automatically.
+
+ To add scrollbars to a non self-scrolling widget, (such as a GtkList),
+ first add it to a viewport, then add the viewport to a scrolled window.
+ The scrolled window code provides a convenience function to do this:
+
+ void gtk_scrolled_window_add_with_viewport (GtkScrolledWindow *scrollwin,
+ GtkWidget *child);
+
+ This does exactly what it says - it creates a Viewport, adds the child
+ widget to it, then adds the Viewport to the scrolled window.
+
+ The scrollbars have been removed from the GtkCList and GtkCTree,
+ because they are now scrolled by simply adding them to a Scrolled
+ Window. The scrollbar policy is set on the scrolled window with
+ gtk_scrolled_window_set_policy() and not on the child widgets
+ (e.g. GtkCList's gtk_clist_set_policy() was removed).
layout = gtk_type_new (gtk_layout_get_type());
- gtk_layout_set_hadjustment (layout, hadjustment);
- gtk_layout_set_vadjustment (layout, vadjustment);
+ gtk_layout_set_adjustments (layout, hadjustment, vadjustment);
return GTK_WIDGET (layout);
}
GtkAdjustment *hadj,
GtkAdjustment *vadj)
{
+ gboolean need_adjust = FALSE;
+
g_return_if_fail (layout != NULL);
g_return_if_fail (GTK_IS_LAYOUT (layout));
gtk_signal_connect (GTK_OBJECT (layout->hadjustment), "value_changed",
(GtkSignalFunc) gtk_layout_adjustment_changed,
layout);
- gtk_layout_adjustment_changed (hadj, layout);
+ need_adjust = TRUE;
}
if (layout->vadjustment != vadj)
gtk_signal_connect (GTK_OBJECT (layout->vadjustment), "value_changed",
(GtkSignalFunc) gtk_layout_adjustment_changed,
layout);
- gtk_layout_adjustment_changed (vadj, layout);
+ need_adjust = TRUE;
}
+
+ if (need_adjust)
+ gtk_layout_adjustment_changed (NULL, layout);
}
void
g_return_if_fail (layout != NULL);
g_return_if_fail (GTK_IS_LAYOUT (layout));
- if (layout->hadjustment)
- gtk_object_unref (GTK_OBJECT (layout->hadjustment));
-
- if (!adjustment)
- adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 10.0, 0.0, 0.0));
- else
- gtk_object_ref (GTK_OBJECT (adjustment));
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- GTK_SIGNAL_FUNC (gtk_layout_adjustment_changed),
- layout);
-
- layout->hadjustment = adjustment;
+ gtk_layout_set_adjustments (layout, adjustment, layout->vadjustment);
}
g_return_if_fail (layout != NULL);
g_return_if_fail (GTK_IS_LAYOUT (layout));
- if (layout->vadjustment)
- gtk_object_unref (GTK_OBJECT (layout->hadjustment));
-
- if (!adjustment)
- adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (0.0, 0.0, 0.0, 10.0, 0.0, 0.0));
- else
- gtk_object_ref (GTK_OBJECT (adjustment));
-
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- GTK_SIGNAL_FUNC (gtk_layout_adjustment_changed),
- layout);
-
- layout->vadjustment = adjustment;
+ gtk_layout_set_adjustments (layout, layout->hadjustment, adjustment);
}
child->y = y;
child->widget->requisition.width = 0;
child->widget->requisition.height = 0;
+ child->mapped = FALSE;
layout->children = g_list_append (layout->children, child);
{
GtkLayoutChild *child = tmp_list->data;
- if (GTK_WIDGET_VISIBLE (child->widget) &&
- !GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_map (child->widget);
-
- if (child->window)
- gdk_window_show (child->window);
+ if (child->mapped && GTK_WIDGET_VISIBLE (child->widget))
+ {
+ if (!GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_map (child->widget);
+
+ if (child->window)
+ gdk_window_show (child->window);
+ }
tmp_list = tmp_list->next;
}
if ((x >= G_MINSHORT) && (x <= G_MAXSHORT) &&
(y >= G_MINSHORT) && (y <= G_MAXSHORT))
{
- if (GTK_WIDGET_VISIBLE (child->widget) &&
- GTK_WIDGET_MAPPED (layout) &&
- !GTK_WIDGET_MAPPED (child->widget))
+ if (!child->mapped)
{
- gtk_widget_map (child->widget);
- force_allocate = TRUE;
+ child->mapped = TRUE;
+
+ if (GTK_WIDGET_MAPPED (layout) &&
+ GTK_WIDGET_VISIBLE (child->widget))
+ {
+ if (child->window)
+ gdk_window_show (child->window);
+ if (!GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_map (child->widget);
+
+ child->mapped = TRUE;
+ force_allocate = TRUE;
+ }
}
if (force_allocate)
}
else
{
- if (child->window)
- gdk_window_hide (child->window);
- else if (GTK_WIDGET_MAPPED (child->widget))
- gtk_widget_unmap (child->widget);
+ if (child->mapped)
+ {
+ child->mapped = FALSE;
+ if (child->window)
+ gdk_window_hide (child->window);
+ else if (GTK_WIDGET_MAPPED (child->widget))
+ gtk_widget_unmap (child->widget);
+ }
}
}
if (layout->frozen)
return;
- gtk_layout_position_children (layout);
-
if (!GTK_WIDGET_MAPPED (layout))
- return;
+ {
+ gtk_layout_position_children (layout);
+ return;
+ }
if (dx > 0)
{
-dy);
}
+ gtk_layout_position_children (layout);
+
/* We have to make sure that all exposes from this scroll get
* processed before we scroll again, or the expose events will
* have invalid coordinates.
GdkWindow *window; /* For NO_WINDOW widgets */
gint x;
gint y;
+ gboolean mapped : 1;
};
struct _GtkLayout {
window->type = GTK_WINDOW_TOPLEVEL;
window->auto_shrink = TRUE;
}
+
void
gtk_plug_construct (GtkPlug *plug, guint32 socket_id)
{
plug->same_app = FALSE;
}
}
+
GtkWidget*
gtk_plug_new (guint32 socket_id)
{
gtk_widget_set_usize (window, 200, 200);
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
- gtk_widget_show (scrolledwindow);
gtk_container_add (GTK_CONTAINER (window), scrolledwindow);
gtk_signal_connect (GTK_OBJECT (layout), "expose_event",
GTK_SIGNAL_FUNC (layout_expose_handler), NULL);
- gtk_layout_set_size (GTK_LAYOUT (layout), 1600, 1600);
- gtk_widget_show (layout);
+ gtk_layout_set_size (GTK_LAYOUT (layout), 1600, 64000);
for (i=0 ; i < 16 ; i++)
for (j=0 ; j < 16 ; j++)
button = gtk_button_new_with_label (buf);
else
button = gtk_label_new (buf);
+
gtk_layout_put (GTK_LAYOUT (layout), button,
j*100, i*100);
- gtk_widget_show (button);
}
+
+ for (i=16; i < 640; i++)
+ {
+ sprintf(buf, "Button %d, %d", i, 0);
+ if (i % 2)
+ button = gtk_button_new_with_label (buf);
+ else
+ button = gtk_label_new (buf);
+
+ gtk_layout_put (GTK_LAYOUT (layout), button,
+ 0, i*100);
+ }
}
if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
+ gtk_widget_show_all (window);
else
gtk_widget_destroy (window);
}
gtk_widget_set_usize (window, 200, 200);
scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
- gtk_widget_show (scrolledwindow);
gtk_container_add (GTK_CONTAINER (window), scrolledwindow);
gtk_signal_connect (GTK_OBJECT (layout), "expose_event",
GTK_SIGNAL_FUNC (layout_expose_handler), NULL);
- gtk_layout_set_size (GTK_LAYOUT (layout), 1600, 1600);
- gtk_widget_show (layout);
+ gtk_layout_set_size (GTK_LAYOUT (layout), 1600, 64000);
for (i=0 ; i < 16 ; i++)
for (j=0 ; j < 16 ; j++)
button = gtk_button_new_with_label (buf);
else
button = gtk_label_new (buf);
+
gtk_layout_put (GTK_LAYOUT (layout), button,
j*100, i*100);
- gtk_widget_show (button);
}
+
+ for (i=16; i < 640; i++)
+ {
+ sprintf(buf, "Button %d, %d", i, 0);
+ if (i % 2)
+ button = gtk_button_new_with_label (buf);
+ else
+ button = gtk_label_new (buf);
+
+ gtk_layout_put (GTK_LAYOUT (layout), button,
+ 0, i*100);
+ }
}
if (!GTK_WIDGET_VISIBLE (window))
- gtk_widget_show (window);
+ gtk_widget_show_all (window);
else
gtk_widget_destroy (window);
}