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
1313431b
Commit
1313431b
authored
Oct 10, 2002
by
Dimitrie O. Paun
Committed by
Alexandre Julliard
Oct 10, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rewrite HitTest to make it pretty, and very fast.
parent
a80ced02
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
114 additions
and
5 deletions
+114
-5
listview.c
dlls/comctl32/listview.c
+114
-5
No files found.
dlls/comctl32/listview.c
View file @
1313431b
...
@@ -5695,12 +5695,20 @@ static INT LISTVIEW_SuperHitTestItem(LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lph
...
@@ -5695,12 +5695,20 @@ static INT LISTVIEW_SuperHitTestItem(LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lph
* [IO] lpht : hit test information
* [IO] lpht : hit test information
* [I] subitem : fill out iSubItem.
* [I] subitem : fill out iSubItem.
*
*
* NOTE:
* (mm 20001022): We must not allow iSubItem to be touched, for
* an app might pass only a structure with space up to iItem!
* (MS Office 97 does that for instance in the file open dialog)
*
* RETURN:
* RETURN:
* SUCCESS : item index
* SUCCESS : item index
* FAILURE : -1
* FAILURE : -1
*/
*/
static
LRESULT
LISTVIEW_HitTest
(
LISTVIEW_INFO
*
infoPtr
,
LPLVHITTESTINFO
lpht
,
BOOL
subitem
)
static
LRESULT
LISTVIEW_HitTest
(
LISTVIEW_INFO
*
infoPtr
,
LPLVHITTESTINFO
lpht
,
BOOL
subitem
)
{
{
UINT
uView
=
infoPtr
->
dwStyle
&
LVS_TYPEMASK
;
RECT
rcBounds
,
rcIcon
,
rcLabel
;
TRACE
(
"(x=%ld, y=%ld)
\n
"
,
lpht
->
pt
.
x
,
lpht
->
pt
.
y
);
TRACE
(
"(x=%ld, y=%ld)
\n
"
,
lpht
->
pt
.
x
,
lpht
->
pt
.
y
);
lpht
->
flags
=
0
;
lpht
->
flags
=
0
;
...
@@ -5718,12 +5726,113 @@ static LRESULT LISTVIEW_HitTest(LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BO
...
@@ -5718,12 +5726,113 @@ static LRESULT LISTVIEW_HitTest(LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BO
lpht
->
flags
|=
LVHT_BELOW
;
lpht
->
flags
|=
LVHT_BELOW
;
if
(
lpht
->
flags
)
return
-
1
;
if
(
lpht
->
flags
)
return
-
1
;
lpht
->
flags
|=
LVHT_NOWHERE
;
/* first deal with the large items */
if
(
uView
==
LVS_ICON
&&
(
infoPtr
->
dwStyle
&
LVS_OWNERDRAWFIXED
)
&&
PtInRect
(
&
infoPtr
->
rcFocus
,
lpht
->
pt
))
{
lpht
->
iItem
=
infoPtr
->
nFocusedItem
;
}
else
{
if
(
uView
==
LVS_ICON
||
uView
==
LVS_SMALLICON
)
{
RECT
rcSearch
;
ITERATOR
i
;
rcSearch
.
left
=
lpht
->
pt
.
x
-
infoPtr
->
nItemWidth
;
rcSearch
.
top
=
lpht
->
pt
.
y
-
infoPtr
->
nItemHeight
;
rcSearch
.
right
=
lpht
->
pt
.
x
+
1
;
rcSearch
.
bottom
=
lpht
->
pt
.
y
+
1
;
iterator_create_frameditems
(
&
i
,
infoPtr
,
&
rcSearch
,
0
);
while
(
iterator_next
(
&
i
))
{
if
(
!
LISTVIEW_GetItemMeasures
(
infoPtr
,
i
.
nItem
,
&
rcBounds
,
0
,
0
,
0
))
continue
;
if
(
PtInRect
(
&
rcBounds
,
lpht
->
pt
))
break
;
}
lpht
->
iItem
=
i
.
nItem
;
iterator_destroy
(
&
i
);
}
else
{
POINT
Origin
,
Position
;
if
(
!
LISTVIEW_GetOrigin
(
infoPtr
,
&
Origin
))
return
-
1
;
Position
.
x
=
lpht
->
pt
.
x
-
Origin
.
x
;
Position
.
y
=
lpht
->
pt
.
y
-
Origin
.
y
;
if
(
Position
.
x
<
LISTVIEW_GetCountPerRow
(
infoPtr
)
*
infoPtr
->
nItemWidth
&&
Position
.
y
<
LISTVIEW_GetCountPerColumn
(
infoPtr
)
*
infoPtr
->
nItemHeight
)
{
lpht
->
iItem
=
(
Position
.
x
/
infoPtr
->
nItemWidth
)
*
(
Position
.
y
/
infoPtr
->
nItemHeight
);
}
}
}
if
(
lpht
->
iItem
==
-
1
)
return
-
1
;
if
(
!
LISTVIEW_GetItemMeasures
(
infoPtr
,
lpht
->
iItem
,
0
,
&
rcBounds
,
&
rcIcon
,
&
rcLabel
))
return
-
1
;
/* NOTE (mm 20001022): We must not allow iSubItem to be touched, for
if
(
!
PtInRect
(
&
rcBounds
,
lpht
->
pt
))
return
-
1
;
* an app might pass only a structure with space up to iItem!
* (MS Office 97 does that for instance in the file open dialog)
if
(
PtInRect
(
&
rcIcon
,
lpht
->
pt
))
*/
lpht
->
flags
|=
LVHT_ONITEMICON
;
return
LISTVIEW_SuperHitTestItem
(
infoPtr
,
lpht
,
subitem
,
FALSE
);
else
if
(
PtInRect
(
&
rcLabel
,
lpht
->
pt
))
lpht
->
flags
|=
LVHT_ONITEMLABEL
;
else
if
(
infoPtr
->
himlState
)
{
/* FIXME: move this to GetItemMeasures */
LVITEMW
lvItem
;
lvItem
.
mask
=
LVIF_STATE
;
lvItem
.
stateMask
=
LVIS_STATEIMAGEMASK
;
lvItem
.
iItem
=
lpht
->
iItem
;
lvItem
.
iSubItem
=
0
;
if
(
!
LISTVIEW_GetItemW
(
infoPtr
,
&
lvItem
))
return
-
1
;
{
UINT
uStateImage
=
(
lvItem
.
state
&
LVIS_STATEIMAGEMASK
)
>>
12
;
RECT
rcState
;
if
(
uView
==
LVS_ICON
)
{
rcState
.
left
=
rcIcon
.
left
-
infoPtr
->
iconStateSize
.
cx
+
10
;
rcState
.
top
=
rcIcon
.
top
+
infoPtr
->
iconSize
.
cy
-
infoPtr
->
iconStateSize
.
cy
+
4
;
}
else
{
rcState
.
left
=
rcIcon
.
left
-
infoPtr
->
iconStateSize
.
cx
-
IMAGE_PADDING
;
rcState
.
top
=
rcIcon
.
top
;
}
rcState
.
right
=
rcState
.
left
+
infoPtr
->
iconStateSize
.
cx
;
rcState
.
bottom
=
rcState
.
top
+
infoPtr
->
iconStateSize
.
cy
;
if
(
uStateImage
>
0
&&
PtInRect
(
&
rcState
,
lpht
->
pt
))
lpht
->
flags
|=
LVHT_ONITEMSTATEICON
;
}
}
if
(
lpht
->
flags
&
LVHT_ONITEM
)
lpht
->
flags
&=
~
LVHT_NOWHERE
;
if
(
uView
==
LVS_REPORT
&&
lpht
->
iItem
!=
-
1
&&
subitem
)
{
INT
j
,
nColumnCount
=
Header_GetItemCount
(
infoPtr
->
hwndHeader
);
rcBounds
.
right
=
rcBounds
.
left
;
for
(
j
=
0
;
j
<
nColumnCount
;
j
++
)
{
rcBounds
.
left
=
rcBounds
.
right
;
rcBounds
.
right
+=
LISTVIEW_GetColumnWidth
(
infoPtr
,
j
);
if
(
PtInRect
(
&
rcBounds
,
lpht
->
pt
))
{
lpht
->
iSubItem
=
j
;
break
;
}
}
}
return
lpht
->
iItem
;
}
}
...
...
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