forked from AuroraMiddleware/gtk
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:
parent
dbe026ed1e
commit
626f27f7ed
@ -356,7 +356,7 @@ static void gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea
|
||||
gint height,
|
||||
gint *minimum_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,
|
||||
GtkCellAreaContext *context,
|
||||
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;
|
||||
|
||||
/* focus */
|
||||
class->can_focus = gtk_cell_area_real_can_focus;
|
||||
class->focus = NULL;
|
||||
class->activate = gtk_cell_area_real_activate;
|
||||
class->is_activatable = gtk_cell_area_real_is_activatable;
|
||||
class->activate = gtk_cell_area_real_activate;
|
||||
class->focus = NULL;
|
||||
|
||||
/* Signals */
|
||||
/**
|
||||
@ -990,18 +990,18 @@ gtk_cell_area_real_get_preferred_width_for_height (GtkCellArea *area,
|
||||
}
|
||||
|
||||
static void
|
||||
get_can_focus (GtkCellRenderer *renderer,
|
||||
gboolean *can_focus)
|
||||
get_is_activatable (GtkCellRenderer *renderer,
|
||||
gboolean *activatable)
|
||||
{
|
||||
|
||||
if (gtk_cell_renderer_can_focus (renderer))
|
||||
*can_focus = TRUE;
|
||||
if (gtk_cell_renderer_is_activatable (renderer))
|
||||
*activatable = TRUE;
|
||||
}
|
||||
|
||||
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
|
||||
* attributes.
|
||||
@ -1009,9 +1009,9 @@ gtk_cell_area_real_can_focus (GtkCellArea *area)
|
||||
* Subclasses can override this in the case that they are also
|
||||
* 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
|
||||
@ -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
|
||||
*
|
||||
* Returns whether the area can receive keyboard focus,
|
||||
* Returns whether the area can do anything when activated,
|
||||
* after applying new attributes to @area.
|
||||
*
|
||||
* Returns: whether @area can receive focus.
|
||||
* Returns: whether @area can do anything when activated.
|
||||
*/
|
||||
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);
|
||||
|
||||
return GTK_CELL_AREA_GET_CLASS (area)->can_focus (area);
|
||||
return GTK_CELL_AREA_GET_CLASS (area)->is_activatable (area);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -144,7 +144,7 @@ struct _GtkCellAreaClass
|
||||
GParamSpec *pspec);
|
||||
|
||||
/* Focus */
|
||||
gboolean (* can_focus) (GtkCellArea *area);
|
||||
gboolean (* is_activatable) (GtkCellArea *area);
|
||||
gboolean (* focus) (GtkCellArea *area,
|
||||
GtkDirectionType direction);
|
||||
gboolean (* activate) (GtkCellArea *area,
|
||||
@ -285,14 +285,14 @@ void gtk_cell_area_cell_get_property (GtkCellArea
|
||||
|
||||
|
||||
/* Focus */
|
||||
gboolean gtk_cell_area_can_focus (GtkCellArea *area);
|
||||
gboolean gtk_cell_area_focus (GtkCellArea *area,
|
||||
GtkDirectionType direction);
|
||||
gboolean gtk_cell_area_is_activatable (GtkCellArea *area);
|
||||
gboolean gtk_cell_area_activate (GtkCellArea *area,
|
||||
GtkCellAreaContext *context,
|
||||
GtkWidget *widget,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags);
|
||||
gboolean gtk_cell_area_focus (GtkCellArea *area,
|
||||
GtkDirectionType direction);
|
||||
void gtk_cell_area_set_focus_cell (GtkCellArea *area,
|
||||
GtkCellRenderer *renderer);
|
||||
GtkCellRenderer *gtk_cell_area_get_focus_cell (GtkCellArea *area);
|
||||
|
@ -1138,7 +1138,7 @@ gtk_cell_area_box_render (GtkCellArea *area,
|
||||
|
||||
/* If no cell can activate but the caller wants focus painted,
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
@ -1104,17 +1104,17 @@ gtk_cell_renderer_get_sensitive (GtkCellRenderer *cell)
|
||||
|
||||
|
||||
/**
|
||||
* gtk_cell_renderer_can_focus:
|
||||
* gtk_cell_renderer_is_activatable:
|
||||
* @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
|
||||
*/
|
||||
gboolean
|
||||
gtk_cell_renderer_can_focus (GtkCellRenderer *cell)
|
||||
gtk_cell_renderer_is_activatable (GtkCellRenderer *cell)
|
||||
{
|
||||
GtkCellRendererPrivate *priv;
|
||||
|
||||
|
@ -247,7 +247,7 @@ void gtk_cell_renderer_set_sensitive (GtkCellRenderer *cell,
|
||||
gboolean sensitive);
|
||||
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 */
|
||||
void gtk_cell_renderer_stop_editing (GtkCellRenderer *cell,
|
||||
|
@ -7804,7 +7804,7 @@ gtk_tree_view_has_can_focus_cell (GtkTreeView *tree_view)
|
||||
|
||||
if (!gtk_tree_view_column_get_visible (column))
|
||||
continue;
|
||||
if (gtk_cell_area_can_focus (column->cell_area))
|
||||
if (gtk_cell_area_is_activatable (column->cell_area))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user