On Tue, 2009-05-26 at 14:58 +0200, Murray Cumming wrote: > On Tue, 2009-05-26 at 13:51 +0200, Balazs Scheidler wrote: > > Hi, > > > > We're trying to use dogtail & atk to test our application automatically > > and while trying to learn the tricks involved, I've learned that I have > > to create an accessibility class for each of our custom widgets. > > > > The problem is that the AtkObjectFactory class isn't wrapped in gtkmm > > and neither is atk_registry_set_factory_type(). This means that it is > > not possible to support accessibility (& automatic testability) from > > gtkmm. > > > > Can anyone point me in the right direction whether this was started > > earlier, or what the roadblocks are? Is there a specific reason why it > > hasn't been wrapped? > > I have no idea how this API would be used. Can you give us a clue?
The accessibility framework of Gtk+ has two major uses: provide accessibility for those visually impaired _AND_ to automate GUI operations from an external application. (used by automatic test tools). To make gtk applications accessible, Gtk has a framework to allow each widget to publish information about its internals and various actions that can be performed on widgets. For instance, a toggle button widget publishes its state and also actions to toggle/untoggle the state it contains. This way screen reader apps (like Orca) or automatic test tools (like LDTP or dogtail) can discover the widget structure of the application AND perform action on these widgets. The interfaces a given widget can publish are defined by the various Atk interface classes that are also wrapped in gtkmm. E.g. if a widget is capable of text editing, it can implement the AtkText interface, or if it capable of selecting items, it can implement the AtkSelect interface. Internally, Atk instantiates a new accessibility object for each on-screen widget, this accessibility object then gets associated with the widget in question. (you can get this via Gtk::Widget->get_accessible()) This instantiation is done via a factory class, which is then registered against the GType of the Gtk::Widget (in a hashtable hidden behind various abstraction layers) So in order to provide accessibility features for a widget, you have to use a stock widget where Gtk already has the necessary Atk interface implementation (in the Gtk module named "gail"), or if you have a custom widget you have to implement your own accessibility class. In C, this is implemented in the following way: * you need an AtkObjectFactory derived class, the sole purpose is to instantiate the accessibility object through its create_accessible virtual function, the GType of this class is registered using atk_registry_set_factory_type * then in the create_accessible() function you create an instance of your widget specific accessibility class The way it could be implemented: * the Atk interfaces are already wrapped in gtkmm, thus the accessibility class of a given widget could theoretically be implemented as a C++ class * an Atk::ObjectFactory class should be created to wrap AtkObjectFactory, I can see some relevant code in gtkmm/atk/src/atk_methods.defs file, but no such class is generated. I don't understand the build system of gtkmm and I couldn't convince it to regenerate files even when I've changed the atk.defs file. Is there a document that details how the build system/generating classes work? > > Is there a reason why you can't use the C API? > Of course I could use the C API, but I find that somewhat ugly in a purely C++ program. :) -- Bazsi _______________________________________________ gtkmm-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gtkmm-list
