Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
0a4d8f7f
Commit
0a4d8f7f
authored
Aug 12, 2004
by
Thomas Weidenmüller
Committed by
Alexandre Julliard
Aug 12, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct tooltips behavior.
parent
ba01e4af
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
9 deletions
+97
-9
tooltips.c
dlls/comctl32/tooltips.c
+97
-9
No files found.
dlls/comctl32/tooltips.c
View file @
0a4d8f7f
...
@@ -119,6 +119,7 @@ typedef struct
...
@@ -119,6 +119,7 @@ typedef struct
INT
nAutoPopTime
;
INT
nAutoPopTime
;
INT
nInitialTime
;
INT
nInitialTime
;
RECT
rcMargin
;
RECT
rcMargin
;
BOOL
bToolBelow
;
TTTOOL_INFO
*
tools
;
TTTOOL_INFO
*
tools
;
}
TOOLTIPS_INFO
;
}
TOOLTIPS_INFO
;
...
@@ -132,10 +133,13 @@ typedef struct
...
@@ -132,10 +133,13 @@ typedef struct
/* offsets from window edge to start of text */
/* offsets from window edge to start of text */
#define NORMAL_TEXT_MARGIN 2
#define NORMAL_TEXT_MARGIN 2
#define BALLOON_TEXT_MARGIN (NORMAL_TEXT_MARGIN+
10
)
#define BALLOON_TEXT_MARGIN (NORMAL_TEXT_MARGIN+
8
)
/* value used for CreateRoundRectRgn that specifies how much
/* value used for CreateRoundRectRgn that specifies how much
* each corner is curved */
* each corner is curved */
#define BALLOON_ROUNDEDNESS 20
#define BALLOON_ROUNDEDNESS 20
#define BALLOON_STEMHEIGHT 13
#define BALLOON_STEMWIDTH 10
#define BALLOON_STEMINDENT 20
LRESULT
CALLBACK
LRESULT
CALLBACK
TOOLTIPS_SubclassProc
(
HWND
hwnd
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
,
UINT_PTR
uId
,
DWORD_PTR
dwRef
);
TOOLTIPS_SubclassProc
(
HWND
hwnd
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
,
UINT_PTR
uId
,
DWORD_PTR
dwRef
);
...
@@ -178,6 +182,7 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
...
@@ -178,6 +182,7 @@ TOOLTIPS_Refresh (HWND hwnd, HDC hdc)
rc
.
top
+=
(
BALLOON_TEXT_MARGIN
+
infoPtr
->
rcMargin
.
top
);
rc
.
top
+=
(
BALLOON_TEXT_MARGIN
+
infoPtr
->
rcMargin
.
top
);
rc
.
right
-=
(
BALLOON_TEXT_MARGIN
+
infoPtr
->
rcMargin
.
right
);
rc
.
right
-=
(
BALLOON_TEXT_MARGIN
+
infoPtr
->
rcMargin
.
right
);
rc
.
bottom
-=
(
BALLOON_TEXT_MARGIN
+
infoPtr
->
rcMargin
.
bottom
);
rc
.
bottom
-=
(
BALLOON_TEXT_MARGIN
+
infoPtr
->
rcMargin
.
bottom
);
if
(
infoPtr
->
bToolBelow
)
rc
.
top
+=
BALLOON_STEMHEIGHT
;
}
}
else
else
{
{
...
@@ -351,6 +356,7 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
...
@@ -351,6 +356,7 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
{
{
HDC
hdc
;
HDC
hdc
;
HFONT
hOldFont
;
HFONT
hOldFont
;
DWORD
style
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
UINT
uFlags
=
DT_EXTERNALLEADING
|
DT_CALCRECT
;
UINT
uFlags
=
DT_EXTERNALLEADING
|
DT_CALCRECT
;
RECT
rc
=
{
0
,
0
,
0
,
0
};
RECT
rc
=
{
0
,
0
,
0
,
0
};
...
@@ -358,7 +364,7 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
...
@@ -358,7 +364,7 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
rc
.
right
=
infoPtr
->
nMaxTipWidth
;
rc
.
right
=
infoPtr
->
nMaxTipWidth
;
uFlags
|=
DT_WORDBREAK
;
uFlags
|=
DT_WORDBREAK
;
}
}
if
(
GetWindowLongA
(
hwnd
,
GWL_STYLE
)
&
TTS_NOPREFIX
)
if
(
style
&
TTS_NOPREFIX
)
uFlags
|=
DT_NOPREFIX
;
uFlags
|=
DT_NOPREFIX
;
TRACE
(
"%s
\n
"
,
debugstr_w
(
infoPtr
->
szTipText
));
TRACE
(
"%s
\n
"
,
debugstr_w
(
infoPtr
->
szTipText
));
...
@@ -368,12 +374,13 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
...
@@ -368,12 +374,13 @@ TOOLTIPS_CalcTipSize (HWND hwnd, TOOLTIPS_INFO *infoPtr, LPSIZE lpSize)
SelectObject
(
hdc
,
hOldFont
);
SelectObject
(
hdc
,
hOldFont
);
ReleaseDC
(
hwnd
,
hdc
);
ReleaseDC
(
hwnd
,
hdc
);
if
(
GetWindowLongW
(
hwnd
,
GWL_STYLE
)
&
TTS_BALLOON
)
if
(
style
&
TTS_BALLOON
)
{
{
lpSize
->
cx
=
rc
.
right
-
rc
.
left
+
2
*
BALLOON_TEXT_MARGIN
+
lpSize
->
cx
=
rc
.
right
-
rc
.
left
+
2
*
BALLOON_TEXT_MARGIN
+
infoPtr
->
rcMargin
.
left
+
infoPtr
->
rcMargin
.
right
;
infoPtr
->
rcMargin
.
left
+
infoPtr
->
rcMargin
.
right
;
lpSize
->
cy
=
rc
.
bottom
-
rc
.
top
+
2
*
BALLOON_TEXT_MARGIN
+
lpSize
->
cy
=
rc
.
bottom
-
rc
.
top
+
2
*
BALLOON_TEXT_MARGIN
+
infoPtr
->
rcMargin
.
bottom
+
infoPtr
->
rcMargin
.
top
;
infoPtr
->
rcMargin
.
bottom
+
infoPtr
->
rcMargin
.
top
+
BALLOON_STEMHEIGHT
;
}
}
else
else
{
{
...
@@ -392,6 +399,8 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
...
@@ -392,6 +399,8 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
RECT
rect
,
wndrect
;
RECT
rect
,
wndrect
;
SIZE
size
;
SIZE
size
;
NMHDR
hdr
;
NMHDR
hdr
;
int
ptfx
=
0
;
DWORD
style
=
GetWindowLongW
(
hwnd
,
GWL_STYLE
);
if
(
infoPtr
->
nTool
==
-
1
)
{
if
(
infoPtr
->
nTool
==
-
1
)
{
TRACE
(
"invalid tool (-1)!
\n
"
);
TRACE
(
"invalid tool (-1)!
\n
"
);
...
@@ -433,11 +442,49 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
...
@@ -433,11 +442,49 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
MapWindowPoints
(
toolPtr
->
hwnd
,
NULL
,
(
LPPOINT
)
&
rc
,
2
);
MapWindowPoints
(
toolPtr
->
hwnd
,
NULL
,
(
LPPOINT
)
&
rc
,
2
);
}
}
rect
.
left
=
(
rc
.
left
+
rc
.
right
-
size
.
cx
)
/
2
;
rect
.
left
=
(
rc
.
left
+
rc
.
right
-
size
.
cx
)
/
2
;
rect
.
top
=
rc
.
bottom
+
2
;
if
(
style
&
TTS_BALLOON
)
{
ptfx
=
rc
.
left
+
((
rc
.
right
-
rc
.
left
)
/
2
);
if
(
rect
.
top
-
size
.
cy
>=
0
)
{
rect
.
top
-=
size
.
cy
;
infoPtr
->
bToolBelow
=
FALSE
;
}
else
{
infoPtr
->
bToolBelow
=
TRUE
;
rect
.
top
+=
20
;
}
rect
.
left
=
max
(
0
,
rect
.
left
-
BALLOON_STEMINDENT
);
}
else
{
rect
.
top
=
rc
.
bottom
+
2
;
infoPtr
->
bToolBelow
=
TRUE
;
}
}
}
else
{
else
{
GetCursorPos
((
LPPOINT
)
&
rect
);
GetCursorPos
((
LPPOINT
)
&
rect
);
rect
.
top
+=
20
;
if
(
style
&
TTS_BALLOON
)
{
ptfx
=
rect
.
left
;
if
(
rect
.
top
-
size
.
cy
>=
0
)
{
rect
.
top
-=
size
.
cy
;
infoPtr
->
bToolBelow
=
FALSE
;
}
else
{
infoPtr
->
bToolBelow
=
TRUE
;
rect
.
top
+=
20
;
}
rect
.
left
=
max
(
0
,
rect
.
left
-
BALLOON_STEMINDENT
);
}
else
{
rect
.
top
+=
20
;
infoPtr
->
bToolBelow
=
TRUE
;
}
}
}
TRACE
(
"pos %ld - %ld
\n
"
,
rect
.
left
,
rect
.
top
);
TRACE
(
"pos %ld - %ld
\n
"
,
rect
.
left
,
rect
.
top
);
...
@@ -468,12 +515,53 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
...
@@ -468,12 +515,53 @@ TOOLTIPS_Show (HWND hwnd, TOOLTIPS_INFO *infoPtr)
AdjustWindowRectEx
(
&
rect
,
GetWindowLongA
(
hwnd
,
GWL_STYLE
),
AdjustWindowRectEx
(
&
rect
,
GetWindowLongA
(
hwnd
,
GWL_STYLE
),
FALSE
,
GetWindowLongA
(
hwnd
,
GWL_EXSTYLE
));
FALSE
,
GetWindowLongA
(
hwnd
,
GWL_EXSTYLE
));
if
(
GetWindowLongW
(
hwnd
,
GWL_STYLE
)
&
TTS_BALLOON
)
if
(
style
&
TTS_BALLOON
)
{
{
HRGN
hRgn
;
HRGN
hRgn
;
HRGN
hrStem
;
POINT
pts
[
3
];
ptfx
-=
rect
.
left
;
if
(
infoPtr
->
bToolBelow
)
{
pts
[
0
].
x
=
ptfx
;
pts
[
0
].
y
=
0
;
pts
[
1
].
x
=
max
(
BALLOON_STEMINDENT
,
ptfx
-
(
BALLOON_STEMWIDTH
/
2
));
pts
[
1
].
y
=
BALLOON_STEMHEIGHT
;
pts
[
2
].
x
=
pts
[
1
].
x
+
BALLOON_STEMWIDTH
;
pts
[
2
].
y
=
pts
[
1
].
y
;
if
(
pts
[
2
].
x
>
(
rect
.
right
-
rect
.
left
)
-
BALLOON_STEMINDENT
)
{
pts
[
2
].
x
=
(
rect
.
right
-
rect
.
left
)
-
BALLOON_STEMINDENT
;
pts
[
1
].
x
=
pts
[
2
].
x
-
BALLOON_STEMWIDTH
;
}
}
else
{
pts
[
0
].
x
=
max
(
BALLOON_STEMINDENT
,
ptfx
-
(
BALLOON_STEMWIDTH
/
2
));
pts
[
0
].
y
=
(
rect
.
bottom
-
rect
.
top
)
-
BALLOON_STEMHEIGHT
;
pts
[
1
].
x
=
pts
[
0
].
x
+
BALLOON_STEMWIDTH
;
pts
[
1
].
y
=
pts
[
0
].
y
;
pts
[
2
].
x
=
ptfx
;
pts
[
2
].
y
=
(
rect
.
bottom
-
rect
.
top
);
if
(
pts
[
1
].
x
>
(
rect
.
right
-
rect
.
left
)
-
BALLOON_STEMINDENT
)
{
pts
[
1
].
x
=
(
rect
.
right
-
rect
.
left
)
-
BALLOON_STEMINDENT
;
pts
[
0
].
x
=
pts
[
1
].
x
-
BALLOON_STEMWIDTH
;
}
}
/* FIXME: need to add pointy bit using CreatePolyRgn & CombinRgn */
hrStem
=
CreatePolygonRgn
(
pts
,
sizeof
(
pts
)
/
sizeof
(
pts
[
0
]),
ALTERNATE
);
hRgn
=
CreateRoundRectRgn
(
0
,
0
,
rect
.
right
-
rect
.
left
,
rect
.
bottom
-
rect
.
top
,
BALLOON_ROUNDEDNESS
,
BALLOON_ROUNDEDNESS
);
hRgn
=
CreateRoundRectRgn
(
0
,
(
infoPtr
->
bToolBelow
?
BALLOON_STEMHEIGHT
:
0
),
rect
.
right
-
rect
.
left
,
(
infoPtr
->
bToolBelow
?
rect
.
bottom
-
rect
.
top
:
rect
.
bottom
-
rect
.
top
-
BALLOON_STEMHEIGHT
),
BALLOON_ROUNDEDNESS
,
BALLOON_ROUNDEDNESS
);
CombineRgn
(
hRgn
,
hRgn
,
hrStem
,
RGN_OR
);
DeleteObject
(
hrStem
);
SetWindowRgn
(
hwnd
,
hRgn
,
FALSE
);
SetWindowRgn
(
hwnd
,
hRgn
,
FALSE
);
/* we don't free the region handle as the system deletes it when
/* we don't free the region handle as the system deletes it when
...
...
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