Esempio n. 1
0
/**
 * panel_a11y_query_accessible_parent_type
 * @type: widget type
 * @type_info: accessible object type info to complete
 *
 * Standard hack which figures out the #GType of the accessible
 * object for @type's parent type. Also, fills out the class_size
 * and instance_size of @type_info to match the size of the parent
 * type.
 *
 * Basically, this is the hack to use if you want to derive from
 * an accessible object implementation in gail.
 *
 * Returns: the #GType of @type's parent's accessible peer
 */
GType
panel_a11y_query_accessible_parent_type (GType      type,
					 GTypeInfo *type_info)
{
	AtkObjectFactory *factory;
	GType             parent_type;
	GType             accessible_parent_type;

	g_return_val_if_fail (G_TYPE_IS_OBJECT (type), G_TYPE_INVALID);

	parent_type = g_type_parent (type);

	factory = atk_registry_get_factory (atk_get_default_registry (), parent_type);

	accessible_parent_type = atk_object_factory_get_accessible_type (factory);

	if (type_info) {
		GTypeQuery query;

		g_type_query (accessible_parent_type, &query);

		type_info->class_size    = query.class_size;
		type_info->instance_size = query.instance_size;
	}

	return atk_object_factory_get_accessible_type (factory);
}
Esempio n. 2
0
static GType
goo_canvas_accessible_get_type (void)
{
  static GType g_define_type_id = 0;

  if (G_UNLIKELY (g_define_type_id == 0))
    {
      AtkObjectFactory *factory;
      GType parent_atk_type;
      GTypeQuery query;
      GTypeInfo tinfo = { 0 };

      /* Gail doesn't declare its classes publicly, so we have to do a query
	 to find the size of the class and instances. */
      factory = atk_registry_get_factory (atk_get_default_registry (),
					  GTK_TYPE_WIDGET);
      if (!factory)
	return G_TYPE_INVALID;

      parent_atk_type = atk_object_factory_get_accessible_type (factory);
      if (!parent_atk_type)
	return G_TYPE_INVALID;

      g_type_query (parent_atk_type, &query);
      tinfo.class_init = (GClassInitFunc) goo_canvas_accessible_class_init;
      tinfo.class_size = query.class_size;
      tinfo.instance_size = query.instance_size;
      g_define_type_id = g_type_register_static (parent_atk_type,
						 "GooCanvasAccessible",
						 &tinfo, 0);
    }

  return g_define_type_id;
}
Esempio n. 3
0
static AtkObject *
mate_druid_get_accessible (GtkWidget *widget)
{
	static gboolean first_time = TRUE;

	if (first_time) {
		AtkObjectFactory *factory;
		AtkRegistry *registry;
 		GType derived_type; 
		GType derived_atk_type; 

		/*
		 * Figure out whether accessibility is enabled by looking at the
		 * type of the accessible object which would be created for
		 * the parent type of MateDruid.
		 */
		derived_type = g_type_parent (MATE_TYPE_DRUID);

		registry = atk_get_default_registry ();
		factory = atk_registry_get_factory (registry,
						    derived_type);
		derived_atk_type = atk_object_factory_get_accessible_type (factory);
		if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))  {
			atk_registry_set_factory_type (registry, 
						       MATE_TYPE_DRUID,
						       mate_druid_accessible_factory_get_type ());
		}
		first_time = FALSE;
	} 
	return GTK_WIDGET_CLASS (parent_class)->get_accessible (widget);
}
Esempio n. 4
0
File: gtkswitch.c Progetto: BYC/gtk
static AtkObject *
gtk_switch_get_accessible (GtkWidget *widget)
{
  static gboolean first_time = TRUE;

  if (G_UNLIKELY (first_time))
    {
      AtkObjectFactory *factory;
      AtkRegistry *registry;
      GType derived_type;
      GType derived_atk_type;

      /* Figure out whether accessibility is enabled by looking at the
       * type of the accessible object which would be created for the
       * parent type of GtkSwitch
       */
      derived_type = g_type_parent (GTK_TYPE_SWITCH);

      registry = atk_get_default_registry ();
      factory = atk_registry_get_factory (registry, derived_type);
      derived_atk_type = atk_object_factory_get_accessible_type (factory);
      if (g_type_is_a (derived_atk_type, GTK_TYPE_ACCESSIBLE))
        atk_registry_set_factory_type (registry,
                                       GTK_TYPE_SWITCH,
                                       gtk_switch_accessible_factory_get_type ());

      first_time = FALSE;
    }

  return GTK_WIDGET_CLASS (gtk_switch_parent_class)->get_accessible (widget);
}
Esempio n. 5
0
GType ev_view_accessible_get_type (void)
{
	static GType type = 0;

	if (G_UNLIKELY (type == 0)) {
		GTypeInfo tinfo = {
			0,	/* class size */
			(GBaseInitFunc) NULL,	/* base init */
			(GBaseFinalizeFunc) NULL,	/* base finalize */
			(GClassInitFunc) ev_view_accessible_class_init,	/* class init */
			(GClassFinalizeFunc) NULL,	/* class finalize */
			NULL,	/* class data */
			0,	/* instance size */
			0,	/* nb preallocs */
			(GInstanceInitFunc) NULL,	/* instance init */
			NULL	/* value table */
		};

		const GInterfaceInfo atk_text_info = {
			(GInterfaceInitFunc)
			ev_view_accessible_text_iface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};

		const GInterfaceInfo atk_action_info = {
			(GInterfaceInitFunc)
			ev_view_accessible_action_iface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};
		/*
		 * Figure out the size of the class and instance
		 * we are deriving from
		 */
		AtkObjectFactory *factory;
		GType derived_type;
		GTypeQuery query;
		GType derived_atk_type;

		derived_type = g_type_parent (EV_TYPE_VIEW);
		factory = atk_registry_get_factory (atk_get_default_registry (),
		                                    derived_type);
		derived_atk_type = atk_object_factory_get_accessible_type (factory);

		g_type_query (derived_atk_type, &query);
		tinfo.class_size = query.class_size;
		tinfo.instance_size = query.instance_size;

		type = g_type_register_static (derived_atk_type, "EvViewAccessible",
		                               &tinfo, 0);
		g_type_add_interface_static (type, ATK_TYPE_TEXT,
		                             &atk_text_info);
		g_type_add_interface_static (type, ATK_TYPE_ACTION,
		                             &atk_action_info);
	}

	return type;
}
Esempio n. 6
0
JNIEXPORT jint JNICALL ATK_NATIVE(_1atk_1object_1factory_1get_1accessible_1type)
	(JNIEnv *env, jclass that, jint arg0)
{
	jint rc = 0;
	ATK_NATIVE_ENTER(env, that, _1atk_1object_1factory_1get_1accessible_1type_FUNC);
	rc = (jint)atk_object_factory_get_accessible_type((AtkObjectFactory *)arg0);
	ATK_NATIVE_EXIT(env, that, _1atk_1object_1factory_1get_1accessible_1type_FUNC);
	return rc;
}
GType
accessible_image_view_get_type (void)
{
        static GType type = 0;

        if (!type)
        {
                static GTypeInfo tinfo =
                {
                        0,
                        (GBaseInitFunc) NULL, /* base init */
                        (GBaseFinalizeFunc) NULL, /* base finalize */
                        (GClassInitFunc) accessible_image_view_class_init, /* class init */
                        (GClassFinalizeFunc) NULL, /* class finalize */
                        NULL, /* class data */
                        0, /* instance size */
                        0, /* nb preallocs */
                        (GInstanceInitFunc) accessible_image_view_object_init, /* instance init */
                        NULL /* value table */
                };

	        static const GInterfaceInfo atk_image_info =
    		{
        		(GInterfaceInitFunc) atk_image_interface_init,
        		(GInterfaceFinalizeFunc) NULL,
        		NULL
    		};

                /*
                 * Figure out the size of the class and instance
                 * we are deriving from
                 */
                AtkObjectFactory *factory;
                GType derived_type;
                GTypeQuery query;
                GType derived_atk_type;

                derived_type = g_type_parent (TYPE_IMAGE_VIEW);
                factory = atk_registry_get_factory (atk_get_default_registry(),
                                                    derived_type);
                derived_atk_type = atk_object_factory_get_accessible_type (factory);
                g_type_query (derived_atk_type, &query);
                tinfo.class_size = query.class_size;
                tinfo.instance_size = query.instance_size;

                type = g_type_register_static(derived_atk_type,
                                              "AccessibleImageView", &tinfo, 0);
	    
	        g_type_add_interface_static (type, ATK_TYPE_IMAGE,
                                 &atk_image_info);

        }

        return type;
}
Esempio n. 8
0
GType
ea_jump_button_get_type (void)
{
	static GType type = 0;
	AtkObjectFactory *factory;
	GTypeQuery query;
	GType derived_atk_type;

	if (!type) {
		static GTypeInfo tinfo = {
			sizeof (EaJumpButtonClass),
			(GBaseInitFunc) NULL,
			(GBaseFinalizeFunc) NULL,
			(GClassInitFunc) ea_jump_button_class_init,
			(GClassFinalizeFunc) NULL,
			/* class_data */ NULL,
			sizeof (EaJumpButton),
			/* n_preallocs */ 0,
			(GInstanceInitFunc) NULL,
			/* value_table */ NULL
		};

		static const GInterfaceInfo atk_action_info = {
			(GInterfaceInitFunc) atk_action_interface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};

		/*
		 * Figure out the size of the class and instance
		 * we are run-time deriving from (atk object for
		 * GNOME_TYPE_CANVAS_ITEM, in this case)
		 */

		factory = atk_registry_get_factory (
			atk_get_default_registry (), GNOME_TYPE_CANVAS_ITEM);
		derived_atk_type =
			atk_object_factory_get_accessible_type (factory);
		g_type_query (derived_atk_type, &query);

		tinfo.class_size = query.class_size;
		tinfo.instance_size = query.instance_size;

		/* we inherit the component and other
		 * interfaces from GNOME_TYPE_CANVAS_ITEM */
		type = g_type_register_static (
			derived_atk_type, "EaJumpButton", &tinfo, 0);

		g_type_add_interface_static (
			type, ATK_TYPE_ACTION, &atk_action_info);
	}

	return type;
}
Esempio n. 9
0
GType
ea_minicard_get_type (void)
{
	static GType type = 0;
	AtkObjectFactory *factory;
	GTypeQuery query;
	GType derived_atk_type;

	if (!type) {
		static GTypeInfo tinfo = {
			sizeof (EaMinicardClass),
			(GBaseInitFunc) NULL,  /* base_init */
			(GBaseFinalizeFunc) NULL,  /* base_finalize */
			(GClassInitFunc) ea_minicard_class_init,
			(GClassFinalizeFunc) NULL, /* class_finalize */
			NULL,	/* class_data */
			sizeof (EaMinicard),
			0,	/* n_preallocs */
			(GInstanceInitFunc) NULL, /* instance init */
			NULL	/* value table */
		};

		static const GInterfaceInfo atk_action_info = {
			(GInterfaceInitFunc) atk_action_interface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};

		/*
		 * Figure out the size of the class and instance
		 * we are run-time deriving from (GailWidget, in this case)
		 */

		factory = atk_registry_get_factory (
			atk_get_default_registry (),
			GNOME_TYPE_CANVAS_GROUP);
		derived_atk_type = atk_object_factory_get_accessible_type (factory);
		g_type_query (derived_atk_type, &query);

		tinfo.class_size = query.class_size;
		tinfo.instance_size = query.instance_size;

		type = g_type_register_static (
			derived_atk_type,
			"EaMinicard", &tinfo, 0);
		g_type_add_interface_static (
			type, ATK_TYPE_ACTION,
			&atk_action_info);
	}

	return type;
}
Esempio n. 10
0
/**
 * eel_accessibility_create_derived_type:
 * @type_name: the name for the new accessible type eg. NautilusIconCanvasItemAccessible
 * @existing_gobject_with_proxy: the GType of an object that has a registered factory that
 *      manufactures the type we want to inherit from. ie. to inherit from a GailCanvasItem
 *      we need to pass GNOME_TYPE_CANVAS_ITEM - since GailCanvasItem is registered against
 *      that type.
 * @opt_gail_parent_class: the name of the Gail class to derive from eg. GailCanvasItem
 * @class_init: the init function to run for this class
 * 
 * This should be run to register the type, it can subsequently be run with
 * the same name and will not re-register it, but simply return it.
 *
 * NB. to do instance init, you prolly want to override AtkObject::initialize
 * 
 * Return value: the registered type, or 0 on failure.
 **/
GType
eel_accessibility_create_derived_type (const char *type_name,
				       GType existing_gobject_with_proxy,
				       EelAccessibilityClassInitFn class_init)
{
	GType type;
	GType parent_atk_type;
	GTypeInfo tinfo = { 0 };
	GTypeQuery query;
	AtkObjectFactory *factory;

	if ((type = g_type_from_name (type_name))) {
		return type;
	}

	factory = atk_registry_get_factory
		(atk_get_default_registry (),
		 existing_gobject_with_proxy);
	if (!factory) {
		return G_TYPE_INVALID;
	}
	
	parent_atk_type = atk_object_factory_get_accessible_type (factory);
	if (!parent_atk_type) {
		return G_TYPE_INVALID;
	}

	/*
	 * Figure out the size of the class and instance 
	 * we are deriving from
	 */
	g_type_query (parent_atk_type, &query);

	if (class_init) {
		tinfo.class_init = (GClassInitFunc) class_init;
	}

	tinfo.class_size    = query.class_size;
	tinfo.instance_size = query.instance_size;

	/* Register the type */
	type = g_type_register_static (
		parent_atk_type, type_name, &tinfo, 0);

	return type;
}
Esempio n. 11
0
File: led.c Progetto: pwithnall/mcus
static GType
mcus_led_accessible_get_type (void)
{
	static GType type = 0;

	/* Action interface
	   Name etc. ... */
	if (G_UNLIKELY (type == 0)) {
		const GInterfaceInfo atk_image_info = {
			(GInterfaceInitFunc) mcus_led_accessible_image_interface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};
		GType parent_atk_type;
		GTypeInfo tinfo = { 0 };
		GTypeQuery query;
		AtkObjectFactory *factory;

		if ((type = g_type_from_name ("MCUSLEDAccessible")))
			return type;

		factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_IMAGE);
		if (!factory)
			return G_TYPE_INVALID;

		parent_atk_type = atk_object_factory_get_accessible_type (factory);
		if (!parent_atk_type)
			return G_TYPE_INVALID;

		/* Figure out the size of the class and instance we are deriving from */
		g_type_query (parent_atk_type, &query);

		tinfo.class_init = (GClassInitFunc) mcus_led_accessible_class_init;
		tinfo.class_size = query.class_size;
		tinfo.instance_size = query.instance_size;

		/* Register the type */
		type = g_type_register_static (parent_atk_type, "MCUSLEDAccessible", &tinfo, 0);

		g_type_add_interface_static (type, ATK_TYPE_IMAGE, &atk_image_info);
	}

	return type;
}
Esempio n. 12
0
GType
ea_gnome_calendar_get_type (void)
{
	static GType type = 0;
	AtkObjectFactory *factory;
	GTypeQuery query;
	GType derived_atk_type;

	if (!type) {
		static GTypeInfo tinfo = {
			sizeof (EaGnomeCalendarClass),
			(GBaseInitFunc) NULL, /* base init */
			(GBaseFinalizeFunc) NULL, /* base finalize */
			(GClassInitFunc) ea_gnome_calendar_class_init, /* class init */
			(GClassFinalizeFunc) NULL, /* class finalize */
			NULL, /* class data */
			sizeof (EaGnomeCalendar), /* instance size */
			0, /* nb preallocs */
			(GInstanceInitFunc) NULL, /* instance init */
			NULL /* value table */
		};

		/*
		 * Figure out the size of the class and instance
		 * we are run-time deriving from (GailWidget, in this case)
		 */

		factory = atk_registry_get_factory (atk_get_default_registry (),
						    GTK_TYPE_WIDGET);
		derived_atk_type = atk_object_factory_get_accessible_type (factory);
		g_type_query (derived_atk_type, &query);
		tinfo.class_size = query.class_size;
		tinfo.instance_size = query.instance_size;

		type = g_type_register_static (derived_atk_type,
					       "EaGnomeCalendar", &tinfo, 0);

	}

	return type;
}
Esempio n. 13
0
static GType
mate_druid_accessible_get_type (void)
{
	static GType type = 0;

	if (!type) {
		GTypeInfo tinfo = {
			0, /* class size */
			(GBaseInitFunc) NULL, /* base init */
			(GBaseFinalizeFunc) NULL, /* base finalize */
			(GClassInitFunc) mate_druid_accessible_class_init,
			(GClassFinalizeFunc) NULL, /* class finalize */
			NULL, /* class data */
			0, /* instance size */
			0, /* nb preallocs */
			(GInstanceInitFunc) NULL, /* instance init */
			NULL /* value table */
		};
		/*
		 * Figure out the size of the class and instance
		 * we are deriving from
		 */
		AtkObjectFactory *factory;
		GType derived_type;
		GTypeQuery query;
		GType derived_atk_type;

		derived_type = g_type_parent (MATE_TYPE_DRUID);
		factory = atk_registry_get_factory (atk_get_default_registry (),
						    derived_type);
		derived_atk_type = atk_object_factory_get_accessible_type (factory);
		g_type_query (derived_atk_type, &query);
		tinfo.class_size = query.class_size;
		tinfo.instance_size = query.instance_size;
 
		type = g_type_register_static (derived_atk_type, 
					       "MateDruidAccessible", 
					       &tinfo, 0);
	}
	return type;
}
Esempio n. 14
0
GType
ea_day_view_main_item_get_type (void)
{
	static GType type = 0;
	AtkObjectFactory *factory;
	GTypeQuery query;
	GType derived_atk_type;

	if (!type) {
		static GTypeInfo tinfo = {
			sizeof (EaDayViewMainItemClass),
			(GBaseInitFunc) NULL, /* base init */
			(GBaseFinalizeFunc) NULL, /* base finalize */
			(GClassInitFunc) ea_day_view_main_item_class_init,
			(GClassFinalizeFunc) NULL, /* class finalize */
			NULL, /* class data */
			sizeof (EaDayViewMainItem), /* instance size */
			0, /* nb preallocs */
			(GInstanceInitFunc) NULL, /* instance init */
			NULL /* value table */
		};

		static const GInterfaceInfo atk_component_info = {
			(GInterfaceInitFunc) atk_component_interface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};

		static const GInterfaceInfo atk_table_info = {
			(GInterfaceInitFunc) atk_table_interface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};
		static const GInterfaceInfo atk_selection_info = {
			(GInterfaceInitFunc) atk_selection_interface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};

		/*
		 * Figure out the size of the class and instance
		 * we are run-time deriving from (GailCanvasItem, in this case)
		 *
		 */

		factory = atk_registry_get_factory (
			atk_get_default_registry (),
			e_day_view_main_item_get_type ());
		derived_atk_type = atk_object_factory_get_accessible_type (factory);
		g_type_query (derived_atk_type, &query);

		tinfo.class_size = query.class_size;
		tinfo.instance_size = query.instance_size;

		type = g_type_register_static (
			derived_atk_type,
			"EaDayViewMainItem", &tinfo, 0);
		g_type_add_interface_static (
			type, ATK_TYPE_COMPONENT,
			&atk_component_info);
		g_type_add_interface_static (
			type, ATK_TYPE_TABLE,
			&atk_table_info);
		g_type_add_interface_static (
			type, ATK_TYPE_SELECTION,
			&atk_selection_info);
	}

	return type;
}
Esempio n. 15
0
GType
ea_cal_view_event_get_type (void)
{
	static GType type = 0;
	AtkObjectFactory *factory;
	GTypeQuery query;
	GType derived_atk_type;

	if (!type) {
		static GTypeInfo tinfo = {
			sizeof (EaCalViewEventClass),
			(GBaseInitFunc) NULL, /* base init */
			(GBaseFinalizeFunc) NULL, /* base finalize */
			(GClassInitFunc) ea_cal_view_event_class_init, /* class init */
			(GClassFinalizeFunc) NULL, /* class finalize */
			NULL, /* class data */
			sizeof (EaCalViewEvent), /* instance size */
			0, /* nb preallocs */
			(GInstanceInitFunc) ea_cal_view_event_init, /* instance init */
			NULL /* value table */
		};

		static const GInterfaceInfo atk_component_info = {
			(GInterfaceInitFunc) atk_component_interface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};

		static const GInterfaceInfo atk_action_info = {
			(GInterfaceInitFunc) atk_action_interface_init,
			(GInterfaceFinalizeFunc) NULL,
			NULL
		};

		/*
		 * Figure out the size of the class and instance
		 * we are run-time deriving from (atk object for E_TEXT, in this case)
		 */

		factory = atk_registry_get_factory (
			atk_get_default_registry (),
			E_TYPE_TEXT);
		derived_atk_type = atk_object_factory_get_accessible_type (factory);
		g_type_query (derived_atk_type, &query);

		tinfo.class_size = query.class_size;
		tinfo.instance_size = query.instance_size;

		/* we inherit the component, text and other interfaces from E_TEXT */
		type = g_type_register_static (
			derived_atk_type,
			"EaCalViewEvent", &tinfo, 0);
		g_type_add_interface_static (
			type, ATK_TYPE_COMPONENT,
			&atk_component_info);
		g_type_add_interface_static (
			type, ATK_TYPE_ACTION,
			&atk_action_info);

	}

	return type;
}
GType
gucharmap_chartable_accessible_get_type (void)
{
  static volatile gsize type__volatile = 0;

  if (g_once_init_enter (&type__volatile))
    {
      GTypeInfo typeinfo =
      {
        0 /* filled in by the code below */,
        (GBaseInitFunc) NULL, /* base init */
        (GBaseFinalizeFunc) NULL, /* base finalize */
        (GClassInitFunc) gucharmap_chartable_accessible_class_init, /* class init */
        (GClassFinalizeFunc) NULL, /* class finalize */
        NULL, /* class data */
        0 /* filled in by the code below */,
        0, /* nb preallocs */
        (GInstanceInitFunc) gucharmap_chartable_accessible_init, /* instance init */
        NULL /* value table */
      };
      const GInterfaceInfo atk_table_info =
      {
          (GInterfaceInitFunc) gucharmap_chartable_accessible_table_interface_init,
          (GInterfaceFinalizeFunc) NULL,
          NULL
      };
      const GInterfaceInfo atk_component_info =
      {
          (GInterfaceInitFunc) gucharmap_chartable_accessible_component_interface_init,
          (GInterfaceFinalizeFunc) NULL,
          NULL
      };
      AtkObjectFactory *factory;
      GType derived_type;
      GTypeQuery query;
      GType derived_atk_type;
      GType type;

      /* Figure out the size of the class and instance we are deriving from */
      derived_type = g_type_parent (GUCHARMAP_TYPE_CHARTABLE);
      factory = atk_registry_get_factory (atk_get_default_registry (), 
                                          derived_type);
      derived_atk_type = atk_object_factory_get_accessible_type (factory);
      g_type_query (derived_atk_type, &query);
      typeinfo.class_size = query.class_size;
      typeinfo.instance_size = query.instance_size;

      type = g_type_register_static (derived_atk_type,
                                     "GucharmapChartableAccessible",
                                     &typeinfo, 0);

      g_type_add_interface_static (type, ATK_TYPE_TABLE,
                                   &atk_table_info);
      g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
                                   &atk_component_info);

      g_once_init_leave (&type__volatile, type);
    }

  return type__volatile;
}