forked from dotnet/winforms
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert PR_9884 “Migrate HtmlHelp to CsWin32” and add unit test (dotne…
…t#10435) * revert PR#9884: Migrate HtmlHelp to CsWin32 * Add unit test for Help
- Loading branch information
Showing
9 changed files
with
194 additions
and
67 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
src/System.Windows.Forms.Primitives/src/Interop/Hhctrl/Interop.HH.cs
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,44 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
internal partial class Interop | ||
{ | ||
internal static partial class Hhctl | ||
{ | ||
public enum HH : uint | ||
{ | ||
DISPLAY_TOPIC = 0x00, | ||
HELP_FINDER = 0x00, | ||
DISPLAY_TOC = 0x01, | ||
DISPLAY_INDEX = 0x02, | ||
DISPLAY_SEARCH = 0x03, | ||
SET_WIN_TYPE = 0x04, | ||
GET_WIN_TYPE = 0x05, | ||
GET_WIN_HANDLE = 0x06, | ||
ENUM_INFO_TYPE = 0x07, | ||
SET_INFO_TYPE = 0x08, | ||
SYNC = 0x09, | ||
RESERVED1 = 0x0A, | ||
RESERVED2 = 0x0B, | ||
RESERVED3 = 0x0C, | ||
KEYWORD_LOOKUP = 0x0D, | ||
DISPLAY_TEXT_POPUP = 0x0E, | ||
HELP_CONTEXT = 0x0F, | ||
TP_HELP_CONTEXTMENU = 0x10, | ||
TP_HELP_WM_HELP = 0x11, | ||
CLOSE_ALL = 0x12, | ||
ALINK_LOOKUP = 0x13, | ||
GET_LAST_ERROR = 0x14, | ||
ENUM_CATEGORY = 0x15, | ||
ENUM_CATEGORY_IT = 0x16, | ||
RESET_IT_FILTER = 0x17, | ||
SET_INCLUSIVE_FILTER = 0x18, | ||
SET_EXCLUSIVE_FILTER = 0x19, | ||
INITIALIZE = 0x1C, | ||
UNINITIALIZE = 0x1D, | ||
SAFE_DISPLAY_TOPIC = 0x20, | ||
PRETRANSLATEMESSAGE = 0xFD, | ||
SET_GLOBAL_PROPERTY = 0xFC | ||
} | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/System.Windows.Forms.Primitives/src/Interop/Hhctrl/Interop.HH_ALINKW.cs
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,20 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
internal partial class Interop | ||
{ | ||
internal static partial class Hhctl | ||
{ | ||
public unsafe struct HH_ALINKW | ||
{ | ||
public int cbStruct; | ||
public BOOL fReserved; | ||
public char* pszKeywords; | ||
public char* pszUrl; | ||
public char* pszMsgText; | ||
public char* pszMsgTitle; | ||
public char* pszWindow; | ||
public BOOL fIndexOnFail; | ||
} | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/System.Windows.Forms.Primitives/src/Interop/Hhctrl/Interop.HH_FTS_QUERYW.cs
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,22 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
internal partial class Interop | ||
{ | ||
internal static partial class Hhctl | ||
{ | ||
public unsafe struct HH_FTS_QUERYW | ||
{ | ||
public const int DEFAULT_PROXIMITY = -1; | ||
|
||
public int cbStruct; | ||
public BOOL fUniCodeStrings; | ||
public char* pszSearchQuery; | ||
public int iProximity; | ||
public BOOL fStemmedSearch; | ||
public BOOL fTitleOnly; | ||
public BOOL fExecute; | ||
public char* pszWindow; | ||
} | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/System.Windows.Forms.Primitives/src/Interop/Hhctrl/Interop.HH_POPUPW.cs
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,23 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Drawing; | ||
|
||
internal partial class Interop | ||
{ | ||
internal static partial class Hhctl | ||
{ | ||
public unsafe struct HH_POPUPW | ||
{ | ||
public int cbStruct; | ||
public IntPtr hinst; | ||
public uint idString; | ||
public char* pszText; | ||
public Point pt; | ||
public COLORREF clrForeground; | ||
public COLORREF clrBackground; | ||
public RECT rcMargins; | ||
public char* pszFont; | ||
} | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
src/System.Windows.Forms.Primitives/src/Interop/Hhctrl/Interop.HtmlHelpW.cs
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,36 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Runtime.InteropServices; | ||
|
||
internal partial class Interop | ||
{ | ||
internal static partial class Hhctl | ||
{ | ||
[DllImport(Libraries.Hhctrl, CharSet = CharSet.Unicode, ExactSpelling = true)] | ||
public static extern int HtmlHelpW(IntPtr hwndCaller, string? pszFile, HH uCommand, IntPtr dwData); | ||
|
||
public static int HtmlHelpW(HandleRef<HWND> hwndCaller, string? pszFile, HH uCommand, IntPtr dwData) | ||
{ | ||
int result = HtmlHelpW(hwndCaller.Handle, pszFile, uCommand, dwData); | ||
GC.KeepAlive(hwndCaller.Wrapper); | ||
return result; | ||
} | ||
|
||
public static unsafe int HtmlHelpW(HandleRef<HWND> hwndCaller, string? pszFile, HH uCommand, string data) | ||
{ | ||
fixed (char* dwData = data) | ||
{ | ||
return HtmlHelpW(hwndCaller, pszFile, uCommand, (IntPtr)(void*)dwData); | ||
} | ||
} | ||
|
||
public static unsafe int HtmlHelpW<T>(HandleRef<HWND> hwndCaller, string? pszFile, HH uCommand, ref T data) where T : unmanaged | ||
{ | ||
fixed (void* dwData = &data) | ||
{ | ||
return HtmlHelpW(hwndCaller, pszFile, uCommand, (IntPtr)dwData); | ||
} | ||
} | ||
} | ||
} |
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
25 changes: 0 additions & 25 deletions
25
src/System.Windows.Forms.Primitives/src/Windows/Win32/PInvoke.HtmlHelp.cs
This file was deleted.
Oops, something went wrong.
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
15 changes: 15 additions & 0 deletions
15
src/System.Windows.Forms/tests/UnitTests/System/Windows/Forms/Help/HelpTests.cs
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,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System.Drawing; | ||
|
||
namespace System.Windows.Forms.Tests; | ||
|
||
public class HelpTests | ||
{ | ||
[Fact] | ||
public void ShowPopupTest() | ||
{ | ||
Help.ShowPopup(null, "Popup", Point.Empty); | ||
} | ||
} |