add _gtk_tree_view_column_get_editable_cell and
Sun Apr 14 16:56:59 2002 Kristian Rietveld <kris@gtk.org> * gtk/gtktreeprivate.h: add _gtk_tree_view_column_get_editable_cell and _gtk_tree_view_column_get_neighbor_sizes * gtk/gtktreeviewcolumn.c (struct _GtkTreeViewColumnCellInfo): add real_width field, (_gtk_tree_view_column_get_editable_cell): implement, (gtk_tree_view_column_cell_process_action): fill info->real_width (_gtk_tree_view_column_get_neighbor_sizes): implement * gtk/gtktreeview.c (gtk_tree_view_button_press): make the "editable widget" show up with the same size as the actual cell, so it doesnt cover the complete column if there are any other cells in that column.
This commit is contained in:
committed by
Kristian Rietveld
parent
2b350816a8
commit
54db0fc9fd
@ -64,6 +64,7 @@ struct _GtkTreeViewColumnCellInfo
|
||||
gpointer func_data;
|
||||
GtkDestroyNotify destroy;
|
||||
gint requested_width;
|
||||
gint real_width;
|
||||
guint expand : 1;
|
||||
guint pack : 1;
|
||||
guint has_focus : 1;
|
||||
@ -1053,6 +1054,19 @@ _gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
GtkCellRenderer *
|
||||
_gtk_tree_view_column_get_editable_cell (GtkTreeViewColumn *column)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
for (list = column->cell_list; list; list = list ->next)
|
||||
if (((GtkTreeViewColumnCellInfo *)list->data)->cell->mode ==
|
||||
GTK_CELL_RENDERER_MODE_EDITABLE)
|
||||
return ((GtkTreeViewColumnCellInfo *)list->data)->cell;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Public Functions */
|
||||
|
||||
|
||||
@ -2349,6 +2363,7 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
|
||||
real_cell_area.width = info->requested_width +
|
||||
(info->expand?extra_space:0);
|
||||
info->real_width = real_cell_area.width;
|
||||
real_cell_area.x += focus_line_width;
|
||||
if (action == CELL_ACTION_RENDER)
|
||||
{
|
||||
@ -2447,6 +2462,7 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
|
||||
|
||||
real_cell_area.width = info->requested_width +
|
||||
(info->expand?extra_space:0);
|
||||
info->real_width = real_cell_area.width;
|
||||
if (action == CELL_ACTION_RENDER)
|
||||
{
|
||||
gtk_cell_renderer_render (info->cell,
|
||||
@ -2698,3 +2714,55 @@ _gtk_tree_view_column_stop_editing (GtkTreeViewColumn *tree_column)
|
||||
|
||||
tree_column->editable_widget = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *column,
|
||||
GtkCellRenderer *cell,
|
||||
gint *left,
|
||||
gint *right)
|
||||
{
|
||||
GList *list;
|
||||
|
||||
if (left)
|
||||
{
|
||||
*left = 0;
|
||||
|
||||
for (list = column->cell_list; list; list = list->next)
|
||||
{
|
||||
GtkTreeViewColumnCellInfo *info =
|
||||
(GtkTreeViewColumnCellInfo *)list->data;
|
||||
|
||||
if (info->cell == cell)
|
||||
break;
|
||||
|
||||
*left += info->real_width;
|
||||
}
|
||||
}
|
||||
|
||||
if (right)
|
||||
{
|
||||
*right = 0;
|
||||
|
||||
for (list = column->cell_list; list; list = list->next)
|
||||
{
|
||||
GtkTreeViewColumnCellInfo *info =
|
||||
(GtkTreeViewColumnCellInfo *)list->data;
|
||||
|
||||
if (info->cell == cell)
|
||||
break;
|
||||
}
|
||||
|
||||
/* skip cell */
|
||||
if (list && list->next)
|
||||
{
|
||||
list = list->next;
|
||||
for ( ; list; list = list->next)
|
||||
{
|
||||
GtkTreeViewColumnCellInfo *info =
|
||||
(GtkTreeViewColumnCellInfo *)list->data;
|
||||
|
||||
*right += info->real_width;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user