summaryrefslogtreecommitdiff
path: root/gtk/gtkhpaned.c
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>1998-12-15 17:56:31 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-12-15 17:56:31 +0000
commitcceabe57ba5f083b9f7ffc276050bf3634cc7af4 (patch)
tree252c4465bf0b3875fc3ffae3cfa08d40da8ea5cc /gtk/gtkhpaned.c
parent1bf27c357d69d4a23eaccdb9aeab168f49e98cd7 (diff)
downloadgtk+-cceabe57ba5f083b9f7ffc276050bf3634cc7af4.tar.gz
Fixed up some warnings.
Tue Dec 15 11:37:05 1998 Owen Taylor <otaylor@redhat.com> * gtk/gtkmain.c: Fixed up some warnings. Tue Dec 15 10:32:01 1998 Owen Taylor <otaylor@redhat.com> * gtk/gtk{h,v,}paned.{c,h}: Add new functions gtk_paned_set_position(), gtk_paned_pack1/2(). The latter take a shrink and resize parameters, that allows setting minimum sizes and getting 'relative' resizing.
Diffstat (limited to 'gtk/gtkhpaned.c')
-rw-r--r--gtk/gtkhpaned.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/gtk/gtkhpaned.c b/gtk/gtkhpaned.c
index eec7581627..be20306518 100644
--- a/gtk/gtkhpaned.c
+++ b/gtk/gtkhpaned.c
@@ -144,18 +144,13 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
paned = GTK_PANED (widget);
border_width = GTK_CONTAINER (paned)->border_width;
- if (!paned->position_set)
- {
- if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
- paned->child1_size = paned->child1->requisition.width;
- else
- paned->child1_size = 0;
- }
- else
- paned->child1_size = CLAMP (paned->child1_size, 0,
- allocation->width - paned->gutter_size
- - 2 * GTK_CONTAINER (paned)->border_width);
-
+ gtk_paned_compute_position (paned,
+ widget->allocation.width
+ - paned->gutter_size
+ - 2 * border_width,
+ paned->child1->requisition.width,
+ paned->child2->requisition.width);
+
/* Move the handle before the children so we don't get extra expose events */
paned->handle_xpos = paned->child1_size + border_width + paned->gutter_size / 2 - paned->handle_size / 2;
@@ -338,20 +333,21 @@ gtk_hpaned_motion (GtkWidget *widget, GdkEventMotion *event)
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_PANED (widget), FALSE);
+ paned = GTK_PANED (widget);
+
if (event->is_hint || event->window != widget->window)
gtk_widget_get_pointer(widget, &x, NULL);
else
x = event->x;
- paned = GTK_PANED (widget);
-
if (paned->in_drag)
{
+ gint size = x - GTK_CONTAINER (paned)->border_width - paned->gutter_size/2;
+
gtk_hpaned_xor_line (paned);
- paned->child1_size = x - GTK_CONTAINER (paned)->border_width - paned->gutter_size / 2;
- paned->child1_size = CLAMP (paned->child1_size, 0,
- widget->allocation.width - paned->gutter_size
- - 2 * GTK_CONTAINER (paned)->border_width);
+ paned->child1_size = CLAMP (size,
+ paned->min_position,
+ paned->max_position);
gtk_hpaned_xor_line (paned);
}