> 
> The "self" can be a wxComboBox, wxChoice, wxListBox... and the
> wxItemContainerImmutable class is along the chain of second base
> classes for all of them. All wxLua userdata objects that wrap C++
> objects have a metatable that stores the classes' wxLuaBindClass
> struct (wxlbind.h) which can contain whatever you want, but remember
> that this struct is also stored in Lua as a void* pointer. Also, you
> can't overload C++ functions by return value. The problem is how to
> replace the line getting the "self" with something that first casts
> the object on the stack to its original class type (wxComboBox,
> wxChoice, whatever it may be) before casting it to a
> wxItemContainerImmutable. Finally, this function/baseclass may be in
> one library, but a different binding (wxcore and wxadv for example)
> may have a class with it as it's base class. We don't even know at
> compile time who uses this as a base class so we can't add a
> case/if/else statement to properly cast it.
> 

This is a very good solution and the overhead is pretty minor. It is also 
clean. If you are debugging in C you can always explicitly cast the various 
pointers and look at the information.

I sure cannot think of a better way to so it. You could store a delta instead 
of a pointer and save a few bytes but it would make the whole thing very 
obscure.

This looks great.

Andre


------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
wxlua-users mailing list
wxlua-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wxlua-users

Reply via email to