Commit b48f394e authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

comctl32: Add support for retrieving lpszText in TOOLINFO structure.

parent 40456f4b
...@@ -322,6 +322,11 @@ static void test_gettext(void) ...@@ -322,6 +322,11 @@ static void test_gettext(void)
toolinfoA.lpszText = bufA; toolinfoA.lpszText = bufA;
SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
ok(strcmp(toolinfoA.lpszText, "") == 0, "lpszText should be an empty string\n"); ok(strcmp(toolinfoA.lpszText, "") == 0, "lpszText should be an empty string\n");
toolinfoA.lpszText = bufA;
SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
ok(toolinfoA.lpszText == NULL,
"expected NULL, got %p", toolinfoA.lpszText);
} }
else else
{ {
...@@ -355,6 +360,12 @@ static void test_gettext(void) ...@@ -355,6 +360,12 @@ static void test_gettext(void)
SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
ok(strcmp(toolinfoA.lpszText, testtipA) == 0, "lpszText should be an empty string\n"); ok(strcmp(toolinfoA.lpszText, testtipA) == 0, "lpszText should be an empty string\n");
memset(bufA, 0x1f, sizeof(bufA));
toolinfoA.lpszText = bufA;
SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
ok(strcmp(toolinfoA.lpszText, testtipA) == 0,
"expected %s, got %p\n", testtipA, toolinfoA.lpszText);
length = SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0); length = SendMessage(hwnd, WM_GETTEXTLENGTH, 0, 0);
ok(length == 0, "Expected 0, got %d\n", length); ok(length == 0, "Expected 0, got %d\n", length);
} }
...@@ -378,6 +389,11 @@ static void test_gettext(void) ...@@ -378,6 +389,11 @@ static void test_gettext(void)
SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA); SendMessageA(hwnd, TTM_GETTEXTA, 0, (LPARAM)&toolinfoA);
ok(strcmp(toolinfoA.lpszText, testcallbackA) == 0, ok(strcmp(toolinfoA.lpszText, testcallbackA) == 0,
"lpszText should be an (%s) string\n", testcallbackA); "lpszText should be an (%s) string\n", testcallbackA);
toolinfoA.lpszText = bufA;
SendMessageA(hwnd, TTM_GETTOOLINFOA, 0, (LPARAM)&toolinfoA);
ok(toolinfoA.lpszText == LPSTR_TEXTCALLBACKA,
"expected LPSTR_TEXTCALLBACKA, got %p\n", toolinfoA.lpszText);
} }
DestroyWindow(hwnd); DestroyWindow(hwnd);
......
...@@ -943,6 +943,21 @@ TOOLTIPS_GetToolFromPoint (const TOOLTIPS_INFO *infoPtr, HWND hwnd, const POINT ...@@ -943,6 +943,21 @@ TOOLTIPS_GetToolFromPoint (const TOOLTIPS_INFO *infoPtr, HWND hwnd, const POINT
return -1; return -1;
} }
static inline void
TOOLTIPS_CopyInfoT (const TTTOOL_INFO *toolPtr, TTTOOLINFOW *ti, BOOL isW)
{
if (ti->lpszText) {
if (toolPtr->lpszText == NULL ||
IS_INTRESOURCE(toolPtr->lpszText) ||
toolPtr->lpszText == LPSTR_TEXTCALLBACKW)
ti->lpszText = toolPtr->lpszText;
else if (isW)
strcpyW (ti->lpszText, toolPtr->lpszText);
else
WideCharToMultiByte(CP_ACP, 0, toolPtr->lpszText, -1,
(LPSTR)ti->lpszText, INFOTIPSIZE, NULL, NULL);
}
}
static BOOL static BOOL
TOOLTIPS_IsWindowActive (HWND hwnd) TOOLTIPS_IsWindowActive (HWND hwnd)
...@@ -1199,8 +1214,7 @@ TOOLTIPS_EnumToolsT (const TOOLTIPS_INFO *infoPtr, UINT uIndex, TTTOOLINFOW *ti, ...@@ -1199,8 +1214,7 @@ TOOLTIPS_EnumToolsT (const TOOLTIPS_INFO *infoPtr, UINT uIndex, TTTOOLINFOW *ti,
ti->uId = toolPtr->uId; ti->uId = toolPtr->uId;
ti->rect = toolPtr->rect; ti->rect = toolPtr->rect;
ti->hinst = toolPtr->hinst; ti->hinst = toolPtr->hinst;
/* ti->lpszText = toolPtr->lpszText; */ TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
ti->lpszText = NULL; /* FIXME */
if (ti->cbSize >= TTTOOLINFOA_V2_SIZE) if (ti->cbSize >= TTTOOLINFOA_V2_SIZE)
ti->lParam = toolPtr->lParam; ti->lParam = toolPtr->lParam;
...@@ -1246,8 +1260,7 @@ TOOLTIPS_GetCurrentToolT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL is ...@@ -1246,8 +1260,7 @@ TOOLTIPS_GetCurrentToolT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL is
ti->uFlags = toolPtr->uFlags; ti->uFlags = toolPtr->uFlags;
ti->rect = toolPtr->rect; ti->rect = toolPtr->rect;
ti->hinst = toolPtr->hinst; ti->hinst = toolPtr->hinst;
/* ti->lpszText = toolPtr->lpszText; */ TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
ti->lpszText = NULL; /* FIXME */
if (ti->cbSize >= TTTOOLINFOW_V2_SIZE) if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
ti->lParam = toolPtr->lParam; ti->lParam = toolPtr->lParam;
...@@ -1385,8 +1398,7 @@ TOOLTIPS_GetToolInfoT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW) ...@@ -1385,8 +1398,7 @@ TOOLTIPS_GetToolInfoT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
ti->uFlags = toolPtr->uFlags; ti->uFlags = toolPtr->uFlags;
ti->rect = toolPtr->rect; ti->rect = toolPtr->rect;
ti->hinst = toolPtr->hinst; ti->hinst = toolPtr->hinst;
/* lpToolInfo->lpszText = toolPtr->lpszText; */ TOOLTIPS_CopyInfoT (toolPtr, ti, isW);
ti->lpszText = NULL; /* FIXME */
if (ti->cbSize >= TTTOOLINFOW_V2_SIZE) if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
ti->lParam = toolPtr->lParam; ti->lParam = toolPtr->lParam;
...@@ -1420,8 +1432,7 @@ TOOLTIPS_HitTestT (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit, ...@@ -1420,8 +1432,7 @@ TOOLTIPS_HitTestT (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit,
lptthit->ti.uId = toolPtr->uId; lptthit->ti.uId = toolPtr->uId;
lptthit->ti.rect = toolPtr->rect; lptthit->ti.rect = toolPtr->rect;
lptthit->ti.hinst = toolPtr->hinst; lptthit->ti.hinst = toolPtr->hinst;
/* lptthit->ti.lpszText = toolPtr->lpszText; */ TOOLTIPS_CopyInfoT (toolPtr, &lptthit->ti, isW);
lptthit->ti.lpszText = NULL; /* FIXME */
if (lptthit->ti.cbSize >= TTTOOLINFOW_V2_SIZE) if (lptthit->ti.cbSize >= TTTOOLINFOW_V2_SIZE)
lptthit->ti.lParam = toolPtr->lParam; lptthit->ti.lParam = toolPtr->lParam;
} }
......
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