forked from AuroraMiddleware/gtk
Move _gtk_tree_view_column_cell_focus to gtktreeview.c
This commit is contained in:
parent
131783005e
commit
0a1982aff3
@ -139,10 +139,6 @@ void _gtk_tree_view_column_get_focus_area (GtkTreeViewColumn *tree_column,
|
|||||||
const GdkRectangle *background_area,
|
const GdkRectangle *background_area,
|
||||||
const GdkRectangle *cell_area,
|
const GdkRectangle *cell_area,
|
||||||
GdkRectangle *focus_area);
|
GdkRectangle *focus_area);
|
||||||
gboolean _gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
|
|
||||||
gint count,
|
|
||||||
gboolean left,
|
|
||||||
gboolean right);
|
|
||||||
void _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
|
void _gtk_tree_view_column_cell_set_dirty (GtkTreeViewColumn *tree_column,
|
||||||
gboolean install_handler);
|
gboolean install_handler);
|
||||||
gboolean _gtk_tree_view_column_cell_get_dirty (GtkTreeViewColumn *tree_column);
|
gboolean _gtk_tree_view_column_cell_get_dirty (GtkTreeViewColumn *tree_column);
|
||||||
|
@ -10389,6 +10389,59 @@ cleanup:
|
|||||||
gtk_tree_path_free (cursor_path);
|
gtk_tree_path_free (cursor_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gtk_tree_view_move_focus_column (GtkTreeView *tree_view,
|
||||||
|
GtkTreeViewColumn *tree_column,
|
||||||
|
gint count,
|
||||||
|
gboolean left,
|
||||||
|
gboolean right)
|
||||||
|
{
|
||||||
|
gboolean rtl;
|
||||||
|
GtkDirectionType direction = 0;
|
||||||
|
GtkCellArea *cell_area;
|
||||||
|
|
||||||
|
rtl = gtk_widget_get_direction (GTK_WIDGET (tree_view)) == GTK_TEXT_DIR_RTL;
|
||||||
|
|
||||||
|
switch (count)
|
||||||
|
{
|
||||||
|
case -1:
|
||||||
|
direction = GTK_DIR_LEFT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
direction = GTK_DIR_RIGHT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cell_area = gtk_cell_layout_get_area (GTK_CELL_LAYOUT (tree_column));
|
||||||
|
|
||||||
|
/* if we are the current focus column and have multiple editable cells,
|
||||||
|
* try to select the next one, else move the focus to the next column
|
||||||
|
*/
|
||||||
|
if (tree_view->priv->focus_column == tree_column)
|
||||||
|
{
|
||||||
|
if (gtk_cell_area_focus (cell_area, direction))
|
||||||
|
/* Focus stays in this column, so we are done */
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
/* FIXME: RTL support for the following: */
|
||||||
|
if (count == -1 && !left)
|
||||||
|
{
|
||||||
|
direction = GTK_DIR_RIGHT;
|
||||||
|
gtk_cell_area_focus (cell_area, direction);
|
||||||
|
}
|
||||||
|
else if (count == 1 && !right)
|
||||||
|
{
|
||||||
|
direction = GTK_DIR_LEFT;
|
||||||
|
gtk_cell_area_focus (cell_area, direction);
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gtk_cell_area_focus (cell_area, direction);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
|
gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
|
||||||
gint count)
|
gint count)
|
||||||
@ -10469,7 +10522,7 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
|
|||||||
right = list->next ? TRUE : FALSE;
|
right = list->next ? TRUE : FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (_gtk_tree_view_column_cell_focus (column, count, left, right))
|
if (gtk_tree_view_move_focus_column (tree_view, column, count, left, right))
|
||||||
{
|
{
|
||||||
tree_view->priv->focus_column = column;
|
tree_view->priv->focus_column = column;
|
||||||
found_column = TRUE;
|
found_column = TRUE;
|
||||||
|
@ -2831,56 +2831,6 @@ _gtk_tree_view_column_get_focus_area (GtkTreeViewColumn *tree_column,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gboolean
|
|
||||||
_gtk_tree_view_column_cell_focus (GtkTreeViewColumn *tree_column,
|
|
||||||
gint count,
|
|
||||||
gboolean left,
|
|
||||||
gboolean right)
|
|
||||||
{
|
|
||||||
gboolean rtl;
|
|
||||||
GtkDirectionType direction = 0;
|
|
||||||
GtkTreeViewColumnPrivate *priv = tree_column->priv;
|
|
||||||
|
|
||||||
rtl = gtk_widget_get_direction (priv->tree_view) == GTK_TEXT_DIR_RTL;
|
|
||||||
|
|
||||||
switch (count)
|
|
||||||
{
|
|
||||||
case -1:
|
|
||||||
direction = GTK_DIR_LEFT;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1:
|
|
||||||
direction = GTK_DIR_RIGHT;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we are the current focus column and have multiple editable cells,
|
|
||||||
* try to select the next one, else move the focus to the next column
|
|
||||||
*/
|
|
||||||
if (_gtk_tree_view_get_focus_column (GTK_TREE_VIEW (priv->tree_view)) == tree_column)
|
|
||||||
{
|
|
||||||
if (gtk_cell_area_focus (priv->cell_area, direction))
|
|
||||||
/* Focus stays in this column, so we are done */
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
/* FIXME: RTL support for the following: */
|
|
||||||
if (count == -1 && !left)
|
|
||||||
{
|
|
||||||
direction = GTK_DIR_RIGHT;
|
|
||||||
gtk_cell_area_focus (priv->cell_area, direction);
|
|
||||||
}
|
|
||||||
else if (count == 1 && !right)
|
|
||||||
{
|
|
||||||
direction = GTK_DIR_LEFT;
|
|
||||||
gtk_cell_area_focus (priv->cell_area, direction);
|
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return gtk_cell_area_focus (priv->cell_area, direction);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gtk_tree_view_column_cell_is_visible:
|
* gtk_tree_view_column_cell_is_visible:
|
||||||
* @tree_column: A #GtkTreeViewColumn
|
* @tree_column: A #GtkTreeViewColumn
|
||||||
|
Loading…
Reference in New Issue
Block a user