Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Accessibility]: Adding MonthCalendar control UI Automation providers to improve calendar control accessibility #2090

Merged
merged 1 commit into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions src/Common/src/Interop/ComCtl32/Interop.MCGIF.cs
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
M-Lipin marked this conversation as resolved.
Show resolved Hide resolved
{
/// <summary>
/// Represetns MCGIF_DATE const.
/// </summary>
DATE = 0x00000001,

/// <summary>
/// Represents MCGIF_RECT cosnt.
/// </summary>
RECT = 0x00000002,

/// <summary>
/// Represetns MCGIF_NAME const.
/// </summary>
NAME = 0x00000004
}
M-Lipin marked this conversation as resolved.
Show resolved Hide resolved
}
}
61 changes: 61 additions & 0 deletions src/Common/src/Interop/ComCtl32/Interop.MCGIP.cs
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
}
}
}
37 changes: 37 additions & 0 deletions src/Common/src/Interop/ComCtl32/Interop.MCGRIDINFO.cs
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)]
M-Lipin marked this conversation as resolved.
Show resolved Hide resolved
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);
}
}
27 changes: 27 additions & 0 deletions src/Common/src/Interop/ComCtl32/Interop.MCHITTESTINFO.cs
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;
}
}
}
116 changes: 116 additions & 0 deletions src/Common/src/Interop/ComCtl32/Interop.MCHT.cs
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
M-Lipin marked this conversation as resolved.
Show resolved Hide resolved
{
/// <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
}
}
}
101 changes: 101 additions & 0 deletions src/Common/src/Interop/ComCtl32/Interop.MCM.cs
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
M-Lipin marked this conversation as resolved.
Show resolved Hide resolved
{
/// <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
}
}
}
Loading