forked from AuroraMiddleware/gtk
Welcome _gtk_tree_view_column_get_cell_at_pos to the second dimension
This commit is contained in:
parent
cbfc3f5bf0
commit
ff39c76bfd
@ -122,7 +122,9 @@ gboolean _gtk_tree_view_column_cell_event (GtkTreeViewColumn *tree_column,
|
|||||||
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_edited_cell (GtkTreeViewColumn *column);
|
GtkCellRenderer *_gtk_tree_view_column_get_edited_cell (GtkTreeViewColumn *column);
|
||||||
GtkCellRenderer *_gtk_tree_view_column_get_cell_at_pos (GtkTreeViewColumn *column,
|
GtkCellRenderer *_gtk_tree_view_column_get_cell_at_pos (GtkTreeViewColumn *column,
|
||||||
gint x);
|
GdkRectangle *cell_area,
|
||||||
|
gint x,
|
||||||
|
gint y);
|
||||||
|
|
||||||
void _gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
|
void _gtk_tree_view_column_cell_render (GtkTreeViewColumn *tree_column,
|
||||||
cairo_t *cr,
|
cairo_t *cr,
|
||||||
|
@ -3128,9 +3128,15 @@ gtk_tree_view_button_press (GtkWidget *widget,
|
|||||||
if ((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK)
|
if ((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK)
|
||||||
tree_view->priv->shift_pressed = TRUE;
|
tree_view->priv->shift_pressed = TRUE;
|
||||||
|
|
||||||
|
/* We update the focus cell here, this is also needed if the
|
||||||
/* This needs an x and a y ! */
|
* column does not contain an editable cell. In this case,
|
||||||
focus_cell = _gtk_tree_view_column_get_cell_at_pos (column, event->x - background_area.x);
|
* GtkCellArea did not receive the event for processing (and
|
||||||
|
* could not update the focus cell).
|
||||||
|
*/
|
||||||
|
focus_cell = _gtk_tree_view_column_get_cell_at_pos (column,
|
||||||
|
&cell_area,
|
||||||
|
event->x,
|
||||||
|
event->y);
|
||||||
|
|
||||||
if (focus_cell)
|
if (focus_cell)
|
||||||
gtk_tree_view_column_focus_cell (column, focus_cell);
|
gtk_tree_view_column_focus_cell (column, focus_cell);
|
||||||
|
@ -1472,34 +1472,19 @@ _gtk_tree_view_column_get_edited_cell (GtkTreeViewColumn *column)
|
|||||||
|
|
||||||
GtkCellRenderer *
|
GtkCellRenderer *
|
||||||
_gtk_tree_view_column_get_cell_at_pos (GtkTreeViewColumn *column,
|
_gtk_tree_view_column_get_cell_at_pos (GtkTreeViewColumn *column,
|
||||||
gint x)
|
GdkRectangle *cell_area,
|
||||||
|
gint x,
|
||||||
|
gint y)
|
||||||
{
|
{
|
||||||
GList *list;
|
|
||||||
GList *cell;
|
|
||||||
GtkCellRenderer *match = NULL;
|
GtkCellRenderer *match = NULL;
|
||||||
GtkTreeViewColumnPrivate *priv = column->priv;
|
GtkTreeViewColumnPrivate *priv = column->priv;
|
||||||
|
|
||||||
list = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
|
match = gtk_cell_area_get_cell_at_position (priv->cell_area,
|
||||||
for (cell = list; cell; cell = cell->next)
|
priv->cell_area_context,
|
||||||
{
|
priv->tree_view,
|
||||||
GdkRectangle zero_cell_area = { 0, };
|
cell_area,
|
||||||
GdkRectangle allocation;
|
x, y,
|
||||||
|
NULL);
|
||||||
gtk_cell_area_get_cell_allocation (priv->cell_area,
|
|
||||||
priv->cell_area_context,
|
|
||||||
priv->tree_view,
|
|
||||||
cell->data,
|
|
||||||
&zero_cell_area,
|
|
||||||
&allocation);
|
|
||||||
|
|
||||||
if (allocation.x <= x && x <= allocation.x + allocation.width)
|
|
||||||
{
|
|
||||||
match = cell->data;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_list_free (list);
|
|
||||||
|
|
||||||
return match;
|
return match;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user