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.
This commit is contained in:
Owen Taylor 1998-12-15 17:56:31 +00:00 committed by Owen Taylor
parent 1bf27c357d
commit cceabe57ba
14 changed files with 473 additions and 54 deletions

View File

@ -1,3 +1,15 @@
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/gtkpaned.[ch]: 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.
Tue Dec 15 10:26:23 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c: Keep separate putback_events and

View File

@ -1,3 +1,15 @@
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/gtkpaned.[ch]: 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.
Tue Dec 15 10:26:23 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c: Keep separate putback_events and

View File

@ -1,3 +1,15 @@
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/gtkpaned.[ch]: 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.
Tue Dec 15 10:26:23 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c: Keep separate putback_events and

View File

@ -1,3 +1,15 @@
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/gtkpaned.[ch]: 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.
Tue Dec 15 10:26:23 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c: Keep separate putback_events and

View File

@ -1,3 +1,15 @@
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/gtkpaned.[ch]: 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.
Tue Dec 15 10:26:23 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c: Keep separate putback_events and

View File

@ -1,3 +1,15 @@
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/gtkpaned.[ch]: 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.
Tue Dec 15 10:26:23 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c: Keep separate putback_events and

View File

@ -1,3 +1,15 @@
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/gtkpaned.[ch]: 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.
Tue Dec 15 10:26:23 1998 Owen Taylor <otaylor@redhat.com>
* gdk/gdkevents.c: Keep separate putback_events and

View File

@ -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);
}

View File

@ -202,7 +202,7 @@ gtk_init (int *argc,
*/
gdk_init (argc, argv);
gdk_event_handler_set ((GdkEventFunc *)gtk_main_do_event, NULL, NULL);
gdk_event_handler_set ((GdkEventFunc)gtk_main_do_event, NULL, NULL);
#ifdef G_ENABLE_DEBUG
env_string = getenv ("GTK_DEBUG");
@ -538,7 +538,7 @@ gtk_main_iteration_do (gboolean blocking)
return g_main_iteration (blocking);
}
static void
void
gtk_main_do_event (GdkEvent *event)
{
GtkWidget *event_widget;

View File

@ -113,6 +113,7 @@ gtk_paned_init (GtkPaned *paned)
paned->handle_size = 10;
paned->gutter_size = 6;
paned->position_set = FALSE;
paned->last_allocation = -1;
paned->in_drag = FALSE;
paned->handle_xpos = -1;
@ -287,6 +288,24 @@ void
gtk_paned_add1 (GtkPaned *paned,
GtkWidget *widget)
{
gtk_paned_pack1 (paned, widget, FALSE, TRUE);
}
void
gtk_paned_add2 (GtkPaned *paned,
GtkWidget *widget)
{
gtk_paned_pack2 (paned, widget, TRUE, TRUE);
}
void
gtk_paned_pack1 (GtkPaned *paned,
GtkWidget *widget,
gboolean resize,
gboolean shrink)
{
g_return_if_fail (paned != NULL);
g_return_if_fail (GTK_IS_PANED (paned));
g_return_if_fail (widget != NULL);
if (!paned->child1)
@ -305,6 +324,8 @@ gtk_paned_add1 (GtkPaned *paned,
}
paned->child1 = widget;
paned->child1_resize = resize;
paned->child1_shrink = shrink;
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (paned))
gtk_widget_queue_resize (widget);
@ -312,9 +333,13 @@ gtk_paned_add1 (GtkPaned *paned,
}
void
gtk_paned_add2 (GtkPaned *paned,
GtkWidget *widget)
gtk_paned_pack2 (GtkPaned *paned,
GtkWidget *widget,
gboolean resize,
gboolean shrink)
{
g_return_if_fail (paned != NULL);
g_return_if_fail (GTK_IS_PANED (paned));
g_return_if_fail (widget != NULL);
if (!paned->child2)
@ -333,6 +358,8 @@ gtk_paned_add2 (GtkPaned *paned,
}
paned->child2 = widget;
paned->child2_resize = resize;
paned->child2_shrink = shrink;
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_VISIBLE (paned))
gtk_widget_queue_resize (widget);
@ -411,6 +438,26 @@ gtk_paned_forall (GtkContainer *container,
(* callback) (paned->child2, callback_data);
}
void
gtk_paned_set_position (GtkPaned *paned,
gint position)
{
g_return_if_fail (paned != NULL);
g_return_if_fail (GTK_IS_PANED (paned));
if (position >= 0)
{
paned->child1_size = CLAMP (position,
paned->min_position,
paned->max_position);
paned->position_set = TRUE;
}
else
paned->position_set = FALSE;
gtk_widget_queue_resize (GTK_WIDGET (paned));
}
void
gtk_paned_set_handle_size (GtkPaned *paned,
guint16 size)
@ -443,3 +490,46 @@ gtk_paned_set_gutter_size (GtkPaned *paned,
if (GTK_WIDGET_VISIBLE (GTK_WIDGET (paned)))
gtk_widget_queue_resize (GTK_WIDGET (paned));
}
void
gtk_paned_compute_position (GtkPaned *paned,
gint allocation,
gint child1_req,
gint child2_req)
{
g_return_if_fail (paned != NULL);
g_return_if_fail (GTK_IS_PANED (paned));
paned->min_position = paned->child1_shrink ? 0 : child1_req;
paned->max_position = allocation;
if (!paned->child2_shrink)
paned->max_position -= child2_req;
if (!paned->position_set)
{
if (paned->child1_resize && !paned->child2_resize)
paned->child1_size = allocation - child2_req;
else if (!paned->child1_resize && paned->child2_resize)
paned->child1_size = child1_req;
else
paned->child1_size = allocation * ((gdouble)child1_req / (child1_req + child2_req));
}
else
{
if (paned->last_allocation < 0)
paned->last_allocation = allocation;
if (paned->child1_resize && !paned->child2_resize)
paned->child1_size += (allocation - paned->last_allocation);
else if (!(!paned->child1_resize && paned->child2_resize))
paned->child1_size = allocation * ((gdouble)paned->child1_size / (paned->last_allocation));
}
paned->child1_size = CLAMP (paned->child1_size,
paned->min_position,
paned->max_position);
paned->last_allocation = allocation;
}

View File

@ -54,8 +54,16 @@ struct _GtkPaned
guint16 gutter_size;
gint child1_size;
gint last_allocation;
gint min_position;
gint max_position;
guint position_set : 1;
guint in_drag : 1;
guint child1_shrink : 1;
guint child1_resize : 1;
guint child2_shrink : 1;
guint child2_resize : 1;
gint16 handle_xpos;
gint16 handle_ypos;
@ -72,11 +80,27 @@ void gtk_paned_add1 (GtkPaned *paned,
GtkWidget *child);
void gtk_paned_add2 (GtkPaned *paned,
GtkWidget *child);
void gtk_paned_pack1 (GtkPaned *paned,
GtkWidget *child,
gboolean resize,
gboolean shrink);
void gtk_paned_pack2 (GtkPaned *paned,
GtkWidget *child,
gboolean resize,
gboolean shrink);
void gtk_paned_set_position (GtkPaned *paned,
gint position);
void gtk_paned_set_handle_size (GtkPaned *paned,
guint16 size);
void gtk_paned_set_gutter_size (GtkPaned *paned,
guint16 size);
/* Internal function */
void gtk_paned_compute_position (GtkPaned *paned,
gint allocation,
gint child1_req,
gint child2_req);
#ifdef __cplusplus
}
#endif /* __cplusplus */

View File

@ -144,17 +144,12 @@ gtk_vpaned_size_allocate (GtkWidget *widget,
paned = GTK_PANED (widget);
border_width = GTK_CONTAINER (widget)->border_width;
if (!paned->position_set)
{
if (paned->child1 && GTK_WIDGET_VISIBLE (paned->child1))
paned->child1_size = paned->child1->requisition.height;
else
paned->child1_size = 0;
}
else
paned->child1_size = CLAMP (paned->child1_size, 0,
allocation->height - paned->gutter_size
- 2 * GTK_CONTAINER (paned)->border_width);
gtk_paned_compute_position (paned,
widget->allocation.height
- paned->gutter_size
- 2 * border_width,
paned->child1->requisition.height,
paned->child2->requisition.height);
/* Move the handle before the children so we don't get extra expose events */
@ -347,12 +342,12 @@ gtk_vpaned_motion (GtkWidget *widget, GdkEventMotion *event)
if (paned->in_drag)
{
gint size = y - GTK_CONTAINER (paned)->border_width - paned->gutter_size/2;
gtk_vpaned_xor_line (paned);
paned->child1_size = y - GTK_CONTAINER (paned)->border_width -
paned->gutter_size/2;
paned->child1_size = CLAMP (paned->child1_size, 0,
widget->allocation.height - paned->gutter_size
- 2 * GTK_CONTAINER (paned)->border_width);
paned->child1_size = CLAMP (size,
paned->min_position,
paned->max_position);
gtk_vpaned_xor_line (paned);
}

View File

@ -6173,6 +6173,106 @@ create_notebook (void)
* GtkPanes
*/
void
toggle_resize (GtkWidget *widget, GtkWidget *child)
{
GtkPaned *paned = GTK_PANED (child->parent);
gboolean is_child1 = (child == paned->child1);
gboolean resize, shrink;
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
gtk_widget_ref (child);
gtk_container_remove (GTK_CONTAINER (child->parent), child);
if (is_child1)
gtk_paned_pack1 (paned, child, !resize, shrink);
else
gtk_paned_pack2 (paned, child, !resize, shrink);
gtk_widget_unref (child);
}
void
toggle_shrink (GtkWidget *widget, GtkWidget *child)
{
GtkPaned *paned = GTK_PANED (child->parent);
gboolean is_child1 = (child == paned->child1);
gboolean resize, shrink;
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
gtk_widget_ref (child);
gtk_container_remove (GTK_CONTAINER (child->parent), child);
if (is_child1)
gtk_paned_pack1 (paned, child, resize, !shrink);
else
gtk_paned_pack2 (paned, child, resize, !shrink);
gtk_widget_unref (child);
}
GtkWidget *
create_pane_options (GtkPaned *paned,
const gchar *frame_label,
const gchar *label1,
const gchar *label2)
{
GtkWidget *frame;
GtkWidget *table;
GtkWidget *label;
GtkWidget *check_button;
frame = gtk_frame_new (frame_label);
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
table = gtk_table_new (3, 2, 4);
gtk_container_add (GTK_CONTAINER (frame), table);
label = gtk_label_new (label1);
gtk_table_attach_defaults (GTK_TABLE (table), label,
0, 1, 0, 1);
check_button = gtk_check_button_new_with_label ("Resize");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 1, 2);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_resize),
paned->child1);
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 2, 3);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_shrink),
paned->child1);
label = gtk_label_new (label2);
gtk_table_attach_defaults (GTK_TABLE (table), label,
1, 2, 0, 1);
check_button = gtk_check_button_new_with_label ("Resize");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 1, 2);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_resize),
paned->child2);
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 2, 3);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_shrink),
paned->child2);
return frame;
}
void
create_panes (void)
{
@ -6181,6 +6281,7 @@ create_panes (void)
GtkWidget *hpaned;
GtkWidget *vpaned;
GtkWidget *button;
GtkWidget *vbox;
if (!window)
{
@ -6193,10 +6294,12 @@ create_panes (void)
gtk_window_set_title (GTK_WINDOW (window), "Panes");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
vpaned = gtk_vpaned_new ();
gtk_container_add (GTK_CONTAINER (window), vpaned);
gtk_box_pack_start (GTK_BOX (vbox), vpaned, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
gtk_widget_show (vpaned);
hpaned = gtk_hpaned_new ();
gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
@ -6205,25 +6308,37 @@ create_panes (void)
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_usize (frame, 60, 60);
gtk_paned_add1 (GTK_PANED (hpaned), frame);
gtk_widget_show (frame);
button = gtk_button_new_with_label ("Hi there");
gtk_container_add (GTK_CONTAINER(frame), button);
gtk_widget_show (button);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_usize (frame, 80, 60);
gtk_paned_add2 (GTK_PANED (hpaned), frame);
gtk_widget_show (frame);
gtk_widget_show (hpaned);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_usize (frame, 60, 80);
gtk_paned_add2 (GTK_PANED (vpaned), frame);
gtk_widget_show (frame);
/* Now create toggle buttons to control sizing */
gtk_box_pack_start (GTK_BOX (vbox),
create_pane_options (GTK_PANED (hpaned),
"Horizontal",
"Left",
"Right"),
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox),
create_pane_options (GTK_PANED (vpaned),
"Vertical",
"Top",
"Bottom"),
FALSE, FALSE, 0);
gtk_widget_show_all (vbox);
}
if (!GTK_WIDGET_VISIBLE (window))

View File

@ -6173,6 +6173,106 @@ create_notebook (void)
* GtkPanes
*/
void
toggle_resize (GtkWidget *widget, GtkWidget *child)
{
GtkPaned *paned = GTK_PANED (child->parent);
gboolean is_child1 = (child == paned->child1);
gboolean resize, shrink;
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
gtk_widget_ref (child);
gtk_container_remove (GTK_CONTAINER (child->parent), child);
if (is_child1)
gtk_paned_pack1 (paned, child, !resize, shrink);
else
gtk_paned_pack2 (paned, child, !resize, shrink);
gtk_widget_unref (child);
}
void
toggle_shrink (GtkWidget *widget, GtkWidget *child)
{
GtkPaned *paned = GTK_PANED (child->parent);
gboolean is_child1 = (child == paned->child1);
gboolean resize, shrink;
resize = is_child1 ? paned->child1_resize : paned->child2_resize;
shrink = is_child1 ? paned->child1_shrink : paned->child2_shrink;
gtk_widget_ref (child);
gtk_container_remove (GTK_CONTAINER (child->parent), child);
if (is_child1)
gtk_paned_pack1 (paned, child, resize, !shrink);
else
gtk_paned_pack2 (paned, child, resize, !shrink);
gtk_widget_unref (child);
}
GtkWidget *
create_pane_options (GtkPaned *paned,
const gchar *frame_label,
const gchar *label1,
const gchar *label2)
{
GtkWidget *frame;
GtkWidget *table;
GtkWidget *label;
GtkWidget *check_button;
frame = gtk_frame_new (frame_label);
gtk_container_set_border_width (GTK_CONTAINER (frame), 4);
table = gtk_table_new (3, 2, 4);
gtk_container_add (GTK_CONTAINER (frame), table);
label = gtk_label_new (label1);
gtk_table_attach_defaults (GTK_TABLE (table), label,
0, 1, 0, 1);
check_button = gtk_check_button_new_with_label ("Resize");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 1, 2);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_resize),
paned->child1);
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
0, 1, 2, 3);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_shrink),
paned->child1);
label = gtk_label_new (label2);
gtk_table_attach_defaults (GTK_TABLE (table), label,
1, 2, 0, 1);
check_button = gtk_check_button_new_with_label ("Resize");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 1, 2);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_resize),
paned->child2);
check_button = gtk_check_button_new_with_label ("Shrink");
gtk_table_attach_defaults (GTK_TABLE (table), check_button,
1, 2, 2, 3);
gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (check_button),
TRUE);
gtk_signal_connect (GTK_OBJECT (check_button), "toggled",
GTK_SIGNAL_FUNC (toggle_shrink),
paned->child2);
return frame;
}
void
create_panes (void)
{
@ -6181,6 +6281,7 @@ create_panes (void)
GtkWidget *hpaned;
GtkWidget *vpaned;
GtkWidget *button;
GtkWidget *vbox;
if (!window)
{
@ -6193,10 +6294,12 @@ create_panes (void)
gtk_window_set_title (GTK_WINDOW (window), "Panes");
gtk_container_set_border_width (GTK_CONTAINER (window), 0);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (window), vbox);
vpaned = gtk_vpaned_new ();
gtk_container_add (GTK_CONTAINER (window), vpaned);
gtk_box_pack_start (GTK_BOX (vbox), vpaned, TRUE, TRUE, 0);
gtk_container_set_border_width (GTK_CONTAINER(vpaned), 5);
gtk_widget_show (vpaned);
hpaned = gtk_hpaned_new ();
gtk_paned_add1 (GTK_PANED (vpaned), hpaned);
@ -6205,25 +6308,37 @@ create_panes (void)
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_usize (frame, 60, 60);
gtk_paned_add1 (GTK_PANED (hpaned), frame);
gtk_widget_show (frame);
button = gtk_button_new_with_label ("Hi there");
gtk_container_add (GTK_CONTAINER(frame), button);
gtk_widget_show (button);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_usize (frame, 80, 60);
gtk_paned_add2 (GTK_PANED (hpaned), frame);
gtk_widget_show (frame);
gtk_widget_show (hpaned);
frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(frame), GTK_SHADOW_IN);
gtk_widget_set_usize (frame, 60, 80);
gtk_paned_add2 (GTK_PANED (vpaned), frame);
gtk_widget_show (frame);
/* Now create toggle buttons to control sizing */
gtk_box_pack_start (GTK_BOX (vbox),
create_pane_options (GTK_PANED (hpaned),
"Horizontal",
"Left",
"Right"),
FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (vbox),
create_pane_options (GTK_PANED (vpaned),
"Vertical",
"Top",
"Bottom"),
FALSE, FALSE, 0);
gtk_widget_show_all (vbox);
}
if (!GTK_WIDGET_VISIBLE (window))