Page MenuHome
Paste P1124

Help button support
ActivePublic

Authored by LazyDodo (LazyDodo) on Oct 2 2019, 5:25 PM.
intern/ghost/intern/GHOST_SystemWin32.cpp | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index ef8ce6a43d7..206daba6dc6 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -32,7 +32,7 @@
#include <tlhelp32.h>
#include <psapi.h>
#include <windowsx.h>
-
+#include <shellapi.h>
#include "utfconv.h"
#include "GHOST_DisplayManagerWin32.h"
@@ -55,6 +55,9 @@
# include "GHOST_NDOFManagerWin32.h"
#endif
+// this feels like a giant hack
+static const char *HelpLink = NULL;
+
// Key code values not found in winuser.h
#ifndef VK_MINUS
# define VK_MINUS 0xBD
@@ -1186,6 +1189,11 @@ LRESULT WINAPI GHOST_SystemWin32::s_wndProc(HWND hwnd, UINT msg, WPARAM wParam,
GHOST_WindowWin32 *window = (GHOST_WindowWin32 *)::GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (window) {
switch (msg) {
+ case WM_HELP:
+ if (HelpLink != NULL) {
+ ShellExecute(NULL, "open", HelpLink, NULL, NULL, SW_SHOWNORMAL);
+ }
+ break;
// we need to check if new key layout has AltGr
case WM_INPUTLANGCHANGE: {
system->handleKeyboardChange();
@@ -1788,7 +1796,15 @@ GHOST_TSuccess GHOST_SystemWin32::showMessageBox(const char *title,
const char *link,
GHOST_DialogOptions dialog_options) const
{
- MessageBox(NULL, message, title, MB_OK | MB_ICONERROR);
+ if (!link) {
+ MessageBox(NULL, message, title, MB_OK | MB_ICONERROR);
+ }
+ else {
+ HelpLink = link;
+ MessageBox(GetForegroundWindow(), message, title, MB_OK | MB_ICONERROR | MB_HELP);
+ HelpLink = NULL;
+ }
+
return GHOST_kSuccess;
}