-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UI Automation providers for MonthCalendar control
Proposed changes: * Added UI Automation server providers to MonthCalendar and switched the accessibility model from MSAA-provided to UIA. * Added/moved from combined Safe/Unsafe NativeMethods native structure definitions and constants: MCGIF, MCGIP, MCGRIDINFO, MCHITTESTINFO, MCHT, MCM, MCS, MCSC, POINT, SYSTEMTIME, MOUSEEVENTF. Description for all definitions can be found in Windows API reference. Some managed-code definitions for structures were moved with changing the class-defined to structure-defined, so changed corresponding native methods to pass corresponding objects by ref. * Implemented wrappers for native method calls to fetch month calendar control inf (bounding rectangles, dates, texts). Implemented marshaling for accessible names/texts with passing strings of defined length. Passing string or pointer with length which does not correspond to passed length of text may lead to heap corruption. Passing null will lead to protected memory write violation. Adding required resources for month calendar elements which text/name cannot be fetched from Windows API calls. * Implemented the hierarchy of MonthCalendar control accessibility children with navigation in all directions using FragmentNavigation (UIA server provided navigation - UIA providers support should be set to true), implemented navigation for all calendar view types (dates, months, years, decades). * Added Table and Grid providers for the root element (but not for the calendar body to prevent announcing "table exit" when navigating to calendar header or today button. Added TableItem and GridItem providers for calendar items (date/months/years/decades). Note: getting number of rows and number of columns is little tricky as there is no documented API for that, so getting these basing on the dimensions and coordinates of cells and container calendar body. * Added Runtime IDs to elements to correctly associate navigated element and its properties in Inspect tree tab and properties tab. * Implemented accessibility hit test to allow getting month calendar child accessible element by specific coordinates. * Implemented accessibility default action invoke (trigger mouse click on the coordinates of specific child element to invoke its native click handler) - same as in client providers. * Improved Narrator support: allowing CAPS+Arrow/Arrow navigation accompanied with blue rectangle emphasizing, correct and detailed announcement for cells, headers, buttons and other MonthCalendar UI elements. Allowed triggering default action/click for MonthCalendar child element using CAPS+Enter. * Changed accessible control type from table to calendar except the case when there is a label before the MonthCalendar control with custom name for below MonthCalendar control. * Fixed AccessibilityInsights issues. Resolves #1908 Resolves #1909 Resolves #1910 Resolves #1911
- Loading branch information
Mikhail Lipin
committed
Nov 5, 2019
1 parent
38e2526
commit b862078
Showing
43 changed files
with
2,327 additions
and
339 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class ComCtl32 | ||
{ | ||
/// <summary> | ||
/// Represents MonthCalendar Control Grid Info Flags. | ||
/// Copied form CommCtrl.h | ||
/// </summary> | ||
[Flags] | ||
public enum MCGIF | ||
{ | ||
/// <summary> | ||
/// Represetns MCGIF_DATE const. | ||
/// </summary> | ||
DATE = 0x00000001, | ||
|
||
/// <summary> | ||
/// Represents MCGIF_RECT cosnt. | ||
/// </summary> | ||
RECT = 0x00000002, | ||
|
||
/// <summary> | ||
/// Represetns MCGIF_NAME const. | ||
/// </summary> | ||
NAME = 0x00000004 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class ComCtl32 | ||
{ | ||
/// <summary> | ||
/// Represents MonthCalendar control part constants. | ||
/// Copied form CommCtrl.h | ||
/// </summary> | ||
public enum MCGIP : uint | ||
{ | ||
/// <summary> | ||
/// Represents MCGIP_CALENDARCONTROL const. | ||
/// </summary> | ||
CALENDARCONTROL = 0, | ||
|
||
/// <summary> | ||
/// Represents MCGIP_NEXT const. | ||
/// </summary> | ||
NEXT = 1, | ||
|
||
/// <summary> | ||
/// Represents MCGIP_PREV const. | ||
/// </summary> | ||
PREV = 2, | ||
|
||
/// <summary> | ||
/// Represents MCGIP_FOOTER const. | ||
/// </summary> | ||
FOOTER = 3, | ||
|
||
/// <summary> | ||
/// Represents MCGIP_CALENDAR const. | ||
/// </summary> | ||
CALENDAR = 4, | ||
|
||
/// <summary> | ||
/// Represents MCGIP_CALENDARHEADER const. | ||
/// </summary> | ||
CALENDARHEADER = 5, | ||
|
||
/// <summary> | ||
/// Represents MCGIP_CALENDARBODY const. | ||
/// </summary> | ||
CALENDARBODY = 6, | ||
|
||
/// <summary> | ||
/// Represents MCGIP_CALENDARROW const. | ||
/// </summary> | ||
CALENDARROW = 7, | ||
|
||
/// <summary> | ||
/// Represents MCGIP_CALENDARCELL const. | ||
/// </summary> | ||
CALENDARCELL = 8 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
using static System.Windows.Forms.NativeMethods; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class ComCtl32 | ||
{ | ||
/// <summary> | ||
/// MonthCalendar grid info structure. | ||
/// Copied form CommCtrl.h | ||
/// </summary> | ||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] | ||
public unsafe struct MCGRIDINFO | ||
{ | ||
public uint cbSize; | ||
public MCGIP dwPart; | ||
public MCGIF dwFlags; | ||
public int iCalendar; | ||
public int iRow; | ||
public int iCol; | ||
public bool bSelected; | ||
public Kernel32.SYSTEMTIME stStart; | ||
public Kernel32.SYSTEMTIME stEnd; | ||
public RECT rc; | ||
public string pszName; | ||
public uint cchName; | ||
} | ||
|
||
[DllImport(ExternDll.User32, CharSet = CharSet.Auto)] | ||
public extern static IntPtr SendMessage(HandleRef hWnd, int Msg, int wParam, [In, Out] ref MCGRIDINFO gridInfo); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class ComCtl32 | ||
{ | ||
/// <summary> | ||
/// <see cref="https://docs.microsoft.com/en-us/windows/win32/api/commctrl/ns-commctrl-mchittestinfo"/> | ||
/// </summary> | ||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] | ||
public struct MCHITTESTINFO | ||
{ | ||
public int cbSize; | ||
public POINT pt; | ||
public int uHit; | ||
public Kernel32.SYSTEMTIME st; | ||
public RECT rc; | ||
public int iOffset; | ||
public int iRow; | ||
public int iCol; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class ComCtl32 | ||
{ | ||
/// <summary> | ||
/// Represents MonthCalendar Control HitTest values. | ||
/// Copied form CommCtrl.h | ||
/// </summary> | ||
public enum MCHT | ||
{ | ||
/// <summary> | ||
/// MCHT_TITLE | ||
/// </summary> | ||
TITLE = 0x00010000, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDAR const. | ||
/// </summary> | ||
CALENDAR = 0x00020000, | ||
|
||
/// <summary> | ||
/// Represents MCHT_TODAYLINK const. | ||
/// </summary> | ||
TODAYLINK = 0x00030000, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDARCONTROL const. | ||
/// </summary> | ||
CALENDARCONTROL = 0x00100000, | ||
|
||
/// <summary> | ||
/// Represents MCHT_NEXT const. | ||
/// </summary> | ||
NEXT = 0x01000000, | ||
|
||
/// <summary> | ||
/// Represents MCHT_PREV const. | ||
/// </summary> | ||
PREV = 0x02000000, | ||
|
||
/// <summary> | ||
/// Represents MCHT_NOWHERE const. | ||
/// </summary> | ||
NOWHERE = 0x00000000, | ||
|
||
/// <summary> | ||
/// Represents MCHT_TITLEBK const. | ||
/// </summary> | ||
TITLEBK = TITLE, | ||
|
||
/// <summary> | ||
/// Represents MCHT_TITLEMONTH const. | ||
/// </summary> | ||
TITLEMONTH = TITLE | 0x0001, | ||
|
||
/// <summary> | ||
/// Represents MCHT_TITLEYEAR const. | ||
/// </summary> | ||
TITLEYEAR = TITLE | 0x0002, | ||
|
||
/// <summary> | ||
/// Represents MCHT_TITLEBTNNEXT const. | ||
/// </summary> | ||
TITLEBTNNEXT = TITLE | NEXT | 0x0003, | ||
|
||
/// <summary> | ||
/// Represents MCHT_TITLEBTNPREV const. | ||
/// </summary> | ||
TITLEBTNPREV = TITLE | PREV | 0x0003, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDARBK const. | ||
/// </summary> | ||
CALENDARBK = CALENDAR, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDARDATE const. | ||
/// </summary> | ||
CALENDARDATE = CALENDAR | 0x0001, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDARDATENEXT const. | ||
/// </summary> | ||
CALENDARDATENEXT = CALENDARDATE | NEXT, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDARDATEPREV const. | ||
/// </summary> | ||
CALENDARDATEPREV = CALENDARDATE | PREV, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDARDAY const. | ||
/// </summary> | ||
CALENDARDAY = CALENDAR | 0x0002, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDARWEEKNUM const. | ||
/// </summary> | ||
CALENDARWEEKNUM = CALENDAR | 0x0003, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDARDATEMIN const. | ||
/// </summary> | ||
CALENDARDATEMIN = CALENDAR | 0x0004, | ||
|
||
/// <summary> | ||
/// Represents MCHT_CALENDARDATEMAX const. | ||
/// </summary> | ||
CALENDARDATEMAX = CALENDAR | 0x0005 | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class ComCtl32 | ||
{ | ||
/// <summary> | ||
/// Represents MonthCalendar Control Messages. | ||
/// Copied form CommCtrl.h | ||
/// </summary> | ||
public enum MCM | ||
{ | ||
/// <summary> | ||
/// Represents MCM_FIRST const. | ||
/// </summary> | ||
FIRST = 0x1000, | ||
|
||
/// <summary> | ||
/// Represents MCM_GETCURSEL const. | ||
/// </summary> | ||
GETCURSEL = FIRST + 1, | ||
|
||
/// <summary> | ||
/// Represents MCM_SETMAXSELCOUNT const. | ||
/// </summary> | ||
SETMAXSELCOUNT = FIRST + 4, | ||
|
||
/// <summary> | ||
/// Represents MCM_GETSELRANGE const. | ||
/// </summary> | ||
GETSELRANGE = FIRST + 5, | ||
|
||
/// <summary> | ||
/// Represents MCM_SETSELRANGE const. | ||
/// </summary> | ||
SETSELRANGE = FIRST + 6, | ||
|
||
/// <summary> | ||
/// Represents MCM_GETMONTHRANGE const. | ||
/// </summary> | ||
GETMONTHRANGE = FIRST + 7, | ||
|
||
/// <summary> | ||
/// Represents MCM_GETMINREQRECT const. | ||
/// </summary> | ||
GETMINREQRECT = FIRST + 9, | ||
|
||
/// <summary> | ||
/// Represents MCM_SETCOLOR const. | ||
/// </summary> | ||
SETCOLOR = FIRST + 10, | ||
|
||
/// <summary> | ||
/// Represents MCM_SETTODAY const. | ||
/// </summary> | ||
SETTODAY = FIRST + 12, | ||
|
||
/// <summary> | ||
/// Represents MCM_GETTODAY const. | ||
/// </summary> | ||
GETTODAY = FIRST + 13, | ||
|
||
/// <summary> | ||
/// Represents MCM_HITTEST const. | ||
/// </summary> | ||
HITTEST = FIRST + 14, | ||
|
||
/// <summary> | ||
/// Represents MCM_SETFIRSTDAYOFWEEK const. | ||
/// </summary> | ||
SETFIRSTDAYOFWEEK = FIRST + 15, | ||
|
||
/// <summary> | ||
/// Represents MCM_GETRANGE const. | ||
/// </summary> | ||
GETRANGE = FIRST + 17, | ||
|
||
/// <summary> | ||
/// Represents MCM_SETRANGE const. | ||
/// </summary> | ||
SETRANGE = FIRST + 18, | ||
|
||
/// <summary> | ||
/// Represents MCM_SETMONTHDELTA const. | ||
/// </summary> | ||
SETMONTHDELTA = FIRST + 20, | ||
|
||
/// <summary> | ||
/// Represents MCM_GETMAXTODAYWIDTH const. | ||
/// </summary> | ||
GETMAXTODAYWIDTH = FIRST + 21, | ||
|
||
/// <summary> | ||
/// Represents MCM_GETCALENDARGRIDINFO const. | ||
/// </summary> | ||
GETCALENDARGRIDINFO = FIRST + 24 | ||
} | ||
} | ||
} |
Oops, something went wrong.