From: John L. <jr...@us...> - 2007-02-22 00:01:40
|
Update of /cvsroot/wxlua/wxLua/modules/wxlua/include In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16385/wxLua/modules/wxlua/include Modified Files: wxlstate.h Log Message: Added wxLuaState::GetwxStringType who's input is either a lua string or a wxString userdata Use it in bindings instead of GetStringType wxNode::IndexOf is now protected in wxWidgets 2.8 so remove it Index: wxlstate.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/wxlua/include/wxlstate.h,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** wxlstate.h 21 Jan 2007 23:13:07 -0000 1.59 --- wxlstate.h 22 Feb 2007 00:01:36 -0000 1.60 *************** *** 62,72 **** if (luastr == NULL) return wxEmptyString; // check for NULL #if wxUSE_UNICODE ! return wxString(luastr, wxConvUTF8); #else ! return wxString(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent); #endif // wxUSE_UNICODE ! //return wxConvertMB2WX(luastr); // old way that mostly works } --- 62,77 ---- if (luastr == NULL) return wxEmptyString; // check for NULL + wxString str; + #if wxUSE_UNICODE ! str = wxString(luastr, wxConvUTF8); #else ! str = wxString(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent); #endif // wxUSE_UNICODE ! if (str.IsEmpty()) ! str = wxConvertMB2WX(luastr); // old way that mostly works ! ! return str; } *************** *** 74,79 **** inline const WXDLLIMPEXP_WXLUA wxCharBuffer wx2lua(const wxString& wxstr) { - //wxCharBuffer buffer(wxConvertWX2MB(wxstr.c_str())); // old way that mostly works wxCharBuffer buffer(wxConvUTF8.cWC2MB(wxstr.wc_str(*wxConvCurrent))); // skieu return buffer; } --- 79,87 ---- inline const WXDLLIMPEXP_WXLUA wxCharBuffer wx2lua(const wxString& wxstr) { wxCharBuffer buffer(wxConvUTF8.cWC2MB(wxstr.wc_str(*wxConvCurrent))); // skieu + + if ((buffer.data() == NULL) && !wxstr.IsEmpty()) + buffer = wxConvertWX2MB(wxstr.c_str()); // old way that mostly works + return buffer; } *************** *** 83,91 **** { public: ! wxLuaCharBuffer(const wxString &wxstr) : m_buffer((const char *)NULL) ! { ! //wxCharBuffer charBuffer = wxConvertWX2MB(wxstr.c_str()); ! m_buffer = wxCharBuffer(wxConvUTF8.cWC2MB(wxstr.wc_str(*wxConvCurrent))); // skieu ! } size_t Length() const { return strlen((const char*)m_buffer); } --- 91,95 ---- { public: ! wxLuaCharBuffer(const wxString &wxstr) : m_buffer(wx2lua(wxstr)) {} size_t Length() const { return strlen((const char*)m_buffer); } *************** *** 209,212 **** --- 213,217 ---- int m_wxluatag_wxEvent; // The lua tag for wxEvents int m_wxluatag_wxWindow; // The lua tag for wxWindows + int m_wxluatag_wxString; // The lua tag for wxStrings bool m_callbase_func; // call the base class function instead of derived func *************** *** 490,493 **** --- 495,499 ---- int GetwxEventTag() const; // The lua tag for wxEvents int GetwxWindowTag() const; // The lua tag for wxWindows + int GetwxStringTag() const; // The lua tag for wxStrings // When looking up a function to call, should the base class function *************** *** 589,592 **** --- 595,601 ---- // calls terror if the value is not of the right type. const char* GetStringType(int stack_idx); + // Same as GetStringType(), but returns a wxString and the item at the stack_idx can be + // either a lua string or a wxString userdata. + wxString GetwxStringType(int stack_idx); // Validate that the object at the stack index specified is a boolean object // or that the object can be converted to a boolean and return the boolean. |