Re: [wx-dev] wxDataViewItem::m_id type confusion

24 views
Skip to first unread message

Belgabor

unread,
Mar 1, 2008, 11:10:30 AM3/1/08
to wx-...@lists.wxwidgets.org
Hi Vadim,

I'm not Robert, but I've used wxDataViewCtrl quite a bit in the last
couple of days. The id definitely needs to be a pointer. (At least on
MSW or generic) It's usually used to point to a user-defined structure
which the Model uses to get/set values. Making it a "limited" int id
would add unnecessary management complexity and error-proneness to the
user's Model-code. Personally I would make it a wxUIntPtr, but probably
Robert knows best if this will cause breakage elsewhere.

Cheers,
Tobias

Vadim Zeitlin schrieb:
> Hello (Robert),
>
> Could you please explain what is wxDataViewItem::m_id under different
> platforms? It's declared as pointer but it is used as an integer in
> wxDataViewModel::Compare(). Does it really have to be a pointer (for Mac?)?
> In this case we need to replace "unsigned int" in the API with wxUIntPtr as
> "unsigned int" is not big enough to hold a pointer under Win64 (but
> wxUIntPtr is) and this results not only in compiler warnings (which is
> annoying enough on its own) but will also break the code if the pointers
> are ever used under MSW.
>
> There is also something very strange going on with m_hash and m_useHash
> in wxDataViewIndexListModel. The latter is always false under Mac AFAICS
> but why then do we even compile all the code using m_hash there? I'm not
> worried about inefficiency here as much as about code clarity: having 2
> versions of each function isn't really ideal IMO. Why not provide 2
> versions of the (base) class, one using the array and the other one not
> using it?
>
> And as a final question, shouldn't we use wxVector instead of
> WX_DEFINE_ARRAY in this (new) code?
>
> Thanks,
> VZ
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wx-dev-un...@lists.wxwidgets.org
> For additional commands, e-mail: wx-de...@lists.wxwidgets.org
>


Reply all
Reply to author
Forward
0 new messages