让自定义组件获得辅助功能
Adding ATK support to your custom widget will assure its cooperation with the accessibility infrastructure. These are the general steps that are required:
-
assess a custom widget according to the applicable User Interface Guidelines;
-
determine which ATK interfaces a custom widget should implement, according to the widget's feature set and function;
-
访问 ATK interfaces 可以继承父部件类;
-
部件类的 ATK 接口可以两种方式实现:
- 直接由自定义部件,或者
- in an AtkObject subtype created by a new AtkObjectFactory subclass
如果使用第二种方法,则在运行时必须使用 AtkObjectFactoryRegistry 来注册合适的 factory 类型。
GAIL source code 提供了一个优秀的教程讲解高级 ATK 用法。