Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
9feb5319
Commit
9feb5319
authored
Oct 24, 1998
by
Eric Kohl
Committed by
Alexandre Julliard
Oct 24, 1998
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for transparent and tracking tooltips.
parent
329072dc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
64 additions
and
69 deletions
+64
-69
tooltips.c
dlls/comctl32/tooltips.c
+64
-69
No files found.
dlls/comctl32/tooltips.c
View file @
9feb5319
...
...
@@ -4,13 +4,8 @@
* Copyright 1998 Eric Kohl
*
* TODO:
* - Tracking tooltips (finished, except smart placement).
* - Transparent tooltips (under construction).
* - TTS_ALWAYSTIP (undefined).
* - Unicode support.
* - Custom draw support.
* - The "lParam" variable from NMTTDISPINFO32A is not handled
* in TOOLTIPS_GetTipText.
*
* Testing:
* - Run tests using Waite Group Windows95 API Bible Volume 2.
...
...
@@ -25,10 +20,9 @@
#include "win.h"
#include "debug.h"
#define ID_TIMER1 1
/* show delay timer */
#define ID_TIMER2 2
/* auto pop timer */
#define ID_TIMER3 3
/* tool leave timer */
#define ID_TIMERSHOW 1
/* show delay timer */
#define ID_TIMERPOP 2
/* auto pop timer */
#define ID_TIMERLEAVE 3
/* tool leave timer */
/* property name of tooltip window handle */
#define TT_SUBCLASS_PROP "CC32SubclassInfo"
...
...
@@ -88,8 +82,9 @@ TOOLTIPS_GetTipText (WND *wndPtr, TOOLTIPS_INFO *infoPtr, INT32 nTool)
ttnmdi
.
hdr
.
hwndFrom
=
wndPtr
->
hwndSelf
;
ttnmdi
.
hdr
.
idFrom
=
toolPtr
->
uId
;
ttnmdi
.
hdr
.
code
=
TTN_GETDISPINFO32A
;
ttnmdi
.
uFlags
=
toolPtr
->
uFlags
;
ttnmdi
.
lpszText
=
infoPtr
->
szTipText
;
ttnmdi
.
uFlags
=
toolPtr
->
uFlags
;
ttnmdi
.
lParam
=
toolPtr
->
lParam
;
TRACE
(
tooltips
,
"hdr.idFrom = %x
\n
"
,
ttnmdi
.
hdr
.
idFrom
);
SendMessage32A
(
toolPtr
->
hwnd
,
WM_NOTIFY
,
...
...
@@ -162,7 +157,6 @@ TOOLTIPS_CalcTipSize (WND *wndPtr, TOOLTIPS_INFO *infoPtr, LPSIZE32 lpSize)
hdc
=
GetDC32
(
wndPtr
->
hwndSelf
);
hOldFont
=
SelectObject32
(
hdc
,
infoPtr
->
hFont
);
DrawText32A
(
hdc
,
infoPtr
->
szTipText
,
-
1
,
&
rc
,
uFlags
);
GetTextExtentPoint32A
(
hdc
,
infoPtr
->
szTipText
,
lstrlen32A
(
infoPtr
->
szTipText
),
lpSize
);
SelectObject32
(
hdc
,
hOldFont
);
ReleaseDC32
(
wndPtr
->
hwndSelf
,
hdc
);
...
...
@@ -228,6 +222,8 @@ TOOLTIPS_Show (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
rect
.
top
+=
20
;
}
/* FIXME: check position */
TRACE
(
tooltips
,
"pos %d - %d
\n
"
,
rect
.
left
,
rect
.
top
);
rect
.
right
=
rect
.
left
+
size
.
cx
;
...
...
@@ -239,7 +235,7 @@ TOOLTIPS_Show (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
,
SWP_SHOWWINDOW
);
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
2
,
infoPtr
->
nAutoPopTime
,
0
);
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
POP
,
infoPtr
->
nAutoPopTime
,
0
);
}
...
...
@@ -254,7 +250,7 @@ TOOLTIPS_Hide (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
toolPtr
=
&
infoPtr
->
tools
[
infoPtr
->
nCurrentTool
];
TRACE
(
tooltips
,
"Hide tooltip %d!
\n
"
,
infoPtr
->
nCurrentTool
);
KillTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
2
);
KillTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
POP
);
hdr
.
hwndFrom
=
wndPtr
->
hwndSelf
;
hdr
.
idFrom
=
toolPtr
->
uId
;
...
...
@@ -315,8 +311,6 @@ TOOLTIPS_TrackShow (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
}
}
else
{
#if 0
/* FIXME: do smart placement */
RECT32
rcTool
;
if
(
toolPtr
->
uFlags
&
TTF_IDISHWND
)
...
...
@@ -325,23 +319,19 @@ TOOLTIPS_TrackShow (WND *wndPtr, TOOLTIPS_INFO *infoPtr)
rcTool
=
toolPtr
->
rect
;
MapWindowPoints32
(
toolPtr
->
hwnd
,
(
HWND32
)
0
,
(
LPPOINT32
)
&
rcTool
,
2
);
}
#endif
GetCursorPos32
((
LPPOINT32
)
&
rect
);
rect
.
top
+=
20
;
#if 0
/* smart placement */
if ((rect.left + size.cx > rcTool.left) && (rect.left < rcTool.right))
rect.left = rcTool.right;
if ((rect.top + size.cy > rcTool.top) &&
(rect.top < rcTool.bottom))
rect.top = rcTool.bottom;
if
(
toolPtr
->
uFlags
&
TTF_CENTERTIP
)
{
rect
.
left
-=
(
size
.
cx
/
2
);
rect
.
top
-=
(
size
.
cy
/
2
);
}
#endif
/* smart placement */
if
((
rect
.
left
+
size
.
cx
>
rcTool
.
left
)
&&
(
rect
.
left
<
rcTool
.
right
)
&&
(
rect
.
top
+
size
.
cy
>
rcTool
.
top
)
&&
(
rect
.
top
<
rcTool
.
bottom
))
rect
.
left
=
rcTool
.
right
;
}
TRACE
(
tooltips
,
"pos %d - %d
\n
"
,
rect
.
left
,
rect
.
top
);
...
...
@@ -453,6 +443,18 @@ TOOLTIPS_GetToolFromMessage (TOOLTIPS_INFO *infoPtr, HWND32 hwndTool)
}
static
BOOL32
TOOLTIPS_IsWindowActive
(
HWND32
hwnd
)
{
HWND32
hwndActive
=
GetActiveWindow32
();
if
(
!
hwndActive
)
return
FALSE
;
if
(
hwndActive
==
hwnd
)
return
TRUE
;
return
IsChild32
(
hwndActive
,
hwnd
);
}
static
INT32
TOOLTIPS_CheckTool
(
WND
*
wndPtr
,
BOOL32
bShowTest
)
{
...
...
@@ -472,12 +474,10 @@ TOOLTIPS_CheckTool (WND *wndPtr, BOOL32 bShowTest)
if
(
nTool
==
-
1
)
return
-
1
;
#if 0
if
(
!
(
wndPtr
->
dwStyle
&
TTS_ALWAYSTIP
)
&&
bShowTest
)
{
if (!
IsWindowEnabled32 (infoPtr->tools[infoPtr->nTool].hwnd
))
if
(
!
TOOLTIPS_IsWindowActive
(
wndPtr
->
owner
->
hwndSelf
))
return
-
1
;
}
#endif
TRACE
(
tooltips
,
"tool %d
\n
"
,
nTool
);
...
...
@@ -1014,19 +1014,19 @@ TOOLTIPS_RelayEvent (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
wndPtr
->
hwndSelf
,
pt
.
x
,
pt
.
y
);
if
((
infoPtr
->
bActive
)
&&
(
infoPtr
->
nTool
!=
infoPtr
->
nOldTool
))
{
if
(
infoPtr
->
nOldTool
==
-
1
)
{
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
1
,
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
SHOW
,
infoPtr
->
nInitialTime
,
0
);
TRACE
(
tooltips
,
"timer 1 started!
\n
"
);
}
else
{
TOOLTIPS_Hide
(
wndPtr
,
infoPtr
);
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
1
,
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
SHOW
,
infoPtr
->
nReshowTime
,
0
);
TRACE
(
tooltips
,
"timer 2 started!
\n
"
);
}
}
if
(
infoPtr
->
nCurrentTool
!=
-
1
)
{
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
3
,
100
,
0
);
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
LEAVE
,
100
,
0
);
TRACE
(
tooltips
,
"timer 3 started!
\n
"
);
}
break
;
...
...
@@ -1411,24 +1411,7 @@ static LRESULT
TOOLTIPS_MouseMessage
(
WND
*
wndPtr
,
UINT32
uMsg
,
WPARAM32
wParam
,
LPARAM
lParam
)
{
TOOLTIPS_INFO
*
infoPtr
=
TOOLTIPS_GetInfoPtr
(
wndPtr
);
TTTOOL_INFO
*
toolPtr
=
&
infoPtr
->
tools
[
infoPtr
->
nTool
];
if
(
toolPtr
->
uFlags
&
TTF_TRANSPARENT
)
{
FIXME
(
tooltips
,
"transparent tooltips not implemented yet!
\n
"
);
#if 0
POINT32 pt;
RECT32 rc;
pt.x = (INT32)LOWORD(lParam);
pt.y = (INT32)HIWORD(lParam);
GetClientRect32 (toolPtr->hwnd, &rc);
ScreenToClient32 (toolPtr->hwnd, &pt);
if (PtInRect32 (&rc, pt))
SendMessage32A (toolPtr->hwnd, uMsg, wParam, lParam);
#endif
}
else
TOOLTIPS_Hide
(
wndPtr
,
infoPtr
);
return
0
;
...
...
@@ -1436,7 +1419,7 @@ TOOLTIPS_MouseMessage (WND *wndPtr, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
static
LRESULT
TOOLTIPS_N
c
Create
(
WND
*
wndPtr
,
WPARAM32
wParam
,
LPARAM
lParam
)
TOOLTIPS_N
C
Create
(
WND
*
wndPtr
,
WPARAM32
wParam
,
LPARAM
lParam
)
{
wndPtr
->
dwStyle
&=
0x0000FFFF
;
wndPtr
->
dwStyle
|=
(
WS_POPUP
|
WS_BORDER
|
WS_CLIPSIBLINGS
);
...
...
@@ -1446,6 +1429,25 @@ TOOLTIPS_NcCreate (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
static
LRESULT
TOOLTIPS_NCHitTest
(
WND
*
wndPtr
,
WPARAM32
wParam
,
LPARAM
lParam
)
{
TOOLTIPS_INFO
*
infoPtr
=
TOOLTIPS_GetInfoPtr
(
wndPtr
);
INT32
nTool
=
(
infoPtr
->
bTrackActive
)
?
infoPtr
->
nTrackTool
:
infoPtr
->
nTool
;
TRACE
(
tooltips
,
" nTool=%d
\n
"
,
nTool
);
if
((
nTool
>
-
1
)
&&
(
nTool
<
infoPtr
->
uNumTools
))
{
if
(
infoPtr
->
tools
[
nTool
].
uFlags
&
TTF_TRANSPARENT
)
{
TRACE
(
tooltips
,
"-- in transparent mode!
\n
"
);
return
HTTRANSPARENT
;
}
}
return
DefWindowProc32A
(
wndPtr
->
hwndSelf
,
WM_NCHITTEST
,
wParam
,
lParam
);
}
static
LRESULT
TOOLTIPS_Paint
(
WND
*
wndPtr
,
WPARAM32
wParam
,
LPARAM
lParam
)
{
HDC32
hdc
;
...
...
@@ -1483,18 +1485,18 @@ TOOLTIPS_Timer (WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
switch
(
wParam
)
{
case
ID_TIMER
1
:
KillTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
1
);
case
ID_TIMER
SHOW
:
KillTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
SHOW
);
if
(
TOOLTIPS_CheckTool
(
wndPtr
,
TRUE
)
==
infoPtr
->
nTool
)
TOOLTIPS_Show
(
wndPtr
,
infoPtr
);
break
;
case
ID_TIMER
2
:
case
ID_TIMER
POP
:
TOOLTIPS_Hide
(
wndPtr
,
infoPtr
);
break
;
case
ID_TIMER
3
:
KillTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
3
);
case
ID_TIMER
LEAVE
:
KillTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
LEAVE
);
if
(
TOOLTIPS_CheckTool
(
wndPtr
,
FALSE
)
==
-
1
)
{
infoPtr
->
nTool
=
-
1
;
infoPtr
->
nOldTool
=
-
1
;
...
...
@@ -1565,19 +1567,19 @@ TOOLTIPS_SubclassProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
if
((
infoPtr
->
bActive
)
&&
(
infoPtr
->
nTool
!=
infoPtr
->
nOldTool
))
{
if
(
infoPtr
->
nOldTool
==
-
1
)
{
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
1
,
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
SHOW
,
infoPtr
->
nInitialTime
,
0
);
TRACE
(
tooltips
,
"timer 1 started!
\n
"
);
}
else
{
TOOLTIPS_Hide
(
wndPtr
,
infoPtr
);
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
1
,
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
SHOW
,
infoPtr
->
nReshowTime
,
0
);
TRACE
(
tooltips
,
"timer 2 started!
\n
"
);
}
}
if
(
infoPtr
->
nCurrentTool
!=
-
1
)
{
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
3
,
100
,
0
);
SetTimer32
(
wndPtr
->
hwndSelf
,
ID_TIMER
LEAVE
,
100
,
0
);
TRACE
(
tooltips
,
"timer 3 started!
\n
"
);
}
}
...
...
@@ -1712,9 +1714,6 @@ TOOLTIPS_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
case
WM_GETFONT
:
return
TOOLTIPS_GetFont
(
wndPtr
,
wParam
,
lParam
);
// case WM_GETTEXT:
// case WM_GETTEXTLENGTH:
case
WM_LBUTTONDOWN
:
case
WM_LBUTTONUP
:
case
WM_MBUTTONDOWN
:
...
...
@@ -1725,21 +1724,17 @@ TOOLTIPS_WindowProc (HWND32 hwnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
return
TOOLTIPS_MouseMessage
(
wndPtr
,
uMsg
,
wParam
,
lParam
);
case
WM_NCCREATE
:
return
TOOLTIPS_N
c
Create
(
wndPtr
,
wParam
,
lParam
);
return
TOOLTIPS_N
C
Create
(
wndPtr
,
wParam
,
lParam
);
//
case WM_NCHITTEST:
// case WM_NOTIFYFORMAT:
case
WM_NCHITTEST
:
return
TOOLTIPS_NCHitTest
(
wndPtr
,
wParam
,
lParam
);
case
WM_PAINT
:
return
TOOLTIPS_Paint
(
wndPtr
,
wParam
,
lParam
);
// case WM_PRINTCLIENT:
case
WM_SETFONT
:
return
TOOLTIPS_SetFont
(
wndPtr
,
wParam
,
lParam
);
// case WM_STYLECHANGED:
case
WM_TIMER
:
return
TOOLTIPS_Timer
(
wndPtr
,
wParam
,
lParam
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment