comctl32: implement LISTVIEW_ApproximateViewRect for icon and small icon.
Nikolay Sivov
bunglehead at gmail.com
Fri Oct 2 13:37:28 CDT 2009
Aric Stewart wrote:
> ---
> dlls/comctl32/listview.c | 39 ++++++++++++++++++++++++++++++++++-----
> 1 files changed, 34 insertions(+), 5 deletions(-)
>
Hi, Aric.
I don't think it's a right way:
---
+ if (infoPtr->nItemCount > 0)
+ {
+ LISTVIEW_GetItemBox(infoPtr, 0, &rcBox);
+ if (wWidth == 0xffff)
+ wWidth = infoPtr->rcList.right - infoPtr->rcList.left;
+
+ row_count = wWidth / (rcBox.right - rcBox.left);
+ if (row_count == 0)
+ {
+ row_count = 1;
+ wWidth = rcBox.right - rcBox.left;
+ }
+ rows = infoPtr->nItemCount / row_count;
+ if (rows == 0)
+ rows = 1;
+
+ wHeight = (rcBox.bottom - rcBox.top) * rows;
+ }
---
You don't respect item spacing here while native does: just tested with
ControlSpy and it does return rectangle with item spacing -
item aren't placed close to each other.
I think you should use a logic we use to position items - place to row
until it wraps to next etc. The difference is that if width is greater
by a value less then itemwidth we should return a minimal rectangle here.
Using LISTVIEW_GetItemBox(infoPtr, 0, &rcBox) for 0 item assuming it's
the same for the rest isn't correct - box depends on label so, it could
differ.
Also this is unsafe:
---
+ row_count = wWidth / (rcBox.right - rcBox.left);
---
Could add some tests for that? Not so strict maybe, but to check that
approx. rectangle is wider then item placed close.
More information about the wine-devel
mailing list