ReactOS 0.4.16-dev-197-g92996da
tooltips.c File Reference
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "commctrl.h"
#include "comctl32.h"
#include "wine/debug.h"
Include dependency graph for tooltips.c:

Go to the source code of this file.

Classes

struct  TTTOOL_INFO
 
struct  TOOLTIPS_INFO
 

Macros

#define ID_TIMERSHOW   1 /* show delay timer */
 
#define ID_TIMERPOP   2 /* auto pop timer */
 
#define ID_TIMERLEAVE   3 /* tool leave timer */
 
#define TOOLTIPS_GetInfoPtr(hWindow)   ((TOOLTIPS_INFO *)GetWindowLongPtrW (hWindow, 0))
 
#define NORMAL_TEXT_MARGIN   2
 
#define BALLOON_TEXT_MARGIN   (NORMAL_TEXT_MARGIN+8)
 
#define BALLOON_ROUNDEDNESS   20
 
#define BALLOON_STEMHEIGHT   13
 
#define BALLOON_STEMWIDTH   10
 
#define BALLOON_STEMINDENT   20
 
#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 ICON_HEIGHT   16
 
#define ICON_WIDTH   16
 
#define MAX_TEXT_SIZE_A   80 /* maximum retrieving text size by ANSI message */
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (tooltips)
 
static LRESULT CALLBACK TOOLTIPS_SubclassProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef)
 
static UINT_PTR TOOLTIPS_GetTitleIconIndex (HICON hIcon)
 
static void TOOLTIPS_InitSystemSettings (TOOLTIPS_INFO *infoPtr)
 
static void TOOLTIPS_customdraw_fill (const TOOLTIPS_INFO *infoPtr, NMTTCUSTOMDRAW *lpnmttcd, HDC hdc, const RECT *rcBounds, UINT uFlags)
 
static DWORD TOOLTIPS_notify_customdraw (DWORD dwDrawStage, NMTTCUSTOMDRAW *lpnmttcd)
 
static void TOOLTIPS_Refresh (const TOOLTIPS_INFO *infoPtr, HDC hdc)
 
static void TOOLTIPS_GetDispInfoA (const TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr, WCHAR *buffer)
 
static void TOOLTIPS_GetDispInfoW (const TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr, WCHAR *buffer)
 
static void TOOLTIPS_GetTipText (const TOOLTIPS_INFO *infoPtr, INT nTool, WCHAR *buffer)
 
static void TOOLTIPS_CalcTipSize (const TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
 
static void TOOLTIPS_Show (TOOLTIPS_INFO *infoPtr, BOOL track_activate)
 
static void TOOLTIPS_Hide (TOOLTIPS_INFO *infoPtr)
 
static void TOOLTIPS_TrackShow (TOOLTIPS_INFO *infoPtr)
 
static void TOOLTIPS_TrackHide (const TOOLTIPS_INFO *infoPtr)
 
static INT TOOLTIPS_GetToolFromInfoT (const TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolInfo)
 
static INT TOOLTIPS_GetToolFromPoint (const TOOLTIPS_INFO *infoPtr, HWND hwnd, const POINT *lpPt)
 
static void TOOLTIPS_CopyInfoT (const TOOLTIPS_INFO *infoPtr, INT index, TTTOOLINFOW *ti, BOOL isW)
 
static BOOL TOOLTIPS_IsWindowActive (HWND hwnd)
 
static INT TOOLTIPS_CheckTool (const TOOLTIPS_INFO *infoPtr, BOOL bShowTest)
 
static LRESULT TOOLTIPS_Activate (TOOLTIPS_INFO *infoPtr, BOOL activate)
 
static LRESULT TOOLTIPS_AddToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
 
static void TOOLTIPS_ResetSubclass (const TTTOOL_INFO *toolPtr)
 
static void TOOLTIPS_FreeToolText (TTTOOL_INFO *toolPtr)
 
static void TOOLTIPS_SetToolText (TTTOOL_INFO *toolPtr, WCHAR *text, BOOL is_unicode)
 
static LRESULT TOOLTIPS_DelToolT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
 
static LRESULT TOOLTIPS_EnumToolsT (const TOOLTIPS_INFO *infoPtr, UINT uIndex, TTTOOLINFOW *ti, BOOL isW)
 
static LRESULT TOOLTIPS_GetBubbleSize (const TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolInfo)
 
static LRESULT TOOLTIPS_GetCurrentToolT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
 
static LRESULT TOOLTIPS_GetDelayTime (const TOOLTIPS_INFO *infoPtr, DWORD duration)
 
static LRESULT TOOLTIPS_GetMargin (const TOOLTIPS_INFO *infoPtr, RECT *rect)
 
static LRESULT TOOLTIPS_GetMaxTipWidth (const TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_GetTextT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
 
static LRESULT TOOLTIPS_GetTipBkColor (const TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_GetTipTextColor (const TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_GetToolCount (const TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_GetToolInfoT (const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
 
static LRESULT TOOLTIPS_HitTestT (const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit, BOOL isW)
 
static LRESULT TOOLTIPS_NewToolRectT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti)
 
static LRESULT TOOLTIPS_Pop (TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_RelayEvent (TOOLTIPS_INFO *infoPtr, LPMSG lpMsg)
 
static LRESULT TOOLTIPS_SetDelayTime (TOOLTIPS_INFO *infoPtr, DWORD duration, INT nTime)
 
static LRESULT TOOLTIPS_SetMargin (TOOLTIPS_INFO *infoPtr, const RECT *rect)
 
static LRESULT TOOLTIPS_SetMaxTipWidth (TOOLTIPS_INFO *infoPtr, INT MaxWidth)
 
static LRESULT TOOLTIPS_SetTipBkColor (TOOLTIPS_INFO *infoPtr, COLORREF clrBk)
 
static LRESULT TOOLTIPS_SetTipTextColor (TOOLTIPS_INFO *infoPtr, COLORREF clrText)
 
static LRESULT TOOLTIPS_SetTitleT (TOOLTIPS_INFO *infoPtr, UINT_PTR uTitleIcon, LPCWSTR pszTitle, BOOL isW)
 
static LRESULT TOOLTIPS_SetToolInfoT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
 
static LRESULT TOOLTIPS_TrackActivate (TOOLTIPS_INFO *infoPtr, BOOL track_activate, const TTTOOLINFOA *ti)
 
static LRESULT TOOLTIPS_TrackPosition (TOOLTIPS_INFO *infoPtr, LPARAM coord)
 
static LRESULT TOOLTIPS_Update (TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_UpdateTipTextT (TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
 
static LRESULT TOOLTIPS_Create (HWND hwnd)
 
static LRESULT TOOLTIPS_Destroy (TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_GetFont (const TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_MouseMessage (TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_NCCreate (HWND hwnd)
 
static LRESULT TOOLTIPS_NCHitTest (const TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLTIPS_NotifyFormat (TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
 
static LRESULT TOOLTIPS_Paint (const TOOLTIPS_INFO *infoPtr, HDC hDC)
 
static LRESULT TOOLTIPS_SetFont (TOOLTIPS_INFO *infoPtr, HFONT hFont, BOOL redraw)
 
static LRESULT TOOLTIPS_GetTextLength (const TOOLTIPS_INFO *infoPtr)
 
static LRESULT TOOLTIPS_OnWMGetText (const TOOLTIPS_INFO *infoPtr, WPARAM size, LPWSTR pszText)
 
static LRESULT TOOLTIPS_Timer (TOOLTIPS_INFO *infoPtr, INT iTimer)
 
static LRESULT TOOLTIPS_WinIniChange (TOOLTIPS_INFO *infoPtr)
 
static LRESULT CALLBACK TOOLTIPS_WindowProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID TOOLTIPS_Register (void)
 
VOID TOOLTIPS_Unregister (void)
 

Variables

static HICON hTooltipIcons [TTI_ERROR+1]
 

Macro Definition Documentation

◆ BALLOON_ICON_TITLE_SPACING

#define BALLOON_ICON_TITLE_SPACING   8 /* horizontal spacing between icon and title */

Definition at line 177 of file tooltips.c.

◆ BALLOON_ROUNDEDNESS

#define BALLOON_ROUNDEDNESS   20

Definition at line 171 of file tooltips.c.

◆ BALLOON_STEMHEIGHT

#define BALLOON_STEMHEIGHT   13

Definition at line 172 of file tooltips.c.

◆ BALLOON_STEMINDENT

#define BALLOON_STEMINDENT   20

Definition at line 174 of file tooltips.c.

◆ BALLOON_STEMWIDTH

#define BALLOON_STEMWIDTH   10

Definition at line 173 of file tooltips.c.

◆ BALLOON_TEXT_MARGIN

#define BALLOON_TEXT_MARGIN   (NORMAL_TEXT_MARGIN+8)

Definition at line 162 of file tooltips.c.

◆ BALLOON_TITLE_TEXT_SPACING

#define BALLOON_TITLE_TEXT_SPACING   8 /* vertical spacing between icon/title and main text */

Definition at line 178 of file tooltips.c.

◆ ICON_HEIGHT

#define ICON_HEIGHT   16

Definition at line 179 of file tooltips.c.

◆ ICON_WIDTH

#define ICON_WIDTH   16

Definition at line 180 of file tooltips.c.

◆ ID_TIMERLEAVE

#define ID_TIMERLEAVE   3 /* tool leave timer */

Definition at line 155 of file tooltips.c.

◆ ID_TIMERPOP

#define ID_TIMERPOP   2 /* auto pop timer */

Definition at line 154 of file tooltips.c.

◆ ID_TIMERSHOW

#define ID_TIMERSHOW   1 /* show delay timer */

Definition at line 153 of file tooltips.c.

◆ MAX_TEXT_SIZE_A

#define MAX_TEXT_SIZE_A   80 /* maximum retrieving text size by ANSI message */

Definition at line 182 of file tooltips.c.

◆ NORMAL_TEXT_MARGIN

#define NORMAL_TEXT_MARGIN   2

Definition at line 161 of file tooltips.c.

◆ TOOLTIPS_GetInfoPtr

#define TOOLTIPS_GetInfoPtr (   hWindow)    ((TOOLTIPS_INFO *)GetWindowLongPtrW (hWindow, 0))

Definition at line 158 of file tooltips.c.

Function Documentation

◆ TOOLTIPS_Activate()

static LRESULT TOOLTIPS_Activate ( TOOLTIPS_INFO infoPtr,
BOOL  activate 
)
static

Definition at line 1092 of file tooltips.c.

1093{
1094 infoPtr->bActive = activate;
1095
1096 TRACE("activate %d\n", activate);
1097
1098 if (!(infoPtr->bActive) && (infoPtr->nCurrentTool != -1))
1099 TOOLTIPS_Hide (infoPtr);
1100
1101 return 0;
1102}
static void TOOLTIPS_Hide(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:900
#define TRACE(s)
Definition: solgame.cpp:4
BOOL bActive
Definition: tooltips.c:129
INT nCurrentTool
Definition: tooltips.c:140

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_AddToolT()

static LRESULT TOOLTIPS_AddToolT ( TOOLTIPS_INFO infoPtr,
const TTTOOLINFOW ti,
BOOL  isW 
)
static

Definition at line 1106 of file tooltips.c.

1107{
1108 TTTOOL_INFO *toolPtr;
1109 INT nResult;
1110
1111 if (!ti) return FALSE;
1112
1113 TRACE("add tool (%p) %p %ld%s\n", infoPtr->hwndSelf, ti->hwnd, ti->uId,
1114 (ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
1115
1116 if (ti->cbSize > TTTOOLINFOW_V3_SIZE && isW)
1117 return FALSE;
1118
1119 if (infoPtr->uNumTools == 0) {
1120 infoPtr->tools = Alloc (sizeof(TTTOOL_INFO));
1121 toolPtr = infoPtr->tools;
1122 }
1123 else {
1124 TTTOOL_INFO *oldTools = infoPtr->tools;
1125 infoPtr->tools =
1126 Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools + 1));
1127 memcpy (infoPtr->tools, oldTools,
1128 infoPtr->uNumTools * sizeof(TTTOOL_INFO));
1129 Free (oldTools);
1130 toolPtr = &infoPtr->tools[infoPtr->uNumTools];
1131 }
1132
1133 infoPtr->uNumTools++;
1134
1135 /* copy tool data */
1136 toolPtr->uFlags = ti->uFlags;
1137 toolPtr->uInternalFlags = (ti->uFlags & (TTF_SUBCLASS | TTF_IDISHWND));
1138 toolPtr->hwnd = ti->hwnd;
1139 toolPtr->uId = ti->uId;
1140 toolPtr->rect = ti->rect;
1141 toolPtr->hinst = ti->hinst;
1142
1143 if (ti->cbSize >= TTTOOLINFOW_V1_SIZE) {
1144 if (IS_INTRESOURCE(ti->lpszText)) {
1145 TRACE("add string id %x\n", LOWORD(ti->lpszText));
1146 toolPtr->lpszText = ti->lpszText;
1147 }
1148 else if (ti->lpszText) {
1149 if (ti->lpszText == LPSTR_TEXTCALLBACKW) {
1150 TRACE("add CALLBACK\n");
1151 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
1152 }
1153 else if (isW) {
1154 INT len = lstrlenW (ti->lpszText);
1155 TRACE("add text %s\n", debugstr_w(ti->lpszText));
1156 toolPtr->lpszText = Alloc ((len + 1)*sizeof(WCHAR));
1157 lstrcpyW (toolPtr->lpszText, ti->lpszText);
1158 }
1159 else {
1160 INT len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, NULL, 0);
1161 TRACE("add text \"%s\"\n", debugstr_a((char *)ti->lpszText));
1162 toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
1163 MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len);
1164 }
1165 }
1166 }
1167
1168 if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
1169 toolPtr->lParam = ti->lParam;
1170
1171 /* install subclassing hook */
1172 if (toolPtr->uInternalFlags & TTF_SUBCLASS) {
1173 if (toolPtr->uInternalFlags & TTF_IDISHWND) {
1175 (DWORD_PTR)infoPtr->hwndSelf);
1176 }
1177 else {
1179 (DWORD_PTR)infoPtr->hwndSelf);
1180 }
1181 TRACE("subclassing installed\n");
1182 }
1183
1184 nResult = SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
1185 (WPARAM)infoPtr->hwndSelf, NF_QUERY);
1186 if (nResult == NFR_ANSI) {
1187 toolPtr->bNotifyUnicode = FALSE;
1188 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
1189 } else if (nResult == NFR_UNICODE) {
1190 toolPtr->bNotifyUnicode = TRUE;
1191 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
1192 } else {
1193 TRACE (" -- WM_NOTIFYFORMAT returns: %d\n", nResult);
1194 }
1195
1196 return TRUE;
1197}
PVOID Alloc(IN DWORD dwFlags, IN SIZE_T dwBytes)
Definition: main.c:63
BOOL WINAPI SetWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uIDSubclass, DWORD_PTR dwRef)
Definition: commctrl.c:1268
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static LRESULT CALLBACK TOOLTIPS_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef)
Definition: tooltips.c:2160
#define CP_ACP
Definition: compat.h:109
#define lstrcpyW
Definition: compat.h:749
#define MultiByteToWideChar
Definition: compat.h:110
#define lstrlenW
Definition: compat.h:750
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_a
Definition: kernel32.h:31
#define debugstr_w
Definition: kernel32.h:32
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define LOWORD(l)
Definition: pedump.c:82
#define LPSTR_TEXTCALLBACKW
Definition: commctrl.h:2385
#define TTTOOLINFOW_V1_SIZE
Definition: commctrl.h:1721
#define TTTOOLINFOW_V3_SIZE
Definition: commctrl.h:1725
#define TTF_IDISHWND
Definition: commctrl.h:1764
#define TTF_SUBCLASS
Definition: commctrl.h:1767
#define TTTOOLINFOW_V2_SIZE
Definition: commctrl.h:1723
UINT uNumTools
Definition: tooltips.c:131
HWND hwndSelf
Definition: tooltips.c:127
TTTOOL_INFO * tools
Definition: tooltips.c:150
UINT_PTR uId
Definition: tooltips.c:117
UINT uFlags
Definition: tooltips.c:113
UINT uInternalFlags
Definition: tooltips.c:114
BOOL bNotifyUnicode
Definition: tooltips.c:116
HINSTANCE hinst
Definition: tooltips.c:119
RECT rect
Definition: tooltips.c:118
LPARAM lParam
Definition: tooltips.c:121
LPWSTR lpszText
Definition: tooltips.c:120
HWND hwnd
Definition: tooltips.c:115
HINSTANCE hinst
Definition: commctrl.h:1745
UINT_PTR uId
Definition: commctrl.h:1743
LPARAM lParam
Definition: commctrl.h:1747
LPWSTR lpszText
Definition: commctrl.h:1746
uint32_t DWORD_PTR
Definition: typedefs.h:65
int32_t INT
Definition: typedefs.h:58
static const WCHAR isW[]
Definition: lex.c:62
UINT_PTR WPARAM
Definition: windef.h:207
#define IS_INTRESOURCE(i)
Definition: winuser.h:580
#define NFR_ANSI
Definition: winuser.h:2461
#define NFR_UNICODE
Definition: winuser.h:2462
#define NF_QUERY
Definition: winuser.h:2463
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815
char * LPSTR
Definition: xmlstorage.h:182
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_CalcTipSize()

static void TOOLTIPS_CalcTipSize ( const TOOLTIPS_INFO infoPtr,
LPSIZE  lpSize 
)
static

Definition at line 528 of file tooltips.c.

529{
530 HDC hdc;
531 HFONT hOldFont;
534 RECT rc = {0, 0, 0, 0};
535 SIZE title = {0, 0};
536
537 if (infoPtr->nMaxTipWidth > -1) {
538 rc.right = infoPtr->nMaxTipWidth;
540 }
541 if (style & TTS_NOPREFIX)
543 TRACE("%s\n", debugstr_w(infoPtr->szTipText));
544
545 hdc = GetDC (infoPtr->hwndSelf);
546 if (infoPtr->pszTitle)
547 {
548 RECT rcTitle = {0, 0, 0, 0};
549 TRACE("title %s\n", debugstr_w(infoPtr->pszTitle));
550 if (infoPtr->hTitleIcon)
551 {
552 title.cx = ICON_WIDTH;
553 title.cy = ICON_HEIGHT;
554 }
555 if (title.cx != 0) title.cx += BALLOON_ICON_TITLE_SPACING;
556 hOldFont = SelectObject (hdc, infoPtr->hTitleFont);
557 DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT);
558 SelectObject (hdc, hOldFont);
559 title.cy = max(title.cy, rcTitle.bottom - rcTitle.top) + BALLOON_TITLE_TEXT_SPACING;
560 title.cx += (rcTitle.right - rcTitle.left);
561 }
562 hOldFont = SelectObject (hdc, infoPtr->hFont);
563#ifdef __REACTOS__
565#endif
566 DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
567 SelectObject (hdc, hOldFont);
568 ReleaseDC (infoPtr->hwndSelf, hdc);
569
570 if ((style & TTS_BALLOON) || infoPtr->pszTitle)
571 {
572 lpSize->cx = max(rc.right - rc.left, title.cx) + 2*BALLOON_TEXT_MARGIN +
573 infoPtr->rcMargin.left + infoPtr->rcMargin.right;
574 lpSize->cy = title.cy + rc.bottom - rc.top + 2*BALLOON_TEXT_MARGIN +
575 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top +
577 }
578 else
579 {
580 lpSize->cx = rc.right - rc.left + 2*NORMAL_TEXT_MARGIN +
581 infoPtr->rcMargin.left + infoPtr->rcMargin.right;
582 lpSize->cy = rc.bottom - rc.top + 2*NORMAL_TEXT_MARGIN +
583 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top;
584 }
585}
Arabic default style
Definition: afstyles.h:94
UINT uFlags
Definition: api.c:59
#define BALLOON_TEXT_MARGIN
Definition: tooltips.c:162
#define BALLOON_STEMHEIGHT
Definition: tooltips.c:172
#define ICON_WIDTH
Definition: tooltips.c:180
#define NORMAL_TEXT_MARGIN
Definition: tooltips.c:161
#define ICON_HEIGHT
Definition: tooltips.c:179
#define BALLOON_TITLE_TEXT_SPACING
Definition: tooltips.c:178
#define BALLOON_ICON_TITLE_SPACING
Definition: tooltips.c:177
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
unsigned int UINT
Definition: ndis.h:50
INT WINAPI DrawTextW(HDC hdc, LPCWSTR str, INT count, LPRECT rect, UINT flags)
Definition: defwnd.c:16
static char title[]
Definition: ps.c:92
#define TTS_NOPREFIX
Definition: commctrl.h:1758
#define TTS_BALLOON
Definition: commctrl.h:1761
INT nMaxTipWidth
Definition: tooltips.c:138
HICON hTitleIcon
Definition: tooltips.c:148
HFONT hFont
Definition: tooltips.c:134
RECT rcMargin
Definition: tooltips.c:145
LPWSTR pszTitle
Definition: tooltips.c:147
HFONT hTitleFont
Definition: tooltips.c:135
WCHAR szTipText[INFOTIPSIZE]
Definition: tooltips.c:128
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
LONG cx
Definition: windef.h:334
LONG cy
Definition: windef.h:335
#define max(a, b)
Definition: svc.c:63
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define DT_NOPREFIX
Definition: winuser.h:537
#define DT_EXTERNALLEADING
Definition: winuser.h:533
LONG WINAPI GetWindowLongW(_In_ HWND, _In_ int)
#define DT_SINGLELINE
Definition: winuser.h:540
#define DT_WORDBREAK
Definition: winuser.h:544
HDC WINAPI GetDC(_In_opt_ HWND)
#define DT_EXPANDTABS
Definition: winuser.h:532
#define DT_CALCRECT
Definition: winuser.h:526
#define GWL_STYLE
Definition: winuser.h:855

Referenced by TOOLTIPS_GetBubbleSize(), and TOOLTIPS_Show().

◆ TOOLTIPS_CheckTool()

static INT TOOLTIPS_CheckTool ( const TOOLTIPS_INFO infoPtr,
BOOL  bShowTest 
)
static

Definition at line 1056 of file tooltips.c.

1057{
1058 POINT pt;
1059 HWND hwndTool;
1060 INT nTool;
1061
1062 GetCursorPos (&pt);
1063 hwndTool = (HWND)SendMessageW (infoPtr->hwndSelf, TTM_WINDOWFROMPOINT, 0, (LPARAM)&pt);
1064 if (hwndTool == 0)
1065 return -1;
1066
1067 ScreenToClient (hwndTool, &pt);
1068 nTool = TOOLTIPS_GetToolFromPoint (infoPtr, hwndTool, &pt);
1069 if (nTool == -1)
1070 return -1;
1071
1072 if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TTS_ALWAYSTIP) && bShowTest)
1073 {
1074 TTTOOL_INFO *ti = &infoPtr->tools[nTool];
1075 HWND hwnd = (ti->uFlags & TTF_IDISHWND) ? (HWND)ti->uId : ti->hwnd;
1076
1078 {
1079 TRACE("not active: hwnd %p, parent %p, active %p\n",
1081 return -1;
1082 }
1083 }
1084
1085 TRACE("tool %d\n", nTool);
1086
1087 return nTool;
1088}
static INT TOOLTIPS_GetToolFromPoint(const TOOLTIPS_INFO *infoPtr, HWND hwnd, const POINT *lpPt)
Definition: tooltips.c:984
static BOOL TOOLTIPS_IsWindowActive(HWND hwnd)
Definition: tooltips.c:1044
HANDLE HWND
Definition: compat.h:19
#define pt(x, y)
Definition: drawing.c:79
#define TTS_ALWAYSTIP
Definition: commctrl.h:1757
#define TTM_WINDOWFROMPOINT
Definition: commctrl.h:1816
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetActiveWindow(void)
Definition: winpos.c:138
BOOL WINAPI GetCursorPos(_Out_ LPPOINT)
Definition: cursoricon.c:2722
HWND WINAPI GetParent(_In_ HWND)
BOOL WINAPI ScreenToClient(_In_ HWND, _Inout_ LPPOINT)

Referenced by TOOLTIPS_Timer().

◆ TOOLTIPS_CopyInfoT()

static void TOOLTIPS_CopyInfoT ( const TOOLTIPS_INFO infoPtr,
INT  index,
TTTOOLINFOW ti,
BOOL  isW 
)
inlinestatic

Definition at line 1014 of file tooltips.c.

1015{
1016 const TTTOOL_INFO *toolPtr = &infoPtr->tools[index];
1017
1018 ti->uFlags = toolPtr->uFlags;
1019 ti->hwnd = toolPtr->hwnd;
1020 ti->uId = toolPtr->uId;
1021 ti->rect = toolPtr->rect;
1022 ti->hinst = toolPtr->hinst;
1023
1024 if (ti->lpszText) {
1025 if (toolPtr->lpszText == NULL ||
1026 IS_INTRESOURCE(toolPtr->lpszText) ||
1027 toolPtr->lpszText == LPSTR_TEXTCALLBACKW)
1028 ti->lpszText = toolPtr->lpszText;
1029 else if (isW)
1030 lstrcpyW (ti->lpszText, toolPtr->lpszText);
1031 else
1032 /* ANSI version, the buffer is maximum 80 bytes without null. */
1033 WideCharToMultiByte(CP_ACP, 0, toolPtr->lpszText, -1,
1035 }
1036
1037 if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
1038 ti->lParam = toolPtr->lParam;
1039
1040 /* lpReserved is intentionally not set. */
1041}
#define index(s, c)
Definition: various.h:29
#define MAX_TEXT_SIZE_A
Definition: tooltips.c:182
#define WideCharToMultiByte
Definition: compat.h:111

Referenced by TOOLTIPS_EnumToolsT(), TOOLTIPS_GetCurrentToolT(), TOOLTIPS_GetToolInfoT(), and TOOLTIPS_HitTestT().

◆ TOOLTIPS_Create()

static LRESULT TOOLTIPS_Create ( HWND  hwnd)
static

Definition at line 1870 of file tooltips.c.

1871{
1872 TOOLTIPS_INFO *infoPtr;
1873
1874 /* allocate memory for info structure */
1875 infoPtr = Alloc (sizeof(TOOLTIPS_INFO));
1876 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
1877
1878 /* initialize info structure */
1879 infoPtr->bActive = TRUE;
1880 infoPtr->bTrackActive = FALSE;
1881
1882 infoPtr->nMaxTipWidth = -1;
1883 infoPtr->nTool = -1;
1884 infoPtr->nCurrentTool = -1;
1885 infoPtr->nTrackTool = -1;
1886 infoPtr->hwndSelf = hwnd;
1887
1888 /* initialize colours and fonts */
1890
1892
1894
1895 return 0;
1896}
static LRESULT TOOLTIPS_SetDelayTime(TOOLTIPS_INFO *infoPtr, DWORD duration, INT nTime)
Definition: tooltips.c:1615
static void TOOLTIPS_InitSystemSettings(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:198
#define TTDT_AUTOMATIC
Definition: commctrl.h:1774
INT nTrackTool
Definition: tooltips.c:141
BOOL bTrackActive
Definition: tooltips.c:130
#define SWP_NOACTIVATE
Definition: winuser.h:1245
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define HWND_TOP
Definition: winuser.h:1210
#define SWP_HIDEWINDOW
Definition: winuser.h:1244
#define SWP_NOZORDER
Definition: winuser.h:1250
#define SetWindowLongPtrW
Definition: winuser.h:5358

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_customdraw_fill()

static void TOOLTIPS_customdraw_fill ( const TOOLTIPS_INFO infoPtr,
NMTTCUSTOMDRAW lpnmttcd,
HDC  hdc,
const RECT rcBounds,
UINT  uFlags 
)
static

Definition at line 217 of file tooltips.c.

219{
220 ZeroMemory(lpnmttcd, sizeof(NMTTCUSTOMDRAW));
221 lpnmttcd->uDrawFlags = uFlags;
222 lpnmttcd->nmcd.hdr.hwndFrom = infoPtr->hwndSelf;
223 lpnmttcd->nmcd.hdr.code = NM_CUSTOMDRAW;
224 if (infoPtr->nCurrentTool != -1) {
225 TTTOOL_INFO *toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
226 lpnmttcd->nmcd.hdr.idFrom = toolPtr->uId;
227 }
228 lpnmttcd->nmcd.hdc = hdc;
229 lpnmttcd->nmcd.rc = *rcBounds;
230 /* FIXME - dwItemSpec, uItemState, lItemlParam */
231}
#define NM_CUSTOMDRAW
Definition: commctrl.h:137
UINT_PTR idFrom
Definition: winuser.h:3161
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
NMCUSTOMDRAW nmcd
Definition: commctrl.h:313
#define ZeroMemory
Definition: winbase.h:1736

Referenced by TOOLTIPS_Refresh().

◆ TOOLTIPS_DelToolT()

static LRESULT TOOLTIPS_DelToolT ( TOOLTIPS_INFO infoPtr,
const TTTOOLINFOW ti,
BOOL  isW 
)
static

Definition at line 1247 of file tooltips.c.

1248{
1249 TTTOOL_INFO *toolPtr;
1250 INT nTool;
1251
1252 if (!ti) return 0;
1253 if (isW && ti->cbSize > TTTOOLINFOW_V2_SIZE &&
1255 return 0;
1256 if (infoPtr->uNumTools == 0)
1257 return 0;
1258
1259 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1260
1261 TRACE("tool %d\n", nTool);
1262
1263 if (nTool == -1)
1264 return 0;
1265
1266 /* make sure the tooltip has disappeared before deleting it */
1267 TOOLTIPS_Hide(infoPtr);
1268
1269 toolPtr = &infoPtr->tools[nTool];
1270 TOOLTIPS_FreeToolText (toolPtr);
1271 TOOLTIPS_ResetSubclass (toolPtr);
1272
1273 /* delete tool from tool list */
1274 if (infoPtr->uNumTools == 1) {
1275 Free (infoPtr->tools);
1276 infoPtr->tools = NULL;
1277 }
1278 else {
1279 TTTOOL_INFO *oldTools = infoPtr->tools;
1280 infoPtr->tools =
1281 Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools - 1));
1282
1283 if (nTool > 0)
1284 memcpy (&infoPtr->tools[0], &oldTools[0],
1285 nTool * sizeof(TTTOOL_INFO));
1286
1287 if (nTool < infoPtr->uNumTools - 1)
1288 memcpy (&infoPtr->tools[nTool], &oldTools[nTool + 1],
1289 (infoPtr->uNumTools - nTool - 1) * sizeof(TTTOOL_INFO));
1290
1291 Free (oldTools);
1292 }
1293
1294 /* update any indices affected by delete */
1295
1296 /* destroying tool that mouse was on on last relayed mouse move */
1297 if (infoPtr->nTool == nTool)
1298 /* -1 means no current tool (0 means first tool) */
1299 infoPtr->nTool = -1;
1300 else if (infoPtr->nTool > nTool)
1301 infoPtr->nTool--;
1302
1303 if (infoPtr->nTrackTool == nTool)
1304 /* -1 means no current tool (0 means first tool) */
1305 infoPtr->nTrackTool = -1;
1306 else if (infoPtr->nTrackTool > nTool)
1307 infoPtr->nTrackTool--;
1308
1309 if (infoPtr->nCurrentTool == nTool)
1310 /* -1 means no current tool (0 means first tool) */
1311 infoPtr->nCurrentTool = -1;
1312 else if (infoPtr->nCurrentTool > nTool)
1313 infoPtr->nCurrentTool--;
1314
1315 infoPtr->uNumTools--;
1316
1317 return 0;
1318}
static void TOOLTIPS_FreeToolText(TTTOOL_INFO *toolPtr)
Definition: tooltips.c:1207
static void TOOLTIPS_ResetSubclass(const TTTOOL_INFO *toolPtr)
Definition: tooltips.c:1199
static INT TOOLTIPS_GetToolFromInfoT(const TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolInfo)
Definition: tooltips.c:957

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_Destroy()

static LRESULT TOOLTIPS_Destroy ( TOOLTIPS_INFO infoPtr)
static

Definition at line 1900 of file tooltips.c.

1901{
1902 TTTOOL_INFO *toolPtr;
1903 UINT i;
1904
1905 for (i = 0; i < infoPtr->uNumTools; i++)
1906 {
1907 toolPtr = &infoPtr->tools[i];
1908
1909 TOOLTIPS_FreeToolText (toolPtr);
1910 TOOLTIPS_ResetSubclass (toolPtr);
1911 }
1912
1913 Free (infoPtr->tools);
1914
1915 /* free title string */
1916 Free (infoPtr->pszTitle);
1917 /* free title icon if not a standard one */
1919 DeleteObject(infoPtr->hTitleIcon);
1920
1921 /* delete fonts */
1922 DeleteObject (infoPtr->hFont);
1923 DeleteObject (infoPtr->hTitleFont);
1924
1925 /* free tool tips info data */
1926 SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
1927 Free (infoPtr);
1928
1929 return 0;
1930}
static UINT_PTR TOOLTIPS_GetTitleIconIndex(HICON hIcon)
Definition: tooltips.c:188
pKey DeleteObject()
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TTI_ERROR
Definition: commctrl.h:1782

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_EnumToolsT()

static LRESULT TOOLTIPS_EnumToolsT ( const TOOLTIPS_INFO infoPtr,
UINT  uIndex,
TTTOOLINFOW ti,
BOOL  isW 
)
static

Definition at line 1321 of file tooltips.c.

1323{
1324 if (!ti || ti->cbSize < TTTOOLINFOW_V1_SIZE)
1325 return FALSE;
1326 if (uIndex >= infoPtr->uNumTools)
1327 return FALSE;
1328
1329 TRACE("index=%u\n", uIndex);
1330
1331 TOOLTIPS_CopyInfoT (infoPtr, uIndex, ti, isW);
1332
1333 return TRUE;
1334}
static void TOOLTIPS_CopyInfoT(const TOOLTIPS_INFO *infoPtr, INT index, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1014

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_FreeToolText()

static void TOOLTIPS_FreeToolText ( TTTOOL_INFO toolPtr)
static

Definition at line 1207 of file tooltips.c.

1208{
1209 if (toolPtr->lpszText)
1210 {
1211 if (!IS_INTRESOURCE(toolPtr->lpszText) && toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
1212 Free(toolPtr->lpszText);
1213 toolPtr->lpszText = NULL;
1214 }
1215}

Referenced by TOOLTIPS_DelToolT(), TOOLTIPS_Destroy(), and TOOLTIPS_SetToolText().

◆ TOOLTIPS_GetBubbleSize()

static LRESULT TOOLTIPS_GetBubbleSize ( const TOOLTIPS_INFO infoPtr,
const TTTOOLINFOW lpToolInfo 
)
static

Definition at line 1337 of file tooltips.c.

1338{
1339 INT nTool;
1340 SIZE size;
1341
1342 if (lpToolInfo == NULL)
1343 return FALSE;
1344 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
1345 return FALSE;
1346
1347 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, lpToolInfo);
1348 if (nTool == -1) return 0;
1349
1350 TRACE("tool %d\n", nTool);
1351
1352 TOOLTIPS_CalcTipSize (infoPtr, &size);
1353 TRACE("size %d x %d\n", size.cx, size.cy);
1354
1355 return MAKELRESULT(size.cx, size.cy);
1356}
static void TOOLTIPS_CalcTipSize(const TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
Definition: tooltips.c:528
GLsizeiptr size
Definition: glext.h:5919
#define MAKELRESULT(l, h)
Definition: winuser.h:4013

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetCurrentToolT()

static LRESULT TOOLTIPS_GetCurrentToolT ( const TOOLTIPS_INFO infoPtr,
TTTOOLINFOW ti,
BOOL  isW 
)
static

Definition at line 1359 of file tooltips.c.

1360{
1361 if (ti) {
1362 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1363 return FALSE;
1364
1365 if (infoPtr->nCurrentTool != -1)
1366 TOOLTIPS_CopyInfoT (infoPtr, infoPtr->nCurrentTool, ti, isW);
1367 }
1368
1369 return infoPtr->nCurrentTool != -1;
1370}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetDelayTime()

static LRESULT TOOLTIPS_GetDelayTime ( const TOOLTIPS_INFO infoPtr,
DWORD  duration 
)
static

Definition at line 1374 of file tooltips.c.

1375{
1376 switch (duration) {
1377 case TTDT_RESHOW:
1378 return infoPtr->nReshowTime;
1379
1380 case TTDT_AUTOPOP:
1381 return infoPtr->nAutoPopTime;
1382
1383 case TTDT_INITIAL:
1384 case TTDT_AUTOMATIC: /* Apparently TTDT_AUTOMATIC returns TTDT_INITIAL */
1385 return infoPtr->nInitialTime;
1386
1387 default:
1388 WARN("Invalid duration flag %x\n", duration);
1389 break;
1390 }
1391
1392 return -1;
1393}
#define WARN(fmt,...)
Definition: precomp.h:61
#define TTDT_RESHOW
Definition: commctrl.h:1775
#define TTDT_AUTOPOP
Definition: commctrl.h:1776
#define TTDT_INITIAL
Definition: commctrl.h:1777
INT nReshowTime
Definition: tooltips.c:142
INT nAutoPopTime
Definition: tooltips.c:143
INT nInitialTime
Definition: tooltips.c:144

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetDispInfoA()

static void TOOLTIPS_GetDispInfoA ( const TOOLTIPS_INFO infoPtr,
TTTOOL_INFO toolPtr,
WCHAR buffer 
)
static

Definition at line 371 of file tooltips.c.

372{
373 NMTTDISPINFOA ttnmdi;
374
375 /* fill NMHDR struct */
376 ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOA));
377 ttnmdi.hdr.hwndFrom = infoPtr->hwndSelf;
378 ttnmdi.hdr.idFrom = toolPtr->uId;
379 ttnmdi.hdr.code = TTN_GETDISPINFOA; /* == TTN_NEEDTEXTA */
380 ttnmdi.lpszText = ttnmdi.szText;
381 ttnmdi.uFlags = toolPtr->uFlags;
382 ttnmdi.lParam = toolPtr->lParam;
383
384 TRACE("hdr.idFrom = %lx\n", ttnmdi.hdr.idFrom);
385 SendMessageW(toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&ttnmdi);
386
387 if (IS_INTRESOURCE(ttnmdi.lpszText)) {
388 LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText),
390 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
391 toolPtr->hinst = ttnmdi.hinst;
392 toolPtr->lpszText = (LPWSTR)ttnmdi.lpszText;
393 }
394 }
395 else if (ttnmdi.lpszText == 0) {
396 buffer[0] = '\0';
397 }
398 else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) {
400 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
401 toolPtr->hinst = 0;
402 toolPtr->lpszText = NULL;
403 Str_SetPtrW(&toolPtr->lpszText, buffer);
404 }
405 }
406 else {
407 ERR("recursive text callback\n");
408 buffer[0] = '\0';
409 }
410
411#ifndef __REACTOS_
412 /* no text available - try calling parent instead as per native */
413 /* FIXME: Unsure if SETITEM should save the value or not */
414 if (buffer[0] == 0x00) {
415
416 SendMessageW(GetParent(toolPtr->hwnd), WM_NOTIFY, toolPtr->uId, (LPARAM)&ttnmdi);
417
418 if (IS_INTRESOURCE(ttnmdi.lpszText)) {
419 LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText),
421 } else if (ttnmdi.lpszText &&
422 ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) {
424 }
425 }
426#endif
427}
#define ERR(fmt,...)
Definition: precomp.h:57
INT Str_GetPtrAtoW(LPCSTR lpSrc, LPWSTR lpDest, INT nMaxLen) DECLSPEC_HIDDEN
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:232
GLuint buffer
Definition: glext.h:5915
#define TTN_GETDISPINFOA
Definition: commctrl.h:1877
#define LPSTR_TEXTCALLBACKA
Definition: commctrl.h:2386
#define TTF_DI_SETITEM
Definition: commctrl.h:1772
#define INFOTIPSIZE
Definition: commctrl.h:124
#define WM_NOTIFY
Definition: richedit.h:61
char szText[80]
Definition: commctrl.h:1903
HINSTANCE hinst
Definition: commctrl.h:1904
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by TOOLTIPS_GetTipText().

◆ TOOLTIPS_GetDispInfoW()

static void TOOLTIPS_GetDispInfoW ( const TOOLTIPS_INFO infoPtr,
TTTOOL_INFO toolPtr,
WCHAR buffer 
)
static

Definition at line 429 of file tooltips.c.

430{
431 NMTTDISPINFOW ttnmdi;
432
433 /* fill NMHDR struct */
434 ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOW));
435 ttnmdi.hdr.hwndFrom = infoPtr->hwndSelf;
436 ttnmdi.hdr.idFrom = toolPtr->uId;
437 ttnmdi.hdr.code = TTN_GETDISPINFOW; /* == TTN_NEEDTEXTW */
438 ttnmdi.lpszText = ttnmdi.szText;
439 ttnmdi.uFlags = toolPtr->uFlags;
440 ttnmdi.lParam = toolPtr->lParam;
441
442 TRACE("hdr.idFrom = %lx\n", ttnmdi.hdr.idFrom);
443 SendMessageW(toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&ttnmdi);
444
445 if (IS_INTRESOURCE(ttnmdi.lpszText)) {
446 LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText),
448 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
449 toolPtr->hinst = ttnmdi.hinst;
450 toolPtr->lpszText = ttnmdi.lpszText;
451 }
452 }
453 else if (ttnmdi.lpszText == 0) {
454 buffer[0] = '\0';
455 }
456 else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) {
458 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
459 toolPtr->hinst = 0;
460 toolPtr->lpszText = NULL;
461 Str_SetPtrW(&toolPtr->lpszText, buffer);
462 }
463 }
464 else {
465 ERR("recursive text callback\n");
466 buffer[0] = '\0';
467 }
468
469#ifndef __REACTOS__
470 /* no text available - try calling parent instead as per native */
471 /* FIXME: Unsure if SETITEM should save the value or not */
472 if (buffer[0] == 0x00) {
473
474 SendMessageW(GetParent(toolPtr->hwnd), WM_NOTIFY, toolPtr->uId, (LPARAM)&ttnmdi);
475
476 if (IS_INTRESOURCE(ttnmdi.lpszText)) {
477 LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText),
479 } else if (ttnmdi.lpszText &&
480 ttnmdi.lpszText != LPSTR_TEXTCALLBACKW) {
482 }
483 }
484#endif
485
486}
INT WINAPI Str_GetPtrW(LPCWSTR, LPWSTR, INT)
Definition: string.c:200
#define TTN_GETDISPINFOW
Definition: commctrl.h:1878
HINSTANCE hinst
Definition: commctrl.h:1913
WCHAR szText[80]
Definition: commctrl.h:1912

Referenced by TOOLTIPS_GetTipText().

◆ TOOLTIPS_GetFont()

static LRESULT TOOLTIPS_GetFont ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1934 of file tooltips.c.

1935{
1936 return (LRESULT)infoPtr->hFont;
1937}
LONG_PTR LRESULT
Definition: windef.h:209

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetMargin()

static LRESULT TOOLTIPS_GetMargin ( const TOOLTIPS_INFO infoPtr,
RECT rect 
)
static

Definition at line 1397 of file tooltips.c.

1398{
1399 if (rect)
1400 *rect = infoPtr->rcMargin;
1401
1402 return 0;
1403}
& rect
Definition: startmenu.cpp:1413

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetMaxTipWidth()

static LRESULT TOOLTIPS_GetMaxTipWidth ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1407 of file tooltips.c.

1408{
1409 return infoPtr->nMaxTipWidth;
1410}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetTextLength()

static LRESULT TOOLTIPS_GetTextLength ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 2071 of file tooltips.c.

2072{
2073 return lstrlenW(infoPtr->szTipText);
2074}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetTextT()

static LRESULT TOOLTIPS_GetTextT ( const TOOLTIPS_INFO infoPtr,
TTTOOLINFOW ti,
BOOL  isW 
)
static

Definition at line 1414 of file tooltips.c.

1415{
1416 INT nTool;
1417
1418 if (!ti) return 0;
1419 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1420 return 0;
1421
1422 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1423 if (nTool == -1) return 0;
1424
1425 if (infoPtr->tools[nTool].lpszText == NULL)
1426 return 0;
1427
1428 if (isW) {
1429 ti->lpszText[0] = '\0';
1430 TOOLTIPS_GetTipText(infoPtr, nTool, ti->lpszText);
1431 }
1432 else {
1434
1435 /* NB this API is broken, there is no way for the app to determine
1436 what size buffer it requires nor a way to specify how long the
1437 one it supplies is. According to the test result, it's up to
1438 80 bytes by the ANSI version. */
1439
1440 buffer[0] = '\0';
1441 TOOLTIPS_GetTipText(infoPtr, nTool, buffer);
1444 }
1445
1446 return 0;
1447}
static void TOOLTIPS_GetTipText(const TOOLTIPS_INFO *infoPtr, INT nTool, WCHAR *buffer)
Definition: tooltips.c:489

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetTipBkColor()

static LRESULT TOOLTIPS_GetTipBkColor ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1451 of file tooltips.c.

1452{
1453 return infoPtr->clrBk;
1454}
COLORREF clrBk
Definition: tooltips.c:132

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetTipText()

static void TOOLTIPS_GetTipText ( const TOOLTIPS_INFO infoPtr,
INT  nTool,
WCHAR buffer 
)
static

Definition at line 489 of file tooltips.c.

490{
491 TTTOOL_INFO *toolPtr = &infoPtr->tools[nTool];
492
493 if (IS_INTRESOURCE(toolPtr->lpszText)) {
494 /* load a resource */
495 TRACE("load res string %p %x\n",
496 toolPtr->hinst, LOWORD(toolPtr->lpszText));
497 if (!LoadStringW (toolPtr->hinst, LOWORD(toolPtr->lpszText), buffer, INFOTIPSIZE))
498 buffer[0] = '\0';
499 }
500 else if (toolPtr->lpszText) {
501 if (toolPtr->lpszText == LPSTR_TEXTCALLBACKW) {
502 if (toolPtr->bNotifyUnicode)
503 TOOLTIPS_GetDispInfoW(infoPtr, toolPtr, buffer);
504 else
505 TOOLTIPS_GetDispInfoA(infoPtr, toolPtr, buffer);
506 }
507 else {
508 /* the item is a usual (unicode) text */
510 }
511 }
512 else {
513 /* no text available */
514 buffer[0] = '\0';
515 }
516
517 if (!(GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE) & TTS_NOPREFIX)) {
518 WCHAR *ptrW;
519 if ((ptrW = wcschr(buffer, '\t')))
520 *ptrW = 0;
521 }
522
523 TRACE("%s\n", debugstr_w(buffer));
524}
static void TOOLTIPS_GetDispInfoW(const TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr, WCHAR *buffer)
Definition: tooltips.c:429
static void TOOLTIPS_GetDispInfoA(const TOOLTIPS_INFO *infoPtr, TTTOOL_INFO *toolPtr, WCHAR *buffer)
Definition: tooltips.c:371
#define wcschr
Definition: compat.h:17
#define lstrcpynW
Definition: compat.h:738

Referenced by TOOLTIPS_GetTextT(), TOOLTIPS_SetToolInfoT(), and TOOLTIPS_Show().

◆ TOOLTIPS_GetTipTextColor()

static LRESULT TOOLTIPS_GetTipTextColor ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1458 of file tooltips.c.

1459{
1460 return infoPtr->clrText;
1461}
COLORREF clrText
Definition: tooltips.c:133

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetTitleIconIndex()

static UINT_PTR TOOLTIPS_GetTitleIconIndex ( HICON  hIcon)
inlinestatic

Definition at line 188 of file tooltips.c.

189{
190 UINT i;
191 for (i = 0; i <= TTI_ERROR; i++)
192 if (hTooltipIcons[i] == hIcon)
193 return i;
194 return (UINT_PTR)hIcon;
195}
static HICON hTooltipIcons[TTI_ERROR+1]
Definition: tooltips.c:109
HICON hIcon
Definition: msconfig.c:44
unsigned __int3264 UINT_PTR
Definition: mstsclib_h.h:274

Referenced by TOOLTIPS_Destroy().

◆ TOOLTIPS_GetToolCount()

static LRESULT TOOLTIPS_GetToolCount ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1465 of file tooltips.c.

1466{
1467 return infoPtr->uNumTools;
1468}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetToolFromInfoT()

static INT TOOLTIPS_GetToolFromInfoT ( const TOOLTIPS_INFO infoPtr,
const TTTOOLINFOW lpToolInfo 
)
static

Definition at line 957 of file tooltips.c.

958{
959 TTTOOL_INFO *toolPtr;
960 UINT nTool;
961
962 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
963 toolPtr = &infoPtr->tools[nTool];
964
965 if (!(toolPtr->uFlags & TTF_IDISHWND) &&
966 (lpToolInfo->hwnd == toolPtr->hwnd) &&
967 (lpToolInfo->uId == toolPtr->uId))
968 return nTool;
969 }
970
971 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
972 toolPtr = &infoPtr->tools[nTool];
973
974 if ((toolPtr->uFlags & TTF_IDISHWND) &&
975 (lpToolInfo->uId == toolPtr->uId))
976 return nTool;
977 }
978
979 return -1;
980}

Referenced by TOOLTIPS_DelToolT(), TOOLTIPS_GetBubbleSize(), TOOLTIPS_GetTextT(), TOOLTIPS_GetToolInfoT(), TOOLTIPS_NewToolRectT(), TOOLTIPS_SetToolInfoT(), TOOLTIPS_TrackActivate(), and TOOLTIPS_UpdateTipTextT().

◆ TOOLTIPS_GetToolFromPoint()

static INT TOOLTIPS_GetToolFromPoint ( const TOOLTIPS_INFO infoPtr,
HWND  hwnd,
const POINT lpPt 
)
static

Definition at line 984 of file tooltips.c.

985{
986 TTTOOL_INFO *toolPtr;
987 UINT nTool;
988
989 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
990 toolPtr = &infoPtr->tools[nTool];
991
992 if (!(toolPtr->uFlags & TTF_IDISHWND)) {
993 if (hwnd != toolPtr->hwnd)
994 continue;
995 if (!PtInRect (&toolPtr->rect, *lpPt))
996 continue;
997 return nTool;
998 }
999 }
1000
1001 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
1002 toolPtr = &infoPtr->tools[nTool];
1003
1004 if (toolPtr->uFlags & TTF_IDISHWND) {
1005 if ((HWND)toolPtr->uId == hwnd)
1006 return nTool;
1007 }
1008 }
1009
1010 return -1;
1011}
BOOL WINAPI PtInRect(_In_ LPCRECT, _In_ POINT)

Referenced by TOOLTIPS_CheckTool(), TOOLTIPS_HitTestT(), and TOOLTIPS_RelayEvent().

◆ TOOLTIPS_GetToolInfoT()

static LRESULT TOOLTIPS_GetToolInfoT ( const TOOLTIPS_INFO infoPtr,
TTTOOLINFOW ti,
BOOL  isW 
)
static

Definition at line 1472 of file tooltips.c.

1473{
1474 INT nTool;
1475 HWND hwnd;
1476
1477 if (!ti) return FALSE;
1478 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1479 return FALSE;
1480 if (infoPtr->uNumTools == 0)
1481 return FALSE;
1482
1483 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1484 if (nTool == -1)
1485 return FALSE;
1486
1487 TRACE("tool %d\n", nTool);
1488
1489 hwnd = ti->hwnd;
1490 TOOLTIPS_CopyInfoT (infoPtr, nTool, ti, isW);
1491 ti->hwnd = hwnd;
1492
1493 return TRUE;
1494}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_Hide()

static void TOOLTIPS_Hide ( TOOLTIPS_INFO infoPtr)
static

Definition at line 900 of file tooltips.c.

901{
902 TTTOOL_INFO *toolPtr;
903 NMHDR hdr;
904
905 TRACE("Hide tooltip %d, %p.\n", infoPtr->nCurrentTool, infoPtr->hwndSelf);
906
907 if (infoPtr->nCurrentTool == -1)
908 return;
909
910 toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
911 KillTimer (infoPtr->hwndSelf, ID_TIMERPOP);
912
913 hdr.hwndFrom = infoPtr->hwndSelf;
914 hdr.idFrom = toolPtr->uId;
915 hdr.code = TTN_POP;
916 SendMessageW (toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&hdr);
917
918 infoPtr->nCurrentTool = -1;
919
920 SetWindowPos (infoPtr->hwndSelf, HWND_TOP, 0, 0, 0, 0,
922}
#define ID_TIMERPOP
Definition: tooltips.c:154
char hdr[14]
Definition: iptest.cpp:33
#define TTN_POP
Definition: commctrl.h:1880
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)

Referenced by TOOLTIPS_Activate(), TOOLTIPS_DelToolT(), TOOLTIPS_MouseMessage(), TOOLTIPS_Pop(), TOOLTIPS_RelayEvent(), TOOLTIPS_SetToolInfoT(), and TOOLTIPS_Timer().

◆ TOOLTIPS_HitTestT()

static LRESULT TOOLTIPS_HitTestT ( const TOOLTIPS_INFO infoPtr,
LPTTHITTESTINFOW  lptthit,
BOOL  isW 
)
static

Definition at line 1498 of file tooltips.c.

1500{
1501 INT nTool;
1502
1503 if (lptthit == 0)
1504 return FALSE;
1505
1506 nTool = TOOLTIPS_GetToolFromPoint (infoPtr, lptthit->hwnd, &lptthit->pt);
1507 if (nTool == -1)
1508 return FALSE;
1509
1510 TRACE("tool %d\n", nTool);
1511
1512 /* copy tool data */
1513 if (lptthit->ti.cbSize >= TTTOOLINFOW_V1_SIZE)
1514 TOOLTIPS_CopyInfoT (infoPtr, nTool, &lptthit->ti, isW);
1515
1516 return TRUE;
1517}
TTTOOLINFOW ti
Definition: commctrl.h:1871

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_InitSystemSettings()

static void TOOLTIPS_InitSystemSettings ( TOOLTIPS_INFO infoPtr)
static

Definition at line 198 of file tooltips.c.

199{
200 NONCLIENTMETRICSW nclm;
201
202 infoPtr->clrBk = comctl32_color.clrInfoBk;
204
205 DeleteObject (infoPtr->hFont);
206 nclm.cbSize = sizeof(nclm);
207 SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof(nclm), &nclm, 0);
208 infoPtr->hFont = CreateFontIndirectW (&nclm.lfStatusFont);
209
210 DeleteObject (infoPtr->hTitleFont);
211 nclm.lfStatusFont.lfWeight = FW_BOLD;
212 infoPtr->hTitleFont = CreateFontIndirectW (&nclm.lfStatusFont);
213}
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
COLORREF clrInfoText
Definition: comctl32.h:187
COLORREF clrInfoBk
Definition: comctl32.h:186
#define FW_BOLD
Definition: wingdi.h:378
HFONT WINAPI CreateFontIndirectW(_In_ const LOGFONTW *)
BOOL WINAPI SystemParametersInfoW(_In_ UINT uiAction, _In_ UINT uiParam, _Inout_opt_ PVOID pvParam, _In_ UINT fWinIni)

Referenced by TOOLTIPS_Create(), and TOOLTIPS_WinIniChange().

◆ TOOLTIPS_IsWindowActive()

static BOOL TOOLTIPS_IsWindowActive ( HWND  hwnd)
static

Definition at line 1044 of file tooltips.c.

1045{
1046 HWND hwndActive = GetActiveWindow ();
1047 if (!hwndActive)
1048 return FALSE;
1049 if (hwndActive == hwnd)
1050 return TRUE;
1051 return IsChild (hwndActive, hwnd);
1052}
BOOL WINAPI IsChild(_In_ HWND, _In_ HWND)

Referenced by TOOLTIPS_CheckTool().

◆ TOOLTIPS_MouseMessage()

static LRESULT TOOLTIPS_MouseMessage ( TOOLTIPS_INFO infoPtr)
static

Definition at line 1941 of file tooltips.c.

1942{
1943 TOOLTIPS_Hide (infoPtr);
1944
1945 return 0;
1946}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_NCCreate()

static LRESULT TOOLTIPS_NCCreate ( HWND  hwnd)
static

Definition at line 1950 of file tooltips.c.

1951{
1952 DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
1953 DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
1954
1955 dwStyle &= ~(WS_CHILD | /*WS_MAXIMIZE |*/ WS_BORDER | WS_DLGFRAME);
1956 dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS);
1957
1958 /* WS_BORDER only draws a border round the window rect, not the
1959 * window region, therefore it is useless to us in balloon mode */
1960 if (dwStyle & TTS_BALLOON) dwStyle &= ~WS_BORDER;
1961
1962 SetWindowLongW (hwnd, GWL_STYLE, dwStyle);
1963
1964 dwExStyle |= WS_EX_TOOLWINDOW;
1965 SetWindowLongW (hwnd, GWL_EXSTYLE, dwExStyle);
1966
1967 return TRUE;
1968}
#define WS_CHILD
Definition: pedump.c:617
#define WS_BORDER
Definition: pedump.c:625
#define WS_POPUP
Definition: pedump.c:616
#define WS_DLGFRAME
Definition: pedump.c:626
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
LONG WINAPI SetWindowLongW(_In_ HWND, _In_ int, _In_ LONG)
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
#define GWL_EXSTYLE
Definition: winuser.h:854

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_NCHitTest()

static LRESULT TOOLTIPS_NCHitTest ( const TOOLTIPS_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1972 of file tooltips.c.

1973{
1974 INT nTool = (infoPtr->bTrackActive) ? infoPtr->nTrackTool : infoPtr->nTool;
1975
1976 TRACE(" nTool=%d\n", nTool);
1977
1978 if ((nTool > -1) && (nTool < infoPtr->uNumTools)) {
1979 if (infoPtr->tools[nTool].uFlags & TTF_TRANSPARENT) {
1980 TRACE("-- in transparent mode\n");
1981 return HTTRANSPARENT;
1982 }
1983 }
1984
1985 return DefWindowProcW (infoPtr->hwndSelf, WM_NCHITTEST, wParam, lParam);
1986}
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define TTF_TRANSPARENT
Definition: commctrl.h:1770
LRESULT WINAPI DefWindowProcW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_NCHITTEST
Definition: winuser.h:1689
#define HTTRANSPARENT
Definition: winuser.h:2476

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_NewToolRectT()

static LRESULT TOOLTIPS_NewToolRectT ( TOOLTIPS_INFO infoPtr,
const TTTOOLINFOW ti 
)
static

Definition at line 1521 of file tooltips.c.

1522{
1523 INT nTool;
1524
1525 if (!ti) return 0;
1526 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1527 return FALSE;
1528
1529 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1530
1531 TRACE("nTool = %d, rect = %s\n", nTool, wine_dbgstr_rect(&ti->rect));
1532
1533 if (nTool == -1) return 0;
1534
1535 infoPtr->tools[nTool].rect = ti->rect;
1536
1537 return 0;
1538}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_notify_customdraw()

static DWORD TOOLTIPS_notify_customdraw ( DWORD  dwDrawStage,
NMTTCUSTOMDRAW lpnmttcd 
)
inlinestatic

Definition at line 234 of file tooltips.c.

235{
237 lpnmttcd->nmcd.dwDrawStage = dwDrawStage;
238
239 TRACE("Notifying stage %d, flags %x, id %x\n", lpnmttcd->nmcd.dwDrawStage,
240 lpnmttcd->uDrawFlags, lpnmttcd->nmcd.hdr.code);
241
243 0, (LPARAM)lpnmttcd);
244
245 TRACE("Notify result %x\n", (unsigned int)result);
246
247 return result;
248}
GLuint64EXT * result
Definition: glext.h:11304

Referenced by TOOLTIPS_Refresh().

◆ TOOLTIPS_NotifyFormat()

static LRESULT TOOLTIPS_NotifyFormat ( TOOLTIPS_INFO infoPtr,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 1990 of file tooltips.c.

1991{
1992#ifdef __REACTOS__
1993 TTTOOL_INFO *toolPtr = infoPtr->tools;
1994 LRESULT nResult;
1995
1996 TRACE("infoPtr=%p wParam=%lx lParam=%p\n", infoPtr, wParam, (PVOID)lParam);
1997
1998 if (lParam == NF_QUERY) {
1999 if (toolPtr->bNotifyUnicode) {
2000 return NFR_UNICODE;
2001 } else {
2002 return NFR_ANSI;
2003 }
2004 }
2005 else if (lParam == NF_REQUERY) {
2006 nResult = SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
2007 (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY);
2008 if (nResult == NFR_ANSI) {
2009 toolPtr->bNotifyUnicode = FALSE;
2010 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
2011 } else if (nResult == NFR_UNICODE) {
2012 toolPtr->bNotifyUnicode = TRUE;
2013 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
2014 } else {
2015 TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
2016 }
2017 return nResult;
2018 }
2019#else
2020 FIXME ("hwnd=%p wParam=%lx lParam=%lx\n", infoPtr->hwndSelf, wParam, lParam);
2021#endif
2022
2023 return 0;
2024}
#define FIXME(fmt,...)
Definition: precomp.h:53
#define NF_REQUERY
Definition: winuser.h:2464

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_OnWMGetText()

static LRESULT TOOLTIPS_OnWMGetText ( const TOOLTIPS_INFO infoPtr,
WPARAM  size,
LPWSTR  pszText 
)
static

Definition at line 2088 of file tooltips.c.

2089{
2090 LRESULT res;
2091
2092 if(!size)
2093 return 0;
2094
2095 res = min(lstrlenW(infoPtr->szTipText)+1, size);
2096 memcpy(pszText, infoPtr->szTipText, res*sizeof(WCHAR));
2097 pszText[res-1] = '\0';
2098 return res-1;
2099}
GLuint res
Definition: glext.h:9613
#define min(a, b)
Definition: monoChain.cc:55

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_Paint()

static LRESULT TOOLTIPS_Paint ( const TOOLTIPS_INFO infoPtr,
HDC  hDC 
)
static

Definition at line 2028 of file tooltips.c.

2029{
2030 HDC hdc;
2031 PAINTSTRUCT ps;
2032
2033 hdc = (hDC == NULL) ? BeginPaint (infoPtr->hwndSelf, &ps) : hDC;
2034 TOOLTIPS_Refresh (infoPtr, hdc);
2035 if (!hDC)
2036 EndPaint (infoPtr->hwndSelf, &ps);
2037 return 0;
2038}
static HDC hDC
Definition: 3dtext.c:33
static void TOOLTIPS_Refresh(const TOOLTIPS_INFO *infoPtr, HDC hdc)
Definition: tooltips.c:251
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_Pop()

static LRESULT TOOLTIPS_Pop ( TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1542 of file tooltips.c.

1543{
1544 TOOLTIPS_Hide (infoPtr);
1545
1546 return 0;
1547}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_Refresh()

static void TOOLTIPS_Refresh ( const TOOLTIPS_INFO infoPtr,
HDC  hdc 
)
static

Definition at line 251 of file tooltips.c.

252{
253 RECT rc;
254 INT oldBkMode;
255 HFONT hOldFont;
256 HBRUSH hBrush;
258 HRGN hRgn = NULL;
259 DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
260 NMTTCUSTOMDRAW nmttcd;
261 DWORD cdmode;
262
263 if (infoPtr->nMaxTipWidth > -1)
267 GetClientRect (infoPtr->hwndSelf, &rc);
268
269 hBrush = CreateSolidBrush(infoPtr->clrBk);
270
271 oldBkMode = SetBkMode (hdc, TRANSPARENT);
272 SetTextColor (hdc, infoPtr->clrText);
273 hOldFont = SelectObject (hdc, infoPtr->hFont);
274
275 /* Custom draw - Call PrePaint once initial properties set up */
276 /* Note: Contrary to MSDN, CDRF_SKIPDEFAULT still draws a tooltip */
277 TOOLTIPS_customdraw_fill(infoPtr, &nmttcd, hdc, &rc, uFlags);
278 cdmode = TOOLTIPS_notify_customdraw(CDDS_PREPAINT, &nmttcd);
279 uFlags = nmttcd.uDrawFlags;
280
281 if (dwStyle & TTS_BALLOON)
282 {
283 /* create a region to store result into */
284 hRgn = CreateRectRgn(0, 0, 0, 0);
285
286 GetWindowRgn(infoPtr->hwndSelf, hRgn);
287
288 /* fill the background */
289 FillRgn(hdc, hRgn, hBrush);
290 DeleteObject(hBrush);
291 hBrush = NULL;
292 }
293 else
294 {
295 /* fill the background */
296 FillRect(hdc, &rc, hBrush);
297 DeleteObject(hBrush);
298 hBrush = NULL;
299 }
300
301 if ((dwStyle & TTS_BALLOON) || infoPtr->pszTitle)
302 {
303 /* calculate text rectangle */
304 rc.left += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.left);
305 rc.top += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.top);
306 rc.right -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.right);
307 rc.bottom -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.bottom);
308 if(infoPtr->bToolBelow) rc.top += BALLOON_STEMHEIGHT;
309
310 if (infoPtr->pszTitle)
311 {
312 RECT rcTitle = {rc.left, rc.top, rc.right, rc.bottom};
313 int height;
314 BOOL icon_present;
315 HFONT prevFont;
316
317 /* draw icon */
318 icon_present = infoPtr->hTitleIcon &&
319 DrawIconEx(hdc, rc.left, rc.top, infoPtr->hTitleIcon,
321 if (icon_present)
323
324 rcTitle.bottom = rc.top + ICON_HEIGHT;
325
326 /* draw title text */
327 prevFont = SelectObject (hdc, infoPtr->hTitleFont);
328 height = DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX);
329 SelectObject (hdc, prevFont);
331 }
332 }
333 else
334 {
335 /* calculate text rectangle */
336 rc.left += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.left);
337 rc.top += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.top);
338 rc.right -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.right);
339 rc.bottom -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.bottom);
340 }
341
342 /* draw text */
343#ifdef __REACTOS__
345#endif
346 DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
347
348 /* Custom draw - Call PostPaint after drawing */
349 if (cdmode & CDRF_NOTIFYPOSTPAINT) {
351 }
352
353 /* be polite and reset the things we changed in the dc */
354 SelectObject (hdc, hOldFont);
355 SetBkMode (hdc, oldBkMode);
356
357 if (dwStyle & TTS_BALLOON)
358 {
359 /* frame region because default window proc doesn't do it */
362
364 FrameRgn(hdc, hRgn, hBrush, width, height);
365 }
366
367 if (hRgn)
369}
static void TOOLTIPS_customdraw_fill(const TOOLTIPS_INFO *infoPtr, NMTTCUSTOMDRAW *lpnmttcd, HDC hdc, const RECT *rcBounds, UINT uFlags)
Definition: tooltips.c:217
static DWORD TOOLTIPS_notify_customdraw(DWORD dwDrawStage, NMTTCUSTOMDRAW *lpnmttcd)
Definition: tooltips.c:234
unsigned int BOOL
Definition: ntddk_ex.h:94
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
static HRGN hRgn
Definition: mapping.c:33
#define CDRF_NOTIFYPOSTPAINT
Definition: commctrl.h:274
#define CDDS_PREPAINT
Definition: commctrl.h:280
#define CDDS_POSTPAINT
Definition: commctrl.h:281
BOOL bToolBelow
Definition: tooltips.c:146
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI FrameRgn(_In_ HDC, _In_ HRGN, _In_ HBRUSH, _In_ int, _In_ int)
#define DI_NORMAL
Definition: wingdi.h:72
#define TRANSPARENT
Definition: wingdi.h:950
int WINAPI FillRgn(_In_ HDC, _In_ HRGN, _In_ HBRUSH)
Definition: painting.c:183
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
int WINAPI SetBkMode(_In_ HDC, _In_ int)
Definition: dc.c:1056
COLORREF WINAPI SetTextColor(_In_ HDC, _In_ COLORREF)
Definition: text.c:918
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define SM_CYEDGE
Definition: winuser.h:1012
#define COLOR_WINDOWFRAME
Definition: winuser.h:922
#define SM_CXEDGE
Definition: winuser.h:1011
int WINAPI GetWindowRgn(_In_ HWND, _In_ HRGN)
HBRUSH WINAPI GetSysColorBrush(_In_ int)
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
Definition: cursoricon.c:2080
#define SM_CXDLGFRAME
Definition: winuser.h:969
#define DT_BOTTOM
Definition: winuser.h:525
#define SM_CYDLGFRAME
Definition: winuser.h:971
int WINAPI GetSystemMetrics(_In_ int)

Referenced by TOOLTIPS_Paint().

◆ TOOLTIPS_Register()

VOID TOOLTIPS_Register ( void  )

Definition at line 2375 of file tooltips.c.

2376{
2377 WNDCLASSW wndClass;
2378
2379 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2382 wndClass.cbClsExtra = 0;
2383 wndClass.cbWndExtra = sizeof(TOOLTIPS_INFO *);
2384 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
2385 wndClass.hbrBackground = 0;
2386 wndClass.lpszClassName = TOOLTIPS_CLASSW;
2387
2388 RegisterClassW (&wndClass);
2389
2397}
#define IDI_TT_WARN_SM
Definition: comctl32.h:110
#define IDI_TT_ERROR_SM
Definition: comctl32.h:111
#define IDI_TT_INFO_SM
Definition: comctl32.h:109
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
static LRESULT CALLBACK TOOLTIPS_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: tooltips.c:2195
#define TOOLTIPS_CLASSW
Definition: commctrl.h:1707
#define TTI_NONE
Definition: commctrl.h:1779
#define TTI_INFO
Definition: commctrl.h:1780
#define TTI_WARNING
Definition: commctrl.h:1781
LPCWSTR lpszClassName
Definition: winuser.h:3188
HBRUSH hbrBackground
Definition: winuser.h:3186
int cbClsExtra
Definition: winuser.h:3181
UINT style
Definition: winuser.h:3179
WNDPROC lpfnWndProc
Definition: winuser.h:3180
int cbWndExtra
Definition: winuser.h:3182
HCURSOR hCursor
Definition: winuser.h:3185
#define IMAGE_ICON
Definition: winuser.h:212
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2255
#define IDC_ARROW
Definition: winuser.h:687
#define CS_DBLCLKS
Definition: winuser.h:651
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2157
#define CS_GLOBALCLASS
Definition: winuser.h:652
#define CS_SAVEBITS
Definition: winuser.h:657
#define MAKEINTRESOURCE
Definition: winuser.h:591
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185

Referenced by DllMain().

◆ TOOLTIPS_RelayEvent()

static LRESULT TOOLTIPS_RelayEvent ( TOOLTIPS_INFO infoPtr,
LPMSG  lpMsg 
)
static

Definition at line 1551 of file tooltips.c.

1552{
1553 POINT pt;
1554 INT nOldTool;
1555
1556 if (!lpMsg) {
1557 ERR("lpMsg == NULL\n");
1558 return 0;
1559 }
1560
1561 switch (lpMsg->message) {
1562 case WM_LBUTTONDOWN:
1563 case WM_LBUTTONUP:
1564 case WM_MBUTTONDOWN:
1565 case WM_MBUTTONUP:
1566 case WM_RBUTTONDOWN:
1567 case WM_RBUTTONUP:
1568 TOOLTIPS_Hide (infoPtr);
1569 break;
1570
1571 case WM_MOUSEMOVE:
1572 pt.x = (short)LOWORD(lpMsg->lParam);
1573 pt.y = (short)HIWORD(lpMsg->lParam);
1574 nOldTool = infoPtr->nTool;
1575 infoPtr->nTool = TOOLTIPS_GetToolFromPoint(infoPtr, lpMsg->hwnd,
1576 &pt);
1577 TRACE("tool (%p) %d %d %d\n", infoPtr->hwndSelf, nOldTool,
1578 infoPtr->nTool, infoPtr->nCurrentTool);
1579 TRACE("WM_MOUSEMOVE (%p %s)\n", infoPtr->hwndSelf, wine_dbgstr_point(&pt));
1580
1581 if (infoPtr->nTool != nOldTool) {
1582 if(infoPtr->nTool == -1) { /* Moved out of all tools */
1583 TOOLTIPS_Hide(infoPtr);
1584 KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
1585 } else if (nOldTool == -1) { /* Moved from outside */
1586 if(infoPtr->bActive) {
1587 SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
1588 TRACE("timer 1 started\n");
1589 }
1590 } else { /* Moved from one to another */
1591 TOOLTIPS_Hide (infoPtr);
1592 KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
1593 if(infoPtr->bActive) {
1594 SetTimer (infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nReshowTime, 0);
1595 TRACE("timer 1 started\n");
1596 }
1597 }
1598 } else if(infoPtr->nCurrentTool != -1) { /* restart autopop */
1599 KillTimer(infoPtr->hwndSelf, ID_TIMERPOP);
1600 SetTimer(infoPtr->hwndSelf, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
1601 TRACE("timer 2 restarted\n");
1602 } else if(infoPtr->nTool != -1 && infoPtr->bActive) {
1603 /* previous show attempt didn't result in tooltip so try again */
1604 SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
1605 TRACE("timer 1 started\n");
1606 }
1607 break;
1608 }
1609
1610 return 0;
1611}
static const char * wine_dbgstr_point(const POINT *ppt)
Definition: atltest.h:138
#define ID_TIMERSHOW
Definition: tooltips.c:153
#define ID_TIMERLEAVE
Definition: tooltips.c:155
unsigned short(__cdecl typeof(TIFFCurrentDirectory))(struct tiff *)
Definition: typeof.h:94
UINT message
Definition: winuser.h:3118
HWND hwnd
Definition: winuser.h:3117
LPARAM lParam
Definition: winuser.h:3120
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_RBUTTONUP
Definition: winuser.h:1783
#define WM_MOUSEMOVE
Definition: winuser.h:1778
#define WM_LBUTTONDOWN
Definition: winuser.h:1779
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1782
#define WM_LBUTTONUP
Definition: winuser.h:1780
#define WM_MBUTTONUP
Definition: winuser.h:1786
#define WM_MBUTTONDOWN
Definition: winuser.h:1785

Referenced by TOOLTIPS_SubclassProc(), and TOOLTIPS_WindowProc().

◆ TOOLTIPS_ResetSubclass()

static void TOOLTIPS_ResetSubclass ( const TTTOOL_INFO toolPtr)
static

Definition at line 1199 of file tooltips.c.

1200{
1201 /* Reset subclassing data. */
1202 if (toolPtr->uInternalFlags & TTF_SUBCLASS)
1203 SetWindowSubclass(toolPtr->uInternalFlags & TTF_IDISHWND ? (HWND)toolPtr->uId : toolPtr->hwnd,
1204 TOOLTIPS_SubclassProc, 1, 0);
1205}

Referenced by TOOLTIPS_DelToolT(), and TOOLTIPS_Destroy().

◆ TOOLTIPS_SetDelayTime()

static LRESULT TOOLTIPS_SetDelayTime ( TOOLTIPS_INFO infoPtr,
DWORD  duration,
INT  nTime 
)
static

Definition at line 1615 of file tooltips.c.

1616{
1617 switch (duration) {
1618 case TTDT_AUTOMATIC:
1619 if (nTime <= 0)
1620 nTime = GetDoubleClickTime();
1621 infoPtr->nReshowTime = nTime / 5;
1622 infoPtr->nAutoPopTime = nTime * 10;
1623 infoPtr->nInitialTime = nTime;
1624 break;
1625
1626 case TTDT_RESHOW:
1627 if(nTime < 0)
1628 nTime = GetDoubleClickTime() / 5;
1629 infoPtr->nReshowTime = nTime;
1630 break;
1631
1632 case TTDT_AUTOPOP:
1633 if(nTime < 0)
1634 nTime = GetDoubleClickTime() * 10;
1635 infoPtr->nAutoPopTime = nTime;
1636 break;
1637
1638 case TTDT_INITIAL:
1639 if(nTime < 0)
1640 nTime = GetDoubleClickTime();
1641 infoPtr->nInitialTime = nTime;
1642 break;
1643
1644 default:
1645 WARN("Invalid duration flag %x\n", duration);
1646 break;
1647 }
1648
1649 return 0;
1650}
UINT WINAPI GetDoubleClickTime(void)
Definition: ntwrapper.h:314

Referenced by TOOLTIPS_Create(), and TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetFont()

static LRESULT TOOLTIPS_SetFont ( TOOLTIPS_INFO infoPtr,
HFONT  hFont,
BOOL  redraw 
)
static

Definition at line 2042 of file tooltips.c.

2043{
2044 LOGFONTW lf;
2045
2046 if(!GetObjectW(hFont, sizeof(lf), &lf))
2047 return 0;
2048
2049 DeleteObject (infoPtr->hFont);
2050 infoPtr->hFont = CreateFontIndirectW(&lf);
2051
2052 DeleteObject (infoPtr->hTitleFont);
2053 lf.lfWeight = FW_BOLD;
2054 infoPtr->hTitleFont = CreateFontIndirectW(&lf);
2055
2056 if (redraw && infoPtr->nCurrentTool != -1)
2057 FIXME("full redraw needed\n");
2058
2059 return 0;
2060}
HFONT hFont
Definition: main.c:53
void redraw(int x, int y, int cx, int cy)
Definition: qtewin.cpp:1248
LONG lfWeight
Definition: dimm.idl:63
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetMargin()

static LRESULT TOOLTIPS_SetMargin ( TOOLTIPS_INFO infoPtr,
const RECT rect 
)
static

Definition at line 1654 of file tooltips.c.

1655{
1656 if (rect)
1657 infoPtr->rcMargin = *rect;
1658
1659 return 0;
1660}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetMaxTipWidth()

static LRESULT TOOLTIPS_SetMaxTipWidth ( TOOLTIPS_INFO infoPtr,
INT  MaxWidth 
)
inlinestatic

Definition at line 1664 of file tooltips.c.

1665{
1666 INT nTemp = infoPtr->nMaxTipWidth;
1667
1668 infoPtr->nMaxTipWidth = MaxWidth;
1669
1670 return nTemp;
1671}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetTipBkColor()

static LRESULT TOOLTIPS_SetTipBkColor ( TOOLTIPS_INFO infoPtr,
COLORREF  clrBk 
)
inlinestatic

Definition at line 1675 of file tooltips.c.

1676{
1677 infoPtr->clrBk = clrBk;
1678
1679 return 0;
1680}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetTipTextColor()

static LRESULT TOOLTIPS_SetTipTextColor ( TOOLTIPS_INFO infoPtr,
COLORREF  clrText 
)
inlinestatic

Definition at line 1684 of file tooltips.c.

1685{
1686 infoPtr->clrText = clrText;
1687
1688 return 0;
1689}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetTitleT()

static LRESULT TOOLTIPS_SetTitleT ( TOOLTIPS_INFO infoPtr,
UINT_PTR  uTitleIcon,
LPCWSTR  pszTitle,
BOOL  isW 
)
static

Definition at line 1693 of file tooltips.c.

1695{
1696 UINT size;
1697
1698 TRACE("hwnd = %p, title = %s, icon = %p\n", infoPtr->hwndSelf, debugstr_w(pszTitle),
1699 (void*)uTitleIcon);
1700
1701 Free(infoPtr->pszTitle);
1702
1703 if (pszTitle)
1704 {
1705 if (isW)
1706 {
1707 size = (lstrlenW(pszTitle)+1)*sizeof(WCHAR);
1708 infoPtr->pszTitle = Alloc(size);
1709 if (!infoPtr->pszTitle)
1710 return FALSE;
1711 memcpy(infoPtr->pszTitle, pszTitle, size);
1712 }
1713 else
1714 {
1715 size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszTitle, -1, NULL, 0);
1716 infoPtr->pszTitle = Alloc(size);
1717 if (!infoPtr->pszTitle)
1718 return FALSE;
1719 MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR));
1720 }
1721 }
1722 else
1723 infoPtr->pszTitle = NULL;
1724
1725 if (uTitleIcon <= TTI_ERROR)
1726 infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
1727 else
1728 infoPtr->hTitleIcon = CopyIcon((HICON)uTitleIcon);
1729
1730 TRACE("icon = %p\n", infoPtr->hTitleIcon);
1731
1732 return TRUE;
1733}
static HICON
Definition: imagelist.c:80
HICON WINAPI CopyIcon(_In_ HICON)
Definition: cursoricon.c:2063
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetToolInfoT()

static LRESULT TOOLTIPS_SetToolInfoT ( TOOLTIPS_INFO infoPtr,
const TTTOOLINFOW ti,
BOOL  isW 
)
static

Definition at line 1736 of file tooltips.c.

1737{
1738 TTTOOL_INFO *toolPtr;
1739 INT nTool;
1740
1741 if (!ti) return 0;
1742 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1743 return 0;
1744
1745 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1746 if (nTool == -1) return 0;
1747
1748 TRACE("tool %d\n", nTool);
1749
1750 toolPtr = &infoPtr->tools[nTool];
1751
1752 /* copy tool data */
1753 toolPtr->uFlags = ti->uFlags;
1754 toolPtr->hwnd = ti->hwnd;
1755 toolPtr->uId = ti->uId;
1756 toolPtr->rect = ti->rect;
1757 toolPtr->hinst = ti->hinst;
1758
1759 TOOLTIPS_SetToolText (toolPtr, ti->lpszText, isW);
1760
1761 if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
1762 toolPtr->lParam = ti->lParam;
1763
1764 if (infoPtr->nCurrentTool == nTool)
1765 {
1766 TOOLTIPS_GetTipText (infoPtr, infoPtr->nCurrentTool, infoPtr->szTipText);
1767
1768 if (infoPtr->szTipText[0] == 0)
1769 TOOLTIPS_Hide(infoPtr);
1770 else
1771 TOOLTIPS_Show (infoPtr, FALSE);
1772 }
1773
1774 return 0;
1775}
static void TOOLTIPS_SetToolText(TTTOOL_INFO *toolPtr, WCHAR *text, BOOL is_unicode)
Definition: tooltips.c:1217
static void TOOLTIPS_Show(TOOLTIPS_INFO *infoPtr, BOOL track_activate)
Definition: tooltips.c:589

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetToolText()

static void TOOLTIPS_SetToolText ( TTTOOL_INFO toolPtr,
WCHAR text,
BOOL  is_unicode 
)
static

Definition at line 1217 of file tooltips.c.

1218{
1219 int len;
1220
1221 TOOLTIPS_FreeToolText (toolPtr);
1222
1223 if (IS_INTRESOURCE(text))
1224 toolPtr->lpszText = text;
1225 else if (text == LPSTR_TEXTCALLBACKW)
1226 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
1227 else if (text)
1228 {
1229 if (is_unicode)
1230 {
1231 len = lstrlenW(text);
1232 toolPtr->lpszText = Alloc ((len + 1) * sizeof(WCHAR));
1233 if (toolPtr->lpszText)
1234 lstrcpyW (toolPtr->lpszText, text);
1235 }
1236 else
1237 {
1238 len = MultiByteToWideChar(CP_ACP, 0, (char *)text, -1, NULL, 0);
1239 toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
1240 if (toolPtr->lpszText)
1241 MultiByteToWideChar(CP_ACP, 0, (char *)text, -1, toolPtr->lpszText, len);
1242 }
1243 }
1244}
const WCHAR * text
Definition: package.c:1794

Referenced by TOOLTIPS_SetToolInfoT(), and TOOLTIPS_UpdateTipTextT().

◆ TOOLTIPS_Show()

static void TOOLTIPS_Show ( TOOLTIPS_INFO infoPtr,
BOOL  track_activate 
)
static

Definition at line 589 of file tooltips.c.

590{
591 TTTOOL_INFO *toolPtr;
592 HMONITOR monitor;
593 MONITORINFO mon_info;
594 RECT rect;
595 SIZE size;
596 NMHDR hdr;
597 int ptfx = 0;
599 INT nTool, current;
600
601 if (track_activate)
602 {
603 if (infoPtr->nTrackTool == -1)
604 {
605 TRACE("invalid tracking tool %d\n", infoPtr->nTrackTool);
606 return;
607 }
608 nTool = infoPtr->nTrackTool;
609 }
610 else
611 {
612 if (infoPtr->nTool == -1)
613 {
614 TRACE("invalid tool %d\n", infoPtr->nTool);
615 return;
616 }
617 nTool = infoPtr->nTool;
618 }
619
620 TRACE("Show tooltip pre %d, %p\n", nTool, infoPtr->hwndSelf);
621
622 current = infoPtr->nCurrentTool;
623 if (!track_activate)
624 infoPtr->nCurrentTool = infoPtr->nTool;
625
626 TOOLTIPS_GetTipText (infoPtr, nTool, infoPtr->szTipText);
627
628 if (infoPtr->szTipText[0] == '\0')
629 {
630 infoPtr->nCurrentTool = current;
631 return;
632 }
633
634 toolPtr = &infoPtr->tools[nTool];
635 TOOLTIPS_CalcTipSize (infoPtr, &size);
636
637 TRACE("Show tooltip %d, %s, size %d x %d\n", nTool, debugstr_w(infoPtr->szTipText),
638 size.cx, size.cy);
639
640 if (track_activate && (toolPtr->uFlags & TTF_TRACK))
641 {
642 rect.left = infoPtr->xTrackPos;
643 rect.top = infoPtr->yTrackPos;
644 ptfx = rect.left;
645
646 if (toolPtr->uFlags & TTF_CENTERTIP)
647 {
648 rect.left -= (size.cx / 2);
649 if (!(style & TTS_BALLOON))
650 rect.top -= (size.cy / 2);
651 }
652 if (!(infoPtr->bToolBelow = (infoPtr->yTrackPos + size.cy <= GetSystemMetrics(SM_CYSCREEN))))
653 rect.top -= size.cy;
654
655 if (!(toolPtr->uFlags & TTF_ABSOLUTE))
656 {
657 if (style & TTS_BALLOON)
658 rect.left -= BALLOON_STEMINDENT;
659 else
660 {
661 RECT rcTool;
662
663 if (toolPtr->uFlags & TTF_IDISHWND)
664 GetWindowRect ((HWND)toolPtr->uId, &rcTool);
665 else
666 {
667 rcTool = toolPtr->rect;
668 MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rcTool, 2);
669 }
670
671 /* smart placement */
672 if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) &&
673 (rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom))
674 rect.left = rcTool.right;
675 }
676 }
677 }
678 else
679 {
680 if (toolPtr->uFlags & TTF_CENTERTIP)
681 {
682 RECT rc;
683
684 if (toolPtr->uFlags & TTF_IDISHWND)
685 GetWindowRect ((HWND)toolPtr->uId, &rc);
686 else {
687 rc = toolPtr->rect;
688 MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
689 }
690 rect.left = (rc.left + rc.right - size.cx) / 2;
691 if (style & TTS_BALLOON)
692 {
693 ptfx = rc.left + ((rc.right - rc.left) / 2);
694
695 /* CENTERTIP ballon tooltips default to below the field
696 * if they fit on the screen */
698 {
699 rect.top = rc.top - size.cy;
700 infoPtr->bToolBelow = FALSE;
701 }
702 else
703 {
704 infoPtr->bToolBelow = TRUE;
705 rect.top = rc.bottom;
706 }
707 rect.left = max(0, rect.left - BALLOON_STEMINDENT);
708 }
709 else
710 {
711 rect.top = rc.bottom + 2;
712 infoPtr->bToolBelow = TRUE;
713 }
714 }
715 else
716 {
718 if (style & TTS_BALLOON)
719 {
720 ptfx = rect.left;
721 if(rect.top - size.cy >= 0)
722 {
723 rect.top -= size.cy;
724 infoPtr->bToolBelow = FALSE;
725 }
726 else
727 {
728 infoPtr->bToolBelow = TRUE;
729 rect.top += 20;
730 }
731 rect.left = max(0, rect.left - BALLOON_STEMINDENT);
732 }
733 else
734 {
735 rect.top += 20;
736 infoPtr->bToolBelow = TRUE;
737 }
738 }
739 }
740
741 TRACE("pos %d - %d\n", rect.left, rect.top);
742
743 rect.right = rect.left + size.cx;
744 rect.bottom = rect.top + size.cy;
745
746 /* check position */
747
748 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
749 mon_info.cbSize = sizeof(mon_info);
750 GetMonitorInfoW( monitor, &mon_info );
751
752#ifdef __REACTOS__
753 if (rect.right > mon_info.rcMonitor.right)
754 {
757 if (rect.right > mon_info.rcMonitor.right)
758 {
759 rect.left -= (rect.right - mon_info.rcMonitor.right);
760 rect.right = mon_info.rcMonitor.right;
761 }
762 }
763
764 if (rect.left < mon_info.rcMonitor.left)
765 {
766 rect.right += abs(rect.left);
767 rect.left = 0;
768 }
769
770 if (rect.bottom > mon_info.rcMonitor.bottom)
771 {
772 RECT rc;
773 if (toolPtr->uFlags & TTF_IDISHWND)
774 {
775 GetWindowRect((HWND)toolPtr->uId, &rc);
776 }
777 else
778 {
779 rc = toolPtr->rect;
780 MapWindowPoints(toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
781 }
782 rect.bottom = rc.top - 2;
783 rect.top = rect.bottom - size.cy;
784 }
785#else
786 if( rect.right > mon_info.rcWork.right ) {
787 rect.left -= rect.right - mon_info.rcWork.right + 2;
788 rect.right = mon_info.rcWork.right - 2;
789 }
790 if (rect.left < mon_info.rcWork.left) rect.left = mon_info.rcWork.left;
791
792 if( rect.bottom > mon_info.rcWork.bottom ) {
793 RECT rc;
794
795 if (toolPtr->uFlags & TTF_IDISHWND)
796 GetWindowRect ((HWND)toolPtr->uId, &rc);
797 else {
798 rc = toolPtr->rect;
799 MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
800 }
801 rect.bottom = rc.top - 2;
802 rect.top = rect.bottom - size.cy;
803 }
804#endif // __REACTOS__
805
808
809 if (style & TTS_BALLOON)
810 {
811 HRGN hRgn;
812 HRGN hrStem;
813 POINT pts[3];
814
815 ptfx -= rect.left;
816
817 if(infoPtr->bToolBelow)
818 {
819 pts[0].x = ptfx;
820 pts[0].y = 0;
821#ifdef __REACTOS__
822 pts[1].x = max(BALLOON_STEMINDENT, ptfx - BALLOON_STEMWIDTH);
823#else
824 pts[1].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
825#endif
826 pts[1].y = BALLOON_STEMHEIGHT;
827 pts[2].x = pts[1].x + BALLOON_STEMWIDTH;
828 pts[2].y = pts[1].y;
829 if(pts[2].x > (rect.right - rect.left) - BALLOON_STEMINDENT)
830 {
831 pts[2].x = (rect.right - rect.left) - BALLOON_STEMINDENT;
832 pts[1].x = pts[2].x - BALLOON_STEMWIDTH;
833 }
834 }
835 else
836 {
837#ifdef __REACTOS__
838 pts[0].x = max(BALLOON_STEMINDENT, ptfx - BALLOON_STEMWIDTH);
839#else
840 pts[0].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
841#endif
842 pts[0].y = (rect.bottom - rect.top) - BALLOON_STEMHEIGHT;
843 pts[1].x = pts[0].x + BALLOON_STEMWIDTH;
844 pts[1].y = pts[0].y;
845 pts[2].x = ptfx;
846 pts[2].y = (rect.bottom - rect.top);
847 if(pts[1].x > (rect.right - rect.left) - BALLOON_STEMINDENT)
848 {
849 pts[1].x = (rect.right - rect.left) - BALLOON_STEMINDENT;
850 pts[0].x = pts[1].x - BALLOON_STEMWIDTH;
851 }
852 }
853
854 hrStem = CreatePolygonRgn(pts, ARRAY_SIZE(pts), ALTERNATE);
855
857 (infoPtr->bToolBelow ? BALLOON_STEMHEIGHT : 0),
858 rect.right - rect.left,
859#ifdef __REACTOS__
860 (infoPtr->bToolBelow ? rect.bottom - rect.top : rect.bottom - rect.top - BALLOON_STEMHEIGHT + 1),
861#else
862 (infoPtr->bToolBelow ? rect.bottom - rect.top : rect.bottom - rect.top - BALLOON_STEMHEIGHT),
863#endif
865
866 CombineRgn(hRgn, hRgn, hrStem, RGN_OR);
867 DeleteObject(hrStem);
868
869 SetWindowRgn(infoPtr->hwndSelf, hRgn, FALSE);
870 /* we don't free the region handle as the system deletes it when
871 * it is no longer needed */
872 }
873
874 SetWindowPos (infoPtr->hwndSelf, NULL, rect.left, rect.top,
875 rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE);
876
877 hdr.hwndFrom = infoPtr->hwndSelf;
878 hdr.idFrom = toolPtr->uId;
879 hdr.code = TTN_SHOW;
880 SendMessageW (toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&hdr);
881
882 SetWindowPos (infoPtr->hwndSelf, HWND_TOPMOST, 0, 0, 0, 0,
884
885 /* repaint the tooltip */
886 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
887 UpdateWindow(infoPtr->hwndSelf);
888
889 if (!track_activate)
890 {
891 SetTimer (infoPtr->hwndSelf, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
892 TRACE("timer 2 started\n");
893 SetTimer (infoPtr->hwndSelf, ID_TIMERLEAVE, infoPtr->nReshowTime, 0);
894 TRACE("timer 3 started\n");
895 }
896}
#define ALTERNATE
Definition: constants.h:278
#define ARRAY_SIZE(A)
Definition: main.h:20
#define BALLOON_STEMWIDTH
Definition: tooltips.c:173
#define BALLOON_STEMINDENT
Definition: tooltips.c:174
#define BALLOON_ROUNDEDNESS
Definition: tooltips.c:171
#define abs(i)
Definition: fconv.c:206
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
if(dx< 0)
Definition: linetemp.h:194
struct task_struct * current
Definition: linux.c:32
HMONITOR WINAPI MonitorFromRect(LPCRECT, DWORD)
#define TTN_SHOW
Definition: commctrl.h:1879
#define TTF_CENTERTIP
Definition: commctrl.h:1765
#define TTF_ABSOLUTE
Definition: commctrl.h:1769
#define TTF_TRACK
Definition: commctrl.h:1768
RECT rcMonitor
Definition: winuser.h:3788
DWORD cbSize
Definition: winuser.h:3787
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
else
Definition: tritemp.h:161
HRGN WINAPI CreatePolygonRgn(_In_reads_(cPoint) const POINT *pptl, _In_ int cPoint, _In_ int iMode)
HRGN WINAPI CreateRoundRectRgn(_In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
#define RGN_OR
Definition: wingdi.h:359
#define SM_CYSCREEN
Definition: winuser.h:963
#define HWND_TOPMOST
Definition: winuser.h:1211
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI SetWindowRgn(_In_ HWND, _In_opt_ HRGN, _In_ BOOL)
#define SWP_NOMOVE
Definition: winuser.h:1247
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
#define SWP_NOSIZE
Definition: winuser.h:1248
int WINAPI MapWindowPoints(_In_opt_ HWND hWndFrom, _In_opt_ HWND hWndTo, _Inout_updates_(cPoints) LPPOINT lpPoints, _In_ UINT cPoints)
BOOL WINAPI UpdateWindow(_In_ HWND)
#define SWP_SHOWWINDOW
Definition: winuser.h:1251
BOOL WINAPI GetMonitorInfoW(_In_ HMONITOR, _Inout_ LPMONITORINFO)
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)

Referenced by TOOLTIPS_SetToolInfoT(), TOOLTIPS_Timer(), TOOLTIPS_TrackShow(), and TOOLTIPS_UpdateTipTextT().

◆ TOOLTIPS_SubclassProc()

static LRESULT CALLBACK TOOLTIPS_SubclassProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam,
UINT_PTR  uId,
DWORD_PTR  dwRef 
)
static

Definition at line 2160 of file tooltips.c.

2161{
2162 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr ((HWND)dwRef);
2163 MSG msg;
2164
2165 switch (message)
2166 {
2167 case WM_MOUSEMOVE:
2168 case WM_LBUTTONDOWN:
2169 case WM_LBUTTONUP:
2170 case WM_MBUTTONDOWN:
2171 case WM_MBUTTONUP:
2172 case WM_RBUTTONDOWN:
2173 case WM_RBUTTONUP:
2174 if (infoPtr)
2175 {
2176 msg.hwnd = hwnd;
2177 msg.message = message;
2178 msg.wParam = wParam;
2179 msg.lParam = lParam;
2180 TOOLTIPS_RelayEvent(infoPtr, &msg);
2181 }
2182 break;
2183 case WM_NCDESTROY:
2185 break;
2186 default:
2187 break;
2188 }
2189
2191}
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID)
Definition: commctrl.c:1397
LRESULT WINAPI DefSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: commctrl.c:1503
#define TOOLTIPS_GetInfoPtr(hWindow)
Definition: tooltips.c:158
static LRESULT TOOLTIPS_RelayEvent(TOOLTIPS_INFO *infoPtr, LPMSG lpMsg)
Definition: tooltips.c:1551
Definition: tftpd.h:60
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define WM_NCDESTROY
Definition: winuser.h:1687

Referenced by TOOLTIPS_AddToolT(), TOOLTIPS_ResetSubclass(), and TOOLTIPS_SubclassProc().

◆ TOOLTIPS_Timer()

static LRESULT TOOLTIPS_Timer ( TOOLTIPS_INFO infoPtr,
INT  iTimer 
)
static

Definition at line 2102 of file tooltips.c.

2103{
2104 INT nOldTool;
2105
2106 TRACE("timer %d (%p) expired\n", iTimer, infoPtr->hwndSelf);
2107
2108 switch (iTimer) {
2109 case ID_TIMERSHOW:
2110 KillTimer (infoPtr->hwndSelf, ID_TIMERSHOW);
2111 nOldTool = infoPtr->nTool;
2112 if ((infoPtr->nTool = TOOLTIPS_CheckTool (infoPtr, TRUE)) == nOldTool)
2113 TOOLTIPS_Show (infoPtr, FALSE);
2114 break;
2115
2116 case ID_TIMERPOP:
2117 TOOLTIPS_Hide (infoPtr);
2118 break;
2119
2120 case ID_TIMERLEAVE:
2121 nOldTool = infoPtr->nTool;
2122 infoPtr->nTool = TOOLTIPS_CheckTool (infoPtr, FALSE);
2123 TRACE("tool (%p) %d %d %d\n", infoPtr->hwndSelf, nOldTool,
2124 infoPtr->nTool, infoPtr->nCurrentTool);
2125 if (infoPtr->nTool != nOldTool) {
2126 if(infoPtr->nTool == -1) { /* Moved out of all tools */
2127 TOOLTIPS_Hide(infoPtr);
2128 KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
2129 } else if (nOldTool == -1) { /* Moved from outside */
2130 ERR("How did this happen?\n");
2131 } else { /* Moved from one to another */
2132 TOOLTIPS_Hide (infoPtr);
2133 KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
2134 if(infoPtr->bActive) {
2135 SetTimer (infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nReshowTime, 0);
2136 TRACE("timer 1 started!\n");
2137 }
2138 }
2139 }
2140 break;
2141
2142 default:
2143 ERR("Unknown timer id %d\n", iTimer);
2144 break;
2145 }
2146 return 0;
2147}
static INT TOOLTIPS_CheckTool(const TOOLTIPS_INFO *infoPtr, BOOL bShowTest)
Definition: tooltips.c:1056

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_TrackActivate()

static LRESULT TOOLTIPS_TrackActivate ( TOOLTIPS_INFO infoPtr,
BOOL  track_activate,
const TTTOOLINFOA ti 
)
static

Definition at line 1779 of file tooltips.c.

1780{
1781 if (track_activate) {
1782
1783 if (!ti) return 0;
1784 if (ti->cbSize < TTTOOLINFOA_V1_SIZE)
1785 return FALSE;
1786
1787 /* activate */
1788 infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoT (infoPtr, (const TTTOOLINFOW*)ti);
1789 if (infoPtr->nTrackTool != -1) {
1790 TRACE("activated\n");
1791 infoPtr->bTrackActive = TRUE;
1792 TOOLTIPS_TrackShow (infoPtr);
1793 }
1794 }
1795 else {
1796 /* deactivate */
1797 TOOLTIPS_TrackHide (infoPtr);
1798
1799 infoPtr->bTrackActive = FALSE;
1800 infoPtr->nTrackTool = -1;
1801
1802 TRACE("deactivated\n");
1803 }
1804
1805 return 0;
1806}
static void TOOLTIPS_TrackHide(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:933
static void TOOLTIPS_TrackShow(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:926
#define TTTOOLINFOA_V1_SIZE
Definition: commctrl.h:1720

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_TrackHide()

static void TOOLTIPS_TrackHide ( const TOOLTIPS_INFO infoPtr)
static

Definition at line 933 of file tooltips.c.

934{
935 TTTOOL_INFO *toolPtr;
936 NMHDR hdr;
937
938 TRACE("hide tracking tooltip %d\n", infoPtr->nTrackTool);
939
940 if (infoPtr->nTrackTool == -1)
941 return;
942
943 toolPtr = &infoPtr->tools[infoPtr->nTrackTool];
944
945 hdr.hwndFrom = infoPtr->hwndSelf;
946 hdr.idFrom = toolPtr->uId;
947 hdr.code = TTN_POP;
948 SendMessageW (toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&hdr);
949
950 SetWindowPos (infoPtr->hwndSelf, HWND_TOP, 0, 0, 0, 0,
952}

Referenced by TOOLTIPS_TrackActivate().

◆ TOOLTIPS_TrackPosition()

static LRESULT TOOLTIPS_TrackPosition ( TOOLTIPS_INFO infoPtr,
LPARAM  coord 
)
static

Definition at line 1810 of file tooltips.c.

1811{
1812 infoPtr->xTrackPos = (INT)LOWORD(coord);
1813 infoPtr->yTrackPos = (INT)HIWORD(coord);
1814
1815 if (infoPtr->bTrackActive) {
1816 TRACE("[%d %d]\n",
1817 infoPtr->xTrackPos, infoPtr->yTrackPos);
1818
1819 TOOLTIPS_TrackShow (infoPtr);
1820 }
1821
1822 return 0;
1823}
GLuint coord
Definition: glext.h:9511
#define INT
Definition: polytest.cpp:20

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_TrackShow()

static void TOOLTIPS_TrackShow ( TOOLTIPS_INFO infoPtr)
static

Definition at line 926 of file tooltips.c.

927{
928 TOOLTIPS_Show(infoPtr, TRUE);
929}

Referenced by TOOLTIPS_TrackActivate(), and TOOLTIPS_TrackPosition().

◆ TOOLTIPS_Unregister()

VOID TOOLTIPS_Unregister ( void  )

Definition at line 2401 of file tooltips.c.

2402{
2403 int i;
2404 for (i = TTI_INFO; i <= TTI_ERROR; i++)
2407}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105

Referenced by DllMain().

◆ TOOLTIPS_Update()

static LRESULT TOOLTIPS_Update ( TOOLTIPS_INFO infoPtr)
static

Definition at line 1827 of file tooltips.c.

1828{
1829 if (infoPtr->nCurrentTool != -1)
1830 UpdateWindow (infoPtr->hwndSelf);
1831
1832 return 0;
1833}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_UpdateTipTextT()

static LRESULT TOOLTIPS_UpdateTipTextT ( TOOLTIPS_INFO infoPtr,
const TTTOOLINFOW ti,
BOOL  isW 
)
static

Definition at line 1837 of file tooltips.c.

1838{
1839 TTTOOL_INFO *toolPtr;
1840 INT nTool;
1841
1842 if (!ti) return 0;
1843 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1844 return FALSE;
1845
1846 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1847 if (nTool == -1)
1848 return 0;
1849
1850 TRACE("tool %d\n", nTool);
1851
1852 toolPtr = &infoPtr->tools[nTool];
1853
1854 toolPtr->hinst = ti->hinst;
1855
1856 TOOLTIPS_SetToolText(toolPtr, ti->lpszText, isW);
1857
1858 if(infoPtr->nCurrentTool == -1) return 0;
1859 /* force repaint */
1860 if (infoPtr->bActive)
1861 TOOLTIPS_Show (infoPtr, FALSE);
1862 else if (infoPtr->bTrackActive)
1863 TOOLTIPS_Show (infoPtr, TRUE);
1864
1865 return 0;
1866}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_WindowProc()

static LRESULT CALLBACK TOOLTIPS_WindowProc ( HWND  hwnd,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 2195 of file tooltips.c.

2196{
2198
2199 TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx\n", hwnd, uMsg, wParam, lParam);
2200 if (!infoPtr && (uMsg != WM_CREATE) && (uMsg != WM_NCCREATE))
2201 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2202 switch (uMsg)
2203 {
2204 case TTM_ACTIVATE:
2205 return TOOLTIPS_Activate (infoPtr, (BOOL)wParam);
2206
2207 case TTM_ADDTOOLA:
2208 case TTM_ADDTOOLW:
2209 return TOOLTIPS_AddToolT (infoPtr, (LPTTTOOLINFOW)lParam, uMsg == TTM_ADDTOOLW);
2210
2211 case TTM_DELTOOLA:
2212 case TTM_DELTOOLW:
2213 return TOOLTIPS_DelToolT (infoPtr, (LPTOOLINFOW)lParam,
2214 uMsg == TTM_DELTOOLW);
2215 case TTM_ENUMTOOLSA:
2216 case TTM_ENUMTOOLSW:
2218 uMsg == TTM_ENUMTOOLSW);
2219 case TTM_GETBUBBLESIZE:
2220 return TOOLTIPS_GetBubbleSize (infoPtr, (LPTTTOOLINFOW)lParam);
2221
2225 uMsg == TTM_GETCURRENTTOOLW);
2226
2227 case TTM_GETDELAYTIME:
2228 return TOOLTIPS_GetDelayTime (infoPtr, (DWORD)wParam);
2229
2230 case TTM_GETMARGIN:
2231 return TOOLTIPS_GetMargin (infoPtr, (LPRECT)lParam);
2232
2233 case TTM_GETMAXTIPWIDTH:
2234 return TOOLTIPS_GetMaxTipWidth (infoPtr);
2235
2236 case TTM_GETTEXTA:
2237 case TTM_GETTEXTW:
2238 return TOOLTIPS_GetTextT (infoPtr, (LPTTTOOLINFOW)lParam,
2239 uMsg == TTM_GETTEXTW);
2240
2241 case TTM_GETTIPBKCOLOR:
2242 return TOOLTIPS_GetTipBkColor (infoPtr);
2243
2245 return TOOLTIPS_GetTipTextColor (infoPtr);
2246
2247 case TTM_GETTOOLCOUNT:
2248 return TOOLTIPS_GetToolCount (infoPtr);
2249
2250 case TTM_GETTOOLINFOA:
2251 case TTM_GETTOOLINFOW:
2252 return TOOLTIPS_GetToolInfoT (infoPtr, (LPTTTOOLINFOW)lParam,
2253 uMsg == TTM_GETTOOLINFOW);
2254
2255 case TTM_HITTESTA:
2256 case TTM_HITTESTW:
2257 return TOOLTIPS_HitTestT (infoPtr, (LPTTHITTESTINFOW)lParam,
2258 uMsg == TTM_HITTESTW);
2259 case TTM_NEWTOOLRECTA:
2260 case TTM_NEWTOOLRECTW:
2261 return TOOLTIPS_NewToolRectT (infoPtr, (LPTTTOOLINFOW)lParam);
2262
2263 case TTM_POP:
2264 return TOOLTIPS_Pop (infoPtr);
2265
2266 case TTM_RELAYEVENT:
2267 return TOOLTIPS_RelayEvent (infoPtr, (LPMSG)lParam);
2268
2269 case TTM_SETDELAYTIME:
2270 return TOOLTIPS_SetDelayTime (infoPtr, (DWORD)wParam, (INT)LOWORD(lParam));
2271
2272 case TTM_SETMARGIN:
2273 return TOOLTIPS_SetMargin (infoPtr, (LPRECT)lParam);
2274
2275 case TTM_SETMAXTIPWIDTH:
2276 return TOOLTIPS_SetMaxTipWidth (infoPtr, (INT)lParam);
2277
2278 case TTM_SETTIPBKCOLOR:
2279 return TOOLTIPS_SetTipBkColor (infoPtr, (COLORREF)wParam);
2280
2282 return TOOLTIPS_SetTipTextColor (infoPtr, (COLORREF)wParam);
2283
2284 case TTM_SETTITLEA:
2285 case TTM_SETTITLEW:
2286 return TOOLTIPS_SetTitleT (infoPtr, (UINT_PTR)wParam, (LPCWSTR)lParam,
2287 uMsg == TTM_SETTITLEW);
2288
2289 case TTM_SETTOOLINFOA:
2290 case TTM_SETTOOLINFOW:
2291 return TOOLTIPS_SetToolInfoT (infoPtr, (LPTTTOOLINFOW)lParam,
2292 uMsg == TTM_SETTOOLINFOW);
2293
2294 case TTM_TRACKACTIVATE:
2296
2297 case TTM_TRACKPOSITION:
2298 return TOOLTIPS_TrackPosition (infoPtr, lParam);
2299
2300 case TTM_UPDATE:
2301 return TOOLTIPS_Update (infoPtr);
2302
2303 case TTM_UPDATETIPTEXTA:
2304 case TTM_UPDATETIPTEXTW:
2306 uMsg == TTM_UPDATETIPTEXTW);
2307
2309 return (LRESULT)WindowFromPoint (*((LPPOINT)lParam));
2310
2311 case WM_CREATE:
2312 return TOOLTIPS_Create (hwnd);
2313
2314 case WM_DESTROY:
2315 return TOOLTIPS_Destroy (infoPtr);
2316
2317 case WM_ERASEBKGND:
2318 /* we draw the background in WM_PAINT */
2319 return 0;
2320
2321 case WM_GETFONT:
2322 return TOOLTIPS_GetFont (infoPtr);
2323
2324 case WM_GETTEXT:
2325 return TOOLTIPS_OnWMGetText (infoPtr, wParam, (LPWSTR)lParam);
2326
2327 case WM_GETTEXTLENGTH:
2328 return TOOLTIPS_GetTextLength (infoPtr);
2329
2330 case WM_LBUTTONDOWN:
2331 case WM_LBUTTONUP:
2332 case WM_MBUTTONDOWN:
2333 case WM_MBUTTONUP:
2334 case WM_RBUTTONDOWN:
2335 case WM_RBUTTONUP:
2336 case WM_MOUSEMOVE:
2337 return TOOLTIPS_MouseMessage (infoPtr);
2338
2339 case WM_NCCREATE:
2340 return TOOLTIPS_NCCreate (hwnd);
2341
2342 case WM_NCHITTEST:
2343 return TOOLTIPS_NCHitTest (infoPtr, wParam, lParam);
2344
2345 case WM_NOTIFYFORMAT:
2346 return TOOLTIPS_NotifyFormat (infoPtr, wParam, lParam);
2347
2348 case WM_PRINTCLIENT:
2349 case WM_PAINT:
2350 return TOOLTIPS_Paint (infoPtr, (HDC)wParam);
2351
2352 case WM_SETFONT:
2353 return TOOLTIPS_SetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
2354
2355 case WM_SYSCOLORCHANGE:
2357 return 0;
2358
2359 case WM_TIMER:
2360 return TOOLTIPS_Timer (infoPtr, (INT)wParam);
2361
2362 case WM_WININICHANGE:
2363 return TOOLTIPS_WinIniChange (infoPtr);
2364
2365 default:
2366 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
2367 ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
2368 uMsg, wParam, lParam);
2369 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2370 }
2371}
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1755
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1593
static LRESULT TOOLTIPS_SetTipBkColor(TOOLTIPS_INFO *infoPtr, COLORREF clrBk)
Definition: tooltips.c:1675
static LRESULT TOOLTIPS_Destroy(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1900
static LRESULT TOOLTIPS_GetCurrentToolT(const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1359
static LRESULT TOOLTIPS_UpdateTipTextT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1837
static LRESULT TOOLTIPS_DelToolT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1247
static LRESULT TOOLTIPS_Update(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1827
static LRESULT TOOLTIPS_GetToolCount(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1465
static LRESULT TOOLTIPS_SetTipTextColor(TOOLTIPS_INFO *infoPtr, COLORREF clrText)
Definition: tooltips.c:1684
static LRESULT TOOLTIPS_AddToolT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1106
static LRESULT TOOLTIPS_WinIniChange(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:2151
static LRESULT TOOLTIPS_Activate(TOOLTIPS_INFO *infoPtr, BOOL activate)
Definition: tooltips.c:1092
static LRESULT TOOLTIPS_GetToolInfoT(const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1472
static LRESULT TOOLTIPS_NotifyFormat(TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: tooltips.c:1990
static LRESULT TOOLTIPS_GetTextT(const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1414
static LRESULT TOOLTIPS_TrackPosition(TOOLTIPS_INFO *infoPtr, LPARAM coord)
Definition: tooltips.c:1810
static LRESULT TOOLTIPS_GetTipTextColor(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1458
static LRESULT TOOLTIPS_GetTipBkColor(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1451
static LRESULT TOOLTIPS_OnWMGetText(const TOOLTIPS_INFO *infoPtr, WPARAM size, LPWSTR pszText)
Definition: tooltips.c:2088
static LRESULT TOOLTIPS_GetTextLength(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:2071
static LRESULT TOOLTIPS_Pop(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1542
static LRESULT TOOLTIPS_Paint(const TOOLTIPS_INFO *infoPtr, HDC hDC)
Definition: tooltips.c:2028
static LRESULT TOOLTIPS_SetToolInfoT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1736
static LRESULT TOOLTIPS_NewToolRectT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti)
Definition: tooltips.c:1521
static LRESULT TOOLTIPS_GetFont(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1934
static LRESULT TOOLTIPS_SetFont(TOOLTIPS_INFO *infoPtr, HFONT hFont, BOOL redraw)
Definition: tooltips.c:2042
static LRESULT TOOLTIPS_Timer(TOOLTIPS_INFO *infoPtr, INT iTimer)
Definition: tooltips.c:2102
static LRESULT TOOLTIPS_GetMargin(const TOOLTIPS_INFO *infoPtr, RECT *rect)
Definition: tooltips.c:1397
static LRESULT TOOLTIPS_NCHitTest(const TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: tooltips.c:1972
static LRESULT TOOLTIPS_SetMaxTipWidth(TOOLTIPS_INFO *infoPtr, INT MaxWidth)
Definition: tooltips.c:1664
static LRESULT TOOLTIPS_HitTestT(const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit, BOOL isW)
Definition: tooltips.c:1498
static LRESULT TOOLTIPS_GetDelayTime(const TOOLTIPS_INFO *infoPtr, DWORD duration)
Definition: tooltips.c:1374
static LRESULT TOOLTIPS_EnumToolsT(const TOOLTIPS_INFO *infoPtr, UINT uIndex, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1321
static LRESULT TOOLTIPS_SetMargin(TOOLTIPS_INFO *infoPtr, const RECT *rect)
Definition: tooltips.c:1654
static LRESULT TOOLTIPS_MouseMessage(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1941
static LRESULT TOOLTIPS_GetBubbleSize(const TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolInfo)
Definition: tooltips.c:1337
static LRESULT TOOLTIPS_NCCreate(HWND hwnd)
Definition: tooltips.c:1950
static LRESULT TOOLTIPS_GetMaxTipWidth(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1407
static LRESULT TOOLTIPS_Create(HWND hwnd)
Definition: tooltips.c:1870
static LRESULT TOOLTIPS_TrackActivate(TOOLTIPS_INFO *infoPtr, BOOL track_activate, const TTTOOLINFOA *ti)
Definition: tooltips.c:1779
static LRESULT TOOLTIPS_SetTitleT(TOOLTIPS_INFO *infoPtr, UINT_PTR uTitleIcon, LPCWSTR pszTitle, BOOL isW)
Definition: tooltips.c:1693
#define WM_APP
Definition: eventvwr.h:73
#define TTM_SETDELAYTIME
Definition: commctrl.h:1790
#define TTM_NEWTOOLRECTA
Definition: commctrl.h:1795
#define TTM_ACTIVATE
Definition: commctrl.h:1789
#define TTM_GETMAXTIPWIDTH
Definition: commctrl.h:1825
#define TTM_SETTOOLINFOA
Definition: commctrl.h:1802
#define TTM_GETCURRENTTOOLW
Definition: commctrl.h:1815
#define TTM_GETTIPTEXTCOLOR
Definition: commctrl.h:1823
#define TTM_RELAYEVENT
Definition: commctrl.h:1797
#define TTM_DELTOOLA
Definition: commctrl.h:1793
#define LPTOOLINFOW
Definition: commctrl.h:1713
#define TTM_DELTOOLW
Definition: commctrl.h:1794
#define TTM_GETMARGIN
Definition: commctrl.h:1827
#define TTM_GETTOOLINFOA
Definition: commctrl.h:1799
#define TTM_GETTEXTW
Definition: commctrl.h:1808
#define TTM_GETDELAYTIME
Definition: commctrl.h:1821
#define TTM_POP
Definition: commctrl.h:1828
#define TTM_ADDTOOLA
Definition: commctrl.h:1791
#define TTM_ENUMTOOLSA
Definition: commctrl.h:1812
#define TTM_NEWTOOLRECTW
Definition: commctrl.h:1796
#define TTM_SETTITLEW
Definition: commctrl.h:1833
#define TTM_ENUMTOOLSW
Definition: commctrl.h:1813
#define TTM_TRACKPOSITION
Definition: commctrl.h:1818
#define TTM_UPDATE
Definition: commctrl.h:1829
#define TTM_GETTOOLCOUNT
Definition: commctrl.h:1811
#define TTM_ADDTOOLW
Definition: commctrl.h:1792
#define TTM_UPDATETIPTEXTA
Definition: commctrl.h:1809
#define TTM_GETCURRENTTOOLA
Definition: commctrl.h:1814
#define TTM_GETTIPBKCOLOR
Definition: commctrl.h:1822
#define TTM_SETMARGIN
Definition: commctrl.h:1826
#define TTM_UPDATETIPTEXTW
Definition: commctrl.h:1810
#define TTM_SETTIPBKCOLOR
Definition: commctrl.h:1819
#define TTM_SETTOOLINFOW
Definition: commctrl.h:1803
#define TTM_SETTITLEA
Definition: commctrl.h:1832
#define TTM_SETTIPTEXTCOLOR
Definition: commctrl.h:1820
#define TTM_HITTESTA
Definition: commctrl.h:1805
#define TTM_TRACKACTIVATE
Definition: commctrl.h:1817
#define TTM_GETTOOLINFOW
Definition: commctrl.h:1800
#define TTM_GETBUBBLESIZE
Definition: commctrl.h:1830
#define TTM_GETTEXTA
Definition: commctrl.h:1807
#define TTM_SETMAXTIPWIDTH
Definition: commctrl.h:1824
#define TTM_HITTESTW
Definition: commctrl.h:1806
#define WM_PRINTCLIENT
Definition: richedit.h:70
DWORD COLORREF
Definition: windef.h:300
#define WM_PAINT
Definition: winuser.h:1623
#define WM_ERASEBKGND
Definition: winuser.h:1628
#define WM_GETTEXTLENGTH
Definition: winuser.h:1622
#define WM_CREATE
Definition: winuser.h:1611
#define WM_WININICHANGE
Definition: winuser.h:1633
#define WM_GETTEXT
Definition: winuser.h:1621
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1629
#define WM_GETFONT
Definition: winuser.h:1654
#define WM_NCCREATE
Definition: winuser.h:1686
#define WM_SETFONT
Definition: winuser.h:1653
#define WM_TIMER
Definition: winuser.h:1745
HWND WINAPI WindowFromPoint(_In_ POINT)
#define WM_USER
Definition: winuser.h:1898
#define WM_DESTROY
Definition: winuser.h:1612

Referenced by TOOLTIPS_Register().

◆ TOOLTIPS_WinIniChange()

static LRESULT TOOLTIPS_WinIniChange ( TOOLTIPS_INFO infoPtr)
static

Definition at line 2151 of file tooltips.c.

2152{
2154
2155 return 0;
2156}

Referenced by TOOLTIPS_WindowProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( tooltips  )

Variable Documentation

◆ hTooltipIcons

HICON hTooltipIcons[TTI_ERROR+1]
static