Commit c6525745 authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

comctl32: Fix the tooltips behaviour when TTF_ABSOLUTE isn't specified.

This does not mean to use the current cursor position. Instead, it means that the left hand edge of balloon tips doesn't have to be exactly the co-ordinate passed in (i.e. the stem can be as vertical as possible) and it means non-balloon tips can use smart placement.
parent 5ff8e6d7
...@@ -573,64 +573,39 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr, BOOL track_activate) ...@@ -573,64 +573,39 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr, BOOL track_activate)
if (track_activate) if (track_activate)
{ {
if (toolPtr->uFlags & TTF_ABSOLUTE) rect.left = infoPtr->xTrackPos;
{ rect.top = infoPtr->yTrackPos;
rect.left = infoPtr->xTrackPos; ptfx = rect.left;
rect.top = infoPtr->yTrackPos;
ptfx = rect.left;
if (toolPtr->uFlags & TTF_CENTERTIP) if (toolPtr->uFlags & TTF_CENTERTIP)
{ {
rect.left -= (size.cx / 2); rect.left -= (size.cx / 2);
if (!(style & TTS_BALLOON)) if (!(style & TTS_BALLOON))
rect.top -= (size.cy / 2); rect.top -= (size.cy / 2);
}
infoPtr->bToolBelow = TRUE;
} }
else infoPtr->bToolBelow = TRUE;
if (!(toolPtr->uFlags & TTF_ABSOLUTE))
{ {
RECT rcTool; if (style & TTS_BALLOON)
rect.left -= BALLOON_STEMINDENT;
else
{
RECT rcTool;
GetCursorPos ((LPPOINT)&rect); if (toolPtr->uFlags & TTF_IDISHWND)
if (style & TTS_BALLOON) GetWindowRect ((HWND)toolPtr->uId, &rcTool);
{
ptfx = rect.left;
if (rect.top - size.cy >= 0)
{
rect.top -= size.cy;
infoPtr->bToolBelow = FALSE;
}
else else
{ {
infoPtr->bToolBelow = TRUE; rcTool = toolPtr->rect;
rect.top += 20; MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rcTool, 2);
} }
rect.left = max(0, rect.left - BALLOON_STEMINDENT);
}
else
{
rect.top += 20;
infoPtr->bToolBelow = TRUE;
}
if (toolPtr->uFlags & TTF_CENTERTIP) /* smart placement */
{ if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) &&
rect.left -= (size.cx / 2); (rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom))
rect.top -= (size.cy / 2); rect.left = rcTool.right;
}
if (toolPtr->uFlags & TTF_IDISHWND)
GetWindowRect ((HWND)toolPtr->uId, &rcTool);
else
{
rcTool = toolPtr->rect;
MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rcTool, 2);
} }
/* smart placement */
if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) &&
(rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom))
rect.left = rcTool.right;
} }
} }
else else
......
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