From: Seoyeon2Kim <34738918+Seoyeon2Kim@users.noreply.github.com> Date: Fri, 21 May 2021 09:35:36 +0000 (+0900) Subject: [NUI] Update ViewAccessibility according to the coding rule (#3022) X-Git-Tag: accepted/tizen/unified/20231205.024657~1858 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6d91064e62e6a3ddc70aa87e503bbf9e7c72e2b4;p=platform%2Fcore%2Fcsapi%2Ftizenfx.git [NUI] Update ViewAccessibility according to the coding rule (#3022) * [NUI] Update ViewAccessibility according to the coding rule - Updated ViewAccessibility code, such as description or coding style. Signed-off-by: Seoyeon Kim * [NUI] Update ATSPI more Signed-off-by: Seoyeon Kim * [NUI] Update ViewAccessibility to the current status Signed-off-by: Seoyeon Kim --- diff --git a/src/Tizen.NUI.Components/Controls/Button.cs b/src/Tizen.NUI.Components/Controls/Button.cs index 69cd5c8..b5b1c32 100755 --- a/src/Tizen.NUI.Components/Controls/Button.cs +++ b/src/Tizen.NUI.Components/Controls/Button.cs @@ -163,7 +163,7 @@ namespace Tizen.NUI.Components if (instance.itemAlignment != newAlignment) { instance.itemAlignment = newAlignment; - instance.LayoutItems(); + instance.LayoutItems(); } }, defaultValueCreator: (bindable) => ((Button)bindable).itemAlignment); @@ -782,7 +782,7 @@ namespace Tizen.NUI.Components Extension = buttonStyle.CreateExtension(); if (buttonStyle.Overlay != null) - { + { OverlayImage?.ApplyStyle(buttonStyle.Overlay); } diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs b/src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs index 8f82843..2c300bb 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.ControlDevel.cs @@ -153,7 +153,7 @@ namespace Tizen.NUI [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); + public static extern global::System.IntPtr DaliAccessibilityEmitTextCursorMovedEvent(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")] @@ -165,7 +165,7 @@ namespace Tizen.NUI [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); + public static extern void DaliAccessibilityBridgeRegisterPopup(global::System.Runtime.InteropServices.HandleRef arg1); [EditorBrowsable(EditorBrowsableState.Never)] [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Accessibility_Bridge_Remove_Popup")] @@ -266,14 +266,14 @@ namespace Tizen.NUI public AccessibilityGetCharacterCount GetCharacterCount; // 15 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate int AccessibilityGetCaretOffset(); + public delegate int AccessibilityGetCursorOffset(); [EditorBrowsable(EditorBrowsableState.Never)] - public AccessibilityGetCaretOffset GetCaretOffset; // 16 + public AccessibilityGetCursorOffset GetCursorOffset; // 16 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] - public delegate bool AccessibilitySetCaretOffset(int offset); + public delegate bool AccessibilitySetCursorOffset(int offset); [EditorBrowsable(EditorBrowsableState.Never)] - public AccessibilitySetCaretOffset SetCaretOffset; // 17 + public AccessibilitySetCursorOffset SetCursorOffset; // 17 [UnmanagedFunctionPointer(CallingConvention.Cdecl)] public delegate IntPtr AccessibilityGetTextAtOffset(int offset, int boundary); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs index 46dd7ff..14a3109 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibility.cs @@ -22,70 +22,128 @@ using Tizen.NUI; namespace Tizen.NUI.BaseComponents { + /// + /// Address represents an unique object address on accessibility bus. + /// [EditorBrowsable(EditorBrowsableState.Never)] public class Address { + /// + /// Creates an initialized Address. + /// + /// Accessibility bus + /// Accessibility path [EditorBrowsable(EditorBrowsableState.Never)] - public Address(string xbus, string xpath) + public Address(string bus, string path) { - bus = xbus; - path = xpath; + Bus = bus; + Path = path; } + /// + /// Gets or sets accessibility bus. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public string bus { get; set; } + public string Bus { get; set; } + + /// + /// Gets or sets accessibility path. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public string path { get; set; } + public string Path { get; set; } } + /// + /// AddressCollection. + /// [EditorBrowsable(EditorBrowsableState.Never)] public class AddressCollection : SafeHandle { + /// + /// Creates an initialized AddressCollection. + /// + /// Initialized AddressCollection [EditorBrowsable(EditorBrowsableState.Never)] - public AddressCollection(IntPtr collection) : base(collection, true) { } + public AddressCollection(IntPtr collection) : base(collection, true) + { + } + /// + /// Checks whether this handle is invalid or not. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool IsInvalid { get { return this.handle == IntPtr.Zero; } } + public override bool IsInvalid + { + get + { + return this.handle == IntPtr.Zero; + } + } + /// + /// Gets the size of accessibility relation. + /// + /// Accessibility relation + /// The size of relation, which means the number of elements [EditorBrowsable(EditorBrowsableState.Never)] - public uint RelationSize(View.RelationType relation) + public uint GetRelationSize(View.RelationType relation) { uint result = Interop.ControlDevel.DaliToolkitDevelControlAccessibilityRelationsRelationSize(this, Convert.ToInt32(relation)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return result; } + /// + /// Gets Address object using contained bus and path. + /// + /// Accessibility relation + /// Position + /// Accessibility Adress [EditorBrowsable(EditorBrowsableState.Never)] - public Address At(View.RelationType relation, int position) + public Address GetAddressAt(View.RelationType relation, int position) { var bus = Interop.ControlDevel.DaliToolkitDevelControlAccessibilityRelationsAt(this, Convert.ToInt32(relation), position, 0); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + 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(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return new Address(bus, path); } + /// + /// Releases handle itself. + /// + /// true when released successfully. [EditorBrowsable(EditorBrowsableState.Never)] protected override bool ReleaseHandle() { Interop.ControlDevel.DaliToolkitDevelControlDeleteAccessibilityRelations(handle); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); this.SetHandle(IntPtr.Zero); return true; } } + /// + /// AccessibilityRange is used to store data related with Text. + /// [EditorBrowsable(EditorBrowsableState.Never)] public class AccessibilityRange { + /// + /// Start position in stored text. + /// public int StartOffset { get; set; } = 0; + + /// + /// End position in stored text. + /// public int EndOffset { get; set; } = 0; + + /// + /// Text content in stored text. + /// public string Content { get; set; } = ""; } @@ -99,52 +157,73 @@ namespace Tizen.NUI.BaseComponents // ****************** Accessibility Attributes ****************** // /////////////////////////////////////////////////////////////////// + /// + /// Adds or modifies the value matched with given key. + /// + /// + /// Modification takes place if key was previously set. + /// + /// The key to insert + /// The value to insert [EditorBrowsable(EditorBrowsableState.Never)] - public void AppendAccessibilityAttribute(string key, string val) + public void AppendAccessibilityAttribute(string key, string value) { - Interop.ControlDevel.DaliToolkitDevelControlAppendAccessibilityAttribute(SwigCPtr, key, val); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Interop.ControlDevel.DaliToolkitDevelControlAppendAccessibilityAttribute(SwigCPtr, key, value); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Erases a key with its value from accessibility attributes. + /// + /// The key to remove [EditorBrowsable(EditorBrowsableState.Never)] public void RemoveAccessibilityAttribute(string key) { Interop.ControlDevel.DaliToolkitDevelControlRemoveAccessibilityAttribute(SwigCPtr, key); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Clears accessibility attributes. + /// [EditorBrowsable(EditorBrowsableState.Never)] public void ClearAccessibilityAttributes() { Interop.ControlDevel.DaliToolkitDevelControlClearAccessibilityAttributes(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /////////////////////////////////////////////////////////////////// // ************************** Highlight ************************ // /////////////////////////////////////////////////////////////////// + /// + /// Clears accessibility highlight. + /// + /// True if cleared, otherwise false when it is not possible [EditorBrowsable(EditorBrowsableState.Never)] public bool ClearAccessibilityHighlight() { bool result = Interop.ControlDevel.DaliToolkitDevelControlClearAccessibilityHighlight(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return result; } + /// + /// Grabs accessibility highlight. + /// + /// True if cleared, otherwise false when it is not possible [EditorBrowsable(EditorBrowsableState.Never)] public bool GrabAccessibilityHighlight() { bool result = Interop.ControlDevel.DaliToolkitDevelControlGrabAccessibilityHighlight(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return result; } + /// + /// Flag to check whether this view is highlighted or not. + /// [EditorBrowsable(EditorBrowsableState.Never)] protected bool IsHighlighted { @@ -171,38 +250,50 @@ namespace Tizen.NUI.BaseComponents public void AppendAccessibilityRelation(View second, RelationType relation) { if (second is null) + { throw new ArgumentNullException(nameof(second)); + } Interop.ControlDevel.DaliToolkitDevelControlAppendAccessibilityRelation(SwigCPtr, second.SwigCPtr, (int)relation); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Removes accessibility relation. + /// + /// Object which will be removed in relation + /// Relation type [EditorBrowsable(EditorBrowsableState.Never)] public void RemoveAccessibilityRelation(View second, RelationType relation) { if (second is null) + { throw new ArgumentNullException(nameof(second)); + } Interop.ControlDevel.DaliToolkitDevelControlRemoveAccessibilityRelation(SwigCPtr, second.SwigCPtr, (int)relation); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Removes all previously appended relations. + /// [EditorBrowsable(EditorBrowsableState.Never)] public void ClearAccessibilityRelations() { Interop.ControlDevel.DaliToolkitDevelControlClearAccessibilityRelations(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Gets accessibility collection connected with the current object. + /// + /// AddressCollection [EditorBrowsable(EditorBrowsableState.Never)] public AddressCollection GetAccessibilityRelations() { var result = new AddressCollection(Interop.ControlDevel.DaliToolkitDevelControlNewGetAccessibilityRelations(SwigCPtr)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return result; } @@ -210,20 +301,26 @@ namespace Tizen.NUI.BaseComponents // ********************* ReadingInfoType *********************** // /////////////////////////////////////////////////////////////////// + /// + /// Sets accessibility reading information. + /// + /// Reading information type [EditorBrowsable(EditorBrowsableState.Never)] - public void SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes info) + public void SetAccessibilityReadingInfoTypes(AccessibilityReadingInfoTypes type) { - Interop.ControlDevel.DaliToolkitDevelControlSetAccessibilityReadingInfoTypes(SwigCPtr, (int)info); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Interop.ControlDevel.DaliToolkitDevelControlSetAccessibilityReadingInfoTypes(SwigCPtr, (int)type); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Gets accessibility reading information. + /// + /// Reading information type [EditorBrowsable(EditorBrowsableState.Never)] public AccessibilityReadingInfoTypes GetAccessibilityReadingInfoTypes() { AccessibilityReadingInfoTypes result = (AccessibilityReadingInfoTypes)Interop.ControlDevel.DaliToolkitDevelControlGetAccessibilityReadingInfoTypes(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return result; } @@ -231,20 +328,30 @@ namespace Tizen.NUI.BaseComponents // ******************** Accessibility States ******************* // /////////////////////////////////////////////////////////////////// + /// + /// Notifies sending notifications about the current states to accessibility clients. + /// + /// + /// If recursive is true, all children of the Accessibility object will also re-emit the states. + /// + /// Accessibility States + /// Flag to point if notifications of children's state would be sent [EditorBrowsable(EditorBrowsableState.Never)] - public void NotifyAccessibilityStatesChange(AccessibilityStates state, bool recursive) + public void NotifyAccessibilityStatesChange(AccessibilityStates states, bool recursive) { - Interop.ControlDevel.DaliToolkitDevelControlNotifyAccessibilityStatesChange(SwigCPtr, (ulong)state, Convert.ToInt32(recursive)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Interop.ControlDevel.DaliToolkitDevelControlNotifyAccessibilityStatesChange(SwigCPtr, (ulong)states, Convert.ToInt32(recursive)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Gets Accessibility States. + /// + /// Accessibility States [EditorBrowsable(EditorBrowsableState.Never)] public AccessibilityStates GetAccessibilityStates() { AccessibilityStates result = (AccessibilityStates) Interop.ControlDevel.DaliToolkitDevelControlGetAccessibilityStates(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); return result; } @@ -252,107 +359,131 @@ namespace Tizen.NUI.BaseComponents // ************************ Accessible ************************* // /////////////////////////////////////////////////////////////////// + /// + /// Emits accessibility property changed event. + /// + /// Property changed event [EditorBrowsable(EditorBrowsableState.Never)] - public void EmitAccessibilityEvent(ObjectPropertyChangeEvent e) + public void EmitAccessibilityEvent(ObjectPropertyChangeEvent changeEvent) { - Interop.ControlDevel.DaliAccessibilityEmitAccessibilityEvent(SwigCPtr, Convert.ToInt32(e)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Interop.ControlDevel.DaliAccessibilityEmitAccessibilityEvent(SwigCPtr, Convert.ToInt32(changeEvent)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Emits accessibility states changed event. + /// + /// Accessibility state + /// True if the state is set or enabled, otherwise false [EditorBrowsable(EditorBrowsableState.Never)] - public void EmitAccessibilityStatesChangedEvent(AccessibilityStates e, bool b) + public void EmitAccessibilityStatesChangedEvent(AccessibilityStates state, bool equal) { - Interop.ControlDevel.DaliAccessibilityEmitAccessibilityStatesChangedEvent(SwigCPtr, (ulong)e, Convert.ToInt32(b)); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Interop.ControlDevel.DaliAccessibilityEmitAccessibilityStatesChangedEvent(SwigCPtr, (ulong)state, Convert.ToInt32(equal)); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Emits accessibility text inserted event. + /// + /// Text cursor position + /// Text length + /// Inserted text content [EditorBrowsable(EditorBrowsableState.Never)] - public void EmitTextInsertedEvent(int position, int length, string content) + public void EmitTextInsertedEvent(int cursorPosition, int length, string content) { - Interop.ControlDevel.DaliAccessibilityEmitTextInsertedEvent(SwigCPtr, position, length, content); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Interop.ControlDevel.DaliAccessibilityEmitTextInsertedEvent(SwigCPtr, cursorPosition, length, content); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Emits accessibility text deleted event. + /// + /// Text cursor position + /// Text length + /// Inserted text content [EditorBrowsable(EditorBrowsableState.Never)] - public void EmitTextDeletedEvent(int position, int length, string content) + public void EmitTextDeletedEvent(int cursorPosition, int length, string content) { - Interop.ControlDevel.DaliAccessibilityEmitTextDeletedEvent(SwigCPtr, position, length, content); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Interop.ControlDevel.DaliAccessibilityEmitTextDeletedEvent(SwigCPtr, cursorPosition, length, content); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Emits accessibility text cursor moved event. + /// + /// The new cursor position [EditorBrowsable(EditorBrowsableState.Never)] - public void EmitTextCaretMovedEvent(int position) + public void EmitTextCursorMovedEvent(int cursorPosition) { - Interop.ControlDevel.DaliAccessibilityEmitTextCaretMovedEvent(SwigCPtr, position); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Interop.ControlDevel.DaliAccessibilityEmitTextCursorMovedEvent(SwigCPtr, cursorPosition); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } /////////////////////////////////////////////////////////////////// // ************************** Bridge *************************** // /////////////////////////////////////////////////////////////////// + /// + /// Registers popup component to accessibility tree. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public void AddPopup() + public void RegisterPopup() { - Interop.ControlDevel.DaliAccessibilityBridgeAddPopup(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + Interop.ControlDevel.DaliAccessibilityBridgeRegisterPopup(SwigCPtr); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } + /// + /// Removes the previously added popup to accessibility tree. + /// [EditorBrowsable(EditorBrowsableState.Never)] public void RemovePopup() { Interop.ControlDevel.DaliAccessibilityBridgeRemovePopup(SwigCPtr); - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); } - private IntPtr strdup(string arg) + private IntPtr DuplicateString(string value) { - return Interop.ControlDevel.DaliToolkitDevelControlAccessibleImplNUIDuplicateString(arg ?? ""); + return Interop.ControlDevel.DaliToolkitDevelControlAccessibleImplNUIDuplicateString(value ?? ""); } - private IntPtr statesdup(AccessibilityStates states) + private IntPtr DuplicateStates(AccessibilityStates states) { return Interop.ControlDevel.DaliToolkitDevelControlConvertState((ulong)states); } - private IntPtr rangedup(AccessibilityRange range) + private IntPtr DuplicateRange(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, - } + private Interop.ControlDevel.AccessibilityDelegate accessibilityDelegate = null; + private IntPtr accessibilityDelegatePtr; + /// + /// Sets the specific constructor for creating accessibility structure with its role and interface. + /// + /// + /// The method should be called inside OnInitialize method of all classes inheriting from View. + /// + /// Accessibility role + /// Accessibility interface [EditorBrowsable(EditorBrowsableState.Never)] - public void SetAccessibilityConstructor(Role role, AccessibilityInterface iface = AccessibilityInterface.None) + public void SetAccessibilityConstructor(Role role, AccessibilityInterface accessibilityInterface = AccessibilityInterface.None) { var size = Marshal.SizeOf(); - if (_accessibilityDelegate == null) + if (accessibilityDelegate == null) { - _accessibilityDelegate = new Interop.ControlDevel.AccessibilityDelegate() + accessibilityDelegate = new Interop.ControlDevel.AccessibilityDelegate() { - GetName = () => strdup(AccessibilityGetName()), - GetDescription = () => strdup(AccessibilityGetDescription()), + GetName = () => DuplicateString(AccessibilityGetName()), + GetDescription = () => DuplicateString(AccessibilityGetDescription()), DoAction = (name) => AccessibilityDoAction(Marshal.PtrToStringAnsi(name)), - CalculateStates = () => statesdup(AccessibilityCalculateStates()), + CalculateStates = () => DuplicateStates(AccessibilityCalculateStates()), GetActionCount = () => AccessibilityGetActionCount(), - GetActionName = (index) => strdup(AccessibilityGetActionName(index)), + GetActionName = (index) => DuplicateString(AccessibilityGetActionName(index)), ShouldReportZeroChildren = () => AccessibilityShouldReportZeroChildren(), GetMinimum = () => AccessibilityGetMinimum(), GetCurrent = () => AccessibilityGetCurrent(), @@ -360,27 +491,47 @@ namespace Tizen.NUI.BaseComponents SetCurrent = (value) => AccessibilitySetCurrent(value), GetMinimumIncrement = () => AccessibilityGetMinimumIncrement(), IsScrollable = () => AccessibilityIsScrollable(), - GetText = (startOffset, endOffset) => strdup(AccessibilityGetText(startOffset, endOffset)), + GetText = (startOffset, endOffset) => DuplicateString(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), + GetCursorOffset = () => AccessibilityGetCursorOffset(), + SetCursorOffset = (offset) => AccessibilitySetCursorOffset(offset), + GetTextAtOffset = (offset, boundary) => DuplicateRange(AccessibilityGetTextAtOffset(offset, (TextBoundary)boundary)), + GetSelection = (selectionNumber) => DuplicateRange(AccessibilityGetSelection(selectionNumber)), + RemoveSelection = (selectionNumber) => AccessibilityRemoveSelection(selectionNumber), + SetSelection = (selectionNumber, startOffset, endOffset) => AccessibilitySetSelection(selectionNumber, startOffset, endOffset), CopyText = (startPosition, endPosition) => AccessibilityCopyText(startPosition, endPosition), CutText = (startPosition, endPosition) => AccessibilityCutText(startPosition, endPosition), }; - _accessibilityDelegatePtr = Marshal.AllocHGlobal(size); - Marshal.StructureToPtr(_accessibilityDelegate, _accessibilityDelegatePtr, false); + accessibilityDelegatePtr = Marshal.AllocHGlobal(size); + Marshal.StructureToPtr(accessibilityDelegate, accessibilityDelegatePtr, false); } - Interop.ControlDevel.DaliToolkitDevelControlSetAccessibilityConstructor(SwigCPtr, (int)role, (int)iface, _accessibilityDelegatePtr, size); + Interop.ControlDevel.DaliToolkitDevelControlSetAccessibilityConstructor(SwigCPtr, (int)role, (int)accessibilityInterface, accessibilityDelegatePtr, size); + if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + } - if (NDalicPINVOKE.SWIGPendingException.Pending) - throw NDalicPINVOKE.SWIGPendingException.Retrieve(); + /// + /// A helper method to manipulate individual bit flags (e.g. turn them on or off) + /// + /// An object that accumulates combination of bit flags + /// A bit flag to be operated + /// A state of the bit flag to be set (0 == off, 1 == on) + [EditorBrowsable(EditorBrowsableState.Never)] + static public void FlagSetter(ref T obj ,T bit, bool state) + { + dynamic result = obj; + dynamic param = bit; + if (state) + { + result |= param; + } + else + { + result &= (~param); + } + obj = result; } [EditorBrowsable(EditorBrowsableState.Never)] @@ -388,11 +539,11 @@ namespace Tizen.NUI.BaseComponents { base.Dispose(disposing); - if (_accessibilityDelegate != null) + if (accessibilityDelegate != null) { - Marshal.DestroyStructure(_accessibilityDelegatePtr); - Marshal.FreeHGlobal(_accessibilityDelegatePtr); - _accessibilityDelegate = null; + Marshal.DestroyStructure(accessibilityDelegatePtr); + Marshal.FreeHGlobal(accessibilityDelegatePtr); + accessibilityDelegate = null; } } @@ -466,9 +617,13 @@ namespace Tizen.NUI.BaseComponents protected virtual string AccessibilityGetActionName(int index) { if (index >= 0 && index < AccessibilityActions.Length) + { return AccessibilityActions[index]; + } else + { return ""; + } } [EditorBrowsable(EditorBrowsableState.Never)] @@ -526,13 +681,13 @@ namespace Tizen.NUI.BaseComponents } [EditorBrowsable(EditorBrowsableState.Never)] - protected virtual int AccessibilityGetCaretOffset() + protected virtual int AccessibilityGetCursorOffset() { return 0; } [EditorBrowsable(EditorBrowsableState.Never)] - protected virtual bool AccessibilitySetCaretOffset(int offset) + protected virtual bool AccessibilitySetCursorOffset(int offset) { return false; } @@ -544,19 +699,19 @@ namespace Tizen.NUI.BaseComponents } [EditorBrowsable(EditorBrowsableState.Never)] - protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNum) + protected virtual AccessibilityRange AccessibilityGetSelection(int selectionNumber) { return new AccessibilityRange(); } [EditorBrowsable(EditorBrowsableState.Never)] - protected virtual bool AccessibilityRemoveSelection(int selectionNum) + protected virtual bool AccessibilityRemoveSelection(int selectionNumber) { return false; } [EditorBrowsable(EditorBrowsableState.Never)] - protected virtual bool AccessibilitySetSelection(int selectionNum, int startOffset, int endOffset) + protected virtual bool AccessibilitySetSelection(int selectionNumber, int startOffset, int endOffset) { return false; } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEnum.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEnum.cs index 31d9139..01ecc77 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEnum.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEnum.cs @@ -22,6 +22,29 @@ using Tizen.NUI; namespace Tizen.NUI.BaseComponents { + /// + /// Accessibility interface. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public enum AccessibilityInterface + { + /// + /// Common accessibility interface + /// + [EditorBrowsable(EditorBrowsableState.Never)] + None = 0, + /// + /// Accessibility interface which can store numeric value + /// + [EditorBrowsable(EditorBrowsableState.Never)] + Value = 1, + /// + /// Accessibility interface which can store editable texts + /// + [EditorBrowsable(EditorBrowsableState.Never)] + EditableText = 2, + } + [EditorBrowsable(EditorBrowsableState.Never)] [Flags] public enum AccessibilityReadingInfoTypes : int @@ -148,28 +171,6 @@ namespace Tizen.NUI.BaseComponents public partial class View { [EditorBrowsable(EditorBrowsableState.Never)] - /// - /// A helper method to manipulate individual bit flags (e.g. turn them on or off) - /// - /// An object that accumulates combination of bit flags - /// A bit flag to be operated - /// A state of the bit flag to be set (0 == off, 1 == on) - static public void FlagSetter(ref T obj ,T bit, bool state) - { - dynamic result = obj; - dynamic param = bit; - if (state) - { - result |= param; - } - else - { - result &= (~param); - } - obj = result; - } - - [EditorBrowsable(EditorBrowsableState.Never)] public enum RelationType { NullOf = 0, diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEvent.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEvent.cs index 6068c71..5843bb8 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEvent.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewAccessibilityEvent.cs @@ -23,31 +23,60 @@ using Tizen.NUI; namespace Tizen.NUI.BaseComponents { + /// + /// Gesture information type containing all values needed to AccessibilityDoGestureSignal. + /// [EditorBrowsable(EditorBrowsableState.Never)] [StructLayout(LayoutKind.Sequential)] public struct GestureInfoType : IEquatable { + /// + /// Accessibility enumerated gesture type. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public AccessibilityGesture type { get; set; } + public AccessibilityGesture Type { get; set; } + /// + /// The X position where the gesture begins. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public int xBeg { get; set; } + public int StartPositionX { get; set; } + /// + /// The X position where the gesture ends. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public int xEnd { get; set; } + public int EndPositionX { get; set; } + /// + /// The Y position where the gesture begins. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public int yBeg { get; set; } + public int StartPositionY { get; set; } + /// + /// The Y position where the gesture ends. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public int yEnd { get; set; } + public int EndPositionY { get; set; } + /// + /// The enumerated state of gesture. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public AccessibilityGestureState state { get; set; } + public AccessibilityGestureState State { get; set; } + /// + /// The time when event occured. + /// [EditorBrowsable(EditorBrowsableState.Never)] - public uint eventTime { get; set; } + public uint EventTime { get; set; } + /// + /// Determines whether the specified object is equal to the current object. + /// + /// The object to compare with the current object + /// True if the specified object is equal to the current object, otherwise false [EditorBrowsable(EditorBrowsableState.Never)] public override bool Equals(System.Object obj) { @@ -58,22 +87,35 @@ namespace Tizen.NUI.BaseComponents return false; } + /// + /// Determines whether the specified object is equal to the current object. + /// + /// The GestureInfoType to compare with the current GestureInfoType + /// True if equal GestureInfoType, otherwise false public bool Equals(GestureInfoType other) { if ((other == null) || !this.GetType().Equals(other.GetType())) + { return false; + } - GestureInfoType sec = (GestureInfoType)other; - return - type == sec.type && - xBeg == sec.xBeg && - xEnd == sec.xEnd && - yBeg == sec.yBeg && - yEnd == sec.yEnd && - state == sec.state && - eventTime == sec.eventTime; + GestureInfoType compared = (GestureInfoType)other; + // Return true if the fields match: + return (Type == compared.Type && + StartPositionX == compared.StartPositionX && + EndPositionX == compared.EndPositionX && + StartPositionY == compared.StartPositionY && + EndPositionY == compared.EndPositionY && + State == compared.State && + EventTime == compared.EventTime); } + /// + /// The == operator. + /// + /// The first value + /// The second value + /// True if GestureInfoTypes are equal [EditorBrowsable(EditorBrowsableState.Never)] public static bool operator ==(GestureInfoType arg1, GestureInfoType arg2) { @@ -83,35 +125,66 @@ namespace Tizen.NUI.BaseComponents /// /// The != operator. /// + /// The first value + /// The second value + /// True if GestureInfoTypes are not equal [EditorBrowsable(EditorBrowsableState.Never)] public static bool operator !=(GestureInfoType arg1, GestureInfoType arg2) { return !arg1.Equals(arg2); } + /// + /// Gets the hash code of this baseHandle. + /// + /// The Hash Code [EditorBrowsable(EditorBrowsableState.Never)] public override int GetHashCode() { - return Tuple.Create((int)type, xBeg, xEnd, yBeg, yEnd, (int)state, eventTime).GetHashCode(); + return Tuple.Create((int)Type, StartPositionX, EndPositionX, StartPositionY, EndPositionY, (int)State, EventTime).GetHashCode(); } } + /// + /// Accessibility gesture information event arguments. + /// [EditorBrowsable(EditorBrowsableState.Never)] public class GestureInfoEventArgs : EventArgs { + /// + /// The gesture information type. + /// + [EditorBrowsable(EditorBrowsableState.Never)] public GestureInfoType GestureInfo { get; internal set; } + + /// + /// True if the event is consumed. + /// + [EditorBrowsable(EditorBrowsableState.Never)] public int Consumed { get; set; } } + /// + /// Accessibility description event arguments. + /// [EditorBrowsable(EditorBrowsableState.Never)] public class GetDescriptionEventArgs : EventArgs { + /// + /// Accessibility description. + /// public string Description { get; set; } } + /// + /// Accessibility name event arguments. + /// [EditorBrowsable(EditorBrowsableState.Never)] public class GetNameEventArgs : EventArgs { + /// + /// Accessibility name. + /// public string Name { get; set; } } @@ -143,12 +216,16 @@ namespace Tizen.NUI.BaseComponents } } + /// + /// Gets the control handle. + /// + /// The control handle of the view [EditorBrowsable(EditorBrowsableState.Never)] ControlHandle GetControl() { - var ret = new ControlHandle(Interop.View.DownCast(SwigCPtr)); + var result = new ControlHandle(Interop.View.DownCast(SwigCPtr)); if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve(); - return ret; + return result; } /////////////////////////////////////////////////////////////////// @@ -163,27 +240,32 @@ namespace Tizen.NUI.BaseComponents private void OnAccessibilityGestureInfoEvent(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.Consumed = AccessibilityDoGestureSignal.GetResult(data); - arg.GestureInfo = (GestureInfoType)Marshal.PtrToStructure(data, typeof(GestureInfoType)); - + var arg = new GestureInfoEventArgs() + { + Consumed = AccessibilityDoGestureSignal.GetResult(data), + GestureInfo = (GestureInfoType)Marshal.PtrToStructure(data, typeof(GestureInfoType)), + }; gestureInfoHandler?.Invoke(this, arg); AccessibilityDoGestureSignal.SetResult(data, Convert.ToInt32(arg.Consumed)); } - // This uses DoGestureInfo signal from C++ API. + /// + /// AccessibilityGestureInfo is received. + /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler AccessibilityGestureInfoReceived { + // This uses DoGestureInfo signal from C++ API. add { if (gestureInfoHandler == null) @@ -226,20 +308,26 @@ namespace Tizen.NUI.BaseComponents private void OnGetAccessibilityDescriptionEvent(IntPtr data) { if (data == IntPtr.Zero) + { return; + } - var arg = new GetDescriptionEventArgs(); - arg.Description = StringToVoidSignal.GetResult(data); - + var arg = new GetDescriptionEventArgs() + { + Description = StringToVoidSignal.GetResult(data) + }; getDescriptionHandler?.Invoke(this, arg); StringToVoidSignal.SetResult(data, arg.Description); } - // This uses GetDescription signal from C++ API. + /// + /// AccessibilityDescription is requested. + /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler AccessibilityDescriptionRequested { + // This uses GetDescription signal from C++ API. add { if (getDescriptionHandler == null) @@ -282,20 +370,26 @@ namespace Tizen.NUI.BaseComponents private void OnGetAccessibilityNameEvent(IntPtr data) { if (data == IntPtr.Zero) + { return; + } - var arg = new GetNameEventArgs(); - arg.Name = StringToVoidSignal.GetResult(data); - + var arg = new GetNameEventArgs() + { + Name = StringToVoidSignal.GetResult(data) + }; getNameHandler?.Invoke(this, arg); StringToVoidSignal.SetResult(data, arg.Name); } - // This uses GetName signal from C++ API. + /// + /// AccessibilityName is requested. + /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler AccessibilityNameRequested { + // This uses GetName signal from C++ API. add { if (getNameHandler == null) @@ -340,6 +434,9 @@ namespace Tizen.NUI.BaseComponents activateHandler?.Invoke(this, null); } + /// + /// Accessibility is activated. + /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler AccessibilityActivated { @@ -386,6 +483,9 @@ namespace Tizen.NUI.BaseComponents readingSkippedHandler?.Invoke(this, null); } + /// + /// AccessibilityReading is skipped. + /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler AccessibilityReadingSkipped { @@ -432,6 +532,9 @@ namespace Tizen.NUI.BaseComponents readingPausedHandler?.Invoke(this, null); } + /// + /// AccessibilityReading is paused. + /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler AccessibilityReadingPaused { @@ -478,6 +581,9 @@ namespace Tizen.NUI.BaseComponents readingResumedHandler?.Invoke(this, null); } + /// + /// AccessibilityReading is resumed. + /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler AccessibilityReadingResumed { @@ -524,6 +630,9 @@ namespace Tizen.NUI.BaseComponents readingCancelledHandler?.Invoke(this, null); } + /// + /// AccessibilityReading is cancelled. + /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler AccessibilityReadingCancelled { @@ -570,6 +679,9 @@ namespace Tizen.NUI.BaseComponents readingStoppedHandler?.Invoke(this, null); } + /// + /// AccessibilityReading is stopped. + /// [EditorBrowsable(EditorBrowsableState.Never)] public event EventHandler AccessibilityReadingStopped { diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs index a83eb8f..e2bcd01 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewPublicMethods.cs @@ -303,7 +303,9 @@ namespace Tizen.NUI.BaseComponents public void Show() { if ((AccessibilityCalculateStates() & AccessibilityStates.Modal) != 0) - AddPopup(); + { + RegisterPopup(); + } SetVisible(true); } @@ -322,7 +324,9 @@ namespace Tizen.NUI.BaseComponents SetVisible(false); if ((AccessibilityCalculateStates() & AccessibilityStates.Modal) != 0) + { RemovePopup(); + } } ///