2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 namespace ElmSharp.Accessible
22 public delegate string AccessibleInfoProvider (AccessibleObject obj);
24 public abstract class AccessibleObject : EvasObject, IAccessibleObject
27 AccessibleInfoProvider _nameProvider;
28 AccessibleInfoProvider _descriptionProvider;
30 Interop.Elementary.Elm_Atspi_Reading_Info_Cb _nameProviderInternal;
31 Interop.Elementary.Elm_Atspi_Reading_Info_Cb _descriptionProviderInternal;
33 ReadingInfoType IAccessibleObject.ReadingInfoType
37 return (ReadingInfoType)Interop.Elementary.elm_atspi_accessible_reading_info_type_get(Handle);
41 Interop.Elementary.elm_atspi_accessible_reading_info_type_set(Handle,
42 (Interop.Elementary.Elm_Accessible_Reading_Info_Type)value);
45 AccessRole IAccessibleObject.Role
49 return (AccessRole)Interop.Elementary.elm_atspi_accessible_role_get(Handle);
53 Interop.Elementary.elm_atspi_accessible_role_set(Handle,
54 (Interop.Elementary.Elm_Atspi_Role)value);
57 bool IAccessibleObject.CanHighlight
61 return Interop.Elementary.elm_atspi_accessible_can_highlight_get(Handle);
65 Interop.Elementary.elm_atspi_accessible_can_highlight_set(Handle, value);
68 string IAccessibleObject.TranslationDomain
72 return Interop.Elementary.elm_atspi_accessible_translation_domain_get(Handle);
76 Interop.Elementary.elm_atspi_accessible_translation_domain_set(Handle, value);
79 string IAccessibleObject.Name
83 return Interop.Elementary.elm_atspi_accessible_name_get(Handle);
87 Interop.Elementary.elm_atspi_accessible_name_set(Handle, value);
90 string IAccessibleObject.Description
94 return Interop.Elementary.elm_atspi_accessible_description_get(Handle);
98 Interop.Elementary.elm_atspi_accessible_description_set(Handle, value);
102 AccessibleInfoProvider IAccessibleObject.NameProvider
106 return _nameProvider;
111 if (_nameProviderInternal == null)
113 _nameProviderInternal = (data, obj) => _nameProvider(this);
117 _nameProvider = null;
118 Interop.Elementary.elm_atspi_accessible_name_cb_set(Handle, null, IntPtr.Zero);
122 _nameProvider = new AccessibleInfoProvider(value);
123 Interop.Elementary.elm_atspi_accessible_name_cb_set(Handle, _nameProviderInternal, IntPtr.Zero);
127 AccessibleInfoProvider IAccessibleObject.DescriptionProvider
131 return _descriptionProvider;
136 if (_descriptionProviderInternal == null)
138 _descriptionProviderInternal = (data, obj) => _descriptionProvider(this);
142 _descriptionProvider = null;
143 Interop.Elementary.elm_atspi_accessible_description_cb_set(Handle, null, IntPtr.Zero);
147 _descriptionProvider = new AccessibleInfoProvider(value);
148 Interop.Elementary.elm_atspi_accessible_description_cb_set(Handle, _descriptionProviderInternal, IntPtr.Zero);
153 public AccessibleObject(EvasObject parent) : base(parent)
157 public AccessibleObject() : base()
161 void IAccessibleObject.AppendRelation(IAccessibleRelation relation)
163 if (relation.Target == null) throw new ArgumentException("Target of Accessibility relation can not be null");
164 Interop.Elementary.elm_atspi_accessible_relationship_append(Handle, relation.Type, relation.Target.Handle);
167 void IAccessibleObject.RemoveRelation(IAccessibleRelation relation)
169 if (relation.Target == null) throw new ArgumentException("Target of Accessibility relation can not be null");
170 Interop.Elementary.elm_atspi_accessible_relationship_remove(Handle, relation.Type, relation.Target.Handle);
173 public void Highlight()
175 Interop.Elementary.elm_atspi_component_highlight_grab(Handle);
178 public void Unhighlight()
180 Interop.Elementary.elm_atspi_component_highlight_clear(Handle);