Nevermind, you have to do this since the pointers may be NULL at startup...
-John
On 4/17/06, John Labenski <[EMAIL PROTECTED]> wrote:
> Some changes in wxWidgets CVS head are causing more problems. They've
> removed wxRED_PEN and and the rest of the objects and use a wxStockGDI
> class to get them so that we get "error: non-lvalue in unary `&'" on
> these objects, see wxRED_PEN below for code.
>
> This is new wxWidgets code
>
> #define wxRED_PEN wxStockGDI::GetPen(RED_PEN);
> static wxPen* wxStockGDI::GetPen(int type);
>
> =========================
>
> My question is why do we have objPtr and pObjPtr in WXLUAMETHOD? When
> would pObjPtr be needed instead of just assigning the pointer value as
> is to objPtr? The fix to the above is not terrible, a little annoying,
> but I guess I'd like to understand this first and remove pObjPtr is
> it's not needed.
>
> Thanks,
> John Labenski
>
> =========================
>
> wxlua/include/wxlbind.h
>
> struct WXLUAOBJECT // Defines a wxWidgets object or
> pointer for wxLua
> {
> const void *objPtr; // a pointer to the object or pointer
> const void **pObjPtr; // a pointer to the object or pointer
> const char *objName; // the name of the object or pointer
> int *objClassTag; // the class tag of the object or pointer.
> };
>
> =========================
>
> is used, for example, in in wxbind/src/wx_bind.cpp for
>
> wxWidgets has (or used to for wxRED_PEN) these
> wxPen wxNullPen; (an object)
> wxPen* wxRED_PEN = new wxPen(...); a pointer
>
> { &wxNullPen, 0, "wxNullPen", &s_wxluatag_wxPen },
> *** error on next line
> { 0, (const void **) &wxRED_PEN, "wxRED_PEN", &s_wxluatag_wxPen },
>
> =========================
>
> and wxlua/src/wxlbind.cpp
>
> // install the objects and pointers
> for (size_t iObject = 0; iObject < m_objectCount; ++iObject)
> {
> WXLUAOBJECT *pObject = m_objectList + iObject;
> lua_pushstring(L, pObject->objName);
> if (pObject->objPtr != 0)
> wxlState.tpushusertag(pObject->objPtr, *pObject->objClassTag);
> else
> wxlState.tpushusertag(*pObject->pObjPtr, *pObject->objClassTag);
> lua_rawset(L, tableOffset);
> }
>
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Wxlua-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wxlua-users