ListView painting (was Re: Mouse up vs Mouse click)

Dimitrie O. Paun dimi at intelliware.ca
Mon Feb 2 09:12:25 CST 2004


On Mon, 2 Feb 2004, Fabian Cenedese wrote:

> static INT LISTVIEW_HitTest(LISTVIEW_INFO *infoPtr, LPLVHITTESTINFO lpht, BOOL subitem, BOOL select)
> {
> -- snip--
> 
>     if (select && !(uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)))
>     {
>         if (uView == LVS_REPORT)
>         {
>             UnionRect(&rcBounds, &rcIcon, &rcLabel);
>             UnionRect(&rcBounds, &rcBounds, &rcState);
>         }
> 
>         if (!PtInRect(&rcBounds, opt)) iItem = -1;
>     }
> 
>     return lpht->iItem = iItem;
> }
> 
> In the end is this piece of code. What's the intention of it? 

OK, the idea of LISTVIEW_HitTest() is to figure out where a specific point
falls: what item/subitem/label/etc. As you said correctly, it does that OK
up to this piece of code at the end.

The reason we have this is that for _selecting_ items (hence the test for
select), we have slighly different behaviour:
  -- we 'hit' an item if we click anywhere in the union of the icon and
     label rectangles.
  -- the above rule works in all cases _except_ for full row select in
     REPORT mode, where we have to consider the entire row, and regular
     REPORT mode where we have to consider the first column only

> Index: wine/dlls/comctl32/listview.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/comctl32/listview.c,v
> retrieving revision 1.380
> diff -u -r1.380 listview.c
> --- wine/dlls/comctl32/listview.c       10 Dec 2003 00:37:14 -0000      1.380
> +++ wine/dlls/comctl32/listview.c       2 Feb 2004 14:09:16 -0000
> @@ -5980,7 +5980,8 @@
>         }
>      }
> 
> -    if (select && !(uView == LVS_REPORT && (infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)))
> +    if (select && !(uView == LVS_REPORT && ((infoPtr->dwLvExStyle & LVS_EX_FULLROWSELECT)
> +       || (infoPtr->dwStyle & LVS_OWNERDRAWFIXED))))
>      {
>          if (uView == LVS_REPORT)
>          {


I don't think behaviour in the LVS_OWNERDRAWFIXED case is explicitly documented,
but I think it should behave as in the LVS_EX_FULLROWSELECT case. In other words,
I think your patch is correct, please submit it to wine-patches.

-- 
Dimi.





More information about the wine-devel mailing list