Commit 4494a500 authored by Chris Morgan's avatar Chris Morgan Committed by Alexandre Julliard

Added changing mouse cursor when over a help topic link.

parent 4b3afdcc
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "windows.h" #include "winbase.h"
#include "windowsx.h" #include "windowsx.h"
#include "winhelp.h" #include "winhelp.h"
...@@ -27,6 +27,7 @@ static VOID WINHELP_SetupText(HWND hWnd); ...@@ -27,6 +27,7 @@ static VOID WINHELP_SetupText(HWND hWnd);
static BOOL WINHELP_AppendText(WINHELP_LINE***, WINHELP_LINE_PART***, static BOOL WINHELP_AppendText(WINHELP_LINE***, WINHELP_LINE_PART***,
LPSIZE, LPSIZE, INT*, INT, LPCSTR, UINT, LPSIZE, LPSIZE, INT*, INT, LPCSTR, UINT,
HFONT, COLORREF, HLPFILE_LINK*); HFONT, COLORREF, HLPFILE_LINK*);
static WINHELP_LINE_PART* WINHELP_IsOverLink(HWND hWnd, WPARAM wParam, LPARAM lParam);
WINHELP_GLOBALS Globals = {3, 0, 0, 0, 0, 0}; WINHELP_GLOBALS Globals = {3, 0, 0, 0, 0, 0};
...@@ -241,6 +242,7 @@ VOID WINHELP_CreateHelpWindow(LPCSTR lpszFile, LONG lHash, LPCSTR lpszWindow, ...@@ -241,6 +242,7 @@ VOID WINHELP_CreateHelpWindow(LPCSTR lpszFile, LONG lHash, LPCSTR lpszWindow,
win->lpszName = ptr; win->lpszName = ptr;
} }
else win->lpszName = NULL; else win->lpszName = NULL;
win->page = page; win->page = page;
win->first_button = 0; win->first_button = 0;
win->first_line = 0; win->first_line = 0;
...@@ -249,6 +251,9 @@ VOID WINHELP_CreateHelpWindow(LPCSTR lpszFile, LONG lHash, LPCSTR lpszWindow, ...@@ -249,6 +251,9 @@ VOID WINHELP_CreateHelpWindow(LPCSTR lpszFile, LONG lHash, LPCSTR lpszWindow,
win->hTextWnd = 0; win->hTextWnd = 0;
win->hShadowWnd = 0; win->hShadowWnd = 0;
win->hArrowCur = LoadCursorA(0, IDC_ARROWA);
win->hHandCur = LoadCursorA(0, IDC_HANDA);
Globals.active_win = win; Globals.active_win = win;
/* Initialize default pushbuttons */ /* Initialize default pushbuttons */
...@@ -620,24 +625,32 @@ static LRESULT CALLBACK WINHELP_TextWndProc (HWND hWnd, UINT msg, WPARAM wParam, ...@@ -620,24 +625,32 @@ static LRESULT CALLBACK WINHELP_TextWndProc (HWND hWnd, UINT msg, WPARAM wParam,
EndPaint (hWnd, &ps); EndPaint (hWnd, &ps);
break; break;
case WM_MOUSEMOVE:
win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0);
if(WINHELP_IsOverLink(hWnd, wParam, lParam))
SetCursor(win->hHandCur); /* set to hand pointer cursor to indicate a link */
else
SetCursor(win->hArrowCur); /* set to hand pointer cursor to indicate a link */
break;
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0); win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0);
scroll_pos = GetScrollPos(hWnd, SB_VERT);
hPopupWnd = Globals.hPopupWnd; hPopupWnd = Globals.hPopupWnd;
Globals.hPopupWnd = 0; Globals.hPopupWnd = 0;
mouse.x = LOWORD(lParam); part = WINHELP_IsOverLink(hWnd, wParam, lParam);
mouse.y = HIWORD(lParam); if(part)
for (line = win->first_line; line; line = line->next) {
for (part = &line->first_part; part; part = part->next) mouse.x = LOWORD(lParam);
if (part->link.lpszPath && mouse.y = HIWORD(lParam);
part->rect.left <= mouse.x &&
part->rect.right >= mouse.x && WINHELP_CreateHelpWindow(part->link.lpszPath, part->link.lHash, NULL,
part->rect.top <= mouse.y + scroll_pos &&
part->rect.bottom >= mouse.y + scroll_pos)
WINHELP_CreateHelpWindow(part->link.lpszPath, part->link.lHash, NULL,
part->link.bPopup, hWnd, &mouse, SW_NORMAL); part->link.bPopup, hWnd, &mouse, SW_NORMAL);
}
if (hPopupWnd) if (hPopupWnd)
DestroyWindow(hPopupWnd); DestroyWindow(hPopupWnd);
break; break;
...@@ -1052,6 +1065,34 @@ INT WINHELP_MessageBoxIDS_s(UINT ids_text, LPCSTR str, UINT ids_title, WORD type ...@@ -1052,6 +1065,34 @@ INT WINHELP_MessageBoxIDS_s(UINT ids_text, LPCSTR str, UINT ids_title, WORD type
return(MessageBox(0, newtext, title, type)); return(MessageBox(0, newtext, title, type));
} }
WINHELP_LINE_PART* WINHELP_IsOverLink(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
WINHELP_WINDOW* win = (WINHELP_WINDOW*) GetWindowLong(hWnd, 0);
POINT mouse;
WINHELP_LINE *line;
WINHELP_LINE_PART *part;
int scroll_pos = GetScrollPos(hWnd, SB_VERT);
mouse.x = LOWORD(lParam);
mouse.y = HIWORD(lParam);
for (line = win->first_line; line; line = line->next)
{
for (part = &line->first_part; part; part = part->next)
{
if (part->link.lpszPath &&
part->rect.left <= mouse.x &&
part->rect.right >= mouse.x &&
part->rect.top <= mouse.y + scroll_pos &&
part->rect.bottom >= mouse.y + scroll_pos)
{
return part;
}
}
}
return NULL;
}
/* Local Variables: */ /* Local Variables: */
/* c-file-style: "GNU" */ /* c-file-style: "GNU" */
/* End: */ /* End: */
...@@ -78,6 +78,9 @@ typedef struct tagWinHelp ...@@ -78,6 +78,9 @@ typedef struct tagWinHelp
HFONT (*fonts)[2]; HFONT (*fonts)[2];
UINT fonts_len; UINT fonts_len;
HCURSOR hArrowCur;
HCURSOR hHandCur;
HGLOBAL hSelf; HGLOBAL hSelf;
struct tagWinHelp *next; struct tagWinHelp *next;
} WINHELP_WINDOW; } WINHELP_WINDOW;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment