Commit f4ca3290 authored by Anders Carlsson's avatar Anders Carlsson Committed by Anders Carlsson

Add support for animating expanders.

2001-07-22  Anders Carlsson  <andersca@gnome.org>

	* gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the
	expander_height and expander_width properties with a single
	property, expander_size.
	(gtk_tree_view_init): Set the tab_offset to expander_size
	plus some padding.
	(gtk_tree_view_unrealize): Remove the expand/collapse
	timeout if it exists.
	(coords_are_over_arrow): Fix a small bug.
	(gtk_tree_view_motion_draw_column_motion_arrow): Use
	expander_size.
	(gtk_tree_view_draw_focus): Use "treeview" instead of
	"add-mode" as detail when drawing the focus.
	(gtk_tree_view_bin_expose): Use "treeview-drop-indicator"
	instead of "add-mode" as detail when drawing the focus.
	(gtk_tree_view_deleted): If we have a node currently being
	expanded or collapsed, remove the timeout and set the node
	to NULL.
	(gtk_tree_view_queue_draw_arrow): New function that just
	redraws the arrow of a node.
	(gtk_tree_view_draw_arrow): Use expander_size instead of
	expander_width/expander_height, also pass a different
	expander_style to gtk_paint_expander depending on the
	state of the node being drawn.
	(expand_collapse_timeout): New function for expanding
	or collapsing a node depending on the previous state.
	(gtk_tree_view_real_expand_row): Add timeout and set
	correct state for node being expanded.
	(gtk_tree_view_real_collapse_row): Add timeout and set
	correct state for node being collapsed.

	* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add
	information about the node currently being expanded or
	collapsed, and also a timeout id.

	* gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open
	with expander_style for draw_expander.

	* gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with
	expander_style.
	(create_expander_affine): New function for creating an
	expander affine.
	(apply_affine_on_point): New function for applying an
	affine to a point.
	(gtk_default_draw_expander): Modified to take expander_style
	instead of is_open, and to draw the rectangle rotated differently
	depending on the expander style.
	(gtk_paint_expander): Replace is_open with expander_style.

	* gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor.

	* gtk/gtkenums.h: Add expander style enum.
parent 5751ed9e
2001-07-22 Anders Carlsson <andersca@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the
expander_height and expander_width properties with a single
property, expander_size.
(gtk_tree_view_init): Set the tab_offset to expander_size
plus some padding.
(gtk_tree_view_unrealize): Remove the expand/collapse
timeout if it exists.
(coords_are_over_arrow): Fix a small bug.
(gtk_tree_view_motion_draw_column_motion_arrow): Use
expander_size.
(gtk_tree_view_draw_focus): Use "treeview" instead of
"add-mode" as detail when drawing the focus.
(gtk_tree_view_bin_expose): Use "treeview-drop-indicator"
instead of "add-mode" as detail when drawing the focus.
(gtk_tree_view_deleted): If we have a node currently being
expanded or collapsed, remove the timeout and set the node
to NULL.
(gtk_tree_view_queue_draw_arrow): New function that just
redraws the arrow of a node.
(gtk_tree_view_draw_arrow): Use expander_size instead of
expander_width/expander_height, also pass a different
expander_style to gtk_paint_expander depending on the
state of the node being drawn.
(expand_collapse_timeout): New function for expanding
or collapsing a node depending on the previous state.
(gtk_tree_view_real_expand_row): Add timeout and set
correct state for node being expanded.
(gtk_tree_view_real_collapse_row): Add timeout and set
correct state for node being collapsed.
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add
information about the node currently being expanded or
collapsed, and also a timeout id.
* gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open
with expander_style for draw_expander.
* gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with
expander_style.
(create_expander_affine): New function for creating an
expander affine.
(apply_affine_on_point): New function for applying an
affine to a point.
(gtk_default_draw_expander): Modified to take expander_style
instead of is_open, and to draw the rectangle rotated differently
depending on the expander style.
(gtk_paint_expander): Replace is_open with expander_style.
* gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor.
* gtk/gtkenums.h: Add expander style enum.
2001-07-21 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): Check the return
......
2001-07-22 Anders Carlsson <andersca@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the
expander_height and expander_width properties with a single
property, expander_size.
(gtk_tree_view_init): Set the tab_offset to expander_size
plus some padding.
(gtk_tree_view_unrealize): Remove the expand/collapse
timeout if it exists.
(coords_are_over_arrow): Fix a small bug.
(gtk_tree_view_motion_draw_column_motion_arrow): Use
expander_size.
(gtk_tree_view_draw_focus): Use "treeview" instead of
"add-mode" as detail when drawing the focus.
(gtk_tree_view_bin_expose): Use "treeview-drop-indicator"
instead of "add-mode" as detail when drawing the focus.
(gtk_tree_view_deleted): If we have a node currently being
expanded or collapsed, remove the timeout and set the node
to NULL.
(gtk_tree_view_queue_draw_arrow): New function that just
redraws the arrow of a node.
(gtk_tree_view_draw_arrow): Use expander_size instead of
expander_width/expander_height, also pass a different
expander_style to gtk_paint_expander depending on the
state of the node being drawn.
(expand_collapse_timeout): New function for expanding
or collapsing a node depending on the previous state.
(gtk_tree_view_real_expand_row): Add timeout and set
correct state for node being expanded.
(gtk_tree_view_real_collapse_row): Add timeout and set
correct state for node being collapsed.
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add
information about the node currently being expanded or
collapsed, and also a timeout id.
* gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open
with expander_style for draw_expander.
* gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with
expander_style.
(create_expander_affine): New function for creating an
expander affine.
(apply_affine_on_point): New function for applying an
affine to a point.
(gtk_default_draw_expander): Modified to take expander_style
instead of is_open, and to draw the rectangle rotated differently
depending on the expander style.
(gtk_paint_expander): Replace is_open with expander_style.
* gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor.
* gtk/gtkenums.h: Add expander style enum.
2001-07-21 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): Check the return
......
2001-07-22 Anders Carlsson <andersca@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the
expander_height and expander_width properties with a single
property, expander_size.
(gtk_tree_view_init): Set the tab_offset to expander_size
plus some padding.
(gtk_tree_view_unrealize): Remove the expand/collapse
timeout if it exists.
(coords_are_over_arrow): Fix a small bug.
(gtk_tree_view_motion_draw_column_motion_arrow): Use
expander_size.
(gtk_tree_view_draw_focus): Use "treeview" instead of
"add-mode" as detail when drawing the focus.
(gtk_tree_view_bin_expose): Use "treeview-drop-indicator"
instead of "add-mode" as detail when drawing the focus.
(gtk_tree_view_deleted): If we have a node currently being
expanded or collapsed, remove the timeout and set the node
to NULL.
(gtk_tree_view_queue_draw_arrow): New function that just
redraws the arrow of a node.
(gtk_tree_view_draw_arrow): Use expander_size instead of
expander_width/expander_height, also pass a different
expander_style to gtk_paint_expander depending on the
state of the node being drawn.
(expand_collapse_timeout): New function for expanding
or collapsing a node depending on the previous state.
(gtk_tree_view_real_expand_row): Add timeout and set
correct state for node being expanded.
(gtk_tree_view_real_collapse_row): Add timeout and set
correct state for node being collapsed.
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add
information about the node currently being expanded or
collapsed, and also a timeout id.
* gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open
with expander_style for draw_expander.
* gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with
expander_style.
(create_expander_affine): New function for creating an
expander affine.
(apply_affine_on_point): New function for applying an
affine to a point.
(gtk_default_draw_expander): Modified to take expander_style
instead of is_open, and to draw the rectangle rotated differently
depending on the expander style.
(gtk_paint_expander): Replace is_open with expander_style.
* gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor.
* gtk/gtkenums.h: Add expander style enum.
2001-07-21 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): Check the return
......
2001-07-22 Anders Carlsson <andersca@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the
expander_height and expander_width properties with a single
property, expander_size.
(gtk_tree_view_init): Set the tab_offset to expander_size
plus some padding.
(gtk_tree_view_unrealize): Remove the expand/collapse
timeout if it exists.
(coords_are_over_arrow): Fix a small bug.
(gtk_tree_view_motion_draw_column_motion_arrow): Use
expander_size.
(gtk_tree_view_draw_focus): Use "treeview" instead of
"add-mode" as detail when drawing the focus.
(gtk_tree_view_bin_expose): Use "treeview-drop-indicator"
instead of "add-mode" as detail when drawing the focus.
(gtk_tree_view_deleted): If we have a node currently being
expanded or collapsed, remove the timeout and set the node
to NULL.
(gtk_tree_view_queue_draw_arrow): New function that just
redraws the arrow of a node.
(gtk_tree_view_draw_arrow): Use expander_size instead of
expander_width/expander_height, also pass a different
expander_style to gtk_paint_expander depending on the
state of the node being drawn.
(expand_collapse_timeout): New function for expanding
or collapsing a node depending on the previous state.
(gtk_tree_view_real_expand_row): Add timeout and set
correct state for node being expanded.
(gtk_tree_view_real_collapse_row): Add timeout and set
correct state for node being collapsed.
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add
information about the node currently being expanded or
collapsed, and also a timeout id.
* gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open
with expander_style for draw_expander.
* gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with
expander_style.
(create_expander_affine): New function for creating an
expander affine.
(apply_affine_on_point): New function for applying an
affine to a point.
(gtk_default_draw_expander): Modified to take expander_style
instead of is_open, and to draw the rectangle rotated differently
depending on the expander style.
(gtk_paint_expander): Replace is_open with expander_style.
* gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor.
* gtk/gtkenums.h: Add expander style enum.
2001-07-21 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): Check the return
......
2001-07-22 Anders Carlsson <andersca@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the
expander_height and expander_width properties with a single
property, expander_size.
(gtk_tree_view_init): Set the tab_offset to expander_size
plus some padding.
(gtk_tree_view_unrealize): Remove the expand/collapse
timeout if it exists.
(coords_are_over_arrow): Fix a small bug.
(gtk_tree_view_motion_draw_column_motion_arrow): Use
expander_size.
(gtk_tree_view_draw_focus): Use "treeview" instead of
"add-mode" as detail when drawing the focus.
(gtk_tree_view_bin_expose): Use "treeview-drop-indicator"
instead of "add-mode" as detail when drawing the focus.
(gtk_tree_view_deleted): If we have a node currently being
expanded or collapsed, remove the timeout and set the node
to NULL.
(gtk_tree_view_queue_draw_arrow): New function that just
redraws the arrow of a node.
(gtk_tree_view_draw_arrow): Use expander_size instead of
expander_width/expander_height, also pass a different
expander_style to gtk_paint_expander depending on the
state of the node being drawn.
(expand_collapse_timeout): New function for expanding
or collapsing a node depending on the previous state.
(gtk_tree_view_real_expand_row): Add timeout and set
correct state for node being expanded.
(gtk_tree_view_real_collapse_row): Add timeout and set
correct state for node being collapsed.
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add
information about the node currently being expanded or
collapsed, and also a timeout id.
* gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open
with expander_style for draw_expander.
* gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with
expander_style.
(create_expander_affine): New function for creating an
expander affine.
(apply_affine_on_point): New function for applying an
affine to a point.
(gtk_default_draw_expander): Modified to take expander_style
instead of is_open, and to draw the rectangle rotated differently
depending on the expander style.
(gtk_paint_expander): Replace is_open with expander_style.
* gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor.
* gtk/gtkenums.h: Add expander style enum.
2001-07-21 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): Check the return
......
2001-07-22 Anders Carlsson <andersca@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the
expander_height and expander_width properties with a single
property, expander_size.
(gtk_tree_view_init): Set the tab_offset to expander_size
plus some padding.
(gtk_tree_view_unrealize): Remove the expand/collapse
timeout if it exists.
(coords_are_over_arrow): Fix a small bug.
(gtk_tree_view_motion_draw_column_motion_arrow): Use
expander_size.
(gtk_tree_view_draw_focus): Use "treeview" instead of
"add-mode" as detail when drawing the focus.
(gtk_tree_view_bin_expose): Use "treeview-drop-indicator"
instead of "add-mode" as detail when drawing the focus.
(gtk_tree_view_deleted): If we have a node currently being
expanded or collapsed, remove the timeout and set the node
to NULL.
(gtk_tree_view_queue_draw_arrow): New function that just
redraws the arrow of a node.
(gtk_tree_view_draw_arrow): Use expander_size instead of
expander_width/expander_height, also pass a different
expander_style to gtk_paint_expander depending on the
state of the node being drawn.
(expand_collapse_timeout): New function for expanding
or collapsing a node depending on the previous state.
(gtk_tree_view_real_expand_row): Add timeout and set
correct state for node being expanded.
(gtk_tree_view_real_collapse_row): Add timeout and set
correct state for node being collapsed.
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add
information about the node currently being expanded or
collapsed, and also a timeout id.
* gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open
with expander_style for draw_expander.
* gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with
expander_style.
(create_expander_affine): New function for creating an
expander affine.
(apply_affine_on_point): New function for applying an
affine to a point.
(gtk_default_draw_expander): Modified to take expander_style
instead of is_open, and to draw the rectangle rotated differently
depending on the expander style.
(gtk_paint_expander): Replace is_open with expander_style.
* gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor.
* gtk/gtkenums.h: Add expander style enum.
2001-07-21 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): Check the return
......
2001-07-22 Anders Carlsson <andersca@gnome.org>
* gtk/gtktreeview.c (gtk_tree_view_class_init): Replace the
expander_height and expander_width properties with a single
property, expander_size.
(gtk_tree_view_init): Set the tab_offset to expander_size
plus some padding.
(gtk_tree_view_unrealize): Remove the expand/collapse
timeout if it exists.
(coords_are_over_arrow): Fix a small bug.
(gtk_tree_view_motion_draw_column_motion_arrow): Use
expander_size.
(gtk_tree_view_draw_focus): Use "treeview" instead of
"add-mode" as detail when drawing the focus.
(gtk_tree_view_bin_expose): Use "treeview-drop-indicator"
instead of "add-mode" as detail when drawing the focus.
(gtk_tree_view_deleted): If we have a node currently being
expanded or collapsed, remove the timeout and set the node
to NULL.
(gtk_tree_view_queue_draw_arrow): New function that just
redraws the arrow of a node.
(gtk_tree_view_draw_arrow): Use expander_size instead of
expander_width/expander_height, also pass a different
expander_style to gtk_paint_expander depending on the
state of the node being drawn.
(expand_collapse_timeout): New function for expanding
or collapsing a node depending on the previous state.
(gtk_tree_view_real_expand_row): Add timeout and set
correct state for node being expanded.
(gtk_tree_view_real_collapse_row): Add timeout and set
correct state for node being collapsed.
* gtk/gtktreeprivate.h (struct _GtkTreeViewPrivate): Add
information about the node currently being expanded or
collapsed, and also a timeout id.
* gtk/gtkstyle.h (struct _GtkStyleClass): Replace is_open
with expander_style for draw_expander.
* gtk/gtkstyle.c (gtk_draw_expander): Replace is_open with
expander_style.
(create_expander_affine): New function for creating an
expander affine.
(apply_affine_on_point): New function for applying an
affine to a point.
(gtk_default_draw_expander): Modified to take expander_style
instead of is_open, and to draw the rectangle rotated differently
depending on the expander style.
(gtk_paint_expander): Replace is_open with expander_style.
* gtk/gtkrbtree.h: Add expander states to GtkRBNodeColor.
* gtk/gtkenums.h: Add expander style enum.
2001-07-21 Jonas Borgstrm <jonas@codefactory.se>
* gtk/gtktreemodel.c (gtk_tree_model_foreach): Check the return
......
......@@ -115,6 +115,15 @@ typedef enum
GTK_DIR_RIGHT
} GtkDirectionType;
/* Expander styles */
typedef enum
{
GTK_EXPANDER_COLLAPSED,
GTK_EXPANDER_SEMI_COLLAPSED,
GTK_EXPANDER_SEMI_EXPANDED,
GTK_EXPANDER_EXPANDED
} GtkExpanderStyle;
/* Built-in stock icon sizes */
typedef enum
{
......
......@@ -32,7 +32,9 @@ typedef enum
GTK_RBNODE_IS_PARENT = 1 << 2,
GTK_RBNODE_IS_SELECTED = 1 << 3,
GTK_RBNODE_IS_PRELIT = 1 << 4,
GTK_RBNODE_NON_COLORS = GTK_RBNODE_IS_PARENT | GTK_RBNODE_IS_SELECTED | GTK_RBNODE_IS_PRELIT,
GTK_RBNODE_IS_SEMI_COLLAPSED = 1 << 5,
GTK_RBNODE_IS_SEMI_EXPANDED = 1 << 6,
GTK_RBNODE_NON_COLORS = GTK_RBNODE_IS_PARENT | GTK_RBNODE_IS_SELECTED | GTK_RBNODE_IS_PRELIT | GTK_RBNODE_IS_SEMI_COLLAPSED | GTK_RBNODE_IS_SEMI_EXPANDED
} GtkRBNodeColor;
typedef struct _GtkRBTree GtkRBTree;
......
......@@ -278,7 +278,7 @@ static void gtk_default_draw_expander (GtkStyle *style,
const gchar *detail,
gint x,
gint y,
gboolean is_open);
GtkExpanderStyle expander_style);
static void gtk_default_draw_layout (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
......@@ -1103,14 +1103,14 @@ gtk_draw_expander (GtkStyle *style,
GtkStateType state_type,
gint x,
gint y,
gboolean is_open)
GtkExpanderStyle expander_style)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_expander != NULL);
GTK_STYLE_GET_CLASS (style)->draw_expander (style, window, state_type,
NULL, NULL, NULL,
x, y, is_open);
x, y, expander_style);
}
void
......@@ -3804,7 +3804,7 @@ gtk_default_draw_focus (GtkStyle *style,
GdkPoint points[5];
sanitize_size (window, &width, &height);
if (area)
gdk_gc_set_clip_rectangle (style->black_gc, area);
......@@ -3991,6 +3991,43 @@ gtk_default_draw_handle (GtkStyle *style,
gdk_gc_set_clip_rectangle (dark_gc, NULL);
}
static void
create_expander_affine (gdouble affine[6],
gint degrees,
gint expander_size,
gint x,
gint y)
{
gdouble s, c;
gdouble width;
gdouble height;
width = expander_size / 4;
height = expander_size / 2;
s = sin (degrees * M_PI / 180.0);
c = cos (degrees * M_PI / 180.0);
affine[0] = c;
affine[1] = s;
affine[2] = -s;
affine[3] = c;
affine[4] = -width * c - height * -s + x;
affine[5] = -width * s - height * c + y;
}
static void
apply_affine_on_point (double affine[6], GdkPoint *point)
{
gdouble x, y;
x = point->x * affine[0] + point->y * affine[2] + affine[4];
y = point->x * affine[1] + point->y * affine[3] + affine[5];
point->x = x;
point->y = y;
}
static void
gtk_default_draw_expander (GtkStyle *style,
GdkWindow *window,
......@@ -4000,12 +4037,17 @@ gtk_default_draw_expander (GtkStyle *style,
const gchar *detail,
gint x,
gint y,
gboolean is_open)
GtkExpanderStyle expander_style)
{
/* FIXME replace macro with a style property */
#define PM_SIZE 8
gint expander_size;
GdkPoint points[3];
gint i;
gdouble affine[6];
gint degrees = 0;
gtk_widget_style_get (widget,
"expander_size", &expander_size,
NULL);
if (area)
{
......@@ -4013,38 +4055,46 @@ gtk_default_draw_expander (GtkStyle *style,
gdk_gc_set_clip_rectangle (style->base_gc[GTK_STATE_NORMAL], area);
}
if (is_open)
{
points[0].x = x;
points[0].y = y + (PM_SIZE + 2) / 6;
points[1].x = points[0].x + 1 * (PM_SIZE + 2);
points[1].y = points[0].y;
points[2].x = (points[0].x + 1 * (PM_SIZE + 2) / 2);
points[2].y = y + 2 * (PM_SIZE + 2) / 3;
}
else
points[0].x = 0;
points[0].y = 0;
points[1].x = expander_size / 2;
points[1].y = expander_size / 2;
points[2].x = 0;
points[2].y = expander_size;
switch (expander_style)
{
points[0].x = x + 1 * ((PM_SIZE + 2) / 6 + 2);
points[0].y = y - 1;
points[1].x = points[0].x;
points[1].y = points[0].y + (PM_SIZE + 2);
points[2].x = (points[0].x + 1 * (2 * (PM_SIZE + 2) / 3 - 1));
points[2].y = points[0].y + (PM_SIZE + 2) / 2;
case GTK_EXPANDER_COLLAPSED:
degrees = 0;
break;
case GTK_EXPANDER_SEMI_COLLAPSED:
degrees = 30;
break;
case GTK_EXPANDER_SEMI_EXPANDED:
degrees = 60;
break;
case GTK_EXPANDER_EXPANDED:
degrees = 90;
break;
default:
g_assert_not_reached ();
}
create_expander_affine (affine, degrees, expander_size, x, y);
for (i = 0; i < 3; i++)
apply_affine_on_point (affine, &points[i]);
gdk_draw_polygon (window, style->base_gc[GTK_STATE_NORMAL],
TRUE, points, 3);
TRUE, points, 3);
gdk_draw_polygon (window, style->fg_gc[GTK_STATE_NORMAL],
FALSE, points, 3);
if (area)
{
gdk_gc_set_clip_rectangle (style->fg_gc[GTK_STATE_NORMAL], NULL);
gdk_gc_set_clip_rectangle (style->base_gc[GTK_STATE_NORMAL], NULL);
}
#undef PM_SIZE
}
typedef struct _ByteRange ByteRange;
......@@ -4866,13 +4916,13 @@ gtk_paint_expander (GtkStyle *style,
const gchar *detail,
gint x,
gint y,
gboolean is_open)
GtkExpanderStyle expander_style)
{
g_return_if_fail (GTK_IS_STYLE (style));
g_return_if_fail (GTK_STYLE_GET_CLASS (style)->draw_expander != NULL);
GTK_STYLE_GET_CLASS (style)->draw_expander (style, window, state_type, area,
widget, detail, x, y, is_open);
widget, detail, x, y, expander_style);
}
void
......
......@@ -379,7 +379,7 @@ struct _GtkStyleClass
const gchar *detail,
gint x,
gint y,
gboolean is_open);
GtkExpanderStyle expander_style);
void (*draw_layout) (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
......@@ -587,7 +587,7 @@ void gtk_draw_expander (GtkStyle *style,
GtkStateType state_type,
gint x,
gint y,
gboolean is_open);
GtkExpanderStyle expander_style);
void gtk_draw_layout (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
......@@ -804,7 +804,7 @@ void gtk_paint_expander (GtkStyle *style,
const gchar *detail,
gint x,
gint y,
gboolean is_open);
GtkExpanderStyle expander_style);
void gtk_paint_layout (GtkStyle *style,
GdkWindow *window,
GtkStateType state_type,
......
......@@ -121,6 +121,11 @@ struct _GtkTreeViewPrivate
GtkRBNode *prelight_node;
GtkRBTree *prelight_tree;
/* The node that's currently being collapsed or expanded */
GtkRBNode *expanded_collapsed_node;
GtkRBTree *expanded_collapsed_tree;
guint expand_collapse_timeout;
/* Selection information */
GtkTreeSelection *selection;
......
......@@ -47,7 +47,7 @@
#define SCROLL_EDGE_SIZE 15
#define EXPANDER_EXTRA_PADDING 4
/* The "background" areas of all rows/cells add up to cover the entire tree.
* The background includes all inter-row and inter-cell spacing.
......@@ -276,6 +276,10 @@ static void gtk_tree_view_queue_draw_node (GtkTreeView *tree_view,
static void gtk_tree_view_queue_draw_path (GtkTreeView *tree_view,
GtkTreePath *path,
GdkRectangle *clip_rect);
static void gtk_tree_view_queue_draw_arrow (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
GdkRectangle *clip_rect);
static void gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
GtkRBTree *tree,
GtkRBNode *node,
......@@ -513,30 +517,20 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
/* Style properties */
/* the width of the column resize windows */
#define _TREE_VIEW_EXPANDER_WIDTH 14
#define _TREE_VIEW_EXPANDER_HEIGHT 14
#define _TREE_VIEW_EXPANDER_SIZE 10
#define _TREE_VIEW_VERTICAL_SEPARATOR 2
#define _TREE_VIEW_HORIZONTAL_SEPARATOR 0
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("expander_width",
_("Expander Width"),
_("Width of the expander arrow"),
g_param_spec_int ("expander_size",
_("Expander Size"),
_("Size of the expander arrow"),
0,
G_MAXINT,
_TREE_VIEW_EXPANDER_WIDTH,
_TREE_VIEW_EXPANDER_SIZE,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("expander_height",
_("Expander Height"),
_("Height of the expander arrow"),
4,
G_MAXINT,
_TREE_VIEW_EXPANDER_HEIGHT,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("vertical_separator",
_("Vertical Separator Width"),
_("Vertical space between cells"),
......@@ -544,8 +538,8 @@ gtk_tree_view_class_init (GtkTreeViewClass *class)
G_MAXINT,
_TREE_VIEW_VERTICAL_SEPARATOR,
G_PARAM_READABLE));
gtk_widget_class_install_style_property (widget_class,
gtk_widget_class_install_style_property (widget_class,
g_param_spec_int ("horizontal_separator",
_("Horizontal Separator Width"),
_("Horizontal space between cells"),
......@@ -822,7 +816,11 @@ gtk_tree_view_init (GtkTreeView *tree_view)
GTK_WIDGET_SET_FLAGS (tree_view, GTK_CAN_FOCUS);
tree_view->priv->flags = GTK_TREE_VIEW_IS_LIST | GTK_TREE_VIEW_SHOW_EXPANDERS | GTK_TREE_VIEW_DRAW_KEYFOCUS | GTK_TREE_VIEW_HEADERS_VISIBLE;
gtk_widget_style_get (GTK_WIDGET (tree_view), "expander_width", &tree_view->priv->tab_offset, NULL);
gtk_widget_style_get (GTK_WIDGET (tree_view), "expander_size", &tree_view->priv->tab_offset, NULL);
/* We need some padding */
tree_view->priv->tab_offset += EXPANDER_EXTRA_PADDING;
tree_view->priv->n_columns = 0;
tree_view->priv->header_height = 1;
tree_view->priv->x_drag = 0;
......@@ -1219,6 +1217,12 @@ gtk_tree_view_unrealize (GtkWidget *widget)
tree_view->priv->open_dest_timeout = 0;
}
if (tree_view->priv->expand_collapse_timeout != 0)
{
gtk_timeout_remove (tree_view->priv->expand_collapse_timeout);
tree_view->priv->expand_collapse_timeout = 0;
}
for (list = tree_view->priv->columns; list; list = list->next)
_gtk_tree_view_column_unrealize_button (GTK_TREE_VIEW_COLUMN (list->data));
......@@ -1570,7 +1574,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
}
gtk_tree_view_real_set_cursor (tree_view, path, TRUE);
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
{
if (GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT))
......@@ -1784,7 +1788,7 @@ coords_are_over_arrow (GtkTreeView *tree_view,
arrow.width = x2 - arrow.x;
return (x >= arrow.x &&
x < (arrow.x + arrow.height) &&
x < (arrow.x + arrow.width) &&
y >= arrow.y &&
y < (arrow.