ReactOS 0.4.15-dev-6068-g8061a6f
tooltips.c File Reference
#include <stdarg.h>
#include <string.h>
#include "windef.h"
#include "winbase.h"
#include "wine/unicode.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 BOOL TOOLTIPS_IsCallbackString (LPCWSTR str, BOOL isW)
 
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 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 170 of file tooltips.c.

◆ BALLOON_ROUNDEDNESS

#define BALLOON_ROUNDEDNESS   20

Definition at line 165 of file tooltips.c.

◆ BALLOON_STEMHEIGHT

#define BALLOON_STEMHEIGHT   13

Definition at line 166 of file tooltips.c.

◆ BALLOON_STEMINDENT

#define BALLOON_STEMINDENT   20

Definition at line 168 of file tooltips.c.

◆ BALLOON_STEMWIDTH

#define BALLOON_STEMWIDTH   10

Definition at line 167 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 171 of file tooltips.c.

◆ ICON_HEIGHT

#define ICON_HEIGHT   16

Definition at line 172 of file tooltips.c.

◆ ICON_WIDTH

#define ICON_WIDTH   16

Definition at line 173 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 175 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 1037 of file tooltips.c.

1038{
1039 infoPtr->bActive = activate;
1040
1041 TRACE("activate %d\n", activate);
1042
1043 if (!(infoPtr->bActive) && (infoPtr->nCurrentTool != -1))
1044 TOOLTIPS_Hide (infoPtr);
1045
1046 return 0;
1047}
static void TOOLTIPS_Hide(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:845
#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 1051 of file tooltips.c.

1052{
1053 TTTOOL_INFO *toolPtr;
1054 INT nResult;
1055
1056 if (!ti) return FALSE;
1057
1058 TRACE("add tool (%p) %p %ld%s\n", infoPtr->hwndSelf, ti->hwnd, ti->uId,
1059 (ti->uFlags & TTF_IDISHWND) ? " TTF_IDISHWND" : "");
1060
1061 if (ti->cbSize > TTTOOLINFOW_V3_SIZE && isW)
1062 return FALSE;
1063
1064 if (infoPtr->uNumTools == 0) {
1065 infoPtr->tools = Alloc (sizeof(TTTOOL_INFO));
1066 toolPtr = infoPtr->tools;
1067 }
1068 else {
1069 TTTOOL_INFO *oldTools = infoPtr->tools;
1070 infoPtr->tools =
1071 Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools + 1));
1072 memcpy (infoPtr->tools, oldTools,
1073 infoPtr->uNumTools * sizeof(TTTOOL_INFO));
1074 Free (oldTools);
1075 toolPtr = &infoPtr->tools[infoPtr->uNumTools];
1076 }
1077
1078 infoPtr->uNumTools++;
1079
1080 /* copy tool data */
1081 toolPtr->uFlags = ti->uFlags;
1082 toolPtr->uInternalFlags = (ti->uFlags & (TTF_SUBCLASS | TTF_IDISHWND));
1083 toolPtr->hwnd = ti->hwnd;
1084 toolPtr->uId = ti->uId;
1085 toolPtr->rect = ti->rect;
1086 toolPtr->hinst = ti->hinst;
1087
1088 if (ti->cbSize >= TTTOOLINFOW_V1_SIZE) {
1089 if (IS_INTRESOURCE(ti->lpszText)) {
1090 TRACE("add string id %x\n", LOWORD(ti->lpszText));
1091 toolPtr->lpszText = ti->lpszText;
1092 }
1093 else if (ti->lpszText) {
1095 TRACE("add CALLBACK\n");
1096 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
1097 }
1098 else if (isW) {
1099 INT len = lstrlenW (ti->lpszText);
1100 TRACE("add text %s\n", debugstr_w(ti->lpszText));
1101 toolPtr->lpszText = Alloc ((len + 1)*sizeof(WCHAR));
1102 strcpyW (toolPtr->lpszText, ti->lpszText);
1103 }
1104 else {
1105 INT len = MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, NULL, 0);
1106 TRACE("add text \"%s\"\n", debugstr_a((char *)ti->lpszText));
1107 toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
1108 MultiByteToWideChar(CP_ACP, 0, (LPSTR)ti->lpszText, -1, toolPtr->lpszText, len);
1109 }
1110 }
1111 }
1112
1113 if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
1114 toolPtr->lParam = ti->lParam;
1115
1116 /* install subclassing hook */
1117 if (toolPtr->uInternalFlags & TTF_SUBCLASS) {
1118 if (toolPtr->uInternalFlags & TTF_IDISHWND) {
1120 (DWORD_PTR)infoPtr->hwndSelf);
1121 }
1122 else {
1124 (DWORD_PTR)infoPtr->hwndSelf);
1125 }
1126 TRACE("subclassing installed\n");
1127 }
1128
1129 nResult = SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
1130 (WPARAM)infoPtr->hwndSelf, NF_QUERY);
1131 if (nResult == NFR_ANSI) {
1132 toolPtr->bNotifyUnicode = FALSE;
1133 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
1134 } else if (nResult == NFR_UNICODE) {
1135 toolPtr->bNotifyUnicode = TRUE;
1136 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
1137 } else {
1138 TRACE (" -- WM_NOTIFYFORMAT returns: %d\n", nResult);
1139 }
1140
1141 return TRUE;
1142}
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:1261
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static BOOL TOOLTIPS_IsCallbackString(LPCWSTR str, BOOL isW)
Definition: tooltips.c:181
static LRESULT CALLBACK TOOLTIPS_SubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam, UINT_PTR uId, DWORD_PTR dwRef)
Definition: tooltips.c:2140
#define CP_ACP
Definition: compat.h:109
#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:2380
#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
#define strcpyW(d, s)
Definition: unicode.h:29
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:2448
#define NFR_UNICODE
Definition: winuser.h:2449
#define NF_QUERY
Definition: winuser.h:2450
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 523 of file tooltips.c.

524{
525 HDC hdc;
526 HFONT hOldFont;
529 RECT rc = {0, 0, 0, 0};
530 SIZE title = {0, 0};
531
532 if (infoPtr->nMaxTipWidth > -1) {
533 rc.right = infoPtr->nMaxTipWidth;
535 }
536 if (style & TTS_NOPREFIX)
538 TRACE("%s\n", debugstr_w(infoPtr->szTipText));
539
540 hdc = GetDC (infoPtr->hwndSelf);
541 if (infoPtr->pszTitle)
542 {
543 RECT rcTitle = {0, 0, 0, 0};
544 TRACE("title %s\n", debugstr_w(infoPtr->pszTitle));
545 if (infoPtr->hTitleIcon)
546 {
547 title.cx = ICON_WIDTH;
548 title.cy = ICON_HEIGHT;
549 }
550 if (title.cx != 0) title.cx += BALLOON_ICON_TITLE_SPACING;
551 hOldFont = SelectObject (hdc, infoPtr->hTitleFont);
552 DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_SINGLELINE | DT_NOPREFIX | DT_CALCRECT);
553 SelectObject (hdc, hOldFont);
554 title.cy = max(title.cy, rcTitle.bottom - rcTitle.top) + BALLOON_TITLE_TEXT_SPACING;
555 title.cx += (rcTitle.right - rcTitle.left);
556 }
557 hOldFont = SelectObject (hdc, infoPtr->hFont);
558 DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
559 SelectObject (hdc, hOldFont);
560 ReleaseDC (infoPtr->hwndSelf, hdc);
561
562 if ((style & TTS_BALLOON) || infoPtr->pszTitle)
563 {
564 lpSize->cx = max(rc.right - rc.left, title.cx) + 2*BALLOON_TEXT_MARGIN +
565 infoPtr->rcMargin.left + infoPtr->rcMargin.right;
566 lpSize->cy = title.cy + rc.bottom - rc.top + 2*BALLOON_TEXT_MARGIN +
567 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top +
569 }
570 else
571 {
572 lpSize->cx = rc.right - rc.left + 2*NORMAL_TEXT_MARGIN +
573 infoPtr->rcMargin.left + infoPtr->rcMargin.right;
574 lpSize->cy = rc.bottom - rc.top + 2*NORMAL_TEXT_MARGIN +
575 infoPtr->rcMargin.bottom + infoPtr->rcMargin.top;
576 }
577}
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:166
#define ICON_WIDTH
Definition: tooltips.c:173
#define NORMAL_TEXT_MARGIN
Definition: tooltips.c:161
#define ICON_HEIGHT
Definition: tooltips.c:172
#define BALLOON_TITLE_TEXT_SPACING
Definition: tooltips.c:171
#define BALLOON_ICON_TITLE_SPACING
Definition: tooltips.c:170
unsigned long DWORD
Definition: ntddk_ex.h:95
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:92
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:1539
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_CALCRECT
Definition: winuser.h:526
#define GWL_STYLE
Definition: winuser.h:846

Referenced by TOOLTIPS_GetBubbleSize(), and TOOLTIPS_Show().

◆ TOOLTIPS_CheckTool()

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

Definition at line 1001 of file tooltips.c.

1002{
1003 POINT pt;
1004 HWND hwndTool;
1005 INT nTool;
1006
1007 GetCursorPos (&pt);
1008 hwndTool = (HWND)SendMessageW (infoPtr->hwndSelf, TTM_WINDOWFROMPOINT, 0, (LPARAM)&pt);
1009 if (hwndTool == 0)
1010 return -1;
1011
1012 ScreenToClient (hwndTool, &pt);
1013 nTool = TOOLTIPS_GetToolFromPoint (infoPtr, hwndTool, &pt);
1014 if (nTool == -1)
1015 return -1;
1016
1017 if (!(GetWindowLongW (infoPtr->hwndSelf, GWL_STYLE) & TTS_ALWAYSTIP) && bShowTest)
1018 {
1019 TTTOOL_INFO *ti = &infoPtr->tools[nTool];
1020 HWND hwnd = (ti->uFlags & TTF_IDISHWND) ? (HWND)ti->uId : ti->hwnd;
1021
1023 {
1024 TRACE("not active: hwnd %p, parent %p, active %p\n",
1026 return -1;
1027 }
1028 }
1029
1030 TRACE("tool %d\n", nTool);
1031
1032 return nTool;
1033}
static INT TOOLTIPS_GetToolFromPoint(const TOOLTIPS_INFO *infoPtr, HWND hwnd, const POINT *lpPt)
Definition: tooltips.c:929
static BOOL TOOLTIPS_IsWindowActive(HWND hwnd)
Definition: tooltips.c:989
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:1811
_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:2639
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 959 of file tooltips.c.

960{
961 const TTTOOL_INFO *toolPtr = &infoPtr->tools[index];
962
963 ti->uFlags = toolPtr->uFlags;
964 ti->hwnd = toolPtr->hwnd;
965 ti->uId = toolPtr->uId;
966 ti->rect = toolPtr->rect;
967 ti->hinst = toolPtr->hinst;
968
969 if (ti->lpszText) {
970 if (toolPtr->lpszText == NULL ||
971 IS_INTRESOURCE(toolPtr->lpszText) ||
972 toolPtr->lpszText == LPSTR_TEXTCALLBACKW)
973 ti->lpszText = toolPtr->lpszText;
974 else if (isW)
975 strcpyW (ti->lpszText, toolPtr->lpszText);
976 else
977 /* ANSI version, the buffer is maximum 80 bytes without null. */
978 WideCharToMultiByte(CP_ACP, 0, toolPtr->lpszText, -1,
980 }
981
982 if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
983 ti->lParam = toolPtr->lParam;
984
985 /* lpReserved is intentionally not set. */
986}
#define index(s, c)
Definition: various.h:29
#define MAX_TEXT_SIZE_A
Definition: tooltips.c:175
#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 1841 of file tooltips.c.

1842{
1843 TOOLTIPS_INFO *infoPtr;
1844
1845 /* allocate memory for info structure */
1846 infoPtr = Alloc (sizeof(TOOLTIPS_INFO));
1847 SetWindowLongPtrW (hwnd, 0, (DWORD_PTR)infoPtr);
1848
1849 /* initialize info structure */
1850 infoPtr->bActive = TRUE;
1851 infoPtr->bTrackActive = FALSE;
1852
1853 infoPtr->nMaxTipWidth = -1;
1854 infoPtr->nTool = -1;
1855 infoPtr->nCurrentTool = -1;
1856 infoPtr->nTrackTool = -1;
1857 infoPtr->hwndSelf = hwnd;
1858
1859 /* initialize colours and fonts */
1861
1863
1865
1866 return 0;
1867}
static LRESULT TOOLTIPS_SetDelayTime(TOOLTIPS_INFO *infoPtr, DWORD duration, INT nTime)
Definition: tooltips.c:1527
static void TOOLTIPS_InitSystemSettings(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:200
#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:1232
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define HWND_TOP
Definition: winuser.h:1197
#define SWP_HIDEWINDOW
Definition: winuser.h:1231
#define SWP_NOZORDER
Definition: winuser.h:1237
#define SetWindowLongPtrW
Definition: winuser.h:5336

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 219 of file tooltips.c.

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

Referenced by TOOLTIPS_Refresh().

◆ TOOLTIPS_DelToolT()

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

Definition at line 1153 of file tooltips.c.

1154{
1155 TTTOOL_INFO *toolPtr;
1156 INT nTool;
1157
1158 if (!ti) return 0;
1159 if (isW && ti->cbSize > TTTOOLINFOW_V2_SIZE &&
1161 return 0;
1162 if (infoPtr->uNumTools == 0)
1163 return 0;
1164
1165 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1166
1167 TRACE("tool %d\n", nTool);
1168
1169 if (nTool == -1)
1170 return 0;
1171
1172 /* make sure the tooltip has disappeared before deleting it */
1173 TOOLTIPS_Hide(infoPtr);
1174
1175 /* delete text string */
1176 toolPtr = &infoPtr->tools[nTool];
1177 if (toolPtr->lpszText) {
1178 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
1179 !IS_INTRESOURCE(toolPtr->lpszText) )
1180 Free (toolPtr->lpszText);
1181 }
1182
1183 TOOLTIPS_ResetSubclass (toolPtr);
1184
1185 /* delete tool from tool list */
1186 if (infoPtr->uNumTools == 1) {
1187 Free (infoPtr->tools);
1188 infoPtr->tools = NULL;
1189 }
1190 else {
1191 TTTOOL_INFO *oldTools = infoPtr->tools;
1192 infoPtr->tools =
1193 Alloc (sizeof(TTTOOL_INFO) * (infoPtr->uNumTools - 1));
1194
1195 if (nTool > 0)
1196 memcpy (&infoPtr->tools[0], &oldTools[0],
1197 nTool * sizeof(TTTOOL_INFO));
1198
1199 if (nTool < infoPtr->uNumTools - 1)
1200 memcpy (&infoPtr->tools[nTool], &oldTools[nTool + 1],
1201 (infoPtr->uNumTools - nTool - 1) * sizeof(TTTOOL_INFO));
1202
1203 Free (oldTools);
1204 }
1205
1206 /* update any indices affected by delete */
1207
1208 /* destroying tool that mouse was on on last relayed mouse move */
1209 if (infoPtr->nTool == nTool)
1210 /* -1 means no current tool (0 means first tool) */
1211 infoPtr->nTool = -1;
1212 else if (infoPtr->nTool > nTool)
1213 infoPtr->nTool--;
1214
1215 if (infoPtr->nTrackTool == nTool)
1216 /* -1 means no current tool (0 means first tool) */
1217 infoPtr->nTrackTool = -1;
1218 else if (infoPtr->nTrackTool > nTool)
1219 infoPtr->nTrackTool--;
1220
1221 if (infoPtr->nCurrentTool == nTool)
1222 /* -1 means no current tool (0 means first tool) */
1223 infoPtr->nCurrentTool = -1;
1224 else if (infoPtr->nCurrentTool > nTool)
1225 infoPtr->nCurrentTool--;
1226
1227 infoPtr->uNumTools--;
1228
1229 return 0;
1230}
static void TOOLTIPS_ResetSubclass(const TTTOOL_INFO *toolPtr)
Definition: tooltips.c:1144
static INT TOOLTIPS_GetToolFromInfoT(const TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolInfo)
Definition: tooltips.c:902

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_Destroy()

static LRESULT TOOLTIPS_Destroy ( TOOLTIPS_INFO infoPtr)
static

Definition at line 1871 of file tooltips.c.

1872{
1873 TTTOOL_INFO *toolPtr;
1874 UINT i;
1875
1876 /* free tools */
1877 if (infoPtr->tools) {
1878 for (i = 0; i < infoPtr->uNumTools; i++) {
1879 toolPtr = &infoPtr->tools[i];
1880 if (toolPtr->lpszText) {
1881 if ( (toolPtr->lpszText != LPSTR_TEXTCALLBACKW) &&
1882 !IS_INTRESOURCE(toolPtr->lpszText) )
1883 {
1884 Free (toolPtr->lpszText);
1885 toolPtr->lpszText = NULL;
1886 }
1887 }
1888
1889 TOOLTIPS_ResetSubclass (toolPtr);
1890 }
1891
1892 Free (infoPtr->tools);
1893 }
1894
1895 /* free title string */
1896 Free (infoPtr->pszTitle);
1897 /* free title icon if not a standard one */
1899 DeleteObject(infoPtr->hTitleIcon);
1900
1901 /* delete fonts */
1902 DeleteObject (infoPtr->hFont);
1903 DeleteObject (infoPtr->hTitleFont);
1904
1905 /* free tool tips info data */
1906 SetWindowLongPtrW(infoPtr->hwndSelf, 0, 0);
1907 Free (infoPtr);
1908
1909 return 0;
1910}
static UINT_PTR TOOLTIPS_GetTitleIconIndex(HICON hIcon)
Definition: tooltips.c:190
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 1233 of file tooltips.c.

1235{
1236 if (!ti || ti->cbSize < TTTOOLINFOW_V1_SIZE)
1237 return FALSE;
1238 if (uIndex >= infoPtr->uNumTools)
1239 return FALSE;
1240
1241 TRACE("index=%u\n", uIndex);
1242
1243 TOOLTIPS_CopyInfoT (infoPtr, uIndex, ti, isW);
1244
1245 return TRUE;
1246}
static void TOOLTIPS_CopyInfoT(const TOOLTIPS_INFO *infoPtr, INT index, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:959

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetBubbleSize()

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

Definition at line 1249 of file tooltips.c.

1250{
1251 INT nTool;
1252 SIZE size;
1253
1254 if (lpToolInfo == NULL)
1255 return FALSE;
1256 if (lpToolInfo->cbSize < TTTOOLINFOW_V1_SIZE)
1257 return FALSE;
1258
1259 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, lpToolInfo);
1260 if (nTool == -1) return 0;
1261
1262 TRACE("tool %d\n", nTool);
1263
1264 TOOLTIPS_CalcTipSize (infoPtr, &size);
1265 TRACE("size %d x %d\n", size.cx, size.cy);
1266
1267 return MAKELRESULT(size.cx, size.cy);
1268}
static void TOOLTIPS_CalcTipSize(const TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
Definition: tooltips.c:523
GLsizeiptr size
Definition: glext.h:5919
#define MAKELRESULT(l, h)
Definition: winuser.h:4000

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetCurrentToolT()

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

Definition at line 1271 of file tooltips.c.

1272{
1273 if (ti) {
1274 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1275 return FALSE;
1276
1277 if (infoPtr->nCurrentTool != -1)
1278 TOOLTIPS_CopyInfoT (infoPtr, infoPtr->nCurrentTool, ti, isW);
1279 }
1280
1281 return infoPtr->nCurrentTool != -1;
1282}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetDelayTime()

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

Definition at line 1286 of file tooltips.c.

1287{
1288 switch (duration) {
1289 case TTDT_RESHOW:
1290 return infoPtr->nReshowTime;
1291
1292 case TTDT_AUTOPOP:
1293 return infoPtr->nAutoPopTime;
1294
1295 case TTDT_INITIAL:
1296 case TTDT_AUTOMATIC: /* Apparently TTDT_AUTOMATIC returns TTDT_INITIAL */
1297 return infoPtr->nInitialTime;
1298
1299 default:
1300 WARN("Invalid duration flag %x\n", duration);
1301 break;
1302 }
1303
1304 return -1;
1305}
#define WARN(fmt,...)
Definition: debug.h:112
#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 370 of file tooltips.c.

371{
372 NMTTDISPINFOA ttnmdi;
373
374 /* fill NMHDR struct */
375 ZeroMemory (&ttnmdi, sizeof(NMTTDISPINFOA));
376 ttnmdi.hdr.hwndFrom = infoPtr->hwndSelf;
377 ttnmdi.hdr.idFrom = toolPtr->uId;
378 ttnmdi.hdr.code = TTN_GETDISPINFOA; /* == TTN_NEEDTEXTA */
379 ttnmdi.lpszText = ttnmdi.szText;
380 ttnmdi.uFlags = toolPtr->uFlags;
381 ttnmdi.lParam = toolPtr->lParam;
382
383 TRACE("hdr.idFrom = %lx\n", ttnmdi.hdr.idFrom);
384 SendMessageW(toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&ttnmdi);
385
386 if (IS_INTRESOURCE(ttnmdi.lpszText)) {
387 LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText),
389 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
390 toolPtr->hinst = ttnmdi.hinst;
391 toolPtr->lpszText = (LPWSTR)ttnmdi.lpszText;
392 }
393 }
394 else if (ttnmdi.lpszText == 0) {
395 buffer[0] = '\0';
396 }
397 else if (ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) {
399 if (ttnmdi.uFlags & TTF_DI_SETITEM) {
400 toolPtr->hinst = 0;
401 toolPtr->lpszText = NULL;
402 Str_SetPtrW(&toolPtr->lpszText, buffer);
403 }
404 }
405 else {
406 ERR("recursive text callback\n");
407 buffer[0] = '\0';
408 }
409
410 /* no text available - try calling parent instead as per native */
411 /* FIXME: Unsure if SETITEM should save the value or not */
412 if (buffer[0] == 0x00) {
413
414 SendMessageW(GetParent(toolPtr->hwnd), WM_NOTIFY, toolPtr->uId, (LPARAM)&ttnmdi);
415
416 if (IS_INTRESOURCE(ttnmdi.lpszText)) {
417 LoadStringW(ttnmdi.hinst, LOWORD(ttnmdi.lpszText),
419 } else if (ttnmdi.lpszText &&
420 ttnmdi.lpszText != LPSTR_TEXTCALLBACKA) {
422 }
423 }
424}
#define ERR(fmt,...)
Definition: debug.h:110
INT Str_GetPtrAtoW(LPCSTR lpSrc, LPWSTR lpDest, INT nMaxLen) DECLSPEC_HIDDEN
BOOL WINAPI Str_SetPtrW(LPWSTR *lppDest, LPCWSTR lpSrc)
Definition: string.c:236
GLuint buffer
Definition: glext.h:5915
#define TTN_GETDISPINFOA
Definition: commctrl.h:1872
#define LPSTR_TEXTCALLBACKA
Definition: commctrl.h:2381
#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:1898
HINSTANCE hinst
Definition: commctrl.h:1899
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 426 of file tooltips.c.

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

Referenced by TOOLTIPS_GetTipText().

◆ TOOLTIPS_GetFont()

static LRESULT TOOLTIPS_GetFont ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1914 of file tooltips.c.

1915{
1916 return (LRESULT)infoPtr->hFont;
1917}
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 1309 of file tooltips.c.

1310{
1311 if (rect)
1312 *rect = infoPtr->rcMargin;
1313
1314 return 0;
1315}
& rect
Definition: startmenu.cpp:1413

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetMaxTipWidth()

static LRESULT TOOLTIPS_GetMaxTipWidth ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1319 of file tooltips.c.

1320{
1321 return infoPtr->nMaxTipWidth;
1322}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetTextLength()

static LRESULT TOOLTIPS_GetTextLength ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 2051 of file tooltips.c.

2052{
2053 return strlenW(infoPtr->szTipText);
2054}
#define strlenW(s)
Definition: unicode.h:28

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetTextT()

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

Definition at line 1326 of file tooltips.c.

1327{
1328 INT nTool;
1329
1330 if (!ti) return 0;
1331 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1332 return 0;
1333
1334 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1335 if (nTool == -1) return 0;
1336
1337 if (infoPtr->tools[nTool].lpszText == NULL)
1338 return 0;
1339
1340 if (isW) {
1341 ti->lpszText[0] = '\0';
1342 TOOLTIPS_GetTipText(infoPtr, nTool, ti->lpszText);
1343 }
1344 else {
1346
1347 /* NB this API is broken, there is no way for the app to determine
1348 what size buffer it requires nor a way to specify how long the
1349 one it supplies is. According to the test result, it's up to
1350 80 bytes by the ANSI version. */
1351
1352 buffer[0] = '\0';
1353 TOOLTIPS_GetTipText(infoPtr, nTool, buffer);
1356 }
1357
1358 return 0;
1359}
static void TOOLTIPS_GetTipText(const TOOLTIPS_INFO *infoPtr, INT nTool, WCHAR *buffer)
Definition: tooltips.c:484

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetTipBkColor()

static LRESULT TOOLTIPS_GetTipBkColor ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1363 of file tooltips.c.

1364{
1365 return infoPtr->clrBk;
1366}
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 484 of file tooltips.c.

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

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

◆ TOOLTIPS_GetTipTextColor()

static LRESULT TOOLTIPS_GetTipTextColor ( const TOOLTIPS_INFO infoPtr)
inlinestatic

Definition at line 1370 of file tooltips.c.

1371{
1372 return infoPtr->clrText;
1373}
COLORREF clrText
Definition: tooltips.c:133

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetTitleIconIndex()

static UINT_PTR TOOLTIPS_GetTitleIconIndex ( HICON  hIcon)
inlinestatic

Definition at line 190 of file tooltips.c.

191{
192 UINT i;
193 for (i = 0; i <= TTI_ERROR; i++)
194 if (hTooltipIcons[i] == hIcon)
195 return i;
196 return (UINT_PTR)hIcon;
197}
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 1377 of file tooltips.c.

1378{
1379 return infoPtr->uNumTools;
1380}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_GetToolFromInfoT()

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

Definition at line 902 of file tooltips.c.

903{
904 TTTOOL_INFO *toolPtr;
905 UINT nTool;
906
907 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
908 toolPtr = &infoPtr->tools[nTool];
909
910 if (!(toolPtr->uFlags & TTF_IDISHWND) &&
911 (lpToolInfo->hwnd == toolPtr->hwnd) &&
912 (lpToolInfo->uId == toolPtr->uId))
913 return nTool;
914 }
915
916 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
917 toolPtr = &infoPtr->tools[nTool];
918
919 if ((toolPtr->uFlags & TTF_IDISHWND) &&
920 (lpToolInfo->uId == toolPtr->uId))
921 return nTool;
922 }
923
924 return -1;
925}

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 929 of file tooltips.c.

930{
931 TTTOOL_INFO *toolPtr;
932 UINT nTool;
933
934 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
935 toolPtr = &infoPtr->tools[nTool];
936
937 if (!(toolPtr->uFlags & TTF_IDISHWND)) {
938 if (hwnd != toolPtr->hwnd)
939 continue;
940 if (!PtInRect (&toolPtr->rect, *lpPt))
941 continue;
942 return nTool;
943 }
944 }
945
946 for (nTool = 0; nTool < infoPtr->uNumTools; nTool++) {
947 toolPtr = &infoPtr->tools[nTool];
948
949 if (toolPtr->uFlags & TTF_IDISHWND) {
950 if ((HWND)toolPtr->uId == hwnd)
951 return nTool;
952 }
953 }
954
955 return -1;
956}
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 1384 of file tooltips.c.

1385{
1386 INT nTool;
1387 HWND hwnd;
1388
1389 if (!ti) return FALSE;
1390 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1391 return FALSE;
1392 if (infoPtr->uNumTools == 0)
1393 return FALSE;
1394
1395 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1396 if (nTool == -1)
1397 return FALSE;
1398
1399 TRACE("tool %d\n", nTool);
1400
1401 hwnd = ti->hwnd;
1402 TOOLTIPS_CopyInfoT (infoPtr, nTool, ti, isW);
1403 ti->hwnd = hwnd;
1404
1405 return TRUE;
1406}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_Hide()

static void TOOLTIPS_Hide ( TOOLTIPS_INFO infoPtr)
static

Definition at line 845 of file tooltips.c.

846{
847 TTTOOL_INFO *toolPtr;
848 NMHDR hdr;
849
850 TRACE("Hide tooltip %d, %p.\n", infoPtr->nCurrentTool, infoPtr->hwndSelf);
851
852 if (infoPtr->nCurrentTool == -1)
853 return;
854
855 toolPtr = &infoPtr->tools[infoPtr->nCurrentTool];
856 KillTimer (infoPtr->hwndSelf, ID_TIMERPOP);
857
858 hdr.hwndFrom = infoPtr->hwndSelf;
859 hdr.idFrom = toolPtr->uId;
860 hdr.code = TTN_POP;
861 SendMessageW (toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&hdr);
862
863 infoPtr->nCurrentTool = -1;
864
865 SetWindowPos (infoPtr->hwndSelf, HWND_TOP, 0, 0, 0, 0,
867}
#define ID_TIMERPOP
Definition: tooltips.c:154
char hdr[14]
Definition: iptest.cpp:33
#define TTN_POP
Definition: commctrl.h:1875
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 1410 of file tooltips.c.

1412{
1413 INT nTool;
1414
1415 if (lptthit == 0)
1416 return FALSE;
1417
1418 nTool = TOOLTIPS_GetToolFromPoint (infoPtr, lptthit->hwnd, &lptthit->pt);
1419 if (nTool == -1)
1420 return FALSE;
1421
1422 TRACE("tool %d\n", nTool);
1423
1424 /* copy tool data */
1425 if (lptthit->ti.cbSize >= TTTOOLINFOW_V1_SIZE)
1426 TOOLTIPS_CopyInfoT (infoPtr, nTool, &lptthit->ti, isW);
1427
1428 return TRUE;
1429}
TTTOOLINFOW ti
Definition: commctrl.h:1866

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_InitSystemSettings()

static void TOOLTIPS_InitSystemSettings ( TOOLTIPS_INFO infoPtr)
static

Definition at line 200 of file tooltips.c.

201{
202 NONCLIENTMETRICSW nclm;
203
204 infoPtr->clrBk = comctl32_color.clrInfoBk;
206
207 DeleteObject (infoPtr->hFont);
208 nclm.cbSize = sizeof(nclm);
209 SystemParametersInfoW (SPI_GETNONCLIENTMETRICS, sizeof(nclm), &nclm, 0);
210 infoPtr->hFont = CreateFontIndirectW (&nclm.lfStatusFont);
211
212 DeleteObject (infoPtr->hTitleFont);
213 nclm.lfStatusFont.lfWeight = FW_BOLD;
214 infoPtr->hTitleFont = CreateFontIndirectW (&nclm.lfStatusFont);
215}
COMCTL32_SysColor comctl32_color
Definition: commctrl.c:82
COLORREF clrInfoText
Definition: comctl32.h:181
COLORREF clrInfoBk
Definition: comctl32.h:180
#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_IsCallbackString()

static BOOL TOOLTIPS_IsCallbackString ( LPCWSTR  str,
BOOL  isW 
)
inlinestatic

Definition at line 181 of file tooltips.c.

182{
183 if (isW)
184 return str == LPSTR_TEXTCALLBACKW;
185 else
186 return (LPCSTR)str == LPSTR_TEXTCALLBACKA;
187}
const WCHAR * str
const char * LPCSTR
Definition: xmlstorage.h:183

Referenced by TOOLTIPS_AddToolT(), TOOLTIPS_SetToolInfoT(), and TOOLTIPS_UpdateTipTextT().

◆ TOOLTIPS_IsWindowActive()

static BOOL TOOLTIPS_IsWindowActive ( HWND  hwnd)
static

Definition at line 989 of file tooltips.c.

990{
991 HWND hwndActive = GetActiveWindow ();
992 if (!hwndActive)
993 return FALSE;
994 if (hwndActive == hwnd)
995 return TRUE;
996 return IsChild (hwndActive, hwnd);
997}
BOOL WINAPI IsChild(_In_ HWND, _In_ HWND)

Referenced by TOOLTIPS_CheckTool().

◆ TOOLTIPS_MouseMessage()

static LRESULT TOOLTIPS_MouseMessage ( TOOLTIPS_INFO infoPtr)
static

Definition at line 1921 of file tooltips.c.

1922{
1923 TOOLTIPS_Hide (infoPtr);
1924
1925 return 0;
1926}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_NCCreate()

static LRESULT TOOLTIPS_NCCreate ( HWND  hwnd)
static

Definition at line 1930 of file tooltips.c.

1931{
1932 DWORD dwStyle = GetWindowLongW (hwnd, GWL_STYLE);
1933 DWORD dwExStyle = GetWindowLongW (hwnd, GWL_EXSTYLE);
1934
1935 dwStyle &= ~(WS_CHILD | /*WS_MAXIMIZE |*/ WS_BORDER | WS_DLGFRAME);
1936 dwStyle |= (WS_POPUP | WS_BORDER | WS_CLIPSIBLINGS);
1937
1938 /* WS_BORDER only draws a border round the window rect, not the
1939 * window region, therefore it is useless to us in balloon mode */
1940 if (dwStyle & TTS_BALLOON) dwStyle &= ~WS_BORDER;
1941
1942 SetWindowLongW (hwnd, GWL_STYLE, dwStyle);
1943
1944 dwExStyle |= WS_EX_TOOLWINDOW;
1945 SetWindowLongW (hwnd, GWL_EXSTYLE, dwExStyle);
1946
1947 return TRUE;
1948}
#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:845

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_NCHitTest()

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

Definition at line 1952 of file tooltips.c.

1953{
1954 INT nTool = (infoPtr->bTrackActive) ? infoPtr->nTrackTool : infoPtr->nTool;
1955
1956 TRACE(" nTool=%d\n", nTool);
1957
1958 if ((nTool > -1) && (nTool < infoPtr->uNumTools)) {
1959 if (infoPtr->tools[nTool].uFlags & TTF_TRANSPARENT) {
1960 TRACE("-- in transparent mode\n");
1961 return HTTRANSPARENT;
1962 }
1963 }
1964
1965 return DefWindowProcW (infoPtr->hwndSelf, WM_NCHITTEST, wParam, lParam);
1966}
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:1676
#define HTTRANSPARENT
Definition: winuser.h:2463

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_NewToolRectT()

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

Definition at line 1433 of file tooltips.c.

1434{
1435 INT nTool;
1436
1437 if (!ti) return 0;
1438 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1439 return FALSE;
1440
1441 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1442
1443 TRACE("nTool = %d, rect = %s\n", nTool, wine_dbgstr_rect(&ti->rect));
1444
1445 if (nTool == -1) return 0;
1446
1447 infoPtr->tools[nTool].rect = ti->rect;
1448
1449 return 0;
1450}
static __inline const char * wine_dbgstr_rect(const RECT *rect)
Definition: debug.h:219

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_notify_customdraw()

static DWORD TOOLTIPS_notify_customdraw ( DWORD  dwDrawStage,
NMTTCUSTOMDRAW lpnmttcd 
)
inlinestatic

Definition at line 236 of file tooltips.c.

237{
239 lpnmttcd->nmcd.dwDrawStage = dwDrawStage;
240
241 TRACE("Notifying stage %d, flags %x, id %x\n", lpnmttcd->nmcd.dwDrawStage,
242 lpnmttcd->uDrawFlags, lpnmttcd->nmcd.hdr.code);
243
245 0, (LPARAM)lpnmttcd);
246
247 TRACE("Notify result %x\n", (unsigned int)result);
248
249 return result;
250}
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 1970 of file tooltips.c.

1971{
1972#ifdef __REACTOS__
1973 TTTOOL_INFO *toolPtr = infoPtr->tools;
1974 LRESULT nResult;
1975
1976 TRACE("infoPtr=%p wParam=%lx lParam=%p\n", infoPtr, wParam, (PVOID)lParam);
1977
1978 if (lParam == NF_QUERY) {
1979 if (toolPtr->bNotifyUnicode) {
1980 return NFR_UNICODE;
1981 } else {
1982 return NFR_ANSI;
1983 }
1984 }
1985 else if (lParam == NF_REQUERY) {
1986 nResult = SendMessageW (toolPtr->hwnd, WM_NOTIFYFORMAT,
1987 (WPARAM)infoPtr->hwndSelf, (LPARAM)NF_QUERY);
1988 if (nResult == NFR_ANSI) {
1989 toolPtr->bNotifyUnicode = FALSE;
1990 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_ANSI\n");
1991 } else if (nResult == NFR_UNICODE) {
1992 toolPtr->bNotifyUnicode = TRUE;
1993 TRACE(" -- WM_NOTIFYFORMAT returns: NFR_UNICODE\n");
1994 } else {
1995 TRACE (" -- WM_NOTIFYFORMAT returns: error!\n");
1996 }
1997 return nResult;
1998 }
1999#else
2000 FIXME ("hwnd=%p wParam=%lx lParam=%lx\n", infoPtr->hwndSelf, wParam, lParam);
2001#endif
2002
2003 return 0;
2004}
#define FIXME(fmt,...)
Definition: debug.h:111
#define NF_REQUERY
Definition: winuser.h:2451

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_OnWMGetText()

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

Definition at line 2068 of file tooltips.c.

2069{
2070 LRESULT res;
2071
2072 if(!size)
2073 return 0;
2074
2075 res = min(strlenW(infoPtr->szTipText)+1, size);
2076 memcpy(pszText, infoPtr->szTipText, res*sizeof(WCHAR));
2077 pszText[res-1] = '\0';
2078 return res-1;
2079}
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 2008 of file tooltips.c.

2009{
2010 HDC hdc;
2011 PAINTSTRUCT ps;
2012
2013 hdc = (hDC == NULL) ? BeginPaint (infoPtr->hwndSelf, &ps) : hDC;
2014 TOOLTIPS_Refresh (infoPtr, hdc);
2015 if (!hDC)
2016 EndPaint (infoPtr->hwndSelf, &ps);
2017 return 0;
2018}
static HDC hDC
Definition: 3dtext.c:33
static void TOOLTIPS_Refresh(const TOOLTIPS_INFO *infoPtr, HDC hdc)
Definition: tooltips.c:253
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 1454 of file tooltips.c.

1455{
1456 TOOLTIPS_Hide (infoPtr);
1457
1458 return 0;
1459}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_Refresh()

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

Definition at line 253 of file tooltips.c.

254{
255 RECT rc;
256 INT oldBkMode;
257 HFONT hOldFont;
258 HBRUSH hBrush;
260 HRGN hRgn = NULL;
261 DWORD dwStyle = GetWindowLongW(infoPtr->hwndSelf, GWL_STYLE);
262 NMTTCUSTOMDRAW nmttcd;
263 DWORD cdmode;
264
265 if (infoPtr->nMaxTipWidth > -1)
269 GetClientRect (infoPtr->hwndSelf, &rc);
270
271 hBrush = CreateSolidBrush(infoPtr->clrBk);
272
273 oldBkMode = SetBkMode (hdc, TRANSPARENT);
274 SetTextColor (hdc, infoPtr->clrText);
275 hOldFont = SelectObject (hdc, infoPtr->hFont);
276
277 /* Custom draw - Call PrePaint once initial properties set up */
278 /* Note: Contrary to MSDN, CDRF_SKIPDEFAULT still draws a tooltip */
279 TOOLTIPS_customdraw_fill(infoPtr, &nmttcd, hdc, &rc, uFlags);
280 cdmode = TOOLTIPS_notify_customdraw(CDDS_PREPAINT, &nmttcd);
281 uFlags = nmttcd.uDrawFlags;
282
283 if (dwStyle & TTS_BALLOON)
284 {
285 /* create a region to store result into */
286 hRgn = CreateRectRgn(0, 0, 0, 0);
287
288 GetWindowRgn(infoPtr->hwndSelf, hRgn);
289
290 /* fill the background */
291 FillRgn(hdc, hRgn, hBrush);
292 DeleteObject(hBrush);
293 hBrush = NULL;
294 }
295 else
296 {
297 /* fill the background */
298 FillRect(hdc, &rc, hBrush);
299 DeleteObject(hBrush);
300 hBrush = NULL;
301 }
302
303 if ((dwStyle & TTS_BALLOON) || infoPtr->pszTitle)
304 {
305 /* calculate text rectangle */
306 rc.left += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.left);
307 rc.top += (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.top);
308 rc.right -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.right);
309 rc.bottom -= (BALLOON_TEXT_MARGIN + infoPtr->rcMargin.bottom);
310 if(infoPtr->bToolBelow) rc.top += BALLOON_STEMHEIGHT;
311
312 if (infoPtr->pszTitle)
313 {
314 RECT rcTitle = {rc.left, rc.top, rc.right, rc.bottom};
315 int height;
316 BOOL icon_present;
317 HFONT prevFont;
318
319 /* draw icon */
320 icon_present = infoPtr->hTitleIcon &&
321 DrawIconEx(hdc, rc.left, rc.top, infoPtr->hTitleIcon,
323 if (icon_present)
325
326 rcTitle.bottom = rc.top + ICON_HEIGHT;
327
328 /* draw title text */
329 prevFont = SelectObject (hdc, infoPtr->hTitleFont);
330 height = DrawTextW(hdc, infoPtr->pszTitle, -1, &rcTitle, DT_BOTTOM | DT_SINGLELINE | DT_NOPREFIX);
331 SelectObject (hdc, prevFont);
333 }
334 }
335 else
336 {
337 /* calculate text rectangle */
338 rc.left += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.left);
339 rc.top += (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.top);
340 rc.right -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.right);
341 rc.bottom -= (NORMAL_TEXT_MARGIN + infoPtr->rcMargin.bottom);
342 }
343
344 /* draw text */
345 DrawTextW (hdc, infoPtr->szTipText, -1, &rc, uFlags);
346
347 /* Custom draw - Call PostPaint after drawing */
348 if (cdmode & CDRF_NOTIFYPOSTPAINT) {
350 }
351
352 /* be polite and reset the things we changed in the dc */
353 SelectObject (hdc, hOldFont);
354 SetBkMode (hdc, oldBkMode);
355
356 if (dwStyle & TTS_BALLOON)
357 {
358 /* frame region because default window proc doesn't do it */
361
363 FrameRgn(hdc, hRgn, hBrush, width, height);
364 }
365
366 if (hRgn)
368}
static void TOOLTIPS_customdraw_fill(const TOOLTIPS_INFO *infoPtr, NMTTCUSTOMDRAW *lpnmttcd, HDC hdc, const RECT *rcBounds, UINT uFlags)
Definition: tooltips.c:219
static DWORD TOOLTIPS_notify_customdraw(DWORD dwDrawStage, NMTTCUSTOMDRAW *lpnmttcd)
Definition: tooltips.c:236
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:1003
#define COLOR_WINDOWFRAME
Definition: winuser.h:913
#define SM_CXEDGE
Definition: winuser.h:1002
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:1997
#define SM_CXDLGFRAME
Definition: winuser.h:960
#define DT_BOTTOM
Definition: winuser.h:525
#define SM_CYDLGFRAME
Definition: winuser.h:962
int WINAPI GetSystemMetrics(_In_ int)

Referenced by TOOLTIPS_Paint().

◆ TOOLTIPS_Register()

VOID TOOLTIPS_Register ( void  )

Definition at line 2355 of file tooltips.c.

2356{
2357 WNDCLASSW wndClass;
2358
2359 ZeroMemory (&wndClass, sizeof(WNDCLASSW));
2362 wndClass.cbClsExtra = 0;
2363 wndClass.cbWndExtra = sizeof(TOOLTIPS_INFO *);
2364 wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW);
2365 wndClass.hbrBackground = 0;
2366 wndClass.lpszClassName = TOOLTIPS_CLASSW;
2367
2368 RegisterClassW (&wndClass);
2369
2377}
#define IDI_TT_WARN_SM
Definition: comctl32.h:107
#define IDI_TT_ERROR_SM
Definition: comctl32.h:108
#define IDI_TT_INFO_SM
Definition: comctl32.h:106
HMODULE COMCTL32_hModule
Definition: commctrl.c:79
static LRESULT CALLBACK TOOLTIPS_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: tooltips.c:2175
#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:3175
HBRUSH hbrBackground
Definition: winuser.h:3173
int cbClsExtra
Definition: winuser.h:3168
UINT style
Definition: winuser.h:3166
WNDPROC lpfnWndProc
Definition: winuser.h:3167
int cbWndExtra
Definition: winuser.h:3169
HCURSOR hCursor
Definition: winuser.h:3172
#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:2172
#define IDC_ARROW
Definition: winuser.h:682
#define CS_DBLCLKS
Definition: winuser.h:646
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define CS_GLOBALCLASS
Definition: winuser.h:647
#define CS_SAVEBITS
Definition: winuser.h:652
#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 1463 of file tooltips.c.

1464{
1465 POINT pt;
1466 INT nOldTool;
1467
1468 if (!lpMsg) {
1469 ERR("lpMsg == NULL\n");
1470 return 0;
1471 }
1472
1473 switch (lpMsg->message) {
1474 case WM_LBUTTONDOWN:
1475 case WM_LBUTTONUP:
1476 case WM_MBUTTONDOWN:
1477 case WM_MBUTTONUP:
1478 case WM_RBUTTONDOWN:
1479 case WM_RBUTTONUP:
1480 TOOLTIPS_Hide (infoPtr);
1481 break;
1482
1483 case WM_MOUSEMOVE:
1484 pt.x = (short)LOWORD(lpMsg->lParam);
1485 pt.y = (short)HIWORD(lpMsg->lParam);
1486 nOldTool = infoPtr->nTool;
1487 infoPtr->nTool = TOOLTIPS_GetToolFromPoint(infoPtr, lpMsg->hwnd,
1488 &pt);
1489 TRACE("tool (%p) %d %d %d\n", infoPtr->hwndSelf, nOldTool,
1490 infoPtr->nTool, infoPtr->nCurrentTool);
1491 TRACE("WM_MOUSEMOVE (%p %s)\n", infoPtr->hwndSelf, wine_dbgstr_point(&pt));
1492
1493 if (infoPtr->nTool != nOldTool) {
1494 if(infoPtr->nTool == -1) { /* Moved out of all tools */
1495 TOOLTIPS_Hide(infoPtr);
1496 KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
1497 } else if (nOldTool == -1) { /* Moved from outside */
1498 if(infoPtr->bActive) {
1499 SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
1500 TRACE("timer 1 started\n");
1501 }
1502 } else { /* Moved from one to another */
1503 TOOLTIPS_Hide (infoPtr);
1504 KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
1505 if(infoPtr->bActive) {
1506 SetTimer (infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nReshowTime, 0);
1507 TRACE("timer 1 started\n");
1508 }
1509 }
1510 } else if(infoPtr->nCurrentTool != -1) { /* restart autopop */
1511 KillTimer(infoPtr->hwndSelf, ID_TIMERPOP);
1512 SetTimer(infoPtr->hwndSelf, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
1513 TRACE("timer 2 restarted\n");
1514 } else if(infoPtr->nTool != -1 && infoPtr->bActive) {
1515 /* previous show attempt didn't result in tooltip so try again */
1516 SetTimer(infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nInitialTime, 0);
1517 TRACE("timer 1 started\n");
1518 }
1519 break;
1520 }
1521
1522 return 0;
1523}
#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
static __inline const char * wine_dbgstr_point(const POINT *pt)
Definition: debug.h:207
UINT message
Definition: winuser.h:3105
HWND hwnd
Definition: winuser.h:3104
LPARAM lParam
Definition: winuser.h:3107
#define HIWORD(l)
Definition: typedefs.h:247
#define WM_RBUTTONUP
Definition: winuser.h:1770
#define WM_MOUSEMOVE
Definition: winuser.h:1765
#define WM_LBUTTONDOWN
Definition: winuser.h:1766
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_RBUTTONDOWN
Definition: winuser.h:1769
#define WM_LBUTTONUP
Definition: winuser.h:1767
#define WM_MBUTTONUP
Definition: winuser.h:1773
#define WM_MBUTTONDOWN
Definition: winuser.h:1772

Referenced by TOOLTIPS_SubclassProc(), and TOOLTIPS_WindowProc().

◆ TOOLTIPS_ResetSubclass()

static void TOOLTIPS_ResetSubclass ( const TTTOOL_INFO toolPtr)
static

Definition at line 1144 of file tooltips.c.

1145{
1146 /* Reset subclassing data. */
1147 if (toolPtr->uInternalFlags & TTF_SUBCLASS)
1148 SetWindowSubclass(toolPtr->uInternalFlags & TTF_IDISHWND ? (HWND)toolPtr->uId : toolPtr->hwnd,
1149 TOOLTIPS_SubclassProc, 1, 0);
1150}

Referenced by TOOLTIPS_DelToolT(), and TOOLTIPS_Destroy().

◆ TOOLTIPS_SetDelayTime()

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

Definition at line 1527 of file tooltips.c.

1528{
1529 switch (duration) {
1530 case TTDT_AUTOMATIC:
1531 if (nTime <= 0)
1532 nTime = GetDoubleClickTime();
1533 infoPtr->nReshowTime = nTime / 5;
1534 infoPtr->nAutoPopTime = nTime * 10;
1535 infoPtr->nInitialTime = nTime;
1536 break;
1537
1538 case TTDT_RESHOW:
1539 if(nTime < 0)
1540 nTime = GetDoubleClickTime() / 5;
1541 infoPtr->nReshowTime = nTime;
1542 break;
1543
1544 case TTDT_AUTOPOP:
1545 if(nTime < 0)
1546 nTime = GetDoubleClickTime() * 10;
1547 infoPtr->nAutoPopTime = nTime;
1548 break;
1549
1550 case TTDT_INITIAL:
1551 if(nTime < 0)
1552 nTime = GetDoubleClickTime();
1553 infoPtr->nInitialTime = nTime;
1554 break;
1555
1556 default:
1557 WARN("Invalid duration flag %x\n", duration);
1558 break;
1559 }
1560
1561 return 0;
1562}
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 2022 of file tooltips.c.

2023{
2024 LOGFONTW lf;
2025
2026 if(!GetObjectW(hFont, sizeof(lf), &lf))
2027 return 0;
2028
2029 DeleteObject (infoPtr->hFont);
2030 infoPtr->hFont = CreateFontIndirectW(&lf);
2031
2032 DeleteObject (infoPtr->hTitleFont);
2033 lf.lfWeight = FW_BOLD;
2034 infoPtr->hTitleFont = CreateFontIndirectW(&lf);
2035
2036 if (redraw && infoPtr->nCurrentTool != -1)
2037 FIXME("full redraw needed\n");
2038
2039 return 0;
2040}
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 1566 of file tooltips.c.

1567{
1568 if (rect)
1569 infoPtr->rcMargin = *rect;
1570
1571 return 0;
1572}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetMaxTipWidth()

static LRESULT TOOLTIPS_SetMaxTipWidth ( TOOLTIPS_INFO infoPtr,
INT  MaxWidth 
)
inlinestatic

Definition at line 1576 of file tooltips.c.

1577{
1578 INT nTemp = infoPtr->nMaxTipWidth;
1579
1580 infoPtr->nMaxTipWidth = MaxWidth;
1581
1582 return nTemp;
1583}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetTipBkColor()

static LRESULT TOOLTIPS_SetTipBkColor ( TOOLTIPS_INFO infoPtr,
COLORREF  clrBk 
)
inlinestatic

Definition at line 1587 of file tooltips.c.

1588{
1589 infoPtr->clrBk = clrBk;
1590
1591 return 0;
1592}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetTipTextColor()

static LRESULT TOOLTIPS_SetTipTextColor ( TOOLTIPS_INFO infoPtr,
COLORREF  clrText 
)
inlinestatic

Definition at line 1596 of file tooltips.c.

1597{
1598 infoPtr->clrText = clrText;
1599
1600 return 0;
1601}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetTitleT()

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

Definition at line 1605 of file tooltips.c.

1607{
1608 UINT size;
1609
1610 TRACE("hwnd = %p, title = %s, icon = %p\n", infoPtr->hwndSelf, debugstr_w(pszTitle),
1611 (void*)uTitleIcon);
1612
1613 Free(infoPtr->pszTitle);
1614
1615 if (pszTitle)
1616 {
1617 if (isW)
1618 {
1619 size = (strlenW(pszTitle)+1)*sizeof(WCHAR);
1620 infoPtr->pszTitle = Alloc(size);
1621 if (!infoPtr->pszTitle)
1622 return FALSE;
1623 memcpy(infoPtr->pszTitle, pszTitle, size);
1624 }
1625 else
1626 {
1627 size = sizeof(WCHAR)*MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszTitle, -1, NULL, 0);
1628 infoPtr->pszTitle = Alloc(size);
1629 if (!infoPtr->pszTitle)
1630 return FALSE;
1631 MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pszTitle, -1, infoPtr->pszTitle, size/sizeof(WCHAR));
1632 }
1633 }
1634 else
1635 infoPtr->pszTitle = NULL;
1636
1637 if (uTitleIcon <= TTI_ERROR)
1638 infoPtr->hTitleIcon = hTooltipIcons[uTitleIcon];
1639 else
1640 infoPtr->hTitleIcon = CopyIcon((HICON)uTitleIcon);
1641
1642 TRACE("icon = %p\n", infoPtr->hTitleIcon);
1643
1644 return TRUE;
1645}
static HICON
Definition: imagelist.c:84
HICON WINAPI CopyIcon(_In_ HICON)
Definition: cursoricon.c:1980

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_SetToolInfoT()

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

Definition at line 1649 of file tooltips.c.

1650{
1651 TTTOOL_INFO *toolPtr;
1652 INT nTool;
1653
1654 if (!ti) return 0;
1655 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1656 return 0;
1657
1658 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1659 if (nTool == -1) return 0;
1660
1661 TRACE("tool %d\n", nTool);
1662
1663 toolPtr = &infoPtr->tools[nTool];
1664
1665 /* copy tool data */
1666 toolPtr->uFlags = ti->uFlags;
1667 toolPtr->hwnd = ti->hwnd;
1668 toolPtr->uId = ti->uId;
1669 toolPtr->rect = ti->rect;
1670 toolPtr->hinst = ti->hinst;
1671
1672 if (IS_INTRESOURCE(ti->lpszText)) {
1673 TRACE("set string id %x\n", LOWORD(ti->lpszText));
1674 toolPtr->lpszText = ti->lpszText;
1675 }
1676 else {
1678 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
1679 else {
1680 if ( (toolPtr->lpszText) &&
1681 !IS_INTRESOURCE(toolPtr->lpszText) ) {
1682 if( toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
1683 Free (toolPtr->lpszText);
1684 toolPtr->lpszText = NULL;
1685 }
1686 if (ti->lpszText) {
1687 if (isW) {
1688 INT len = lstrlenW (ti->lpszText);
1689 toolPtr->lpszText = Alloc ((len+1)*sizeof(WCHAR));
1690 strcpyW (toolPtr->lpszText, ti->lpszText);
1691 }
1692 else {
1694 -1, NULL, 0);
1695 toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
1697 toolPtr->lpszText, len);
1698 }
1699 }
1700 }
1701 }
1702
1703 if (ti->cbSize >= TTTOOLINFOW_V2_SIZE)
1704 toolPtr->lParam = ti->lParam;
1705
1706 if (infoPtr->nCurrentTool == nTool)
1707 {
1708 TOOLTIPS_GetTipText (infoPtr, infoPtr->nCurrentTool, infoPtr->szTipText);
1709
1710 if (infoPtr->szTipText[0] == 0)
1711 TOOLTIPS_Hide(infoPtr);
1712 else
1713 TOOLTIPS_Show (infoPtr, FALSE);
1714 }
1715
1716 return 0;
1717}
static void TOOLTIPS_Show(TOOLTIPS_INFO *infoPtr, BOOL track_activate)
Definition: tooltips.c:581

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_Show()

static void TOOLTIPS_Show ( TOOLTIPS_INFO infoPtr,
BOOL  track_activate 
)
static

Definition at line 581 of file tooltips.c.

582{
583 TTTOOL_INFO *toolPtr;
584 HMONITOR monitor;
585 MONITORINFO mon_info;
586 RECT rect;
587 SIZE size;
588 NMHDR hdr;
589 int ptfx = 0;
591 INT nTool, current;
592
593 if (track_activate)
594 {
595 if (infoPtr->nTrackTool == -1)
596 {
597 TRACE("invalid tracking tool %d\n", infoPtr->nTrackTool);
598 return;
599 }
600 nTool = infoPtr->nTrackTool;
601 }
602 else
603 {
604 if (infoPtr->nTool == -1)
605 {
606 TRACE("invalid tool %d\n", infoPtr->nTool);
607 return;
608 }
609 nTool = infoPtr->nTool;
610 }
611
612 TRACE("Show tooltip pre %d, %p\n", nTool, infoPtr->hwndSelf);
613
614 current = infoPtr->nCurrentTool;
615 if (!track_activate)
616 infoPtr->nCurrentTool = infoPtr->nTool;
617
618 TOOLTIPS_GetTipText (infoPtr, nTool, infoPtr->szTipText);
619
620 if (infoPtr->szTipText[0] == '\0')
621 {
622 infoPtr->nCurrentTool = current;
623 return;
624 }
625
626 toolPtr = &infoPtr->tools[nTool];
627 TOOLTIPS_CalcTipSize (infoPtr, &size);
628
629 TRACE("Show tooltip %d, %s, size %d x %d\n", nTool, debugstr_w(infoPtr->szTipText),
630 size.cx, size.cy);
631
632 if (track_activate && (toolPtr->uFlags & TTF_TRACK))
633 {
634 rect.left = infoPtr->xTrackPos;
635 rect.top = infoPtr->yTrackPos;
636 ptfx = rect.left;
637
638 if (toolPtr->uFlags & TTF_CENTERTIP)
639 {
640 rect.left -= (size.cx / 2);
641 if (!(style & TTS_BALLOON))
642 rect.top -= (size.cy / 2);
643 }
644 if (!(infoPtr->bToolBelow = (infoPtr->yTrackPos + size.cy <= GetSystemMetrics(SM_CYSCREEN))))
645 rect.top -= size.cy;
646
647 if (!(toolPtr->uFlags & TTF_ABSOLUTE))
648 {
649 if (style & TTS_BALLOON)
650 rect.left -= BALLOON_STEMINDENT;
651 else
652 {
653 RECT rcTool;
654
655 if (toolPtr->uFlags & TTF_IDISHWND)
656 GetWindowRect ((HWND)toolPtr->uId, &rcTool);
657 else
658 {
659 rcTool = toolPtr->rect;
660 MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rcTool, 2);
661 }
662
663 /* smart placement */
664 if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right) &&
665 (rect.top + size.cy > rcTool.top) && (rect.top < rcTool.bottom))
666 rect.left = rcTool.right;
667 }
668 }
669 }
670 else
671 {
672 if (toolPtr->uFlags & TTF_CENTERTIP)
673 {
674 RECT rc;
675
676 if (toolPtr->uFlags & TTF_IDISHWND)
677 GetWindowRect ((HWND)toolPtr->uId, &rc);
678 else {
679 rc = toolPtr->rect;
680 MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
681 }
682 rect.left = (rc.left + rc.right - size.cx) / 2;
683 if (style & TTS_BALLOON)
684 {
685 ptfx = rc.left + ((rc.right - rc.left) / 2);
686
687 /* CENTERTIP ballon tooltips default to below the field
688 * if they fit on the screen */
690 {
691 rect.top = rc.top - size.cy;
692 infoPtr->bToolBelow = FALSE;
693 }
694 else
695 {
696 infoPtr->bToolBelow = TRUE;
697 rect.top = rc.bottom;
698 }
699 rect.left = max(0, rect.left - BALLOON_STEMINDENT);
700 }
701 else
702 {
703 rect.top = rc.bottom + 2;
704 infoPtr->bToolBelow = TRUE;
705 }
706 }
707 else
708 {
710 if (style & TTS_BALLOON)
711 {
712 ptfx = rect.left;
713 if(rect.top - size.cy >= 0)
714 {
715 rect.top -= size.cy;
716 infoPtr->bToolBelow = FALSE;
717 }
718 else
719 {
720 infoPtr->bToolBelow = TRUE;
721 rect.top += 20;
722 }
723 rect.left = max(0, rect.left - BALLOON_STEMINDENT);
724 }
725 else
726 {
727 rect.top += 20;
728 infoPtr->bToolBelow = TRUE;
729 }
730 }
731 }
732
733 TRACE("pos %d - %d\n", rect.left, rect.top);
734
735 rect.right = rect.left + size.cx;
736 rect.bottom = rect.top + size.cy;
737
738 /* check position */
739
740 monitor = MonitorFromRect( &rect, MONITOR_DEFAULTTOPRIMARY );
741 mon_info.cbSize = sizeof(mon_info);
742 GetMonitorInfoW( monitor, &mon_info );
743
744 if( rect.right > mon_info.rcWork.right ) {
745 rect.left -= rect.right - mon_info.rcWork.right + 2;
746 rect.right = mon_info.rcWork.right - 2;
747 }
748 if (rect.left < mon_info.rcWork.left) rect.left = mon_info.rcWork.left;
749
750 if( rect.bottom > mon_info.rcWork.bottom ) {
751 RECT rc;
752
753 if (toolPtr->uFlags & TTF_IDISHWND)
754 GetWindowRect ((HWND)toolPtr->uId, &rc);
755 else {
756 rc = toolPtr->rect;
757 MapWindowPoints (toolPtr->hwnd, NULL, (LPPOINT)&rc, 2);
758 }
759 rect.bottom = rc.top - 2;
760 rect.top = rect.bottom - size.cy;
761 }
762
765
766 if (style & TTS_BALLOON)
767 {
768 HRGN hRgn;
769 HRGN hrStem;
770 POINT pts[3];
771
772 ptfx -= rect.left;
773
774 if(infoPtr->bToolBelow)
775 {
776 pts[0].x = ptfx;
777 pts[0].y = 0;
778 pts[1].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
779 pts[1].y = BALLOON_STEMHEIGHT;
780 pts[2].x = pts[1].x + BALLOON_STEMWIDTH;
781 pts[2].y = pts[1].y;
782 if(pts[2].x > (rect.right - rect.left) - BALLOON_STEMINDENT)
783 {
784 pts[2].x = (rect.right - rect.left) - BALLOON_STEMINDENT;
785 pts[1].x = pts[2].x - BALLOON_STEMWIDTH;
786 }
787 }
788 else
789 {
790 pts[0].x = max(BALLOON_STEMINDENT, ptfx - (BALLOON_STEMWIDTH / 2));
791 pts[0].y = (rect.bottom - rect.top) - BALLOON_STEMHEIGHT;
792 pts[1].x = pts[0].x + BALLOON_STEMWIDTH;
793 pts[1].y = pts[0].y;
794 pts[2].x = ptfx;
795 pts[2].y = (rect.bottom - rect.top);
796 if(pts[1].x > (rect.right - rect.left) - BALLOON_STEMINDENT)
797 {
798 pts[1].x = (rect.right - rect.left) - BALLOON_STEMINDENT;
799 pts[0].x = pts[1].x - BALLOON_STEMWIDTH;
800 }
801 }
802
803 hrStem = CreatePolygonRgn(pts, ARRAY_SIZE(pts), ALTERNATE);
804
806 (infoPtr->bToolBelow ? BALLOON_STEMHEIGHT : 0),
807 rect.right - rect.left,
808 (infoPtr->bToolBelow ? rect.bottom - rect.top : rect.bottom - rect.top - BALLOON_STEMHEIGHT),
810
811 CombineRgn(hRgn, hRgn, hrStem, RGN_OR);
812 DeleteObject(hrStem);
813
814 SetWindowRgn(infoPtr->hwndSelf, hRgn, FALSE);
815 /* we don't free the region handle as the system deletes it when
816 * it is no longer needed */
817 }
818
819 SetWindowPos (infoPtr->hwndSelf, NULL, rect.left, rect.top,
820 rect.right - rect.left, rect.bottom - rect.top, SWP_NOZORDER | SWP_NOACTIVATE);
821
822 hdr.hwndFrom = infoPtr->hwndSelf;
823 hdr.idFrom = toolPtr->uId;
824 hdr.code = TTN_SHOW;
825 SendMessageW (toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&hdr);
826
827 SetWindowPos (infoPtr->hwndSelf, HWND_TOPMOST, 0, 0, 0, 0,
829
830 /* repaint the tooltip */
831 InvalidateRect(infoPtr->hwndSelf, NULL, TRUE);
832 UpdateWindow(infoPtr->hwndSelf);
833
834 if (!track_activate)
835 {
836 SetTimer (infoPtr->hwndSelf, ID_TIMERPOP, infoPtr->nAutoPopTime, 0);
837 TRACE("timer 2 started\n");
838 SetTimer (infoPtr->hwndSelf, ID_TIMERLEAVE, infoPtr->nReshowTime, 0);
839 TRACE("timer 3 started\n");
840 }
841}
#define ALTERNATE
Definition: constants.h:278
#define ARRAY_SIZE(A)
Definition: main.h:33
#define BALLOON_STEMWIDTH
Definition: tooltips.c:167
#define BALLOON_STEMINDENT
Definition: tooltips.c:168
#define BALLOON_ROUNDEDNESS
Definition: tooltips.c:165
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:1874
#define TTF_CENTERTIP
Definition: commctrl.h:1765
#define TTF_ABSOLUTE
Definition: commctrl.h:1769
#define TTF_TRACK
Definition: commctrl.h:1768
DWORD cbSize
Definition: winuser.h:3774
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
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:954
#define HWND_TOPMOST
Definition: winuser.h:1198
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
int WINAPI SetWindowRgn(_In_ HWND, _In_opt_ HRGN, _In_ BOOL)
#define SWP_NOMOVE
Definition: winuser.h:1234
BOOL WINAPI AdjustWindowRectEx(_Inout_ LPRECT, _In_ DWORD, _In_ BOOL, _In_ DWORD)
#define SWP_NOSIZE
Definition: winuser.h:1235
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:1238
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 2140 of file tooltips.c.

2141{
2142 TOOLTIPS_INFO *infoPtr = TOOLTIPS_GetInfoPtr ((HWND)dwRef);
2143 MSG msg;
2144
2145 switch (message)
2146 {
2147 case WM_MOUSEMOVE:
2148 case WM_LBUTTONDOWN:
2149 case WM_LBUTTONUP:
2150 case WM_MBUTTONDOWN:
2151 case WM_MBUTTONUP:
2152 case WM_RBUTTONDOWN:
2153 case WM_RBUTTONUP:
2154 if (infoPtr)
2155 {
2156 msg.hwnd = hwnd;
2157 msg.message = message;
2158 msg.wParam = wParam;
2159 msg.lParam = lParam;
2160 TOOLTIPS_RelayEvent(infoPtr, &msg);
2161 }
2162 break;
2163 case WM_NCDESTROY:
2165 break;
2166 default:
2167 break;
2168 }
2169
2171}
#define msg(x)
Definition: auth_time.c:54
BOOL WINAPI RemoveWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, UINT_PTR uID)
Definition: commctrl.c:1390
LRESULT WINAPI DefSubclassProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: commctrl.c:1496
#define TOOLTIPS_GetInfoPtr(hWindow)
Definition: tooltips.c:158
static LRESULT TOOLTIPS_RelayEvent(TOOLTIPS_INFO *infoPtr, LPMSG lpMsg)
Definition: tooltips.c:1463
Definition: tftpd.h:60
TW_UINT32 TW_UINT16 TW_UINT16 MSG
Definition: twain.h:1829
#define WM_NCDESTROY
Definition: winuser.h:1674

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

◆ TOOLTIPS_Timer()

static LRESULT TOOLTIPS_Timer ( TOOLTIPS_INFO infoPtr,
INT  iTimer 
)
static

Definition at line 2082 of file tooltips.c.

2083{
2084 INT nOldTool;
2085
2086 TRACE("timer %d (%p) expired\n", iTimer, infoPtr->hwndSelf);
2087
2088 switch (iTimer) {
2089 case ID_TIMERSHOW:
2090 KillTimer (infoPtr->hwndSelf, ID_TIMERSHOW);
2091 nOldTool = infoPtr->nTool;
2092 if ((infoPtr->nTool = TOOLTIPS_CheckTool (infoPtr, TRUE)) == nOldTool)
2093 TOOLTIPS_Show (infoPtr, FALSE);
2094 break;
2095
2096 case ID_TIMERPOP:
2097 TOOLTIPS_Hide (infoPtr);
2098 break;
2099
2100 case ID_TIMERLEAVE:
2101 nOldTool = infoPtr->nTool;
2102 infoPtr->nTool = TOOLTIPS_CheckTool (infoPtr, FALSE);
2103 TRACE("tool (%p) %d %d %d\n", infoPtr->hwndSelf, nOldTool,
2104 infoPtr->nTool, infoPtr->nCurrentTool);
2105 if (infoPtr->nTool != nOldTool) {
2106 if(infoPtr->nTool == -1) { /* Moved out of all tools */
2107 TOOLTIPS_Hide(infoPtr);
2108 KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
2109 } else if (nOldTool == -1) { /* Moved from outside */
2110 ERR("How did this happen?\n");
2111 } else { /* Moved from one to another */
2112 TOOLTIPS_Hide (infoPtr);
2113 KillTimer(infoPtr->hwndSelf, ID_TIMERLEAVE);
2114 if(infoPtr->bActive) {
2115 SetTimer (infoPtr->hwndSelf, ID_TIMERSHOW, infoPtr->nReshowTime, 0);
2116 TRACE("timer 1 started!\n");
2117 }
2118 }
2119 }
2120 break;
2121
2122 default:
2123 ERR("Unknown timer id %d\n", iTimer);
2124 break;
2125 }
2126 return 0;
2127}
static INT TOOLTIPS_CheckTool(const TOOLTIPS_INFO *infoPtr, BOOL bShowTest)
Definition: tooltips.c:1001

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_TrackActivate()

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

Definition at line 1721 of file tooltips.c.

1722{
1723 if (track_activate) {
1724
1725 if (!ti) return 0;
1726 if (ti->cbSize < TTTOOLINFOA_V1_SIZE)
1727 return FALSE;
1728
1729 /* activate */
1730 infoPtr->nTrackTool = TOOLTIPS_GetToolFromInfoT (infoPtr, (const TTTOOLINFOW*)ti);
1731 if (infoPtr->nTrackTool != -1) {
1732 TRACE("activated\n");
1733 infoPtr->bTrackActive = TRUE;
1734 TOOLTIPS_TrackShow (infoPtr);
1735 }
1736 }
1737 else {
1738 /* deactivate */
1739 TOOLTIPS_TrackHide (infoPtr);
1740
1741 infoPtr->bTrackActive = FALSE;
1742 infoPtr->nTrackTool = -1;
1743
1744 TRACE("deactivated\n");
1745 }
1746
1747 return 0;
1748}
static void TOOLTIPS_TrackHide(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:878
static void TOOLTIPS_TrackShow(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:871
#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 878 of file tooltips.c.

879{
880 TTTOOL_INFO *toolPtr;
881 NMHDR hdr;
882
883 TRACE("hide tracking tooltip %d\n", infoPtr->nTrackTool);
884
885 if (infoPtr->nTrackTool == -1)
886 return;
887
888 toolPtr = &infoPtr->tools[infoPtr->nTrackTool];
889
890 hdr.hwndFrom = infoPtr->hwndSelf;
891 hdr.idFrom = toolPtr->uId;
892 hdr.code = TTN_POP;
893 SendMessageW (toolPtr->hwnd, WM_NOTIFY, toolPtr->uId, (LPARAM)&hdr);
894
895 SetWindowPos (infoPtr->hwndSelf, HWND_TOP, 0, 0, 0, 0,
897}

Referenced by TOOLTIPS_TrackActivate().

◆ TOOLTIPS_TrackPosition()

static LRESULT TOOLTIPS_TrackPosition ( TOOLTIPS_INFO infoPtr,
LPARAM  coord 
)
static

Definition at line 1752 of file tooltips.c.

1753{
1754 infoPtr->xTrackPos = (INT)LOWORD(coord);
1755 infoPtr->yTrackPos = (INT)HIWORD(coord);
1756
1757 if (infoPtr->bTrackActive) {
1758 TRACE("[%d %d]\n",
1759 infoPtr->xTrackPos, infoPtr->yTrackPos);
1760
1761 TOOLTIPS_TrackShow (infoPtr);
1762 }
1763
1764 return 0;
1765}
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 871 of file tooltips.c.

872{
873 TOOLTIPS_Show(infoPtr, TRUE);
874}

Referenced by TOOLTIPS_TrackActivate(), and TOOLTIPS_TrackPosition().

◆ TOOLTIPS_Unregister()

VOID TOOLTIPS_Unregister ( void  )

Definition at line 2381 of file tooltips.c.

2382{
2383 int i;
2384 for (i = TTI_INFO; i <= TTI_ERROR; i++)
2387}
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2022

Referenced by DllMain().

◆ TOOLTIPS_Update()

static LRESULT TOOLTIPS_Update ( TOOLTIPS_INFO infoPtr)
static

Definition at line 1769 of file tooltips.c.

1770{
1771 if (infoPtr->nCurrentTool != -1)
1772 UpdateWindow (infoPtr->hwndSelf);
1773
1774 return 0;
1775}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_UpdateTipTextT()

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

Definition at line 1779 of file tooltips.c.

1780{
1781 TTTOOL_INFO *toolPtr;
1782 INT nTool;
1783
1784 if (!ti) return 0;
1785 if (ti->cbSize < TTTOOLINFOW_V1_SIZE)
1786 return FALSE;
1787
1788 nTool = TOOLTIPS_GetToolFromInfoT (infoPtr, ti);
1789 if (nTool == -1)
1790 return 0;
1791
1792 TRACE("tool %d\n", nTool);
1793
1794 toolPtr = &infoPtr->tools[nTool];
1795
1796 /* copy tool text */
1797 toolPtr->hinst = ti->hinst;
1798
1799 if (IS_INTRESOURCE(ti->lpszText)){
1800 toolPtr->lpszText = ti->lpszText;
1801 }
1802 else if (ti->lpszText) {
1804 toolPtr->lpszText = LPSTR_TEXTCALLBACKW;
1805 else {
1806 if ( (toolPtr->lpszText) &&
1807 !IS_INTRESOURCE(toolPtr->lpszText) ) {
1808 if( toolPtr->lpszText != LPSTR_TEXTCALLBACKW)
1809 Free (toolPtr->lpszText);
1810 toolPtr->lpszText = NULL;
1811 }
1812 if (ti->lpszText) {
1813 if (isW) {
1814 INT len = lstrlenW (ti->lpszText);
1815 toolPtr->lpszText = Alloc ((len+1)*sizeof(WCHAR));
1816 strcpyW (toolPtr->lpszText, ti->lpszText);
1817 }
1818 else {
1820 -1, NULL, 0);
1821 toolPtr->lpszText = Alloc (len * sizeof(WCHAR));
1823 toolPtr->lpszText, len);
1824 }
1825 }
1826 }
1827 }
1828
1829 if(infoPtr->nCurrentTool == -1) return 0;
1830 /* force repaint */
1831 if (infoPtr->bActive)
1832 TOOLTIPS_Show (infoPtr, FALSE);
1833 else if (infoPtr->bTrackActive)
1834 TOOLTIPS_Show (infoPtr, TRUE);
1835
1836 return 0;
1837}

Referenced by TOOLTIPS_WindowProc().

◆ TOOLTIPS_WindowProc()

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

Definition at line 2175 of file tooltips.c.

2176{
2178
2179 TRACE("hwnd=%p msg=%x wparam=%lx lParam=%lx\n", hwnd, uMsg, wParam, lParam);
2180 if (!infoPtr && (uMsg != WM_CREATE) && (uMsg != WM_NCCREATE))
2181 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2182 switch (uMsg)
2183 {
2184 case TTM_ACTIVATE:
2185 return TOOLTIPS_Activate (infoPtr, (BOOL)wParam);
2186
2187 case TTM_ADDTOOLA:
2188 case TTM_ADDTOOLW:
2189 return TOOLTIPS_AddToolT (infoPtr, (LPTTTOOLINFOW)lParam, uMsg == TTM_ADDTOOLW);
2190
2191 case TTM_DELTOOLA:
2192 case TTM_DELTOOLW:
2193 return TOOLTIPS_DelToolT (infoPtr, (LPTOOLINFOW)lParam,
2194 uMsg == TTM_DELTOOLW);
2195 case TTM_ENUMTOOLSA:
2196 case TTM_ENUMTOOLSW:
2198 uMsg == TTM_ENUMTOOLSW);
2199 case TTM_GETBUBBLESIZE:
2200 return TOOLTIPS_GetBubbleSize (infoPtr, (LPTTTOOLINFOW)lParam);
2201
2205 uMsg == TTM_GETCURRENTTOOLW);
2206
2207 case TTM_GETDELAYTIME:
2208 return TOOLTIPS_GetDelayTime (infoPtr, (DWORD)wParam);
2209
2210 case TTM_GETMARGIN:
2211 return TOOLTIPS_GetMargin (infoPtr, (LPRECT)lParam);
2212
2213 case TTM_GETMAXTIPWIDTH:
2214 return TOOLTIPS_GetMaxTipWidth (infoPtr);
2215
2216 case TTM_GETTEXTA:
2217 case TTM_GETTEXTW:
2218 return TOOLTIPS_GetTextT (infoPtr, (LPTTTOOLINFOW)lParam,
2219 uMsg == TTM_GETTEXTW);
2220
2221 case TTM_GETTIPBKCOLOR:
2222 return TOOLTIPS_GetTipBkColor (infoPtr);
2223
2225 return TOOLTIPS_GetTipTextColor (infoPtr);
2226
2227 case TTM_GETTOOLCOUNT:
2228 return TOOLTIPS_GetToolCount (infoPtr);
2229
2230 case TTM_GETTOOLINFOA:
2231 case TTM_GETTOOLINFOW:
2232 return TOOLTIPS_GetToolInfoT (infoPtr, (LPTTTOOLINFOW)lParam,
2233 uMsg == TTM_GETTOOLINFOW);
2234
2235 case TTM_HITTESTA:
2236 case TTM_HITTESTW:
2237 return TOOLTIPS_HitTestT (infoPtr, (LPTTHITTESTINFOW)lParam,
2238 uMsg == TTM_HITTESTW);
2239 case TTM_NEWTOOLRECTA:
2240 case TTM_NEWTOOLRECTW:
2241 return TOOLTIPS_NewToolRectT (infoPtr, (LPTTTOOLINFOW)lParam);
2242
2243 case TTM_POP:
2244 return TOOLTIPS_Pop (infoPtr);
2245
2246 case TTM_RELAYEVENT:
2247 return TOOLTIPS_RelayEvent (infoPtr, (LPMSG)lParam);
2248
2249 case TTM_SETDELAYTIME:
2250 return TOOLTIPS_SetDelayTime (infoPtr, (DWORD)wParam, (INT)LOWORD(lParam));
2251
2252 case TTM_SETMARGIN:
2253 return TOOLTIPS_SetMargin (infoPtr, (LPRECT)lParam);
2254
2255 case TTM_SETMAXTIPWIDTH:
2256 return TOOLTIPS_SetMaxTipWidth (infoPtr, (INT)lParam);
2257
2258 case TTM_SETTIPBKCOLOR:
2259 return TOOLTIPS_SetTipBkColor (infoPtr, (COLORREF)wParam);
2260
2262 return TOOLTIPS_SetTipTextColor (infoPtr, (COLORREF)wParam);
2263
2264 case TTM_SETTITLEA:
2265 case TTM_SETTITLEW:
2266 return TOOLTIPS_SetTitleT (infoPtr, (UINT_PTR)wParam, (LPCWSTR)lParam,
2267 uMsg == TTM_SETTITLEW);
2268
2269 case TTM_SETTOOLINFOA:
2270 case TTM_SETTOOLINFOW:
2271 return TOOLTIPS_SetToolInfoT (infoPtr, (LPTTTOOLINFOW)lParam,
2272 uMsg == TTM_SETTOOLINFOW);
2273
2274 case TTM_TRACKACTIVATE:
2276
2277 case TTM_TRACKPOSITION:
2278 return TOOLTIPS_TrackPosition (infoPtr, lParam);
2279
2280 case TTM_UPDATE:
2281 return TOOLTIPS_Update (infoPtr);
2282
2283 case TTM_UPDATETIPTEXTA:
2284 case TTM_UPDATETIPTEXTW:
2286 uMsg == TTM_UPDATETIPTEXTW);
2287
2289 return (LRESULT)WindowFromPoint (*((LPPOINT)lParam));
2290
2291 case WM_CREATE:
2292 return TOOLTIPS_Create (hwnd);
2293
2294 case WM_DESTROY:
2295 return TOOLTIPS_Destroy (infoPtr);
2296
2297 case WM_ERASEBKGND:
2298 /* we draw the background in WM_PAINT */
2299 return 0;
2300
2301 case WM_GETFONT:
2302 return TOOLTIPS_GetFont (infoPtr);
2303
2304 case WM_GETTEXT:
2305 return TOOLTIPS_OnWMGetText (infoPtr, wParam, (LPWSTR)lParam);
2306
2307 case WM_GETTEXTLENGTH:
2308 return TOOLTIPS_GetTextLength (infoPtr);
2309
2310 case WM_LBUTTONDOWN:
2311 case WM_LBUTTONUP:
2312 case WM_MBUTTONDOWN:
2313 case WM_MBUTTONUP:
2314 case WM_RBUTTONDOWN:
2315 case WM_RBUTTONUP:
2316 case WM_MOUSEMOVE:
2317 return TOOLTIPS_MouseMessage (infoPtr);
2318
2319 case WM_NCCREATE:
2320 return TOOLTIPS_NCCreate (hwnd);
2321
2322 case WM_NCHITTEST:
2323 return TOOLTIPS_NCHitTest (infoPtr, wParam, lParam);
2324
2325 case WM_NOTIFYFORMAT:
2326 return TOOLTIPS_NotifyFormat (infoPtr, wParam, lParam);
2327
2328 case WM_PRINTCLIENT:
2329 case WM_PAINT:
2330 return TOOLTIPS_Paint (infoPtr, (HDC)wParam);
2331
2332 case WM_SETFONT:
2333 return TOOLTIPS_SetFont (infoPtr, (HFONT)wParam, LOWORD(lParam));
2334
2335 case WM_SYSCOLORCHANGE:
2337 return 0;
2338
2339 case WM_TIMER:
2340 return TOOLTIPS_Timer (infoPtr, (INT)wParam);
2341
2342 case WM_WININICHANGE:
2343 return TOOLTIPS_WinIniChange (infoPtr);
2344
2345 default:
2346 if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg))
2347 ERR("unknown msg %04x wp=%08lx lp=%08lx\n",
2348 uMsg, wParam, lParam);
2349 return DefWindowProcW (hwnd, uMsg, wParam, lParam);
2350 }
2351}
BOOL COMCTL32_IsReflectedMessage(UINT uMsg) DECLSPEC_HIDDEN
Definition: commctrl.c:1748
VOID COMCTL32_RefreshSysColors(void) DECLSPEC_HIDDEN
Definition: commctrl.c:1586
static LRESULT TOOLTIPS_SetTipBkColor(TOOLTIPS_INFO *infoPtr, COLORREF clrBk)
Definition: tooltips.c:1587
static LRESULT TOOLTIPS_Destroy(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1871
static LRESULT TOOLTIPS_GetCurrentToolT(const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1271
static LRESULT TOOLTIPS_UpdateTipTextT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1779
static LRESULT TOOLTIPS_DelToolT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1153
static LRESULT TOOLTIPS_Update(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1769
static LRESULT TOOLTIPS_GetToolCount(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1377
static LRESULT TOOLTIPS_SetTipTextColor(TOOLTIPS_INFO *infoPtr, COLORREF clrText)
Definition: tooltips.c:1596
static LRESULT TOOLTIPS_AddToolT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1051
static LRESULT TOOLTIPS_WinIniChange(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:2131
static LRESULT TOOLTIPS_Activate(TOOLTIPS_INFO *infoPtr, BOOL activate)
Definition: tooltips.c:1037
static LRESULT TOOLTIPS_GetToolInfoT(const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1384
static LRESULT TOOLTIPS_NotifyFormat(TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: tooltips.c:1970
static LRESULT TOOLTIPS_GetTextT(const TOOLTIPS_INFO *infoPtr, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1326
static LRESULT TOOLTIPS_TrackPosition(TOOLTIPS_INFO *infoPtr, LPARAM coord)
Definition: tooltips.c:1752
static LRESULT TOOLTIPS_GetTipTextColor(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1370
static LRESULT TOOLTIPS_GetTipBkColor(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1363
static LRESULT TOOLTIPS_OnWMGetText(const TOOLTIPS_INFO *infoPtr, WPARAM size, LPWSTR pszText)
Definition: tooltips.c:2068
static LRESULT TOOLTIPS_GetTextLength(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:2051
static LRESULT TOOLTIPS_Pop(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1454
static LRESULT TOOLTIPS_Paint(const TOOLTIPS_INFO *infoPtr, HDC hDC)
Definition: tooltips.c:2008
static LRESULT TOOLTIPS_SetToolInfoT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1649
static LRESULT TOOLTIPS_NewToolRectT(TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *ti)
Definition: tooltips.c:1433
static LRESULT TOOLTIPS_GetFont(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1914
static LRESULT TOOLTIPS_SetFont(TOOLTIPS_INFO *infoPtr, HFONT hFont, BOOL redraw)
Definition: tooltips.c:2022
static LRESULT TOOLTIPS_Timer(TOOLTIPS_INFO *infoPtr, INT iTimer)
Definition: tooltips.c:2082
static LRESULT TOOLTIPS_GetMargin(const TOOLTIPS_INFO *infoPtr, RECT *rect)
Definition: tooltips.c:1309
static LRESULT TOOLTIPS_NCHitTest(const TOOLTIPS_INFO *infoPtr, WPARAM wParam, LPARAM lParam)
Definition: tooltips.c:1952
static LRESULT TOOLTIPS_SetMaxTipWidth(TOOLTIPS_INFO *infoPtr, INT MaxWidth)
Definition: tooltips.c:1576
static LRESULT TOOLTIPS_HitTestT(const TOOLTIPS_INFO *infoPtr, LPTTHITTESTINFOW lptthit, BOOL isW)
Definition: tooltips.c:1410
static LRESULT TOOLTIPS_GetDelayTime(const TOOLTIPS_INFO *infoPtr, DWORD duration)
Definition: tooltips.c:1286
static LRESULT TOOLTIPS_EnumToolsT(const TOOLTIPS_INFO *infoPtr, UINT uIndex, TTTOOLINFOW *ti, BOOL isW)
Definition: tooltips.c:1233
static LRESULT TOOLTIPS_SetMargin(TOOLTIPS_INFO *infoPtr, const RECT *rect)
Definition: tooltips.c:1566
static LRESULT TOOLTIPS_MouseMessage(TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1921
static LRESULT TOOLTIPS_GetBubbleSize(const TOOLTIPS_INFO *infoPtr, const TTTOOLINFOW *lpToolInfo)
Definition: tooltips.c:1249
static LRESULT TOOLTIPS_NCCreate(HWND hwnd)
Definition: tooltips.c:1930
static LRESULT TOOLTIPS_GetMaxTipWidth(const TOOLTIPS_INFO *infoPtr)
Definition: tooltips.c:1319
static LRESULT TOOLTIPS_Create(HWND hwnd)
Definition: tooltips.c:1841
static LRESULT TOOLTIPS_TrackActivate(TOOLTIPS_INFO *infoPtr, BOOL track_activate, const TTTOOLINFOA *ti)
Definition: tooltips.c:1721
static LRESULT TOOLTIPS_SetTitleT(TOOLTIPS_INFO *infoPtr, UINT_PTR uTitleIcon, LPCWSTR pszTitle, BOOL isW)
Definition: tooltips.c:1605
#define WM_APP
Definition: eventvwr.h:73
#define TTM_SETDELAYTIME
Definition: commctrl.h:1785
#define TTM_NEWTOOLRECTA
Definition: commctrl.h:1790
#define TTM_ACTIVATE
Definition: commctrl.h:1784
#define TTM_GETMAXTIPWIDTH
Definition: commctrl.h:1820
#define TTM_SETTOOLINFOA
Definition: commctrl.h:1797
#define TTM_GETCURRENTTOOLW
Definition: commctrl.h:1810
#define TTM_GETTIPTEXTCOLOR
Definition: commctrl.h:1818
#define TTM_RELAYEVENT
Definition: commctrl.h:1792
#define TTM_DELTOOLA
Definition: commctrl.h:1788
#define LPTOOLINFOW
Definition: commctrl.h:1713
#define TTM_DELTOOLW
Definition: commctrl.h:1789
#define TTM_GETMARGIN
Definition: commctrl.h:1822
#define TTM_GETTOOLINFOA
Definition: commctrl.h:1794
#define TTM_GETTEXTW
Definition: commctrl.h:1803
#define TTM_GETDELAYTIME
Definition: commctrl.h:1816
#define TTM_POP
Definition: commctrl.h:1823
#define TTM_ADDTOOLA
Definition: commctrl.h:1786
#define TTM_ENUMTOOLSA
Definition: commctrl.h:1807
#define TTM_NEWTOOLRECTW
Definition: commctrl.h:1791
#define TTM_SETTITLEW
Definition: commctrl.h:1828
#define TTM_ENUMTOOLSW
Definition: commctrl.h:1808
#define TTM_TRACKPOSITION
Definition: commctrl.h:1813
#define TTM_UPDATE
Definition: commctrl.h:1824
#define TTM_GETTOOLCOUNT
Definition: commctrl.h:1806
#define TTM_ADDTOOLW
Definition: commctrl.h:1787
#define TTM_UPDATETIPTEXTA
Definition: commctrl.h:1804
#define TTM_GETCURRENTTOOLA
Definition: commctrl.h:1809
#define TTM_GETTIPBKCOLOR
Definition: commctrl.h:1817
#define TTM_SETMARGIN
Definition: commctrl.h:1821
#define TTM_UPDATETIPTEXTW
Definition: commctrl.h:1805
#define TTM_SETTIPBKCOLOR
Definition: commctrl.h:1814
#define TTM_SETTOOLINFOW
Definition: commctrl.h:1798
#define TTM_SETTITLEA
Definition: commctrl.h:1827
#define TTM_SETTIPTEXTCOLOR
Definition: commctrl.h:1815
#define TTM_HITTESTA
Definition: commctrl.h:1800
#define TTM_TRACKACTIVATE
Definition: commctrl.h:1812
#define TTM_GETTOOLINFOW
Definition: commctrl.h:1795
#define TTM_GETBUBBLESIZE
Definition: commctrl.h:1825
#define TTM_GETTEXTA
Definition: commctrl.h:1802
#define TTM_SETMAXTIPWIDTH
Definition: commctrl.h:1819
#define TTM_HITTESTW
Definition: commctrl.h:1801
#define WM_PRINTCLIENT
Definition: richedit.h:70
DWORD COLORREF
Definition: windef.h:300
#define WM_PAINT
Definition: winuser.h:1610
#define WM_ERASEBKGND
Definition: winuser.h:1615
#define WM_GETTEXTLENGTH
Definition: winuser.h:1609
#define WM_CREATE
Definition: winuser.h:1598
#define WM_WININICHANGE
Definition: winuser.h:1620
#define WM_GETTEXT
Definition: winuser.h:1608
#define WM_SYSCOLORCHANGE
Definition: winuser.h:1616
#define WM_GETFONT
Definition: winuser.h:1641
#define WM_NCCREATE
Definition: winuser.h:1673
#define WM_SETFONT
Definition: winuser.h:1640
#define WM_TIMER
Definition: winuser.h:1732
HWND WINAPI WindowFromPoint(_In_ POINT)
#define WM_USER
Definition: winuser.h:1885
#define WM_DESTROY
Definition: winuser.h:1599

Referenced by TOOLTIPS_Register().

◆ TOOLTIPS_WinIniChange()

static LRESULT TOOLTIPS_WinIniChange ( TOOLTIPS_INFO infoPtr)
static

Definition at line 2131 of file tooltips.c.

2132{
2134
2135 return 0;
2136}

Referenced by TOOLTIPS_WindowProc().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( tooltips  )

Variable Documentation

◆ hTooltipIcons

HICON hTooltipIcons[TTI_ERROR+1]
static