[gtk+/treeview-refactor] Move _gtk_tree_view_column_cell_focus to gtktreeview.c
- From: Kristian Rietveld <kristian src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/treeview-refactor] Move _gtk_tree_view_column_cell_focus to gtktreeview.c
- Date: Sun, 5 Dec 2010 14:23:25 +0000 (UTC)
commit 0a1982aff364a7e23a4c7b282dee980f7c3e9ff9
Author: Kristian Rietveld <kris gtk org>
Date: Sun Dec 5 15:18:13 2010 +0100
Move _gtk_tree_view_column_cell_focus to gtktreeview.c
gtk/gtktreeprivate.h | 4 ---
gtk/gtktreeview.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++-
gtk/gtktreeviewcolumn.c | 50 ------------------------------------------
3 files changed, 54 insertions(+), 55 deletions(-)
---
diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h
index 942a2a3..c0dacd5 100644
--- a/gtk/gtktreeprivate.h
+++ b/gtk/gtktreeprivate.h
@@ -139,10 +139,6 @@ void _gtk_tree_view_column_get_focus_area (GtkTreeViewColumn *tree_column,
const GdkRectangle *background_area,
const GdkRectangle *cell_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,
gboolean install_handler);
gboolean _gtk_tree_view_column_cell_get_dirty (GtkTreeViewColumn *tree_column);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 0a7bf5d..eacfa9b 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -10389,6 +10389,59 @@ cleanup:
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
gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
gint count)
@@ -10469,7 +10522,7 @@ gtk_tree_view_move_cursor_left_right (GtkTreeView *tree_view,
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;
found_column = TRUE;
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 63b10a6..f104d1c 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -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:
* @tree_column: A #GtkTreeViewColumn
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]