From: k. h. <kla...@nl...> - 2005-08-02 11:33:41
|
Hi, John Labenski wrote: >The only problem is that in internal.cpp you have to know the name of >the binding class in order to call it. This means that you can't >compile without it. > See my lattest thread. I think that this binding is added to early, maybe someone does not even want that wx binding. wxLuaStateVariables::wxLuaStateVariables() { ..................... m_bindings.Append(new wx_Binding()); } > It also makes the #include "wxbind.h" necessary. > Not if removed there, and added at e.g. wxLuaInterpreter level or even wx(LuaStandalone)App level. Using the function bind_wx( m_luaState ). This is all fine if the statevars->RegisterBindings(m_luaState, true) is done a bit later. >I >was just thinking out loud about how to dynamicly create a list of >bindings and use the string namespace to differentiate between them. > > Right, which i think is already possible?? >Now that I check it out a little more, it'd be much easier to to just have a >static wxArrayString wxLuaBinding::ms_arrayBindingClassNames; >every subclassed binding just adds it's own classname once to the >binding list. Now that you know the class names of the bindings, each >wxLuaStateVariables can create and add them to the m_bindings list by >running > >wxObject * wxCreateDynamicObject(const wxString& className) > > Sure this is indeed better then a string, since at least all bindings classes will be unique. I use this trick all over wxArt2D, works nice. e.g. i load xml from a file and create the objects in it like this. > I'm just thinking about how people can most simply >add their own wrappers without having to modify anything in wxlua. > > This is already the case now i think, what do you think they need to add/change? >As you can see, I really haven't played with the current system that >much since I don't know how they'll change. I won't commit anything >without consulting others, I just wanted to throw the idea out there. > > I think at least that it is better to use the classname of the binding class to test if it is there or not. So as you suggest above. Regards, Klaas Unclassified |