mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-24 12:41:16 +00:00
From Patrice Fortier <Patrice.Fortier@aquarel.fr>
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0) From Patrice Fortier <Patrice.Fortier@aquarel.fr> Add a widget->window for paned windows, so they can be reparented properly.
This commit is contained in:
parent
7b399a225c
commit
9f96d18eb1
@ -1,3 +1,11 @@
|
||||
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)
|
||||
From Patrice Fortier <Patrice.Fortier@aquarel.fr>
|
||||
|
||||
Add a widget->window for paned windows, so they
|
||||
can be reparented properly.
|
||||
|
||||
Mon Feb 16 23:47:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkviewport.c: (gtk-fortier-980130-0)
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)
|
||||
From Patrice Fortier <Patrice.Fortier@aquarel.fr>
|
||||
|
||||
Add a widget->window for paned windows, so they
|
||||
can be reparented properly.
|
||||
|
||||
Mon Feb 16 23:47:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkviewport.c: (gtk-fortier-980130-0)
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)
|
||||
From Patrice Fortier <Patrice.Fortier@aquarel.fr>
|
||||
|
||||
Add a widget->window for paned windows, so they
|
||||
can be reparented properly.
|
||||
|
||||
Mon Feb 16 23:47:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkviewport.c: (gtk-fortier-980130-0)
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)
|
||||
From Patrice Fortier <Patrice.Fortier@aquarel.fr>
|
||||
|
||||
Add a widget->window for paned windows, so they
|
||||
can be reparented properly.
|
||||
|
||||
Mon Feb 16 23:47:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkviewport.c: (gtk-fortier-980130-0)
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)
|
||||
From Patrice Fortier <Patrice.Fortier@aquarel.fr>
|
||||
|
||||
Add a widget->window for paned windows, so they
|
||||
can be reparented properly.
|
||||
|
||||
Mon Feb 16 23:47:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkviewport.c: (gtk-fortier-980130-0)
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)
|
||||
From Patrice Fortier <Patrice.Fortier@aquarel.fr>
|
||||
|
||||
Add a widget->window for paned windows, so they
|
||||
can be reparented properly.
|
||||
|
||||
Mon Feb 16 23:47:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkviewport.c: (gtk-fortier-980130-0)
|
||||
|
@ -1,3 +1,11 @@
|
||||
Tue Feb 17 00:06:26 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkpaned.c, gtk/gtk[hv]paned.c: (gtk-fortier-980215-0)
|
||||
From Patrice Fortier <Patrice.Fortier@aquarel.fr>
|
||||
|
||||
Add a widget->window for paned windows, so they
|
||||
can be reparented properly.
|
||||
|
||||
Mon Feb 16 23:47:09 1998 Owen Taylor <owt1@cornell.edu>
|
||||
|
||||
* gtk/gtkviewport.c: (gtk-fortier-980130-0)
|
||||
|
@ -150,15 +150,18 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
|
||||
paned->child1_size = 0;
|
||||
}
|
||||
|
||||
/* Move the handle first so we don't get extra expose events */
|
||||
/* Move the handle before the children so we don't get extra expose events */
|
||||
|
||||
paned->handle_xpos = allocation->x + paned->child1_size + border_width + paned->gutter_size / 2 - paned->handle_size / 2;
|
||||
paned->handle_ypos = allocation->y + allocation->height - border_width - 2*paned->handle_size;
|
||||
paned->handle_xpos = paned->child1_size + border_width + paned->gutter_size / 2 - paned->handle_size / 2;
|
||||
paned->handle_ypos = allocation->height - border_width - 2*paned->handle_size;
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
gdk_window_move_resize (widget->window,
|
||||
allocation->x, allocation->y,
|
||||
allocation->width, allocation->height);
|
||||
|
||||
gdk_window_move (paned->handle, paned->handle_xpos, paned->handle_ypos);
|
||||
gdk_window_raise (paned->handle);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_MAPPED (widget))
|
||||
@ -172,17 +175,17 @@ gtk_hpaned_size_allocate (GtkWidget *widget,
|
||||
|
||||
child1_allocation.height = child2_allocation.height = allocation->height - border_width * 2;
|
||||
child1_allocation.width = paned->child1_size;
|
||||
child1_allocation.x = allocation->x + border_width;
|
||||
child1_allocation.y = child2_allocation.y = allocation->y + border_width;
|
||||
child1_allocation.x = border_width;
|
||||
child1_allocation.y = child2_allocation.y = border_width;
|
||||
|
||||
paned->groove_rectangle.x = child1_allocation.x
|
||||
+ child1_allocation.width + paned->gutter_size / 2 - 1;
|
||||
paned->groove_rectangle.y = allocation->y;
|
||||
paned->groove_rectangle.y = 0;
|
||||
paned->groove_rectangle.width = 2;
|
||||
paned->groove_rectangle.height = allocation->height;
|
||||
|
||||
child2_allocation.x = paned->groove_rectangle.x + paned->gutter_size / 2 + 1;
|
||||
child2_allocation.width = allocation->x + allocation->width
|
||||
child2_allocation.width = allocation->width
|
||||
- child2_allocation.x - border_width;
|
||||
|
||||
/* Now allocate the childen, making sure, when resizing not to
|
||||
@ -229,16 +232,16 @@ gtk_hpaned_draw (GtkWidget *widget,
|
||||
|
||||
gdk_draw_line (widget->window,
|
||||
widget->style->dark_gc[widget->state],
|
||||
widget->allocation.x + border_width + paned->child1_size + paned->gutter_size / 2 - 1,
|
||||
widget->allocation.y,
|
||||
widget->allocation.x + border_width + paned->child1_size + paned->gutter_size / 2 - 1,
|
||||
widget->allocation.y + widget->allocation.height - 1);
|
||||
border_width + paned->child1_size + paned->gutter_size / 2 - 1,
|
||||
0,
|
||||
border_width + paned->child1_size + paned->gutter_size / 2 - 1,
|
||||
widget->allocation.height - 1);
|
||||
gdk_draw_line (widget->window,
|
||||
widget->style->light_gc[widget->state],
|
||||
widget->allocation.x + border_width + paned->child1_size + paned->gutter_size / 2,
|
||||
widget->allocation.y,
|
||||
widget->allocation.x + border_width + paned->child1_size + paned->gutter_size / 2,
|
||||
widget->allocation.y + widget->allocation.height - 1);
|
||||
border_width + paned->child1_size + paned->gutter_size / 2,
|
||||
0,
|
||||
border_width + paned->child1_size + paned->gutter_size / 2,
|
||||
widget->allocation.height - 1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,14 +266,14 @@ gtk_hpaned_xor_line (GtkPaned *paned)
|
||||
GDK_GC_SUBWINDOW);
|
||||
}
|
||||
|
||||
xpos = widget->allocation.x + paned->child1_size
|
||||
xpos = paned->child1_size
|
||||
+ GTK_CONTAINER(paned)->border_width + paned->gutter_size / 2;
|
||||
|
||||
gdk_draw_line (widget->window, paned->xor_gc,
|
||||
xpos,
|
||||
widget->allocation.y,
|
||||
0,
|
||||
xpos,
|
||||
widget->allocation.y + widget->allocation.height - 1);
|
||||
widget->allocation.height - 1);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -89,7 +89,7 @@ gtk_paned_class_init (GtkPanedClass *class)
|
||||
static void
|
||||
gtk_paned_init (GtkPaned *paned)
|
||||
{
|
||||
GTK_WIDGET_SET_FLAGS (paned, GTK_NO_WINDOW);
|
||||
GTK_WIDGET_UNSET_FLAGS (paned, GTK_NO_WINDOW);
|
||||
|
||||
paned->child1 = NULL;
|
||||
paned->child2 = NULL;
|
||||
@ -119,37 +119,44 @@ gtk_paned_realize (GtkWidget *widget)
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
|
||||
paned = GTK_PANED (widget);
|
||||
|
||||
attributes.x = widget->allocation.x;
|
||||
attributes.y = widget->allocation.y;
|
||||
attributes.width = widget->allocation.width;
|
||||
attributes.height = widget->allocation.height;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.event_mask = gtk_widget_get_events (widget) | GDK_EXPOSURE_MASK;
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (widget->window, paned);
|
||||
|
||||
attributes.x = paned->handle_xpos;
|
||||
attributes.y = paned->handle_ypos;
|
||||
attributes.width = paned->handle_size;
|
||||
attributes.height = paned->handle_size;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
attributes.cursor = paned->cursor = gdk_cursor_new (GDK_CROSS);
|
||||
attributes.event_mask = gtk_widget_get_events (widget);
|
||||
attributes.event_mask |= (GDK_EXPOSURE_MASK |
|
||||
GDK_BUTTON_PRESS_MASK |
|
||||
attributes.event_mask |= (GDK_BUTTON_PRESS_MASK |
|
||||
GDK_BUTTON_RELEASE_MASK |
|
||||
GDK_POINTER_MOTION_MASK |
|
||||
GDK_POINTER_MOTION_HINT_MASK);
|
||||
attributes_mask |= GDK_WA_CURSOR;
|
||||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP |
|
||||
GDK_WA_CURSOR;
|
||||
paned->handle = gdk_window_new (widget->window,
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (paned->handle, paned);
|
||||
|
||||
paned->handle = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes, attributes_mask);
|
||||
gdk_window_set_user_data (paned->handle, widget);
|
||||
gdk_window_show (paned->handle);
|
||||
gdk_window_raise (paned->handle);
|
||||
|
||||
widget->window = gtk_widget_get_parent_window (widget);
|
||||
gdk_window_ref (widget->window);
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
|
||||
gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
|
||||
gtk_style_set_background (widget->style, paned->handle, GTK_STATE_NORMAL);
|
||||
}
|
||||
|
||||
gdk_window_show (paned->handle);
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_paned_map (GtkWidget *widget)
|
||||
{
|
||||
@ -161,8 +168,7 @@ gtk_paned_map (GtkWidget *widget)
|
||||
GTK_WIDGET_SET_FLAGS (widget, GTK_MAPPED);
|
||||
paned = GTK_PANED (widget);
|
||||
|
||||
gdk_window_show (paned->handle);
|
||||
gtk_widget_queue_draw (widget);
|
||||
gdk_window_show (widget->window);
|
||||
|
||||
if (paned->child1 &&
|
||||
GTK_WIDGET_VISIBLE (paned->child1) &&
|
||||
@ -177,29 +183,12 @@ gtk_paned_map (GtkWidget *widget)
|
||||
static void
|
||||
gtk_paned_unmap (GtkWidget *widget)
|
||||
{
|
||||
GtkPaned *paned;
|
||||
|
||||
g_return_if_fail (widget != NULL);
|
||||
g_return_if_fail (GTK_IS_PANED (widget));
|
||||
|
||||
GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
|
||||
paned = GTK_PANED (widget);
|
||||
|
||||
gdk_window_clear_area (widget->window,
|
||||
widget->allocation.x,
|
||||
widget->allocation.y,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
gdk_window_hide (paned->handle);
|
||||
|
||||
if (paned->child1 &&
|
||||
GTK_WIDGET_VISIBLE (paned->child1) &&
|
||||
GTK_WIDGET_MAPPED (paned->child1))
|
||||
gtk_widget_unmap (paned->child1);
|
||||
if (paned->child2 &&
|
||||
GTK_WIDGET_VISIBLE (paned->child2) &&
|
||||
GTK_WIDGET_MAPPED (paned->child2))
|
||||
gtk_widget_unmap (paned->child2);
|
||||
gdk_window_hide (widget->window);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -140,7 +140,7 @@ gtk_vpaned_size_allocate (GtkWidget *widget,
|
||||
widget->allocation = *allocation;
|
||||
|
||||
paned = GTK_PANED (widget);
|
||||
border_width = GTK_CONTAINER (paned)->border_width;
|
||||
border_width = GTK_CONTAINER (widget)->border_width;
|
||||
|
||||
if (!paned->position_set)
|
||||
{
|
||||
@ -150,15 +150,18 @@ gtk_vpaned_size_allocate (GtkWidget *widget,
|
||||
paned->child1_size = 0;
|
||||
}
|
||||
|
||||
/* Move the handle first so we don't get extra expose events */
|
||||
/* Move the handle before the children so we don't get extra expose events */
|
||||
|
||||
paned->handle_xpos = allocation->x + allocation->width - border_width - 2 * paned->handle_size;
|
||||
paned->handle_ypos = allocation->y + paned->child1_size + border_width + paned->gutter_size / 2 - paned->handle_size / 2;
|
||||
paned->handle_xpos = allocation->width - border_width - 2 * paned->handle_size;
|
||||
paned->handle_ypos = paned->child1_size + border_width + paned->gutter_size / 2 - paned->handle_size / 2;
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
gdk_window_move_resize (widget->window,
|
||||
allocation->x, allocation->y,
|
||||
allocation->width, allocation->height);
|
||||
|
||||
gdk_window_move (paned->handle, paned->handle_xpos, paned->handle_ypos);
|
||||
gdk_window_raise (paned->handle);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_MAPPED (widget))
|
||||
@ -172,17 +175,17 @@ gtk_vpaned_size_allocate (GtkWidget *widget,
|
||||
|
||||
child1_allocation.width = child2_allocation.width = allocation->width - border_width * 2;
|
||||
child1_allocation.height = paned->child1_size;
|
||||
child1_allocation.x = child2_allocation.x = allocation->x + border_width;
|
||||
child1_allocation.y = allocation->y + border_width;
|
||||
child1_allocation.x = child2_allocation.x = border_width;
|
||||
child1_allocation.y = border_width;
|
||||
|
||||
paned->groove_rectangle.y = child1_allocation.y
|
||||
+ child1_allocation.height + paned->gutter_size / 2 - 1;
|
||||
paned->groove_rectangle.x = allocation->x;
|
||||
paned->groove_rectangle.x = 0;
|
||||
paned->groove_rectangle.height = 2;
|
||||
paned->groove_rectangle.width = allocation->width;
|
||||
|
||||
child2_allocation.y = paned->groove_rectangle.y + paned->gutter_size / 2 + 1;
|
||||
child2_allocation.height = allocation->y + allocation->height
|
||||
child2_allocation.height = allocation->height
|
||||
- child2_allocation.y - border_width;
|
||||
|
||||
/* Now allocate the childen, making sure, when resizing not to
|
||||
@ -229,16 +232,16 @@ gtk_vpaned_draw (GtkWidget *widget,
|
||||
|
||||
gdk_draw_line (widget->window,
|
||||
widget->style->dark_gc[widget->state],
|
||||
widget->allocation.x,
|
||||
widget->allocation.y + border_width + paned->child1_size + paned->gutter_size / 2 - 1,
|
||||
widget->allocation.x + widget->allocation.width - 1,
|
||||
widget->allocation.y + border_width + paned->child1_size + paned->gutter_size / 2 - 1);
|
||||
0,
|
||||
border_width + paned->child1_size + paned->gutter_size / 2 - 1,
|
||||
widget->allocation.width - 1,
|
||||
border_width + paned->child1_size + paned->gutter_size / 2 - 1);
|
||||
gdk_draw_line (widget->window,
|
||||
widget->style->light_gc[widget->state],
|
||||
widget->allocation.x,
|
||||
widget->allocation.y + border_width + paned->child1_size + paned->gutter_size / 2,
|
||||
widget->allocation.x + widget->allocation.width - 1,
|
||||
widget->allocation.y + border_width + paned->child1_size + paned->gutter_size / 2);
|
||||
0,
|
||||
border_width + paned->child1_size + paned->gutter_size / 2,
|
||||
widget->allocation.width - 1,
|
||||
border_width + paned->child1_size + paned->gutter_size / 2);
|
||||
}
|
||||
}
|
||||
|
||||
@ -263,13 +266,13 @@ gtk_vpaned_xor_line (GtkPaned *paned)
|
||||
GDK_GC_SUBWINDOW);
|
||||
}
|
||||
|
||||
ypos = widget->allocation.y + paned->child1_size
|
||||
ypos = paned->child1_size
|
||||
+ GTK_CONTAINER (paned)->border_width + paned->gutter_size / 2;
|
||||
|
||||
gdk_draw_line (widget->window, paned->xor_gc,
|
||||
widget->allocation.x,
|
||||
0,
|
||||
ypos,
|
||||
widget->allocation.x + widget->allocation.width - 1,
|
||||
widget->allocation.width - 1,
|
||||
ypos);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user