mirror of
https://github.com/reactos/reactos.git
synced 2025-07-23 11:14:01 +00:00
Fix balloon tooltip shape
This commit is contained in:
parent
ab1868c7bf
commit
1aa76275ac
1 changed files with 54 additions and 0 deletions
|
@ -162,10 +162,17 @@ typedef struct
|
||||||
#define BALLOON_TEXT_MARGIN (NORMAL_TEXT_MARGIN+8)
|
#define BALLOON_TEXT_MARGIN (NORMAL_TEXT_MARGIN+8)
|
||||||
/* value used for CreateRoundRectRgn that specifies how much
|
/* value used for CreateRoundRectRgn that specifies how much
|
||||||
* each corner is curved */
|
* each corner is curved */
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
#define BALLOON_ROUNDEDNESS 16
|
||||||
|
#define BALLOON_STEMHEIGHT 18
|
||||||
|
#define BALLOON_STEMWIDTH 18
|
||||||
|
#define BALLOON_STEMINDENT 16
|
||||||
|
#else
|
||||||
#define BALLOON_ROUNDEDNESS 20
|
#define BALLOON_ROUNDEDNESS 20
|
||||||
#define BALLOON_STEMHEIGHT 13
|
#define BALLOON_STEMHEIGHT 13
|
||||||
#define BALLOON_STEMWIDTH 10
|
#define BALLOON_STEMWIDTH 10
|
||||||
#define BALLOON_STEMINDENT 20
|
#define BALLOON_STEMINDENT 20
|
||||||
|
#endif // __REACTOS__
|
||||||
|
|
||||||
#define BALLOON_ICON_TITLE_SPACING 8 /* horizontal spacing between icon and title */
|
#define BALLOON_ICON_TITLE_SPACING 8 /* horizontal spacing between icon and title */
|
||||||
#define BALLOON_TITLE_TEXT_SPACING 8 /* vertical spacing between icon/title and main text */
|
#define BALLOON_TITLE_TEXT_SPACING 8 /* vertical spacing between icon/title and main text */
|
||||||
|
@ -741,6 +748,40 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
|
||||||
mon_info.cbSize = sizeof(mon_info);
|
mon_info.cbSize = sizeof(mon_info);
|
||||||
GetMonitorInfoW( monitor, &mon_info );
|
GetMonitorInfoW( monitor, &mon_info );
|
||||||
|
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
if (rect.right > mon_info.rcMonitor.right)
|
||||||
|
{
|
||||||
|
rect.left -= size.cx - (BALLOON_STEMINDENT + BALLOON_STEMWIDTH);
|
||||||
|
rect.right -= size.cx - (BALLOON_STEMINDENT + BALLOON_STEMWIDTH);
|
||||||
|
if (rect.right > mon_info.rcMonitor.right)
|
||||||
|
{
|
||||||
|
rect.left -= (rect.right - mon_info.rcMonitor.right);
|
||||||
|
rect.right = mon_info.rcMonitor.right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rect.left < mon_info.rcMonitor.left)
|
||||||
|
{
|
||||||
|
rect.right += abs(rect.left);
|
||||||
|
rect.left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rect.bottom > mon_info.rcMonitor.bottom)
|
||||||
|
{
|
||||||
|
RECT rc;
|
||||||
|
if (toolPtr->uFlags & TTF_IDISHWND)
|
||||||
|
{
|
||||||
|
GetWindowRect((HWND)toolPtr->uId, &rc);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rc = toolPtr->rect;
|
||||||
|
MapWindowPoints(toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
|
||||||
|
}
|
||||||
|
rect.bottom = rc.top - 2;
|
||||||
|
rect.top = rect.bottom - size.cy;
|
||||||
|
}
|
||||||
|
#else
|
||||||
if( rect.right > mon_info.rcWork.right ) {
|
if( rect.right > mon_info.rcWork.right ) {
|
||||||
rect.left -= rect.right - mon_info.rcWork.right + 2;
|
rect.left -= rect.right - mon_info.rcWork.right + 2;
|
||||||
rect.right = mon_info.rcWork.right - 2;
|
rect.right = mon_info.rcWork.right - 2;
|
||||||
|
@ -759,6 +800,7 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
|
||||||
rect.bottom = rc.top - 2;
|
rect.bottom = rc.top - 2;
|
||||||
rect.top = rect.bottom - size.cy;
|
rect.top = rect.bottom - size.cy;
|
||||||
}
|
}
|
||||||
|
#endif // __REACTOS__
|
||||||
|
|
||||||
AdjustWindowRectEx (&rect, GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE),
|
AdjustWindowRectEx (&rect, GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE),
|
||||||
FALSE, GetWindowLongW (infoPtr->hwndSelf, GWL_EXSTYLE));
|
FALSE, GetWindowLongW (infoPtr->hwndSelf, GWL_EXSTYLE));
|
||||||
|
@ -775,7 +817,11 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
|
||||||
{
|
{
|
||||||
pts[0].x = ptfx;
|
pts[0].x = ptfx;
|
||||||
pts[0].y = 0;
|
pts[0].y = 0;
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
pts[1].x = max(BALLOON_STEMINDENT, ptfx - BALLOON_STEMWIDTH);
|
||||||
|
#else
|
||||||
pts[1].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
|
pts[1].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
|
||||||
|
#endif
|
||||||
pts[1].y = BALLOON_STEMHEIGHT;
|
pts[1].y = BALLOON_STEMHEIGHT;
|
||||||
pts[2].x = pts[1].x + BALLOON_STEMWIDTH;
|
pts[2].x = pts[1].x + BALLOON_STEMWIDTH;
|
||||||
pts[2].y = pts[1].y;
|
pts[2].y = pts[1].y;
|
||||||
|
@ -787,7 +833,11 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
pts[0].x = max(BALLOON_STEMINDENT, ptfx - BALLOON_STEMWIDTH);
|
||||||
|
#else
|
||||||
pts[0].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
|
pts[0].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
|
||||||
|
#endif
|
||||||
pts[0].y = (rect.bottom - rect.top) - BALLOON_STEMHEIGHT;
|
pts[0].y = (rect.bottom - rect.top) - BALLOON_STEMHEIGHT;
|
||||||
pts[1].x = pts[0].x + BALLOON_STEMWIDTH;
|
pts[1].x = pts[0].x + BALLOON_STEMWIDTH;
|
||||||
pts[1].y = pts[0].y;
|
pts[1].y = pts[0].y;
|
||||||
|
@ -805,7 +855,11 @@ TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
|
||||||
hRgn = CreateRoundRectRgn(0,
|
hRgn = CreateRoundRectRgn(0,
|
||||||
(infoPtr->bToolBelow ? BALLOON_STEMHEIGHT : 0),
|
(infoPtr->bToolBelow ? BALLOON_STEMHEIGHT : 0),
|
||||||
rect.right - rect.left,
|
rect.right - rect.left,
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
(infoPtr->bToolBelow ? rect.bottom - rect.top : rect.bottom - rect.top - BALLOON_STEMHEIGHT + 1),
|
||||||
|
#else
|
||||||
(infoPtr->bToolBelow ? rect.bottom - rect.top : rect.bottom - rect.top - BALLOON_STEMHEIGHT),
|
(infoPtr->bToolBelow ? rect.bottom - rect.top : rect.bottom - rect.top - BALLOON_STEMHEIGHT),
|
||||||
|
#endif
|
||||||
BALLOON_ROUNDEDNESS, BALLOON_ROUNDEDNESS);
|
BALLOON_ROUNDEDNESS, BALLOON_ROUNDEDNESS);
|
||||||
|
|
||||||
CombineRgn(hRgn, hRgn, hrStem, RGN_OR);
|
CombineRgn(hRgn, hRgn, hrStem, RGN_OR);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue