Thu Apr 25 23:49:01 2002  Kristian Rietveld  <kris@gtk.org>

        Fixes #74206.

        * gtk/gtktreeprivate.h: add _gtk_tree_view_column_count_special_cells

        * gtk/gtktreeview.c (_gtk_tree_view_column_has_editable_cell),
        (_gtk_tree_view_column_get_editable_cell): remove a space which made
        the code look ugly
        (_gtk_tree_view_column_count_special_cells): new function,
        (gtk_tree_view_column_cell_process_action): if there's only one
        activatable cell, the whole column will activate that renderer.
This commit is contained in:
Kristian Rietveld 2002-04-25 21:44:33 +00:00 committed by Kristian Rietveld
parent f5510b6468
commit b4ddb130c7
8 changed files with 110 additions and 3 deletions

View File

@ -1,3 +1,16 @@
Thu Apr 25 23:49:01 2002 Kristian Rietveld <kris@gtk.org>
Fixes #74206.
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_count_special_cells
* gtk/gtktreeview.c (_gtk_tree_view_column_has_editable_cell),
(_gtk_tree_view_column_get_editable_cell): remove a space which made
the code look ugly
(_gtk_tree_view_column_count_special_cells): new function,
(gtk_tree_view_column_cell_process_action): if there's only one
activatable cell, the whole column will activate that renderer.
Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org> Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search * gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search

View File

@ -1,3 +1,16 @@
Thu Apr 25 23:49:01 2002 Kristian Rietveld <kris@gtk.org>
Fixes #74206.
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_count_special_cells
* gtk/gtktreeview.c (_gtk_tree_view_column_has_editable_cell),
(_gtk_tree_view_column_get_editable_cell): remove a space which made
the code look ugly
(_gtk_tree_view_column_count_special_cells): new function,
(gtk_tree_view_column_cell_process_action): if there's only one
activatable cell, the whole column will activate that renderer.
Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org> Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search * gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search

View File

@ -1,3 +1,16 @@
Thu Apr 25 23:49:01 2002 Kristian Rietveld <kris@gtk.org>
Fixes #74206.
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_count_special_cells
* gtk/gtktreeview.c (_gtk_tree_view_column_has_editable_cell),
(_gtk_tree_view_column_get_editable_cell): remove a space which made
the code look ugly
(_gtk_tree_view_column_count_special_cells): new function,
(gtk_tree_view_column_cell_process_action): if there's only one
activatable cell, the whole column will activate that renderer.
Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org> Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search * gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search

View File

@ -1,3 +1,16 @@
Thu Apr 25 23:49:01 2002 Kristian Rietveld <kris@gtk.org>
Fixes #74206.
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_count_special_cells
* gtk/gtktreeview.c (_gtk_tree_view_column_has_editable_cell),
(_gtk_tree_view_column_get_editable_cell): remove a space which made
the code look ugly
(_gtk_tree_view_column_count_special_cells): new function,
(gtk_tree_view_column_cell_process_action): if there's only one
activatable cell, the whole column will activate that renderer.
Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org> Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search * gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search

View File

@ -1,3 +1,16 @@
Thu Apr 25 23:49:01 2002 Kristian Rietveld <kris@gtk.org>
Fixes #74206.
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_count_special_cells
* gtk/gtktreeview.c (_gtk_tree_view_column_has_editable_cell),
(_gtk_tree_view_column_get_editable_cell): remove a space which made
the code look ugly
(_gtk_tree_view_column_count_special_cells): new function,
(gtk_tree_view_column_cell_process_action): if there's only one
activatable cell, the whole column will activate that renderer.
Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org> Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search * gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search

View File

@ -1,3 +1,16 @@
Thu Apr 25 23:49:01 2002 Kristian Rietveld <kris@gtk.org>
Fixes #74206.
* gtk/gtktreeprivate.h: add _gtk_tree_view_column_count_special_cells
* gtk/gtktreeview.c (_gtk_tree_view_column_has_editable_cell),
(_gtk_tree_view_column_get_editable_cell): remove a space which made
the code look ugly
(_gtk_tree_view_column_count_special_cells): new function,
(gtk_tree_view_column_cell_process_action): if there's only one
activatable cell, the whole column will activate that renderer.
Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org> Thu Apr 25 23:36:55 2002 Kristian Rietveld <kris@gtk.org>
* gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search * gtk/gtktreeview.c (gtk_tree_view_search_iter): make the search

View File

@ -317,6 +317,7 @@ void _gtk_tree_view_column_autosize (GtkTreeView *tre
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); GtkCellRenderer *_gtk_tree_view_column_get_editable_cell (GtkTreeViewColumn *column);
gint _gtk_tree_view_column_count_special_cells (GtkTreeViewColumn *column);
GtkTreeSelection* _gtk_tree_selection_new (void); GtkTreeSelection* _gtk_tree_selection_new (void);
GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view); GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);

View File

@ -1046,7 +1046,7 @@ _gtk_tree_view_column_has_editable_cell (GtkTreeViewColumn *column)
{ {
GList *list; GList *list;
for (list = column->cell_list; list; list = list ->next) for (list = column->cell_list; list; list = list->next)
if (((GtkTreeViewColumnCellInfo *)list->data)->cell->mode == if (((GtkTreeViewColumnCellInfo *)list->data)->cell->mode ==
GTK_CELL_RENDERER_MODE_EDITABLE) GTK_CELL_RENDERER_MODE_EDITABLE)
return TRUE; return TRUE;
@ -1059,7 +1059,7 @@ _gtk_tree_view_column_get_editable_cell (GtkTreeViewColumn *column)
{ {
GList *list; GList *list;
for (list = column->cell_list; list; list = list ->next) for (list = column->cell_list; list; list = list->next)
if (((GtkTreeViewColumnCellInfo *)list->data)->cell->mode == if (((GtkTreeViewColumnCellInfo *)list->data)->cell->mode ==
GTK_CELL_RENDERER_MODE_EDITABLE) GTK_CELL_RENDERER_MODE_EDITABLE)
return ((GtkTreeViewColumnCellInfo *)list->data)->cell; return ((GtkTreeViewColumnCellInfo *)list->data)->cell;
@ -1067,6 +1067,24 @@ _gtk_tree_view_column_get_editable_cell (GtkTreeViewColumn *column)
return NULL; return NULL;
} }
gint
_gtk_tree_view_column_count_special_cells (GtkTreeViewColumn *column)
{
gint i = 0;
GList *list;
for (list = column->cell_list; list; list = list->next)
{
GtkTreeViewColumnCellInfo *cellinfo = list->data;
if (cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_EDITABLE ||
cellinfo->cell->mode == GTK_CELL_RENDERER_MODE_ACTIVATABLE)
i++;
}
return i;
}
/* Public Functions */ /* Public Functions */
@ -2418,8 +2436,18 @@ gtk_tree_view_column_cell_process_action (GtkTreeViewColumn *tree_column,
if (event) if (event)
{ {
if (real_cell_area.x <= ((GdkEventButton *)event)->x && if (_gtk_tree_view_column_count_special_cells (tree_column) == 1)
{
/* only 1 activatably cell -> whole column can activate */
if (cell_area->x <= ((GdkEventButton *)event)->x &&
cell_area->x + cell_area->width > ((GdkEventButton *)event)->x)
try_event = TRUE;
}
else if (real_cell_area.x <= ((GdkEventButton *)event)->x &&
real_cell_area.x + real_cell_area.width > ((GdkEventButton *)event)->x) real_cell_area.x + real_cell_area.width > ((GdkEventButton *)event)->x)
/* only activate cell if the user clicked on an individual
* cell
*/
try_event = TRUE; try_event = TRUE;
} }
else /* if (info->has_focus)*/ else /* if (info->has_focus)*/