Changes to gtktreeview to better support thicker focus lines,

and enhancements to the visibility of the default expander when
its size has been increased.
This commit is contained in:
Bill Haneman
2002-01-28 20:19:42 +00:00
parent d8068f867c
commit 011cb31f18
10 changed files with 239 additions and 37 deletions

View File

@ -2131,6 +2131,7 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
{
GList *list;
gboolean first_cell = TRUE;
gint focus_line_width;
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
@ -2139,6 +2140,8 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
if (width)
* width = 0;
gtk_widget_style_get (tree_column->tree_view, "focus-line-width", &focus_line_width, NULL);
for (list = tree_column->cell_list; list; list = list->next)
{
GtkTreeViewColumnCellInfo *info = (GtkTreeViewColumnCellInfo *) list->data;
@ -2162,8 +2165,8 @@ gtk_tree_view_column_cell_get_size (GtkTreeViewColumn *tree_column,
&new_height);
if (height)
* height = MAX (*height, new_height);
info->requested_width = MAX (info->requested_width, new_width);
* height = MAX (*height, new_height + focus_line_width * 2);
info->requested_width = MAX (info->requested_width, new_width + focus_line_width * 2);
if (width)
* width += info->requested_width;
first_cell = TRUE;
@ -2190,6 +2193,7 @@ gtk_tree_view_column_cell_render_or_focus (GtkTreeViewColumn *tree_column,
gint full_requested_width = 0;
gint extra_space;
gint min_x, min_y, max_x, max_y;
gint focus_line_width;
min_x = G_MAXINT;
min_y = G_MAXINT;
@ -2198,6 +2202,8 @@ gtk_tree_view_column_cell_render_or_focus (GtkTreeViewColumn *tree_column,
real_cell_area = *cell_area;
gtk_widget_style_get (GTK_WIDGET (tree_column->tree_view),
"focus-line-width", &focus_line_width, NULL);
/* Find out how my extra space we have to allocate */
for (list = tree_column->cell_list; list; list = list->next)
{
@ -2227,6 +2233,7 @@ gtk_tree_view_column_cell_render_or_focus (GtkTreeViewColumn *tree_column,
real_cell_area.width = info->requested_width +
(info->expand?extra_space:0);
real_cell_area.x += focus_line_width;
if (render)
{
gtk_cell_renderer_render (info->cell,
@ -2284,17 +2291,17 @@ gtk_tree_view_column_cell_render_or_focus (GtkTreeViewColumn *tree_column,
if (min_x >= max_x || min_y >= max_y)
{
*focus_rectangle = *cell_area;
focus_rectangle->x -= 1;
focus_rectangle->y -= 1;
focus_rectangle->width += 2;
focus_rectangle->height += 2;
focus_rectangle->x -= focus_line_width;
focus_rectangle->y -= focus_line_width;
focus_rectangle->width += 2 * focus_line_width;
focus_rectangle->height += 2 * focus_line_width;
}
else
{
focus_rectangle->x = min_x - 1;
focus_rectangle->y = min_y - 1;
focus_rectangle->width = (max_x - min_x) + 2;
focus_rectangle->height = (max_y - min_y) + 2;
focus_rectangle->x = min_x - focus_line_width;
focus_rectangle->y = min_y - focus_line_width;
focus_rectangle->width = (max_x - min_x) + 2 * focus_line_width;
focus_rectangle->height = (max_y - min_y) + 2 * focus_line_width;
}
}
}
@ -2400,23 +2407,28 @@ gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn *tree_column,
GdkRectangle *expose_area,
guint flags)
{
gint focus_line_width;
GtkStateType cell_state;
g_return_if_fail (GTK_IS_TREE_VIEW_COLUMN (tree_column));
gtk_widget_style_get (GTK_WIDGET (tree_column->tree_view),
"focus-line-width", &focus_line_width, NULL);
if (tree_column->editable_widget)
{
/* This function is only called on the editable row when editing.
*/
#if 0
gtk_paint_focus (tree_column->tree_view->style,
window,
GTK_WIDGET_STATE (tree_column->tree_view),
NULL,
tree_column->tree_view,
"treeview",
cell_area->x - 1,
cell_area->y - 1,
cell_area->width + 2,
cell_area->height + 2);
cell_area->x - focus_line_width,
cell_area->y - focus_line_width,
cell_area->width + 2 * focus_line_width,
cell_area->height + 2 * focus_line_width);
#endif
}
else
{
@ -2429,10 +2441,13 @@ gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn *tree_column,
flags,
FALSE,
&focus_rectangle);
cell_state = flags & GTK_CELL_RENDERER_SELECTED ? GTK_STATE_SELECTED :
(flags & GTK_CELL_RENDERER_PRELIT ? GTK_STATE_PRELIGHT :
(flags & GTK_CELL_RENDERER_INSENSITIVE ? GTK_STATE_INSENSITIVE : GTK_STATE_NORMAL));
gtk_paint_focus (tree_column->tree_view->style,
window,
GTK_WIDGET_STATE (tree_column->tree_view),
cell_state,
NULL,
tree_column->tree_view,
"treeview",