접근성 API 활용 예제
앞서 설명한 대로, GTK 위젯을 설정했거나 ATK 인터페이스를 구현한 다른 위젯 라이브러리를 활용할 경우 프로그램에 접근할 수 있게 약간의 처리 과정을 거치든지 손을 댈 필요가 없습니다. 보통 손을 대야하는 대부분의 일반적인 경우는 두가지입니다:
-
atk_object_set_description()함수 또는 atk_image_set_description(): 함수로 일부 컨트롤 및 이미지의 설명을 달아주십시오:
예제 1-3 단추에서 볼 수 있는 설명 설정{ AtkObject *obj; obj = gtk_widget_get_accessible(button); atk_object_set_description(obj,_("Opens Preferences dialog")); }
-
atk_relation_new() 함수와 atk_relation_set_add() 함수로 위젯의 흔치 않은 그룹 관계를 지정하십시오:
예제 1-4 두 컨트롤의 접근 관계 지정{ GtkWidget *widget; GtkLabel *label; AtkObject *atk_widget, *atk_label; AtkRelationSet *relation_set; AtkRelation *relation; AtkObject *targets[1]; atk_widget = gtk_widget_get_accessible (widget); atk_label = gtk_widget_get_accessible (GTK_WIDGET(label)); relation_set = atk_object_ref_relation_set (atk_label); targets[0] = atk_widget; relation = atk_relation_new(targets,1, ATK_RELATION_LABEL_FOR); atk_relation_set_add(relation_set,relation); g_object_unref(G_OBJECT(relation)); }
The examples in the rest of this section are mostly to give you a flavor of the scope of the ATK. They cover techniques that you may never need to use as an application developer, although they may be of interest if you are writing your own custom widgets (see Making Custom Components Accessible) or if you want to write an assistive technology application.
- 1.7.1. 프로그램에서 접근성 정보 가져오기
- 1.7.2. AtkObject 인터페이스 요청
- 1.7.3. ATK 시그널 처리자 설정
- 1.7.4. ATK 객체 구현