[wx-dev] wxDataViewItem::m_id type confusion
Robert Roebling
robert at roebling.de
Sat Mar 1 09:36:55 PST 2008
Vadim Zeitlin wrote:
> Could you please explain what is wxDataViewItem::m_id under different
> platforms? It's declared as pointer
Yes, e.g. for storing user data, which is typically a pointer.
> but it is used as an integer in wxDataViewModel::Compare().
Only as a fallback since (I think) GTK+ doesn't like to
items being equal when comparing.
> Does it really have to be a pointer (for Mac?)?
Everywhere.
> 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
Not quite sure what you mean. The pointer should be able to hold
an int (and it is), where do we need the opposite?
> 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?
Because the other platforms flip-flop between using a hash not
not using it at runtime.
> And as a final question, shouldn't we use wxVector instead of
> WX_DEFINE_ARRAY in this (new) code?
wxVector probably wasn't finished then. I'm also not sure
what support for sorting we have in wxVector without STL.
Robert
More information about the wx-dev
mailing list