From 7645a13ba30a9d29746860bb35935e33aa02028a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bart=C5=82omiej=20Grzelewski?= Date: Thu, 4 Mar 2021 11:57:30 +0100 Subject: [PATCH] [NUI] Interops for accessibility (#2277) MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit * [NUI][AT-SPI] Add accessiblity support to View This commits add support for 2 signals: * generic Signal * atspi custom Signal)> Add accessibilty properties to View. Add accessibilty events to View. Change-Id: I795bbb794a0f0c96210ddf4ad387386c1e1f8777 * [NUI][AT-SPI] Add AccessibilityDelegate * [NUI][AT-SPI] Add basic Accessibility methods * Initial implementation of the method which sets the Accessibility states of a View * Initial implementation of the overriden method for Button class * [NUI][AT-SPI] Add more AccessibilityDelegate methods * [NUI][AT-SPI] Added 2-finger pan possibility to ScrollableBase * [NUI][AT-SPI] Basic Accessibility for Slider * [NUI][AT-SPI] Basic accessibility for Dialog * [NUI][AT-SPI] Clean up code Rename structures with event arguments. Hide at-spi implementation. Change-Id: Icf578f977dc096fc0813c02aa8db2d5434c4a0f0 Co-authored-by: Artur Świgoń Co-authored-by: Maria Bialota --- src/Tizen.NUI.Components/Controls/AlertDialog.cs | 16 + .../Controls/Button.Internal.cs | 40 +- src/Tizen.NUI.Components/Controls/Button.cs | 16 + src/Tizen.NUI.Components/Controls/CheckBox.cs | 10 + src/Tizen.NUI.Components/Controls/Control.cs | 8 + src/Tizen.NUI.Components/Controls/Dialog.cs | 23 + src/Tizen.NUI.Components/Controls/Popup.cs | 22 + src/Tizen.NUI.Components/Controls/RadioButton.cs | 10 + .../Controls/ScrollableBase.cs | 10 + src/Tizen.NUI.Components/Controls/SelectButton.cs | 16 + .../Controls/Slider.Internal.cs | 2 + src/Tizen.NUI.Components/Controls/Slider.cs | 81 ++++ src/Tizen.NUI.Components/Controls/Switch.cs | 26 ++ .../Accessibility/AccessibilityDoGestureSignal.cs | 112 +++++ .../src/internal/Common/StringToVoidSignal.cs | 100 +++++ .../src/internal/Interop/Interop.ControlDevel.cs | 336 +++++++++++++++ .../internal/Interop/Interop.DoGestureSignal.cs | 58 +++ .../internal/Interop/Interop.StringToVoidSignal.cs | 52 +++ src/Tizen.NUI/src/internal/Interop/Interop.View.cs | 3 + .../src/internal/Interop/Interop.ViewProperty.cs | 21 + .../src/public/BaseComponents/CustomView.cs | 125 ++++++ src/Tizen.NUI/src/public/BaseComponents/View.cs | 188 +++++++++ .../src/public/BaseComponents/ViewAccessibility.cs | 426 +++++++++++++++++++ .../public/BaseComponents/ViewAccessibilityEnum.cs | 327 +++++++++++++++ .../BaseComponents/ViewAccessibilityEvent.cs | 463 +++++++++++++++++++++ .../BaseComponents/ViewAccessibilityProperties.cs | 111 +++++ .../public/BaseComponents/ViewBindableProperty.cs | 126 +++++- .../src/public/BaseComponents/ViewEnum.cs | 9 +- .../src/public/BaseComponents/ViewPublicMethods.cs | 6 + .../src/public/BaseComponents/VisualView.cs | 2 + 30 files changed, 2739 insertions(+), 6 deletions(-) create mode 100755 src/Tizen.NUI/src/internal/Accessibility/AccessibilityDoGestureSignal.cs create mode 100755 src/Tizen.NUI/src/internal/Common/StringToVoidSignal.cs create mode 100644 src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs create mode 100755 src/Tizen.NUI/src/internal/Interop/Interop.DoGestureSignal.cs create mode 100755 src/Tizen.NUI/src/internal/Interop/Interop.StringToVoidSignal.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEnum.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEvent.cs create mode 100755 src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityProperties.cs diff --git a/src/Tizen.NUI.Components/Controls/AlertDialog.cs b/src/Tizen.NUI.Components/Controls/AlertDialog.cs index e771290..612b638 100755 --- a/src/Tizen.NUI.Components/Controls/AlertDialog.cs +++ b/src/Tizen.NUI.Components/Controls/AlertDialog.cs @@ -579,5 +579,21 @@ namespace Tizen.NUI.Components base.Dispose(type); } + + /// + /// AccessibilityGetName. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override string AccessibilityGetName() + { + if (!String.IsNullOrEmpty(Title)) + { + return Title; + } + else + { + return Message; + } + } } } diff --git a/src/Tizen.NUI.Components/Controls/Button.Internal.cs b/src/Tizen.NUI.Components/Controls/Button.Internal.cs index 996f777..645e5af 100755 --- a/src/Tizen.NUI.Components/Controls/Button.Internal.cs +++ b/src/Tizen.NUI.Components/Controls/Button.Internal.cs @@ -18,6 +18,24 @@ namespace Tizen.NUI.Components private bool styleApplied = false; /// + /// Get accessibility name. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override string AccessibilityGetName() + { + return Text; + } + + /// + /// Prevents from showing child widgets in AT-SPI tree. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override bool AccessibilityShouldReportZeroChildren() + { + return true; + } + + /// /// The ButtonExtension instance that is injected by ButtonStyle. /// [EditorBrowsable(EditorBrowsableState.Never)] @@ -38,7 +56,8 @@ namespace Tizen.NUI.Components WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, HorizontalAlignment = HorizontalAlignment.Center, - VerticalAlignment = VerticalAlignment.Center + VerticalAlignment = VerticalAlignment.Center, + AccessibilityHighlightable = false }; } @@ -53,7 +72,8 @@ namespace Tizen.NUI.Components { PositionUsesPivotPoint = true, ParentOrigin = NUI.ParentOrigin.Center, - PivotPoint = NUI.PivotPoint.Center + PivotPoint = NUI.PivotPoint.Center, + AccessibilityHighlightable = false }; } @@ -70,7 +90,8 @@ namespace Tizen.NUI.Components ParentOrigin = NUI.ParentOrigin.Center, PivotPoint = NUI.PivotPoint.Center, WidthResizePolicy = ResizePolicyType.FillToParent, - HeightResizePolicy = ResizePolicyType.FillToParent + HeightResizePolicy = ResizePolicyType.FillToParent, + AccessibilityHighlightable = false }; } @@ -381,6 +402,16 @@ namespace Tizen.NUI.Components base.Dispose(type); } + /// + /// Initilizes AT-SPI object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnInitialize() + { + base.OnInitialize(); + SetAccessibilityConstructor(Role.PushButton); + } + /// [EditorBrowsable(EditorBrowsableState.Never)] protected override void OnControlStateChanged(ControlStateChangedEventArgs controlStateChangedInfo) @@ -408,12 +439,13 @@ namespace Tizen.NUI.Components /// 6 private void Initialize() { + AccessibilityHighlightable = true; EnableControlStatePropagation = true; UpdateState(); LayoutDirectionChanged += OnLayoutDirectionChanged; AccessibilityManager.Instance.SetAccessibilityAttribute(this, AccessibilityManager.AccessibilityAttribute.Trait, "Button"); - + #if PROFILE_MOBILE Feedback = true; #endif diff --git a/src/Tizen.NUI.Components/Controls/Button.cs b/src/Tizen.NUI.Components/Controls/Button.cs index c566f66..bece8cf 100755 --- a/src/Tizen.NUI.Components/Controls/Button.cs +++ b/src/Tizen.NUI.Components/Controls/Button.cs @@ -197,6 +197,17 @@ namespace Tizen.NUI.Components } /// + /// Calculates current states for the button
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + protected override AccessibilityStates AccessibilityCalculateStates() + { + var states = base.AccessibilityCalculateStates(); + states.Set(AccessibilityState.Enabled, this.IsEnabled); + return states; + } + + /// /// An event for the button clicked signal which can be used to subscribe or unsubscribe the event handler provided by the user.
///
/// 6 @@ -374,6 +385,11 @@ namespace Tizen.NUI.Components set { TextLabel.Text = value; + + if (IsHighlighted && String.IsNullOrEmpty(AccessibilityName) && GetNameSignal().Empty()) + { + EmitAccessibilityEvent(ObjectPropertyChangeEvent.Name); + } } } diff --git a/src/Tizen.NUI.Components/Controls/CheckBox.cs b/src/Tizen.NUI.Components/Controls/CheckBox.cs index 2f3b3e8..55b0a27 100755 --- a/src/Tizen.NUI.Components/Controls/CheckBox.cs +++ b/src/Tizen.NUI.Components/Controls/CheckBox.cs @@ -44,6 +44,16 @@ namespace Tizen.NUI.Components public CheckBox(ButtonStyle buttonStyle) : base(buttonStyle) { } /// + /// Initialize AT-SPI object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnInitialize() + { + base.OnInitialize(); + SetAccessibilityConstructor(Role.CheckBox); + } + + /// /// Get CheckBoxGroup to which this CheckBox belong. /// /// 6 diff --git a/src/Tizen.NUI.Components/Controls/Control.cs b/src/Tizen.NUI.Components/Controls/Control.cs index 1caef24..1eba802 100755 --- a/src/Tizen.NUI.Components/Controls/Control.cs +++ b/src/Tizen.NUI.Components/Controls/Control.cs @@ -208,6 +208,14 @@ namespace Tizen.NUI.Components } /// + /// OnInitialize + /// + public override void OnInitialize() + { + base.OnInitialize(); + } + + /// /// Called after a key event is received by the view that has had its focus set. /// /// The key event. diff --git a/src/Tizen.NUI.Components/Controls/Dialog.cs b/src/Tizen.NUI.Components/Controls/Dialog.cs index bc2df64..e430044 100755 --- a/src/Tizen.NUI.Components/Controls/Dialog.cs +++ b/src/Tizen.NUI.Components/Controls/Dialog.cs @@ -236,5 +236,28 @@ namespace Tizen.NUI.Components base.Dispose(type); } + + /// + /// Initialize AT-SPI object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnInitialize() + { + base.OnInitialize(); + SetAccessibilityConstructor(Role.Dialog); + AppendAccessibilityAttribute("sub-role", "Alert"); + Show(); // calls AddPopup() + } + + /// + /// Informs AT-SPI bridge about the set of AT-SPI states associated with this object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override AccessibilityStates AccessibilityCalculateStates() + { + var states = base.AccessibilityCalculateStates(); + states.Set(AccessibilityState.Modal, true); + return states; + } } } diff --git a/src/Tizen.NUI.Components/Controls/Popup.cs b/src/Tizen.NUI.Components/Controls/Popup.cs index ef7e278..e806c57 100755 --- a/src/Tizen.NUI.Components/Controls/Popup.cs +++ b/src/Tizen.NUI.Components/Controls/Popup.cs @@ -816,6 +816,28 @@ namespace Tizen.NUI.Components btGroup = new ButtonGroup(this); } + /// + /// Initialize AT-SPI object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnInitialize() + { + base.OnInitialize(); + SetAccessibilityConstructor(Role.Dialog); + AppendAccessibilityAttribute("sub-role", "Alert"); + } + + /// + /// Informs AT-SPI bridge about the set of AT-SPI states associated with this object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override AccessibilityStates AccessibilityCalculateStates() + { + var states = base.AccessibilityCalculateStates(); + states.Set(AccessibilityState.Modal, true); + return states; + } + private void UpdateView() { if (popupStyle == null) return; diff --git a/src/Tizen.NUI.Components/Controls/RadioButton.cs b/src/Tizen.NUI.Components/Controls/RadioButton.cs index 0a7de63..41cd43d 100755 --- a/src/Tizen.NUI.Components/Controls/RadioButton.cs +++ b/src/Tizen.NUI.Components/Controls/RadioButton.cs @@ -55,6 +55,16 @@ namespace Tizen.NUI.Components public RadioButton(ButtonStyle buttonStyle) : base(buttonStyle) { } /// + /// Initialize AT-SPI object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnInitialize() + { + base.OnInitialize(); + SetAccessibilityConstructor(Role.RadioButton); + } + + /// /// Get RadioButtonGroup to which this selections belong. /// /// 6 diff --git a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs index c77c736..b238901 100755 --- a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs +++ b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs @@ -286,6 +286,15 @@ namespace Tizen.NUI.Components } /// + /// Gets scrollable status. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override bool AccessibilityIsScrollable() + { + return true; + } + + /// /// Pages mode, enables moving to the next or return to current page depending on pan displacement. /// Default is false. /// @@ -608,6 +617,7 @@ namespace Tizen.NUI.Components mPanGestureDetector = new PanGestureDetector(); mPanGestureDetector.Attach(this); mPanGestureDetector.AddDirection(PanGestureDetector.DirectionVertical); + if (mPanGestureDetector.GetMaximumTouchesRequired() < 2) mPanGestureDetector.SetMaximumTouchesRequired(2); mPanGestureDetector.Detected += OnPanGestureDetected; ClippingMode = ClippingModeType.ClipToBoundingBox; diff --git a/src/Tizen.NUI.Components/Controls/SelectButton.cs b/src/Tizen.NUI.Components/Controls/SelectButton.cs index 9eebaec..9bf9aac 100755 --- a/src/Tizen.NUI.Components/Controls/SelectButton.cs +++ b/src/Tizen.NUI.Components/Controls/SelectButton.cs @@ -80,6 +80,17 @@ namespace Tizen.NUI.Components } /// + /// Informs AT-SPI bridge about the set of AT-SPI states associated with this object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override AccessibilityStates AccessibilityCalculateStates() + { + var states = base.AccessibilityCalculateStates(); + states.Set(AccessibilityState.Checked, this.IsSelected); + return states; + } + + /// /// An event for the item selected signal which can be used to subscribe or unsubscribe the event handler provided by the user.
///
/// This will be public opened in tizen_5.5 after ACR done. Before ACR, need to be hidden as inhouse API. @@ -213,6 +224,11 @@ namespace Tizen.NUI.Components { if (info.PreviousState.Contains(ControlState.Selected) != info.CurrentState.Contains(ControlState.Selected)) { + if (IsHighlighted) + { + EmitAccessibilityStateChangedEvent(AccessibilityState.Checked, info.CurrentState.Contains(ControlState.Selected)); + } + // SelectedChanged is invoked when button or key is unpressed. if (invokeSelectedChanged == false) { diff --git a/src/Tizen.NUI.Components/Controls/Slider.Internal.cs b/src/Tizen.NUI.Components/Controls/Slider.Internal.cs index 6471f17..a609631 100755 --- a/src/Tizen.NUI.Components/Controls/Slider.Internal.cs +++ b/src/Tizen.NUI.Components/Controls/Slider.Internal.cs @@ -81,6 +81,8 @@ namespace Tizen.NUI.Components private void Initialize() { + AccessibilityHighlightable = true; + currentSlidedOffset = 0; isFocused = false; isPressed = false; diff --git a/src/Tizen.NUI.Components/Controls/Slider.cs b/src/Tizen.NUI.Components/Controls/Slider.cs index 661a8ae..a307642 100755 --- a/src/Tizen.NUI.Components/Controls/Slider.cs +++ b/src/Tizen.NUI.Components/Controls/Slider.cs @@ -453,6 +453,10 @@ namespace Tizen.NUI.Components set { curValue = value; + if (IsHighlighted) + { + EmitAccessibilityEvent(ObjectPropertyChangeEvent.Value); + } UpdateValue(); } } @@ -1168,6 +1172,83 @@ namespace Tizen.NUI.Components } /// + /// Prevents from showing child widgets in AT-SPI tree. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override bool AccessibilityShouldReportZeroChildren() + { + return true; + } + + /// + /// Minimum value. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override double AccessibilityGetMinimum() + { + return (double)MinValue; + } + + /// + /// Current value. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override double AccessibilityGetCurrent() + { + return (double)CurrentValue; + } + + /// + /// Maximum value. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override double AccessibilityGetMaximum() + { + return (double)MaxValue; + } + + /// + /// Current value. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override bool AccessibilitySetCurrent(double value) + { + var f = (float)value; + + if (f >= MinValue && f <= MaxValue) + { + CurrentValue = f; + if (sliderValueChangedHandler != null) + { + sliderValueChangedHandler(this, new SliderValueChangedEventArgs { CurrentValue = f }); + } + return true; + } + + return false; + } + + /// + /// Minimum increment. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override double AccessibilityGetMinimumIncrement() + { + // FIXME + return (MaxValue - MinValue) / 20.0; + } + + /// + /// Initliaze AT-SPI object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnInitialize() + { + base.OnInitialize(); + SetAccessibilityConstructor(Role.Slider, AccessibilityInterface.Value); + } + + /// /// Get Slider style. /// /// The default slider style. diff --git a/src/Tizen.NUI.Components/Controls/Switch.cs b/src/Tizen.NUI.Components/Controls/Switch.cs index 99bfe5a..bd181e8 100755 --- a/src/Tizen.NUI.Components/Controls/Switch.cs +++ b/src/Tizen.NUI.Components/Controls/Switch.cs @@ -63,6 +63,27 @@ namespace Tizen.NUI.Components } /// + /// Initilize AT-SPI object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override void OnInitialize() + { + base.OnInitialize(); + SetAccessibilityConstructor(Role.ToggleButton); + } + + /// + /// Informs AT-SPI bridge about the set of AT-SPI states associated with this object. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + protected override AccessibilityStates AccessibilityCalculateStates() + { + var states = base.AccessibilityCalculateStates(); + states.Set(AccessibilityState.Checked, this.IsSelected); + return states; + } + + /// /// An event for the item selected signal which can be used to subscribe or unsubscribe the event handler provided by the user.
///
/// 6 @@ -324,6 +345,11 @@ namespace Tizen.NUI.Components private void OnSelect() { + if (IsHighlighted) + { + EmitAccessibilityStateChangedEvent(AccessibilityState.Checked, IsSelected); + } + ((SwitchExtension)Extension)?.OnSelectedChanged(this); if (SelectedEvent != null) diff --git a/src/Tizen.NUI/src/internal/Accessibility/AccessibilityDoGestureSignal.cs b/src/Tizen.NUI/src/internal/Accessibility/AccessibilityDoGestureSignal.cs new file mode 100755 index 0000000..27526e7 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Accessibility/AccessibilityDoGestureSignal.cs @@ -0,0 +1,112 @@ +/* + * Copyright(c) 2019-2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System.Diagnostics; +using System; +using System.Drawing; + +namespace Tizen.NUI +{ + using global::System; + using global::System.ComponentModel; + using global::System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + [EditorBrowsable(EditorBrowsableState.Never)] + public class AccessibilityDoGestureSignal : Disposable + { + [EditorBrowsable(EditorBrowsableState.Never)] + internal AccessibilityDoGestureSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) { + } + + [EditorBrowsable(EditorBrowsableState.Never)] + static internal uint GetSizeOfGestureInfo() { + uint ret = Interop.DoGestureSignal.GetSizeOfGestureInfo(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + static internal int GetResult(global::System.IntPtr data) { + int ret = Interop.DoGestureSignal.GetResult(data); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + static internal void SetResult(global::System.IntPtr data, int res) { + Interop.DoGestureSignal.SetResult(data, res); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.DoGestureSignal.Delete(swigCPtr); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityDoGestureSignal() : this(Interop.DoGestureSignal.New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Empty() + { + bool ret = Interop.DoGestureSignal.Empty(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetConnectionCount() + { + uint ret = Interop.DoGestureSignal.GetConnectionCount(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.DoGestureSignal.Connect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.DoGestureSignal.Disconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Emit() + { + Interop.DoGestureSignal.Emit(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +} + diff --git a/src/Tizen.NUI/src/internal/Common/StringToVoidSignal.cs b/src/Tizen.NUI/src/internal/Common/StringToVoidSignal.cs new file mode 100755 index 0000000..6668d20 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Common/StringToVoidSignal.cs @@ -0,0 +1,100 @@ +/* + * Copyright(c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System.Diagnostics; +using System; +using System.Drawing; + +namespace Tizen.NUI +{ + using global::System; + using global::System.ComponentModel; + using global::System.Runtime.InteropServices; + using Tizen.NUI.BaseComponents; + + [EditorBrowsable(EditorBrowsableState.Never)] + public class StringToVoidSignal : Disposable + { + [EditorBrowsable(EditorBrowsableState.Never)] + internal StringToVoidSignal(global::System.IntPtr cPtr, bool cMemoryOwn) : base(cPtr, cMemoryOwn) + { + } + + [EditorBrowsable(EditorBrowsableState.Never)] + static internal string ConvertParam1(global::System.IntPtr data) { + string result = Interop.StringToVoidSignal.ConvertParam1(data); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void ReleaseSwigCPtr(System.Runtime.InteropServices.HandleRef swigCPtr) + { + Interop.StringToVoidSignal.Delete(swigCPtr); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public StringToVoidSignal() : this(Interop.StringToVoidSignal.New(), true) + { + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Empty() + { + bool ret = Interop.StringToVoidSignal.Empty(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public uint GetConnectionCount() + { + uint ret = Interop.StringToVoidSignal.GetConnectionCount(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Connect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.StringToVoidSignal.Connect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Disconnect(System.Delegate func) + { + System.IntPtr ip = System.Runtime.InteropServices.Marshal.GetFunctionPointerForDelegate(func); + { + Interop.StringToVoidSignal.Disconnect(SwigCPtr, new System.Runtime.InteropServices.HandleRef(this, ip)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Emit() + { + Interop.StringToVoidSignal.Emit(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + } +} + diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs b/src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs new file mode 100644 index 0000000..9e35703 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs @@ -0,0 +1,336 @@ +/* + * Copyright (c) 2020-2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Runtime.InteropServices; +using System.Text; + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class ControlDevel + { + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityActivateSignal")] + public static extern global::System.IntPtr DaliToolkitDevelControlAccessibilityActivateSignal(Tizen.NUI.BaseComponents.View.ControlHandle arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityReadingSkippedSignal")] + public static extern global::System.IntPtr DaliToolkitDevelControlAccessibilityReadingSkippedSignal(Tizen.NUI.BaseComponents.View.ControlHandle arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityReadingPausedSignal")] + public static extern global::System.IntPtr DaliToolkitDevelControlAccessibilityReadingPausedSignal(Tizen.NUI.BaseComponents.View.ControlHandle arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityReadingResumedSignal")] + public static extern global::System.IntPtr DaliToolkitDevelControlAccessibilityReadingResumedSignal(Tizen.NUI.BaseComponents.View.ControlHandle arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityReadingCancelledSignal")] + public static extern global::System.IntPtr DaliToolkitDevelControlAccessibilityReadingCancelledSignal(Tizen.NUI.BaseComponents.View.ControlHandle arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityReadingStoppedSignal")] + public static extern global::System.IntPtr DaliToolkitDevelControlAccessibilityReadingStoppedSignal(Tizen.NUI.BaseComponents.View.ControlHandle arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityGetNameSignal")] + public static extern global::System.IntPtr DaliToolkitDevelControlAccessibilityGetNameSignal(Tizen.NUI.BaseComponents.View.ControlHandle arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityGetDescriptionSignal")] + public static extern global::System.IntPtr DaliToolkitDevelControlAccessibilityGetDescriptionSignal(Tizen.NUI.BaseComponents.View.ControlHandle arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityDoGestureSignal")] + public static extern global::System.IntPtr DaliToolkitDevelControlAccessibilityDoGestureSignal(Tizen.NUI.BaseComponents.View.ControlHandle arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AppendAccessibilityRelation")] + public static extern void DaliToolkitDevelControlAppendAccessibilityRelation(global::System.Runtime.InteropServices.HandleRef arg1, global::System.Runtime.InteropServices.HandleRef arg2, int arg3); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_RemoveAccessibilityRelation")] + public static extern void DaliToolkitDevelControlRemoveAccessibilityRelation(global::System.Runtime.InteropServices.HandleRef arg1, global::System.Runtime.InteropServices.HandleRef arg2, int arg3); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_new_GetAccessibilityRelations")] + public static extern global::System.IntPtr DaliToolkitDevelControlNewGetAccessibilityRelations(global::System.Runtime.InteropServices.HandleRef arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityRelations_RelationSize")] + public static extern uint DaliToolkitDevelControlAccessibilityRelationsRelationSize(Tizen.NUI.BaseComponents.AddressCollection arg1, int relation); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibilityRelations_At")] + public static extern string DaliToolkitDevelControlAccessibilityRelationsAt(Tizen.NUI.BaseComponents.AddressCollection arg1, int rel, int pos, int id); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_delete_AccessibilityRelations")] + public static extern void DaliToolkitDevelControlDeleteAccessibilityRelations(IntPtr arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_ClearAccessibilityRelations")] + public static extern void DaliToolkitDevelControlClearAccessibilityRelations(global::System.Runtime.InteropServices.HandleRef arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AppendAccessibilityAttribute")] + public static extern void DaliToolkitDevelControlAppendAccessibilityAttribute(global::System.Runtime.InteropServices.HandleRef arg1, string arg2, string arg3); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_RemoveAccessibilityAttribute")] + public static extern void DaliToolkitDevelControlRemoveAccessibilityAttribute(global::System.Runtime.InteropServices.HandleRef arg1, string arg2); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_ClearAccessibilityAttributes")] + public static extern void DaliToolkitDevelControlClearAccessibilityAttributes(global::System.Runtime.InteropServices.HandleRef arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_SetAccessibilityReadingInfoType")] + public static extern void DaliToolkitDevelControlSetAccessibilityReadingInfoType(global::System.Runtime.InteropServices.HandleRef arg1, Tizen.NUI.BaseComponents.ReadingInfoTypes arg2); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_new_ReadingInfoType")] + public static extern global::System.IntPtr DaliToolkitDevelControlNewReadingInfoType(); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_new_GetAccessibilityReadingInfoType")] + public static extern global::System.IntPtr DaliToolkitDevelControlNewGetAccessibilityReadingInfoType(global::System.Runtime.InteropServices.HandleRef arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_delete_ReadingInfoType")] + public static extern void DaliToolkitDevelControlDeleteReadingInfoType(IntPtr arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_ReadingInfoTypes_Get")] + public static extern bool DaliToolkitDevelControlReadingInfoTypesGet(Tizen.NUI.BaseComponents.ReadingInfoTypes arg1, int arg2); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_ReadingInfoTypes_Set")] + public static extern void DaliToolkitDevelControlReadingInfoTypesSet(Tizen.NUI.BaseComponents.ReadingInfoTypes arg1, int arg2, int arg3); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_ClearAccessibilityHighlight")] + public static extern bool DaliToolkitDevelControlClearAccessibilityHighlight(global::System.Runtime.InteropServices.HandleRef arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_GrabAccessibilityHighlight")] + public static extern bool DaliToolkitDevelControlGrabAccessibilityHighlight(global::System.Runtime.InteropServices.HandleRef arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_new_GetAccessibilityStates")] + public static extern global::System.IntPtr DaliToolkitDevelControlNewGetAccessibilityStates(global::System.Runtime.InteropServices.HandleRef arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_new_States")] + public static extern global::System.IntPtr DaliToolkitDevelControlNewStates(); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_delete_States")] + public static extern void DaliToolkitDevelControlDeleteStates(IntPtr arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_States_Copy")] + public static extern IntPtr DaliToolkitDevelControlStatesCopy(Tizen.NUI.BaseComponents.AccessibilityStates arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_States_Get")] + public static extern bool DaliToolkitDevelControlStatesGet(Tizen.NUI.BaseComponents.AccessibilityStates arg1, int arg2); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_States_Set")] + public static extern void DaliToolkitDevelControlStatesSet(Tizen.NUI.BaseComponents.AccessibilityStates arg1, int arg2, int arg3); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_NotifyAccessibilityStateChange")] + public static extern global::System.IntPtr DaliToolkitDevelControlNotifyAccessibilityStateChange(global::System.Runtime.InteropServices.HandleRef arg1, Tizen.NUI.BaseComponents.AccessibilityStates arg2, int arg3); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_GetBoundAccessibilityObject")] + public static extern global::System.IntPtr DaliToolkitDevelControlGetBoundAccessibilityObject(global::System.Runtime.InteropServices.HandleRef arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_EmitAccessibilityEvent")] + public static extern global::System.IntPtr DaliAccessibilityEmitAccessibilityEvent(global::System.Runtime.InteropServices.HandleRef arg1, int arg2_event); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_EmitAccessibilityStateChangedEvent")] + public static extern global::System.IntPtr DaliAccessibilityEmitAccessibilityStateChangedEvent(global::System.Runtime.InteropServices.HandleRef arg1, int arg2_state, int arg3); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_EmitTextInsertedEvent")] + public static extern global::System.IntPtr DaliAccessibilityEmitTextInsertedEvent(global::System.Runtime.InteropServices.HandleRef arg1, int arg2_pos, int arg3_len, string arg3_content); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_EmitTextDeletedEvent")] + public static extern global::System.IntPtr DaliAccessibilityEmitTextDeletedEvent(global::System.Runtime.InteropServices.HandleRef arg1, int arg2_pos, int arg3_len, string arg3_content); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_EmitTextCaretMovedEvent")] + public static extern global::System.IntPtr DaliAccessibilityEmitTextCaretMovedEvent(global::System.Runtime.InteropServices.HandleRef arg1, int arg2_pos); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_new_Range")] + public static extern global::System.IntPtr DaliAccessibilityNewRange(int arg1_start, int arg2_end, string arg3_content); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_delete_Range")] + public static extern void DaliAccessibilityDeleteRange(IntPtr arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_Bridge_Add_Popup")] + public static extern void DaliAccessibilityBridgeAddPopup(global::System.Runtime.InteropServices.HandleRef arg1); + + [EditorBrowsable(EditorBrowsableState.Never)] + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_Bridge_Remove_Popup")] + public static extern void DaliAccessibilityBridgeRemovePopup(global::System.Runtime.InteropServices.HandleRef arg1); + + // SetAccessibilityConstructor + + // Keep this structure layout binary compatible with the respective C++ structure! + [EditorBrowsable(EditorBrowsableState.Never)] + [StructLayout(LayoutKind.Sequential)] + public class AccessibilityDelegate + { + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate IntPtr AccessibilityGetName(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetName GetName; // 1 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate IntPtr AccessibilityGetDescription(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetDescription GetDescription; // 2 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool AccessibilityDoAction(IntPtr name); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityDoAction DoAction; // 3 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate IntPtr AccessibilityCalculateStates(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityCalculateStates CalculateStates; // 4 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate int AccessibilityGetActionCount(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetActionCount GetActionCount; // 5 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate IntPtr AccessibilityGetActionName(int index); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetActionName GetActionName; // 6 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool AccessibilityShouldReportZeroChildren(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityShouldReportZeroChildren ShouldReportZeroChildren; // 7 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate double AccessibilityGetMinimum(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetMinimum GetMinimum; // 8 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate double AccessibilityGetCurrent(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetCurrent GetCurrent; // 9 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate double AccessibilityGetMaximum(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetMaximum GetMaximum; // 10 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool AccessibilitySetCurrent(double value); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilitySetCurrent SetCurrent; // 11 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate double AccessibilityGetMinimumIncrement(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetMinimumIncrement GetMinimumIncrement; // 12 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool AccessibilityIsScrollable(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityIsScrollable IsScrollable; // 13 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate IntPtr AccessibilityGetText(int startOffset, int endOffset); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetText GetText; // 14 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate int AccessibilityGetCharacterCount(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetCharacterCount GetCharacterCount; // 15 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate int AccessibilityGetCaretOffset(); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetCaretOffset GetCaretOffset; // 16 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool AccessibilitySetCaretOffset(int offset); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilitySetCaretOffset SetCaretOffset; // 17 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate IntPtr AccessibilityGetTextAtOffset(int offset, int boundary); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetTextAtOffset GetTextAtOffset; // 18 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate IntPtr AccessibilityGetSelection(int selectionNum); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGetSelection GetSelection; // 19 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool AccessibilityRemoveSelection(int selectionNum); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityRemoveSelection RemoveSelection; // 20 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilitySetSelection SetSelection; // 21 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool AccessibilityCopyText(int startPosition, int endPosition); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityCopyText CopyText; // 22 + + [UnmanagedFunctionPointer(CallingConvention.Cdecl)] + public delegate bool AccessibilityCutText(int startPosition, int endPosition); + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityCutText CutText; // 23 + } + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_SetAccessibilityConstructor_NUI")] + public static extern void DaliToolkitDevelControlSetAccessibilityConstructor(HandleRef arg1_self, int arg2_role, int arg3_iface, IntPtr arg4_vtable, int arg5_vtableSize); + + [DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Toolkit_DevelControl_AccessibleImpl_NUI_DuplicateString")] + public static extern IntPtr DaliToolkitDevelControlAccessibleImplNUIDuplicateString(string arg); + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.DoGestureSignal.cs b/src/Tizen.NUI/src/internal/Interop/Interop.DoGestureSignal.cs new file mode 100755 index 0000000..d53fc2d --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.DoGestureSignal.cs @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class DoGestureSignal + { + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_new")] + public static extern global::System.IntPtr New(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_delete")] + public static extern void Delete(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_Empty")] + public static extern bool Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_GetConnectionCount")] + public static extern uint GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_Connect")] + public static extern void Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_Disconnect")] + public static extern void Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_Emit")] + public static extern void Emit(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_GetSizeOfGestureInfo")] + public static extern uint GetSizeOfGestureInfo(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_GetResult")] + public static extern int GetResult(global::System.IntPtr jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_GesturePairToVoid_SetResult")] + public static extern void SetResult(global::System.IntPtr jarg1, int result); + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.StringToVoidSignal.cs b/src/Tizen.NUI/src/internal/Interop/Interop.StringToVoidSignal.cs new file mode 100755 index 0000000..ea160e0 --- /dev/null +++ b/src/Tizen.NUI/src/internal/Interop/Interop.StringToVoidSignal.cs @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tizen.NUI +{ + internal static partial class Interop + { + internal static partial class StringToVoidSignal + { + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_StringToVoid_new")] + public static extern global::System.IntPtr New(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_StringToVoid_delete")] + public static extern void Delete(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_StringToVoid_Empty")] + public static extern bool Empty(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_StringToVoid_GetConnectionCount")] + public static extern uint GetConnectionCount(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_StringToVoid_Connect")] + public static extern void Connect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_StringToVoid_Disconnect")] + public static extern void Disconnect(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_StringToVoid_Emit")] + public static extern void Emit(global::System.Runtime.InteropServices.HandleRef jarg1); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Signal_StringToVoid_Convert_Param1")] + public static extern string ConvertParam1(global::System.IntPtr jarg1); + } + } +} diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.View.cs b/src/Tizen.NUI/src/internal/Interop/Interop.View.cs index ed58cf2..1733337 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.View.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.View.cs @@ -33,6 +33,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_View")] public static extern void DeleteView(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_delete_View")] + public static extern void DeleteControlHandleView(global::System.IntPtr jarg1); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Assign")] public static extern global::System.IntPtr Assign(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs b/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs index fb48f1b..7a0dac0 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.ViewProperty.cs @@ -68,6 +68,27 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_SHADOW_get")] public static extern int ShadowGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_ACCESSIBILITY_NAME_get")] + public static extern int AccessibilityNameGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_ACCESSIBILITY_DESCRIPTION_get")] + public static extern int AccessibilityDescriptionGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_ACCESSIBILITY_TRANSLATION_DOMAIN_get")] + public static extern int AccessibilityTranslationDomainGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_ACCESSIBILITY_ROLE_get")] + public static extern int AccessibilityRoleGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_ACCESSIBILITY_HIGHLIGHTABLE_get")] + public static extern int AccessibilityHighlightableGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_ACCESSIBILITY_ATTRIBUTES_get")] + public static extern int AccessibilityAttributesGet(); + + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_View_Property_ACCESSIBILITY_ANIMATED_get")] + public static extern int AccessibilityAnimatedGet(); } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/CustomView.cs b/src/Tizen.NUI/src/public/BaseComponents/CustomView.cs index 458685e..78bc281 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/CustomView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/CustomView.cs @@ -144,6 +144,8 @@ namespace Tizen.NUI.BaseComponents /// 3 public virtual void OnInitialize() { + SetAccessibilityConstructor(Role.Unknown); + AppendAccessibilityAttribute("t", this.GetType().Name); } /// @@ -485,6 +487,87 @@ namespace Tizen.NUI.BaseComponents { } + [EditorBrowsable(EditorBrowsableState.Never)] + protected override bool AccessibilityDoAction(string name) + { + if (name == AccessibilityActivateAction) + { + if (this.ActivateSignal().Empty() == false) + { + this.ActivateSignal().Emit(); + return true; + } + else + { + return OnAccessibilityActivated(); + } + } + else if (name == AccessibilityReadingSkippedAction) + { + if (this.ReadingSkippedSignal().Empty() == false) + { + this.ReadingSkippedSignal().Emit(); + return true; + } + else + { + return OnAccessibilityReadingSkipped(); + } + } + else if (name == AccessibilityReadingCancelledAction) + { + if (this.ReadingCancelledSignal().Empty() == false) + { + this.ReadingCancelledSignal().Emit(); + return true; + } + else + { + return OnAccessibilityReadingCancelled(); + } + } + else if (name == AccessibilityReadingStoppedAction) + { + if (this.ReadingStoppedSignal().Empty() == false) + { + this.ReadingStoppedSignal().Emit(); + return true; + } + else + { + return OnAccessibilityReadingStopped(); + } + } + else if (name == AccessibilityReadingPausedAction) + { + if (this.ReadingPausedSignal().Empty() == false) + { + this.ReadingPausedSignal().Emit(); + return true; + } + else + { + return OnAccessibilityReadingPaused(); + } + } + else if (name == AccessibilityReadingResumedAction) + { + if (this.ReadingResumedSignal().Empty() == false) + { + this.ReadingResumedSignal().Emit(); + return true; + } + else + { + return OnAccessibilityReadingResumed(); + } + } + else + { + return false; + } + } + /// /// This method is called when the control accessibility is activated.
/// Derived classes should override this to perform custom accessibility activation.
@@ -496,6 +579,48 @@ namespace Tizen.NUI.BaseComponents } /// + /// This method is called when reading is skipped. + /// + /// True if information was served. + internal virtual bool OnAccessibilityReadingSkipped() + { + return false; + } + + /// + /// This method is called when reading is cancelled. + /// + /// True if information was served. + internal virtual bool OnAccessibilityReadingCancelled() + { + return false; + } + /// + /// This method is called when reading is stopped. + /// + /// True if information was served. + internal virtual bool OnAccessibilityReadingStopped() + { + return false; + } + /// + /// This method is called when reading was paused. + /// + /// True if information was served. + internal virtual bool OnAccessibilityReadingPaused() + { + return false; + } + /// + /// This method is called when reading is resumed. + /// + /// True if information was served. + internal virtual bool OnAccessibilityReadingResumed() + { + return false; + } + + /// /// This method should be overridden by deriving classes when they wish to respond the accessibility. /// /// The pan gesture. diff --git a/src/Tizen.NUI/src/public/BaseComponents/View.cs b/src/Tizen.NUI/src/public/BaseComponents/View.cs index e8de926..54c9aea 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/View.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/View.cs @@ -479,6 +479,194 @@ namespace Tizen.NUI.BaseComponents } } + // + // Accessibility + // + + [EditorBrowsable(EditorBrowsableState.Never)] + protected bool IsHighlighted + { + get + { + return Accessibility.AccessibilityManager.Instance.GetCurrentFocusView() == this; + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected static readonly string AccessibilityActivateAction = "activate"; + [EditorBrowsable(EditorBrowsableState.Never)] + protected static readonly string AccessibilityReadingSkippedAction = "ReadingSkipped"; + [EditorBrowsable(EditorBrowsableState.Never)] + protected static readonly string AccessibilityReadingCancelledAction = "ReadingCancelled"; + [EditorBrowsable(EditorBrowsableState.Never)] + protected static readonly string AccessibilityReadingStoppedAction = "ReadingStopped"; + [EditorBrowsable(EditorBrowsableState.Never)] + protected static readonly string AccessibilityReadingPausedAction = "ReadingPaused"; + [EditorBrowsable(EditorBrowsableState.Never)] + protected static readonly string AccessibilityReadingResumedAction = "ReadingResumed"; + + [EditorBrowsable(EditorBrowsableState.Never)] + private static readonly string[] AccessibilityActions = { + AccessibilityActivateAction, + AccessibilityReadingSkippedAction, + AccessibilityReadingCancelledAction, + AccessibilityReadingStoppedAction, + AccessibilityReadingPausedAction, + AccessibilityReadingResumedAction, + }; + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual string AccessibilityGetName() + { + return ""; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual string AccessibilityGetDescription() + { + return ""; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual bool AccessibilityDoAction(string name) + { + return false; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual AccessibilityStates AccessibilityCalculateStates() + { + var states = new AccessibilityStates(); + states.Set(AccessibilityState.Highlightable, this.AccessibilityHighlightable); + states.Set(AccessibilityState.Focusable, this.Focusable); + states.Set(AccessibilityState.Focused, this.State == States.Focused); + states.Set(AccessibilityState.Highlighted, this.IsHighlighted); + states.Set(AccessibilityState.Enabled, this.State != States.Disabled); + states.Set(AccessibilityState.Sensitive, this.Sensitive); + states.Set(AccessibilityState.Animated, this.AccessibilityAnimated); + states.Set(AccessibilityState.Visible, true); + states.Set(AccessibilityState.Showing, this.Visibility); + states.Set(AccessibilityState.Defunct, !this.IsOnWindow); + return states; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual int AccessibilityGetActionCount() + { + return AccessibilityActions.Length; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual string AccessibilityGetActionName(int index) + { + if (index >= 0 && index < AccessibilityActions.Length) + return AccessibilityActions[index]; + else + return ""; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual bool AccessibilityShouldReportZeroChildren() + { + return false; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual double AccessibilityGetMinimum() + { + return 0.0; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual double AccessibilityGetCurrent() + { + return 0.0; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual double AccessibilityGetMaximum() + { + return 0.0; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual bool AccessibilitySetCurrent(double value) + { + return false; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual double AccessibilityGetMinimumIncrement() + { + return 0.0; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual bool AccessibilityIsScrollable() + { + return false; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual string AccessibilityGetText(int startOffset, int endOffset) + { + return ""; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual int AccessibilityGetCharacterCount() + { + return 0; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual int AccessibilityGetCaretOffset() + { + return 0; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual bool AccessibilitySetCaretOffset(int offset) + { + return false; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual AccessibilityRange AccessibilityGetTextAtOffset(int offset, TextBoundary boundary) + { + return new AccessibilityRange(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum) + { + return new AccessibilityRange(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual bool AccessibilityRemoveSelection(int selectionNum) + { + return false; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset) + { + return false; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual bool AccessibilityCopyText(int startPosition, int endPosition) + { + return false; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected virtual bool AccessibilityCutText(int startPosition, int endPosition) + { + return false; + } + /// /// Whether the CornerRadius property value is relative (percentage [0.0f to 1.0f] of the view size) or absolute (in world units). /// It is absolute by default. diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs new file mode 100755 index 0000000..40f1d4c --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs @@ -0,0 +1,426 @@ +/* + * Copyright(c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using Tizen.NUI; + +namespace Tizen.NUI.BaseComponents +{ + [EditorBrowsable(EditorBrowsableState.Never)] + public class Address { + [EditorBrowsable(EditorBrowsableState.Never)] + public Address(string xbus, string xpath) { + bus = xbus; + path = xpath; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public string bus { get; set; } + [EditorBrowsable(EditorBrowsableState.Never)] + public string path { get; set; } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public class AddressCollection : SafeHandle { + [EditorBrowsable(EditorBrowsableState.Never)] + public AddressCollection(IntPtr collection) : base(collection, true) {} + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool IsInvalid { get { return this.handle == IntPtr.Zero; }} + + [EditorBrowsable(EditorBrowsableState.Never)] + public uint RelationSize(View.RelationType relation) { + uint result = Interop.ControlDevel.DaliToolkitDevelControlAccessibilityRelationsRelationSize(this, Convert.ToInt32(relation)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public Address At(View.RelationType relation, int position) { + var bus = Interop.ControlDevel.DaliToolkitDevelControlAccessibilityRelationsAt(this, Convert.ToInt32(relation), position, 0); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + var path = Interop.ControlDevel.DaliToolkitDevelControlAccessibilityRelationsAt(this, Convert.ToInt32(relation), position, 1); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + + return new Address(bus, path); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected override bool ReleaseHandle() { + Interop.ControlDevel.DaliToolkitDevelControlDeleteAccessibilityRelations(handle); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public partial class ReadingInfoTypes : SafeHandle { + [EditorBrowsable(EditorBrowsableState.Never)] + public ReadingInfoTypes() : base (IntPtr.Zero, true) { + var obj = Interop.ControlDevel.DaliToolkitDevelControlNewReadingInfoType(); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + this.SetHandle(obj); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public ReadingInfoTypes(IntPtr ptr) : base(ptr, true) {} + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool IsInvalid { get { return this.handle == IntPtr.Zero; }} + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Set(ReadingInfoType type, bool v) { + Interop.ControlDevel.DaliToolkitDevelControlReadingInfoTypesSet(this, (int)type, Convert.ToInt32(v)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Get(ReadingInfoType type) { + bool result = Interop.ControlDevel.DaliToolkitDevelControlReadingInfoTypesGet(this, (int)type); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected override bool ReleaseHandle() { + Interop.ControlDevel.DaliToolkitDevelControlDeleteReadingInfoType(handle); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public partial class AccessibilityStates : SafeHandle { + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityStates() : base (IntPtr.Zero, true) { + var obj = Interop.ControlDevel.DaliToolkitDevelControlNewStates(); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + this.SetHandle(obj); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityStates(IntPtr states) : base(states, true) {} + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool IsInvalid { get { return this.handle == IntPtr.Zero; }} + + [EditorBrowsable(EditorBrowsableState.Never)] + public void Set(AccessibilityState type, bool v) { + Interop.ControlDevel.DaliToolkitDevelControlStatesSet(this, (int)type, Convert.ToInt32(v)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool Get(AccessibilityState type) { + bool result = Interop.ControlDevel.DaliToolkitDevelControlStatesGet(this, (int)type); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected override bool ReleaseHandle() { + Interop.ControlDevel.DaliToolkitDevelControlDeleteStates(handle); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public class AccessibilityRange { + public int StartOffset { get; set; } = 0; + public int EndOffset { get; set; } = 0; + public string Content { get; set; } = ""; + } + + /// + /// View is the base class for all views. + /// + /// 3 + public partial class View + { + /////////////////////////////////////////////////////////////////// + // ****************** Accessiblity Attributes ****************** // + /////////////////////////////////////////////////////////////////// + + [EditorBrowsable(EditorBrowsableState.Never)] + public void AppendAccessibilityAttribute(string key, string val) { + Interop.ControlDevel.DaliToolkitDevelControlAppendAccessibilityAttribute(SwigCPtr, key, val); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void RemoveAccessibilityAttribute(string key) { + Interop.ControlDevel.DaliToolkitDevelControlRemoveAccessibilityAttribute(SwigCPtr, key); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void ClearAccessibilityAttributes() { + Interop.ControlDevel.DaliToolkitDevelControlClearAccessibilityAttributes(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /////////////////////////////////////////////////////////////////// + // ************************** Highlight ************************ // + /////////////////////////////////////////////////////////////////// + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool ClearAccessibilityHighlight() { + bool result = Interop.ControlDevel.DaliToolkitDevelControlClearAccessibilityHighlight(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool GrabAccessibilityHighlight() { + bool result = Interop.ControlDevel.DaliToolkitDevelControlGrabAccessibilityHighlight(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + /////////////////////////////////////////////////////////////////// + // ****************** Accessiblity Relations ******************* // + /////////////////////////////////////////////////////////////////// + + [EditorBrowsable(EditorBrowsableState.Never)] + public void AppendAccessibilityRelation(View second, RelationType relation) { + Interop.ControlDevel.DaliToolkitDevelControlAppendAccessibilityRelation(SwigCPtr, second.SwigCPtr, (int)relation); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void RemoveAccessibilityRelation(View second, RelationType relation) { + Interop.ControlDevel.DaliToolkitDevelControlRemoveAccessibilityRelation(SwigCPtr, second.SwigCPtr, (int)relation); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void ClearAccessibilityRelations() { + Interop.ControlDevel.DaliToolkitDevelControlClearAccessibilityRelations(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public AddressCollection GetAccessibilityRelations() { + var result = new AddressCollection(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityRelations(SwigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetAccessibilityReadingInfoType(ReadingInfoTypes types) { + Interop.ControlDevel.DaliToolkitDevelControlSetAccessibilityReadingInfoType(SwigCPtr, types); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public ReadingInfoTypes GetAccessibilityReadingInfoType() { + var result = new ReadingInfoTypes(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityReadingInfoType(SwigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + /////////////////////////////////////////////////////////////////// + // ****************** Accessiblity Relations ******************* // + /////////////////////////////////////////////////////////////////// + + [EditorBrowsable(EditorBrowsableState.Never)] + public void NotifyAccessibilityStateChange(AccessibilityStates states, bool recursive) { + Interop.ControlDevel.DaliToolkitDevelControlNotifyAccessibilityStateChange(SwigCPtr, states, Convert.ToInt32(recursive)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityStates GetAccessibilityStates() { + var result = new AccessibilityStates(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityStates(SwigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return result; + } + + /////////////////////////////////////////////////////////////////// + // ************************ Accessible ************************* // + /////////////////////////////////////////////////////////////////// + + [EditorBrowsable(EditorBrowsableState.Never)] + public void EmitAccessibilityEvent(ObjectPropertyChangeEvent e) { + Interop.ControlDevel.DaliAccessibilityEmitAccessibilityEvent(SwigCPtr, Convert.ToInt32(e)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void EmitAccessibilityStateChangedEvent(AccessibilityState e, bool b) { + Interop.ControlDevel.DaliAccessibilityEmitAccessibilityStateChangedEvent(SwigCPtr, Convert.ToInt32(e), Convert.ToInt32(b)); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void EmitTextInsertedEvent(int position, int length, string content) { + Interop.ControlDevel.DaliAccessibilityEmitTextInsertedEvent(SwigCPtr, position, length, content); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void EmitTextDeletedEvent(int position, int length, string content) { + Interop.ControlDevel.DaliAccessibilityEmitTextDeletedEvent(SwigCPtr, position, length, content); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void EmitTextCaretMovedEvent(int position) { + Interop.ControlDevel.DaliAccessibilityEmitTextCaretMovedEvent(SwigCPtr, position); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + /////////////////////////////////////////////////////////////////// + // ************************** Bridge *************************** // + /////////////////////////////////////////////////////////////////// + + [EditorBrowsable(EditorBrowsableState.Never)] + public void AddPopup() { + Interop.ControlDevel.DaliAccessibilityBridgeAddPopup(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void RemovePopup() { + Interop.ControlDevel.DaliAccessibilityBridgeRemovePopup(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + private IntPtr strdup(string arg) + { + return Interop.ControlDevel.DaliToolkitDevelControlAccessibleImplNUIDuplicateString(arg ?? ""); + } + + private IntPtr statesdup(AccessibilityStates states) + { + return Interop.ControlDevel.DaliToolkitDevelControlStatesCopy(states); + } + + private IntPtr rangedup(AccessibilityRange range) + { + return Interop.ControlDevel.DaliAccessibilityNewRange(range.StartOffset, range.EndOffset, range.Content); + } + + private Interop.ControlDevel.AccessibilityDelegate _accessibilityDelegate = null; + private IntPtr _accessibilityDelegatePtr; + + [EditorBrowsable(EditorBrowsableState.Never)] + public enum AccessibilityInterface + { + None = 0, + Value = 1, + EditableText = 2, + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public void SetAccessibilityConstructor(Role role, AccessibilityInterface iface = AccessibilityInterface.None) + { + var size = Marshal.SizeOf(); + + if (_accessibilityDelegate == null) + { + _accessibilityDelegate = new Interop.ControlDevel.AccessibilityDelegate() + { + GetName = () => strdup(AccessibilityGetName()), + GetDescription = () => strdup(AccessibilityGetDescription()), + DoAction = (name) => AccessibilityDoAction(Marshal.PtrToStringAnsi(name)), + CalculateStates = () => statesdup(AccessibilityCalculateStates()), + GetActionCount = () => AccessibilityGetActionCount(), + GetActionName = (index) => strdup(AccessibilityGetActionName(index)), + ShouldReportZeroChildren = () => AccessibilityShouldReportZeroChildren(), + GetMinimum = () => AccessibilityGetMinimum(), + GetCurrent = () => AccessibilityGetCurrent(), + GetMaximum = () => AccessibilityGetMaximum(), + SetCurrent = (value) => AccessibilitySetCurrent(value), + GetMinimumIncrement = () => AccessibilityGetMinimumIncrement(), + IsScrollable = () => AccessibilityIsScrollable(), + GetText = (startOffset, endOffset) => strdup(AccessibilityGetText(startOffset, endOffset)), + GetCharacterCount = () => AccessibilityGetCharacterCount(), + GetCaretOffset = () => AccessibilityGetCaretOffset(), + SetCaretOffset = (offset) => AccessibilitySetCaretOffset(offset), + GetTextAtOffset = (offset, boundary) => rangedup(AccessibilityGetTextAtOffset(offset, (TextBoundary)boundary)), + GetSelection = (selectionNum) => rangedup(AccessibilityGetSelection(selectionNum)), + RemoveSelection = (selectionNum) => AccessibilityRemoveSelection(selectionNum), + SetSelection = (selectionNum, startOffset, endOffset) => AccessibilitySetSelection(selectionNum, startOffset, endOffset), + CopyText = (startPosition, endPosition) => AccessibilityCopyText(startPosition, endPosition), + CutText = (startPosition, endPosition) => AccessibilityCutText(startPosition, endPosition), + }; + + _accessibilityDelegatePtr = Marshal.AllocHGlobal(size); + Marshal.StructureToPtr(_accessibilityDelegate, _accessibilityDelegatePtr, false); + } + + Interop.ControlDevel.DaliToolkitDevelControlSetAccessibilityConstructor(SwigCPtr, (int)role, (int)iface, _accessibilityDelegatePtr, size); + + + if (NDalicPINVOKE.SWIGPendingException.Pending) + throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); + + if (_accessibilityDelegate != null) + { + Marshal.DestroyStructure(_accessibilityDelegatePtr); + Marshal.FreeHGlobal(_accessibilityDelegatePtr); + _accessibilityDelegate = null; + } + } + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEnum.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEnum.cs new file mode 100755 index 0000000..b409ee0 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEnum.cs @@ -0,0 +1,327 @@ +/* + * Copyright(c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using Tizen.NUI; + +namespace Tizen.NUI.BaseComponents +{ + public partial class ReadingInfoTypes + { + [EditorBrowsable(EditorBrowsableState.Never)] + public enum ReadingInfoType + { + Name = 0, + Role, + Description, + State + }; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public enum AccessibilityGesture + { + OneFingerHover = 0, + TwoFingerHover, + ThreeFingerHover, + OneFingerFlickLeft, + OneFingerFlickRight, + OneFingerFlickUp, + OneFingerFlickDown, + TwoFingersFlickLeft, + TwoFingersFlickRight, + TwoFingersFlickUp, + TwoFingersFlickDown, + ThreeFingersFlickLeft, + ThreeFingersFlickRight, + ThreeFingersFlickUp, + ThreeFingersFlickDown, + OneFingerSingleTap, + OneFingerDoubleTap, + OneFingerTripleTap, + TwoFingersSingleTap, + TwoFingersDoubleTap, + TwoFingersTripleTap, + ThreeFingersSingleTap, + ThreeFingersDoubleTap, + ThreeFingersTripleTap, + OneFingerFlickLeftReturn, + OneFingerFlickRightReturn, + OneFingerFlickUpReturn, + OneFingerFlickDownReturn, + TwoFingersFlickLeftReturn, + TwoFingersFlickRightReturn, + TwoFingersFlickUpReturn, + TwoFingersFlickDownReturn, + ThreeFingersFlickLeftReturn, + ThreeFingersFlickRightReturn, + ThreeFingersFlickUpReturn, + ThreeFingersFlickDownReturn, + OneFingerDoubleTapNHold, + TwoFingersDoubleTapNHold, + ThreeFingersDoubleTapNHold, + MaxCount + }; + + [EditorBrowsable(EditorBrowsableState.Never)] + public enum AccessibilityGestureState + { + Begin = 0, + Ongoing, + Ended, + Aborted + }; + + + [EditorBrowsable(EditorBrowsableState.Never)] + public enum AccessibilityState + { + Invalid = 0, + Active, + Armed, + Busy, + Checked, + Collapsed, + Defunct, + Editable, + Enabled, + Expandable, + Expanded, + Focusable, + Focused, + HasTooltip, + Horizontal, + Iconified, + Modal, + MultiLine, + MultiSelectable, + Opaque, + Pressed, + Resizeable, + Selectable, + Selected, + Sensitive, + Showing, + SingleLine, + Stale, + Transient, + Vertical, + Visible, + ManagesDescendants, + Indeterminate, + Required, + Truncated, + Animated, + InvalidEntry, + SupportsAutocompletion, + SelectableText, + IsDefault, + Visited, + Checkable, + HasPopup, + ReadOnly, + Highlighted, + Highlightable, + MaxCount, + }; + + /// + /// View is the base class for all views. + /// + /// 3 + public partial class View + { + + [EditorBrowsable(EditorBrowsableState.Never)] + public enum RelationType + { + NullOf = 0, + LabelFor, + LabelledBy, + ControllerFor, + ControlledBy, + MemberOf, + TooltipFor, + NodeChildOf, + NodeParentOf, + Extended, + FlowsTo, + FlowsFrom, + SubwindowOf, + Embeds, + EmbeddedBy, + PopupFor, + ParentWindowOf, + DescriptionFor, + DescribedBy, + Details, + DetailsFor, + ErrorMessage, + ErrorFor, + MaxCount + }; + + [EditorBrowsable(EditorBrowsableState.Never)] + public enum Role + { + Invalid, + AcceleratorLabel, + Alert, + Animation, + Arrow, + Calendar, + Canvas, + CheckBox, + CheckMenuItem, + ColorChooser, + ColumnHeader, + ComboBox, + DateEditor, + DesktopIcon, + DesktopFrame, + Dial, + Dialog, + DirectoryPane, + DrawingArea, + FileChooser, + Filler, + FocusTraversable, + FontChooser, + Frame, + GlassPane, + HtmlContainer, + Icon, + Image, + InternalFrame, + Label, + LayeredPane, + List, + ListItem, + Menu, + MenuBar, + MenuItem, + OptionPane, + PageTab, + PageTabList, + Panel, + PasswordText, + PopupMenu, + ProgressBar, + PushButton, + RadioButton, + RadioMenuItem, + RootPane, + RowHeader, + ScrollBar, + ScrollPane, + Separator, + Slider, + SpinButton, + SplitPane, + StatusBar, + Table, + TableCell, + TableColumnHeader, + TableRowHeader, + TearoffMenuItem, + Terminal, + Text, + ToggleButton, + ToolBar, + ToolTip, + Tree, + TreeTable, + Unknown, + Viewport, + Window, + Extended, + Header, + Footer, + Paragraph, + Ruler, + Application, + Autocomplete, + Editbar, + Embedded, + Entry, + Chart, + Caption, + DocumentFrame, + Heading, + Page, + Section, + RedundantObject, + Form, + Link, + InputMethodWindow, + TableRow, + TreeItem, + DocumentSpreadsheet, + DocumentPresentation, + DocumentText, + DocumentWeb, + DocumentEmail, + Comment, + ListBox, + Grouping, + ImageMap, + Notification, + InfoBar, + LevelBar, + TitleBar, + BlockQuote, + Audio, + Video, + Definition, + Article, + Landmark, + Log, + Marquee, + Math, + Rating, + Timer, + Static, + MathFraction, + MathRoot, + Subscript, + Superscript, + MaxCount + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public enum ObjectPropertyChangeEvent + { + Name, + Description, + Value, + Role, + Parent + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public enum TextBoundary + { + Character, + Word, + Sentence, + Line, + Paragraph, + } + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEvent.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEvent.cs new file mode 100755 index 0000000..3052cc4 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEvent.cs @@ -0,0 +1,463 @@ +/* + * Copyright(c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using Tizen.NUI.Components; +using Tizen.NUI; + +namespace Tizen.NUI.BaseComponents +{ + [EditorBrowsable(EditorBrowsableState.Never)] + [StructLayout(LayoutKind.Sequential)] + public struct GestureInfoType { + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGesture type { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public int xBeg { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public int xEnd { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public int yBeg { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public int yEnd { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public AccessibilityGestureState state { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public uint eventTime { get; set; } + + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(System.Object obj) + { + if ((obj == null) || !this.GetType().Equals(obj.GetType())) + return false; + + GestureInfoType sec = (GestureInfoType)obj; + return + type == sec.type && + xBeg == sec.xBeg && + xEnd == sec.xEnd && + yBeg == sec.yBeg && + yEnd == sec.yEnd && + state == sec.state && + eventTime == sec.eventTime; + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() + { + return Tuple.Create((int)type, xBeg, xEnd, yBeg, yEnd, (int)state, eventTime).GetHashCode(); + } + } + + /// + /// View is the base class for all views. + /// + /// 3 + public partial class View + { + internal class ControlHandle : SafeHandle { + public ControlHandle() : base (IntPtr.Zero, true) {} + + public ControlHandle(IntPtr ptr) : base(ptr, true) {} + + public override bool IsInvalid { + get { + return this.handle == IntPtr.Zero; + } + } + + protected override bool ReleaseHandle() { + Interop.View.DeleteControlHandleView(handle); + this.SetHandle(IntPtr.Zero); + return true; + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + ControlHandle GetControl() { + var ret = new ControlHandle(Interop.View.DownCast(SwigCPtr)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /////////////////////////////////////////////////////////////////// + // ***************** AccessiblityDoGestureSignal ****************// + /////////////////////////////////////////////////////////////////// + + private delegate void GestureInfoHandlerType(IntPtr data); + private GestureInfoHandlerType gestureInfoCallback; + private EventHandler gestureInfoHandler; + + [EditorBrowsable(EditorBrowsableState.Never)] + public class GestureInfoEventArgs : EventArgs + { + public GestureInfoType gestureInfo { get; internal set; } + public int boolValue { get; set; } + } + + private void OnGestureInfoEvent(IntPtr data) { + if (data == IntPtr.Zero) + return; + + if (Marshal.SizeOf() != AccessibilityDoGestureSignal.GetSizeOfGestureInfo()) { + throw new global::System.ApplicationException("ABI mismatch SizeOf(C# GestureInfo) != SizeOf(c++ GestureInfo)"); + } + + var arg = new GestureInfoEventArgs(); + + arg.boolValue = AccessibilityDoGestureSignal.GetResult(data); + arg.gestureInfo = (GestureInfoType)Marshal.PtrToStructure(data, typeof(GestureInfoType)); + + gestureInfoHandler?.Invoke(this, arg); + + AccessibilityDoGestureSignal.SetResult(data, Convert.ToInt32(arg.boolValue)); + } + + // This uses DoGestureInfo signal from C++ API. + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler GestureInfoReceived { + add { + if (gestureInfoHandler == null) { + gestureInfoCallback = OnGestureInfoEvent; + GestureInfoSignal().Connect(gestureInfoCallback); + } + gestureInfoHandler += value; + } + remove { + gestureInfoHandler -= value; + if (gestureInfoHandler == null && GestureInfoSignal().Empty() == false) + GestureInfoSignal().Disconnect(gestureInfoCallback); + } + } + + internal AccessibilityDoGestureSignal GestureInfoSignal() { + var handle = GetControl(); + AccessibilityDoGestureSignal ret = new AccessibilityDoGestureSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityDoGestureSignal(handle), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /////////////////////////////////////////////////////////////////// + // ************** AccessiblityGetDescriptionSignal ************* // + /////////////////////////////////////////////////////////////////// + + private delegate void GetDescriptionHandlerType(IntPtr data); + private GetDescriptionHandlerType getDescriptionCallback; + private EventHandler getDescriptionHandler; + + [EditorBrowsable(EditorBrowsableState.Never)] + public class GetDescriptionEventArgs : EventArgs + { + public string description { get; internal set; } + } + + private void OnGetDescriptionEvent(IntPtr data) { + if (data == IntPtr.Zero) + return; + + var arg = new GetDescriptionEventArgs(); + arg.description = StringToVoidSignal.ConvertParam1(data); + + getDescriptionHandler?.Invoke(this, arg); + } + + // This uses GetDescription signal from C++ API. + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler DescriptionRequested { + add { + if (getDescriptionHandler == null) { + getDescriptionCallback = OnGetDescriptionEvent; + GetDescriptionSignal().Connect(getDescriptionCallback); + } + getDescriptionHandler += value; + } + remove { + getDescriptionHandler -= value; + if (getDescriptionHandler == null && GetDescriptionSignal().Empty() == false) + GetDescriptionSignal().Disconnect(getDescriptionCallback); + } + } + + internal StringToVoidSignal GetDescriptionSignal() { + var handle = GetControl(); + StringToVoidSignal ret = new StringToVoidSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityGetDescriptionSignal(handle), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /////////////////////////////////////////////////////////////////// + // ***************** AccessiblityGetNameSignal ***************** // + /////////////////////////////////////////////////////////////////// + + private delegate void GetNameHandlerType(IntPtr data); + private GetNameHandlerType getNameCallback; + private EventHandler getNameHandler; + + [EditorBrowsable(EditorBrowsableState.Never)] + public class GetNameEventArgs : EventArgs + { + public string description { get; internal set; } + } + + private void OnGetNameEvent(IntPtr data) { + if (data == IntPtr.Zero) + return; + + var arg = new GetNameEventArgs(); + arg.description = StringToVoidSignal.ConvertParam1(data); + + getNameHandler?.Invoke(this, arg); + } + + // This uses GetName signal from C++ API. + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler NameRequested { + add { + if (getNameHandler == null) { + getNameCallback = OnGetNameEvent; + GetNameSignal().Connect(getNameCallback); + } + getNameHandler += value; + } + remove { + getNameHandler -= value; + if (getNameHandler == null && GetNameSignal().Empty() == false) + GetNameSignal().Disconnect(getNameCallback); + } + } + + internal StringToVoidSignal GetNameSignal() { + var handle = GetControl(); + StringToVoidSignal ret = new StringToVoidSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityGetNameSignal(handle), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /////////////////////////////////////////////////////////////////// + // **************** AccessibilityActivateSignal **************** // + /////////////////////////////////////////////////////////////////// + + private delegate void VoidHandlerType(); + private VoidHandlerType activateCallback; + private EventHandler activateHandler; + + private void OnActivateEvent() { + activateHandler?.Invoke(this, null); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler Activate { + add { + if (activateHandler == null) { + activateCallback = OnActivateEvent; + ActivateSignal().Connect(activateCallback); + } + activateHandler += value; + } + remove { + activateHandler -= value; + if (activateHandler == null && ActivateSignal().Empty() == false) + ActivateSignal().Disconnect(activateCallback); + } + } + + internal VoidSignal ActivateSignal() { + var handle = GetControl(); + VoidSignal ret = new VoidSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityActivateSignal(handle), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /////////////////////////////////////////////////////////////////// + // ************ AccessibilityReadingSkippedSignal ************** // + /////////////////////////////////////////////////////////////////// + + private VoidHandlerType readingSkippedCallback; + private EventHandler readingSkippedHandler; + + private void OnReadingSkippedEvent() { + readingSkippedHandler?.Invoke(this, null); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler ReadingSkipped { + add { + if (readingSkippedHandler == null) { + readingSkippedCallback = OnReadingSkippedEvent; + ReadingSkippedSignal().Connect(readingSkippedCallback); + } + readingSkippedHandler += value; + } + remove { + readingSkippedHandler -= value; + if (readingSkippedHandler == null && ReadingSkippedSignal().Empty() == false) + ReadingSkippedSignal().Disconnect(readingSkippedCallback); + } + } + + internal VoidSignal ReadingSkippedSignal() { + var handle = GetControl(); + VoidSignal ret = new VoidSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityReadingSkippedSignal(handle), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /////////////////////////////////////////////////////////////////// + // ************* AccessibilityReadingPausedSignal ************** // + /////////////////////////////////////////////////////////////////// + + private VoidHandlerType readingPausedCallback; + private EventHandler readingPausedHandler; + + private void OnReadingPausedEvent() { + readingPausedHandler?.Invoke(this, null); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler ReadingPaused { + add { + if (readingPausedHandler == null) { + readingPausedCallback = OnReadingPausedEvent; + ReadingPausedSignal().Connect(readingPausedCallback); + } + readingPausedHandler += value; + } + remove { + readingPausedHandler -= value; + if (readingPausedHandler == null && ReadingPausedSignal().Empty() == false) + ReadingPausedSignal().Disconnect(readingPausedCallback); + } + } + + internal VoidSignal ReadingPausedSignal() { + var handle = GetControl(); + VoidSignal ret = new VoidSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityReadingPausedSignal(handle), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /////////////////////////////////////////////////////////////////// + // ************* AccessibilityReadingResumedSignal ************* // + /////////////////////////////////////////////////////////////////// + + private VoidHandlerType readingResumedCallback; + private EventHandler readingResumedHandler; + + private void OnReadingResumedEvent() { + readingResumedHandler?.Invoke(this, null); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler ReadingResumed { + add { + if (readingResumedHandler == null) { + readingResumedCallback = OnReadingResumedEvent; + ReadingResumedSignal().Connect(readingResumedCallback); + } + readingResumedHandler += value; + } + remove { + readingResumedHandler -= value; + if (readingResumedHandler == null && ReadingResumedSignal().Empty() == false) + ReadingResumedSignal().Disconnect(readingResumedCallback); + } + } + + internal VoidSignal ReadingResumedSignal() { + var handle = GetControl(); + VoidSignal ret = new VoidSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityReadingResumedSignal(handle), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /////////////////////////////////////////////////////////////////// + // ************ AccessibilityReadingCancelledSignal ************ // + /////////////////////////////////////////////////////////////////// + + private VoidHandlerType readingCancelledCallback; + private EventHandler readingCancelledHandler; + + private void OnReadingCancelledEvent() { + readingCancelledHandler?.Invoke(this, null); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler ReadingCancelled { + add { + if (readingCancelledHandler == null) { + readingCancelledCallback = OnReadingCancelledEvent; + ReadingCancelledSignal().Connect(readingCancelledCallback); + } + readingCancelledHandler += value; + } + remove { + readingCancelledHandler -= value; + if (readingCancelledHandler == null && ReadingCancelledSignal().Empty() == false) + ReadingCancelledSignal().Disconnect(readingCancelledCallback); + } + } + + internal VoidSignal ReadingCancelledSignal() { + var handle = GetControl(); + VoidSignal ret = new VoidSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityReadingCancelledSignal(handle), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + + /////////////////////////////////////////////////////////////////// + // ************* AccessibilityReadingStoppedSignal ************* // + /////////////////////////////////////////////////////////////////// + + private VoidHandlerType readingStoppedCallback; + private EventHandler readingStoppedHandler; + + private void OnReadingStoppedEvent() { + readingStoppedHandler?.Invoke(this, null); + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public event EventHandler ReadingStopped { + add { + if (readingStoppedHandler == null) { + readingStoppedCallback = OnReadingStoppedEvent; + ReadingStoppedSignal().Connect(readingStoppedCallback); + } + readingStoppedHandler += value; + } + remove { + readingStoppedHandler -= value; + if (readingStoppedHandler == null && ReadingStoppedSignal().Empty() == false) + ReadingStoppedSignal().Disconnect(readingStoppedCallback); + } + } + + internal VoidSignal ReadingStoppedSignal() { + var handle = GetControl(); + VoidSignal ret = new VoidSignal(Interop.ControlDevel.DaliToolkitDevelControlAccessibilityReadingStoppedSignal(handle), false); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + return ret; + } + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityProperties.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityProperties.cs new file mode 100755 index 0000000..5f093b8 --- /dev/null +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityProperties.cs @@ -0,0 +1,111 @@ +/* + * Copyright(c) 2021 Samsung Electronics Co., Ltd. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +using System; +using System.ComponentModel; +using System.Runtime.InteropServices; +using Tizen.NUI; + +namespace Tizen.NUI.BaseComponents +{ + public partial class View + { + [EditorBrowsable(EditorBrowsableState.Never)] + public string AccessibilityName + { + get + { + return (string)GetValue(AccessibilityNameProperty); + } + set + { + SetValue(AccessibilityNameProperty, value); + NotifyPropertyChanged(); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public string AccessibilityDescription + { + get + { + return (string)GetValue(AccessibilityDescriptionProperty); + } + set + { + SetValue(AccessibilityDescriptionProperty, value); + NotifyPropertyChanged(); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public string AccessibilityTranslationDomain + { + get + { + return (string)GetValue(AccessibilityTranslationDomainProperty); + } + set + { + SetValue(AccessibilityTranslationDomainProperty, value); + NotifyPropertyChanged(); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public Role AccessibilityRole + { + get + { + return (Role)GetValue(AccessibilityRoleProperty); + } + set + { + SetValue(AccessibilityRoleProperty, value); + NotifyPropertyChanged(); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool AccessibilityHighlightable + { + get + { + return (bool)GetValue(AccessibilityHighlightableProperty); + } + set + { + SetValue(AccessibilityHighlightableProperty, value); + NotifyPropertyChanged(); + } + } + + [EditorBrowsable(EditorBrowsableState.Never)] + public bool AccessibilityAnimated + { + get + { + return (bool)GetValue(AccessibilityAnimatedProperty); + } + set + { + SetValue(AccessibilityAnimatedProperty, value); + NotifyPropertyChanged(); + } + } + } +} diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs index 73a302c..485a8b9 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewBindableProperty.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019 Samsung Electronics Co., Ltd. + * Copyright(c) 2019-2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -1651,6 +1651,130 @@ namespace Tizen.NUI.BaseComponents return ((View)bindable).themeChangeSensitive; }); + /// + /// AccessibilityNameProperty + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty AccessibilityNameProperty = BindableProperty.Create(nameof(AccessibilityName), typeof(string), typeof(View), string.Empty, propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityName, new Tizen.NUI.PropertyValue((string)newValue)); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + + string temp; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityName).Get(out temp); + return temp; + }); + + /// + /// AccessibilityDescriptionProperty + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty AccessibilityDescriptionProperty = BindableProperty.Create(nameof(AccessibilityDescription), typeof(string), typeof(View), string.Empty, propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityDescription, new Tizen.NUI.PropertyValue((string)newValue)); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + + string temp; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityDescription).Get(out temp); + return temp; + }); + + /// + /// AccessibilityTranslationDomainProperty + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty AccessibilityTranslationDomainProperty = BindableProperty.Create(nameof(AccessibilityTranslationDomain), typeof(string), typeof(View), string.Empty, propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityTranslationDomain, new Tizen.NUI.PropertyValue((string)newValue)); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + + string temp; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityTranslationDomain).Get(out temp); + return temp; + }); + + /// + /// AccessibilityRoleProperty + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty AccessibilityRoleProperty = BindableProperty.Create(nameof(AccessibilityRole), typeof(int), typeof(View), default(int), propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityRole, new Tizen.NUI.PropertyValue((int)newValue)); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + + int temp = 0; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityRole).Get(out temp); + return temp; + }); + + /// + /// AccessibilityHighlightableProperty + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty AccessibilityHighlightableProperty = BindableProperty.Create(nameof(AccessibilityHighlightable), typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityHighlightable, new Tizen.NUI.PropertyValue((bool)newValue)); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + bool temp = false; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityHighlightable).Get(out temp); + return temp; + }); + + /// + /// AccessibilityAnimatedProperty + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public static readonly BindableProperty AccessibilityAnimatedProperty = BindableProperty.Create(nameof(AccessibilityAnimated), typeof(bool), typeof(View), false, propertyChanged: (bindable, oldValue, newValue) => + { + var view = (View)bindable; + if (newValue != null) + { + Tizen.NUI.Object.SetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityAnimated, new Tizen.NUI.PropertyValue((bool)newValue)); + } + }, + defaultValueCreator: (bindable) => + { + var view = (View)bindable; + bool temp = false; + Tizen.NUI.Object.GetProperty((System.Runtime.InteropServices.HandleRef)view.SwigCPtr, View.Property.AccessibilityAnimated).Get(out temp); + return temp; + }); + #region Selectors internal static readonly BindableProperty BackgroundImageSelectorProperty = BindableProperty.Create("BackgroundImageSelector", typeof(Selector), typeof(View), null, propertyChanged: (bindable, oldValue, newValue) => { diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs index cbc8d89..63520b9 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs @@ -1,5 +1,5 @@ /* - * Copyright(c) 2019 Samsung Electronics Co., Ltd. + * Copyright(c) 2019-2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -211,6 +211,13 @@ namespace Tizen.NUI.BaseComponents internal static readonly int CaptureAllTouchAfterStart = Interop.ActorProperty.CaptureAllTouchAfterStartGet(); internal static readonly int BlendEquation = Interop.ActorProperty.BlendEquationGet(); internal static readonly int Culled = Interop.ActorProperty.CulledGet(); + internal static readonly int AccessibilityName = Interop.ViewProperty.AccessibilityNameGet(); + internal static readonly int AccessibilityDescription = Interop.ViewProperty.AccessibilityDescriptionGet(); + internal static readonly int AccessibilityTranslationDomain = Interop.ViewProperty.AccessibilityTranslationDomainGet(); + internal static readonly int AccessibilityRole = Interop.ViewProperty.AccessibilityRoleGet(); + internal static readonly int AccessibilityHighlightable = Interop.ViewProperty.AccessibilityHighlightableGet(); + internal static readonly int AccessibilityAttributes = Interop.ViewProperty.AccessibilityAttributesGet(); + internal static readonly int AccessibilityAnimated = Interop.ViewProperty.AccessibilityAnimatedGet(); } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs index 8928784..e950c09 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs @@ -302,6 +302,9 @@ namespace Tizen.NUI.BaseComponents /// 3 public void Show() { + if (AccessibilityCalculateStates().Get(AccessibilityState.Modal)) + AddPopup(); + SetVisible(true); } @@ -317,6 +320,9 @@ namespace Tizen.NUI.BaseComponents public void Hide() { SetVisible(false); + + if (AccessibilityCalculateStates().Get(AccessibilityState.Modal)) + RemovePopup(); } /// diff --git a/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs index a5ea14f..c6746ee 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/VisualView.cs @@ -103,6 +103,8 @@ namespace Tizen.NUI.BaseComponents /// 3 public override void OnInitialize() { + base.OnInitialize(); + //Initialize empty visualDictionary = new Dictionary(); tranformDictionary = new Dictionary(); -- 2.7.4