mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-29 06:51:10 +00:00
cellrenderer: Add API to keep the accessible type
It's private for now, because we require a GType that isn't exported in the API yet.
This commit is contained in:
parent
acb73f99bb
commit
0470b91add
@ -24,6 +24,7 @@
|
||||
#include "gtktypebuiltins.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtktreeprivate.h"
|
||||
#include "a11y/gtkrenderercellaccessible.h"
|
||||
|
||||
|
||||
/**
|
||||
@ -130,6 +131,7 @@ struct _GtkCellRendererPrivate
|
||||
|
||||
struct _GtkCellRendererClassPrivate
|
||||
{
|
||||
GType accessible_type;
|
||||
};
|
||||
|
||||
enum {
|
||||
@ -416,6 +418,8 @@ gtk_cell_renderer_class_init (GtkCellRendererClass *class)
|
||||
P_("Whether this tag affects the cell background color"));
|
||||
|
||||
g_type_class_add_private (class, sizeof (GtkCellRendererPrivate));
|
||||
|
||||
_gtk_cell_renderer_class_set_accessible_type (class, GTK_TYPE_RENDERER_CELL_ACCESSIBLE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -1759,3 +1763,39 @@ gtk_cell_renderer_get_state (GtkCellRenderer *cell,
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
/*
|
||||
* _gtk_cell_renderer_class_set_accessible_type:
|
||||
* @renderer_class: class to set the accessible type for
|
||||
* @type: The object type that implements the accessible for @widget_class.
|
||||
* The type must be a subtype of #GtkRendererCellAccessible
|
||||
*
|
||||
* Sets the type to be used for creating accessibles for cells rendered by
|
||||
* cell renderers of @renderer_class. Note that multiple accessibles will
|
||||
* be created.
|
||||
*
|
||||
* This function should only be called from class init functions of cell
|
||||
* renderers.
|
||||
**/
|
||||
void
|
||||
_gtk_cell_renderer_class_set_accessible_type (GtkCellRendererClass *renderer_class,
|
||||
GType type)
|
||||
{
|
||||
GtkCellRendererClassPrivate *priv;
|
||||
|
||||
g_return_if_fail (GTK_IS_CELL_RENDERER_CLASS (renderer_class));
|
||||
g_return_if_fail (g_type_is_a (type, GTK_TYPE_RENDERER_CELL_ACCESSIBLE));
|
||||
|
||||
priv = renderer_class->priv;
|
||||
|
||||
priv->accessible_type = type;
|
||||
}
|
||||
|
||||
GType
|
||||
_gtk_cell_renderer_get_accessible_type (GtkCellRenderer *renderer)
|
||||
{
|
||||
g_return_val_if_fail (GTK_IS_CELL_RENDERER (renderer), GTK_TYPE_RENDERER_CELL_ACCESSIBLE);
|
||||
|
||||
return GTK_CELL_RENDERER_GET_CLASS (renderer)->priv->accessible_type;
|
||||
}
|
||||
|
||||
|
@ -271,6 +271,12 @@ GtkStateFlags gtk_cell_renderer_get_state (GtkCellRenderer *cell,
|
||||
GtkWidget *widget,
|
||||
GtkCellRendererState cell_state);
|
||||
|
||||
void _gtk_cell_renderer_class_set_accessible_type
|
||||
(GtkCellRendererClass *renderer_class,
|
||||
GType type);
|
||||
GType _gtk_cell_renderer_get_accessible_type
|
||||
(GtkCellRenderer * renderer);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GTK_CELL_RENDERER_H__ */
|
||||
|
Loading…
Reference in New Issue
Block a user