mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
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:
parent
2b350816a8
commit
54db0fc9fd
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
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.
|
||||
|
||||
2002-04-14 Abigail Brady <morwen@evilmagic.org>
|
||||
|
||||
* gtk/gtkfilesel.c: Fix typo in message.
|
||||
|
@ -1,3 +1,18 @@
|
||||
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.
|
||||
|
||||
2002-04-14 Abigail Brady <morwen@evilmagic.org>
|
||||
|
||||
* gtk/gtkfilesel.c: Fix typo in message.
|
||||
|
@ -1,3 +1,18 @@
|
||||
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.
|
||||
|
||||
2002-04-14 Abigail Brady <morwen@evilmagic.org>
|
||||
|
||||
* gtk/gtkfilesel.c: Fix typo in message.
|
||||
|
@ -1,3 +1,18 @@
|
||||
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.
|
||||
|
||||
2002-04-14 Abigail Brady <morwen@evilmagic.org>
|
||||
|
||||
* gtk/gtkfilesel.c: Fix typo in message.
|
||||
|
@ -1,3 +1,18 @@
|
||||
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.
|
||||
|
||||
2002-04-14 Abigail Brady <morwen@evilmagic.org>
|
||||
|
||||
* gtk/gtkfilesel.c: Fix typo in message.
|
||||
|
@ -1,3 +1,18 @@
|
||||
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.
|
||||
|
||||
2002-04-14 Abigail Brady <morwen@evilmagic.org>
|
||||
|
||||
* gtk/gtkfilesel.c: Fix typo in message.
|
||||
|
@ -312,7 +312,8 @@ void _gtk_tree_view_column_start_editing (GtkTreeViewColumn *tree_column,
|
||||
GtkCellEditable *editable_widget);
|
||||
void _gtk_tree_view_column_stop_editing (GtkTreeViewColumn *tree_column);
|
||||
void _gtk_tree_view_install_mark_rows_col_dirty (GtkTreeView *tree_view);
|
||||
gboolean _gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column);
|
||||
gboolean _gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column);
|
||||
GtkCellRenderer *_gtk_tree_view_column_get_editable_cell (GtkTreeViewColumn *column);
|
||||
|
||||
GtkTreeSelection* _gtk_tree_selection_new (void);
|
||||
GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
|
||||
@ -335,6 +336,10 @@ void _gtk_tree_view_column_cell_draw_focus (GtkTreeViewColumn *tree_column,
|
||||
guint flags);
|
||||
void _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
|
||||
gboolean install_handler);
|
||||
void _gtk_tree_view_column_get_neighbor_sizes (GtkTreeViewColumn *column,
|
||||
GtkCellRenderer *cell,
|
||||
gint *left,
|
||||
gint *right);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -1794,6 +1794,14 @@ gtk_tree_view_button_press (GtkWidget *widget,
|
||||
tree_view->priv->cursor)
|
||||
{
|
||||
GtkTreePath *cursor = gtk_tree_row_reference_get_path (tree_view->priv->cursor);
|
||||
GtkTreeIter iter;
|
||||
|
||||
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
|
||||
gtk_tree_view_column_cell_set_cell_data (column,
|
||||
tree_view->priv->model,
|
||||
&iter,
|
||||
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT),
|
||||
node->children?TRUE:FALSE);
|
||||
|
||||
if ((cursor && !gtk_tree_path_compare (cursor, path))
|
||||
|| !_gtk_tree_view_column_has_editable_cell (column))
|
||||
@ -1802,14 +1810,6 @@ gtk_tree_view_button_press (GtkWidget *widget,
|
||||
|
||||
/* FIXME: get the right flags */
|
||||
guint flags = 0;
|
||||
GtkTreeIter iter;
|
||||
|
||||
gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
|
||||
gtk_tree_view_column_cell_set_cell_data (column,
|
||||
tree_view->priv->model,
|
||||
&iter,
|
||||
GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT),
|
||||
node->children?TRUE:FALSE);
|
||||
|
||||
path_string = gtk_tree_path_to_string (path);
|
||||
|
||||
@ -1822,11 +1822,20 @@ gtk_tree_view_button_press (GtkWidget *widget,
|
||||
{
|
||||
if (cell_editable != NULL)
|
||||
{
|
||||
gint left, right;
|
||||
GdkRectangle area;
|
||||
|
||||
area = cell_area;
|
||||
_gtk_tree_view_column_get_neighbor_sizes (column, _gtk_tree_view_column_get_editable_cell (column), &left, &right);
|
||||
|
||||
area.x += left;
|
||||
area.width -= right + left;
|
||||
|
||||
gtk_tree_view_real_start_editing (tree_view,
|
||||
column,
|
||||
path,
|
||||
cell_editable,
|
||||
&cell_area,
|
||||
&area,
|
||||
(GdkEvent *)event,
|
||||
flags);
|
||||
gtk_tree_path_free (path);
|
||||
@ -1840,6 +1849,7 @@ gtk_tree_view_button_press (GtkWidget *widget,
|
||||
if (cursor)
|
||||
gtk_tree_path_free (cursor);
|
||||
}
|
||||
|
||||
/* select */
|
||||
pre_val = tree_view->priv->vadjustment->value;
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user