Changed cell area/renderer "can_focus" semantics to "is_activatable" across the board.

This is because focus in treeviews can be given to cells that cannot do anything
with activation (for better keynav), so we dissociate the concept of cell
activation and focusing.
This commit is contained in:
Tristan Van Berkom 2010-11-29 16:29:09 +09:00
parent dbe026ed1e
commit 626f27f7ed
6 changed files with 28 additions and 28 deletions

View File

@ -356,7 +356,7 @@ static void gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea
gint height, gint height,
gint *minimum_width, gint *minimum_width,
gint *natural_width); gint *natural_width);
static gboolean gtk_cell_area_real_can_focus (GtkCellArea *area); static gboolean gtk_cell_area_real_is_activatable (GtkCellArea *area);
static gboolean gtk_cell_area_real_activate (GtkCellArea *area, static gboolean gtk_cell_area_real_activate (GtkCellArea *area,
GtkCellAreaContext *context, GtkCellAreaContext *context,
GtkWidget *widget, GtkWidget *widget,
@ -553,9 +553,9 @@ gtk_cell_area_class_init (GtkCellAreaClass *class)
class->get_preferred_width_for_height = gtk_cell_area_real_get_preferred_width_for_height; class->get_preferred_width_for_height = gtk_cell_area_real_get_preferred_width_for_height;
/* focus */ /* focus */
class->can_focus = gtk_cell_area_real_can_focus; class->is_activatable = gtk_cell_area_real_is_activatable;
class->focus = NULL; class->activate = gtk_cell_area_real_activate;
class->activate = gtk_cell_area_real_activate; class->focus = NULL;
/* Signals */ /* Signals */
/** /**
@ -990,18 +990,18 @@ gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea *area,
} }
static void static void
get_can_focus (GtkCellRenderer *renderer, get_is_activatable (GtkCellRenderer *renderer,
gboolean *can_focus) gboolean *activatable)
{ {
if (gtk_cell_renderer_can_focus (renderer)) if (gtk_cell_renderer_is_activatable (renderer))
*can_focus = TRUE; *activatable = TRUE;
} }
static gboolean static gboolean
gtk_cell_area_real_can_focus (GtkCellArea *area) gtk_cell_area_real_is_activatable (GtkCellArea *area)
{ {
gboolean can_focus = FALSE; gboolean activatable = FALSE;
/* Checks if any renderer can focus for the currently applied /* Checks if any renderer can focus for the currently applied
* attributes. * attributes.
@ -1009,9 +1009,9 @@ gtk_cell_area_real_can_focus (GtkCellArea *area)
* Subclasses can override this in the case that they are also * Subclasses can override this in the case that they are also
* rendering widgets as well as renderers. * rendering widgets as well as renderers.
*/ */
gtk_cell_area_forall (area, (GtkCellCallback)get_can_focus, &can_focus); gtk_cell_area_forall (area, (GtkCellCallback)get_is_activatable, &activatable);
return can_focus; return activatable;
} }
static gboolean static gboolean
@ -2326,20 +2326,20 @@ gtk_cell_area_cell_get_property (GtkCellArea *area,
*************************************************************/ *************************************************************/
/** /**
* gtk_cell_area_can_focus: * gtk_cell_area_is_activatable:
* @area: a #GtkCellArea * @area: a #GtkCellArea
* *
* Returns whether the area can receive keyboard focus, * Returns whether the area can do anything when activated,
* after applying new attributes to @area. * after applying new attributes to @area.
* *
* Returns: whether @area can receive focus. * Returns: whether @area can do anything when activated.
*/ */
gboolean gboolean
gtk_cell_area_can_focus (GtkCellArea *area) gtk_cell_area_is_activatable (GtkCellArea *area)
{ {
g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE); g_return_val_if_fail (GTK_IS_CELL_AREA (area), FALSE);
return GTK_CELL_AREA_GET_CLASS (area)->can_focus (area); return GTK_CELL_AREA_GET_CLASS (area)->is_activatable (area);
} }
/** /**

View File

@ -144,7 +144,7 @@ struct _GtkCellAreaClass
GParamSpec *pspec); GParamSpec *pspec);
/* Focus */ /* Focus */
gboolean (* can_focus) (GtkCellArea *area); gboolean (* is_activatable) (GtkCellArea *area);
gboolean (* focus) (GtkCellArea *area, gboolean (* focus) (GtkCellArea *area,
GtkDirectionType direction); GtkDirectionType direction);
gboolean (* activate) (GtkCellArea *area, gboolean (* activate) (GtkCellArea *area,
@ -285,14 +285,14 @@ void gtk_cell_area_cell_get_property (GtkCellArea
/* Focus */ /* Focus */
gboolean gtk_cell_area_can_focus (GtkCellArea *area); gboolean gtk_cell_area_is_activatable (GtkCellArea *area);
gboolean gtk_cell_area_focus (GtkCellArea *area,
GtkDirectionType direction);
gboolean gtk_cell_area_activate (GtkCellArea *area, gboolean gtk_cell_area_activate (GtkCellArea *area,
GtkCellAreaContext *context, GtkCellAreaContext *context,
GtkWidget *widget, GtkWidget *widget,
const GdkRectangle *cell_area, const GdkRectangle *cell_area,
GtkCellRendererState flags); GtkCellRendererState flags);
gboolean gtk_cell_area_focus (GtkCellArea *area,
GtkDirectionType direction);
void gtk_cell_area_set_focus_cell (GtkCellArea *area, void gtk_cell_area_set_focus_cell (GtkCellArea *area,
GtkCellRenderer *renderer); GtkCellRenderer *renderer);
GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area); GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area);

View File

@ -1138,7 +1138,7 @@ gtk_cell_area_box_render (GtkCellArea *area,
/* If no cell can activate but the caller wants focus painted, /* If no cell can activate but the caller wants focus painted,
* then we paint focus around all cells */ * then we paint focus around all cells */
if (paint_focus && !gtk_cell_area_can_focus (area)) if (paint_focus && !gtk_cell_area_is_activatable (area))
focus_all = TRUE; focus_all = TRUE;
} }

View File

@ -1104,17 +1104,17 @@ gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
/** /**
* gtk_cell_renderer_can_focus: * gtk_cell_renderer_is_activatable:
* @cell: A #GtkCellRenderer * @cell: A #GtkCellRenderer
* *
* Checks whether the cell renderer can receive focus. * Checks whether the cell renderer can do something when activated.
* *
* Returns: %TRUE if the cell renderer can do anything with keyboard focus * Returns: %TRUE if the cell renderer can do anything when activated.
* *
* Since: 3.0 * Since: 3.0
*/ */
gboolean gboolean
gtk_cell_renderer_can_focus (GtkCellRenderer *cell) gtk_cell_renderer_is_activatable (GtkCellRenderer *cell)
{ {
GtkCellRendererPrivate *priv; GtkCellRendererPrivate *priv;

View File

@ -247,7 +247,7 @@ void gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
gboolean sensitive); gboolean sensitive);
gboolean gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell); gboolean gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell);
gboolean gtk_cell_renderer_can_focus (GtkCellRenderer *cell); gboolean gtk_cell_renderer_is_activatable (GtkCellRenderer *cell);
/* For use by cell renderer implementations only */ /* For use by cell renderer implementations only */
void gtk_cell_renderer_stop_editing (GtkCellRenderer *cell, void gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,

View File

@ -7804,7 +7804,7 @@ gtk_tree_view_has_can_focus_cell (GtkTreeView *tree_view)
if (!gtk_tree_view_column_get_visible (column)) if (!gtk_tree_view_column_get_visible (column))
continue; continue;
if (gtk_cell_area_can_focus (column->cell_area)) if (gtk_cell_area_is_activatable (column->cell_area))
return TRUE; return TRUE;
} }