From: Paul K <pau...@ya...> - 2016-05-06 06:22:54
|
Hi John, It seems like I'll need to create a derived class for wxLuaApp (similar to wxLuaPrintout) and add those Mac* methods to that class. Then the app can be set using wxGetApp::SetInstance() method, which should trigger those Mac* methods as expected. This also eliminates the issue with getting the Lua state, but I still need to figure out how to initialize the application fields properly... Or is there a better way? Paul. On Thu, May 5, 2016 at 10:59 PM, Paul K <pau...@ya...> wrote: > Hi John, > >> 1. Memory leak in wxlua: http://sourceforge.net/p/wxlua/mailman/message/34430092/ >> 2. MacOpenFiles and related methods: http://sourceforge.net/p/wxlua/mailman/message/34559782/ >> 3. wxButton class is missing all the methods from wxAnyButton class >> 4. Several other methods missing: http://sourceforge.net/p/wxlua/mailman/message/32988247/ > > I've been making good progress updating wxlua API for wxwidgets 3.1.x > and have processed about dozen or so classes, so adding all the > missing methods is much less of a priority for me. > > I tried to add MacOpenFiles processing and ran into an issue with > getting access to the current Lua state. Here is what I currently > have: > > %override wxLua_wxApp_MacOpenFiles > void wxApp::MacOpenFiles(const wxArrayString& filenames) > { > wxLuaState m_wxlState = s_wxlState // <== not sure what to put here > > if (m_wxlState.Ok() && !m_wxlState.GetCallBaseClassFunction() && > m_wxlState.HasDerivedMethod(this, "MacOpenFiles", true)) > { > int nOldTop = m_wxlState.lua_GetTop(); > m_wxlState.wxluaT_PushUserDataType(this, wxluatype_wxApp, true); > m_wxlState.PushwxArrayStringTable(filenames); > > m_wxlState.LuaPCall(2, 0); > m_wxlState.lua_SetTop(nOldTop-1); // -1 to remove pushed > derived method func too > } > m_wxlState.SetCallBaseClassFunction(false); // clear flag always > } > %end > > I would have used s_wxlState, but it's "static" in the Lua module, so > not available outside of that file. It doesn't solve all the problems, > but it could set me on the right track. When I make s_wxlState > non-static, I do get a linker error about duplicate > wxApp::MacOpenFiles method, so any ideas on how to avoid this, would > be useful too. > > Paul. |