1399 lines
188 KiB
HTML
1399 lines
188 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
|
<title>wxLua: /mnt/share/devel/lua/wxLua/modules/wxlua/include/wxlstate.h Source File</title>
|
|
<link href="tabs.css" rel="stylesheet" type="text/css"/>
|
|
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
|
|
</head>
|
|
<body>
|
|
<!-- Generated by Doxygen 1.6.3 -->
|
|
<div class="navigation" id="top">
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="main.html"><span>Main Page</span></a></li>
|
|
<li><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li class="current"><a href="files.html"><span>Files</span></a></li>
|
|
<li><a href="dirs.html"><span>Directories</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="tabs">
|
|
<ul>
|
|
<li><a href="files.html"><span>File List</span></a></li>
|
|
<li><a href="globals.html"><span>File Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<div class="navpath"><a class="el" href="dir_15d5a205ad383328522db6a6be296af1.html">modules</a> » <a class="el" href="dir_b59b58daa92d206701e75411b2cef894.html">wxlua</a> » <a class="el" href="dir_a9b43b959fc4efc3ae9ddc99e98c5750.html">include</a>
|
|
</div>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>wxlstate.h</h1><a href="wxlstate_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/////////////////////////////////////////////////////////////////////////////</span>
|
|
<a name="l00002"></a>00002 <span class="comment"></span><span class="comment">// Name: wxlstate.h</span>
|
|
<a name="l00003"></a>00003 <span class="comment">// Purpose: wxLuaState - a wxWidgets interface to Lua</span>
|
|
<a name="l00004"></a>00004 <span class="comment">// Author: Ray Gilbert, John Labenski, J Winwood</span>
|
|
<a name="l00005"></a>00005 <span class="comment">// Created: 14/11/2001</span>
|
|
<a name="l00006"></a>00006 <span class="comment">// Copyright: (c) 2001-2002 Lomtick Software. All rights reserved.</span>
|
|
<a name="l00007"></a>00007 <span class="comment">// Licence: wxWidgets licence</span><span class="comment"></span>
|
|
<a name="l00008"></a>00008 <span class="comment">/////////////////////////////////////////////////////////////////////////////</span>
|
|
<a name="l00009"></a>00009 <span class="comment"></span>
|
|
<a name="l00010"></a>00010 <span class="preprocessor">#ifndef _WXLSTATE_H_</span>
|
|
<a name="l00011"></a>00011 <span class="preprocessor"></span><span class="preprocessor">#define _WXLSTATE_H_</span>
|
|
<a name="l00012"></a>00012 <span class="preprocessor"></span>
|
|
<a name="l00013"></a>00013 <span class="preprocessor">#include "<a class="code" href="wxldefs_8h.html">wxlua/include/wxldefs.h</a>"</span>
|
|
<a name="l00014"></a>00014 <span class="preprocessor">#include "<a class="code" href="wxlbind_8h.html">wxlua/include/wxlbind.h</a>"</span>
|
|
<a name="l00015"></a>00015 <span class="preprocessor">#include "wx/filefn.h"</span>
|
|
<a name="l00016"></a>00016 <span class="preprocessor">#include "wx/filename.h"</span>
|
|
<a name="l00017"></a>00017 <span class="preprocessor">#include "wx/hashmap.h"</span>
|
|
<a name="l00018"></a>00018
|
|
<a name="l00019"></a>00019 <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaEvent.html">wxLuaEvent</a>;
|
|
<a name="l00020"></a>00020 <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaState.html">wxLuaState</a>;
|
|
<a name="l00021"></a>00021 <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaStateData.html">wxLuaStateData</a>;
|
|
<a name="l00022"></a>00022 <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaStateRefData.html">wxLuaStateRefData</a>;
|
|
<a name="l00023"></a>00023 <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaEventCallback.html">wxLuaEventCallback</a>;
|
|
<a name="l00024"></a>00024 <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaWinDestroyCallback.html">wxLuaWinDestroyCallback</a>;
|
|
<a name="l00025"></a>00025
|
|
<a name="l00026"></a>00026 <span class="comment">// ----------------------------------------------------------------------------</span>
|
|
<a name="l00027"></a>00027 <span class="comment">// String functions - convert between Lua (ansi string) and wxString (encoded)</span>
|
|
<a name="l00028"></a>00028 <span class="comment">// ----------------------------------------------------------------------------</span>
|
|
<a name="l00029"></a>00029
|
|
<a name="l00030"></a><a class="code" href="wxlstate_8h.html#abd80fe6ccc47444afb6359291f50bf29">00030</a> <span class="preprocessor">#define WXLUA_USE_WXSTR_CONVCURRENT 1</span>
|
|
<a name="l00031"></a>00031 <span class="preprocessor"></span>
|
|
<a name="l00032"></a>00032 <span class="comment">// Convert a 8-bit ANSI C Lua String into a wxString</span>
|
|
<a name="l00033"></a><a class="code" href="wxlstate_8h.html#aaa3dbc7e667edd1e7409725fe338f4e8">00033</a> <span class="keyword">inline</span> <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxString <a class="code" href="wxlstate_8h.html#aaa3dbc7e667edd1e7409725fe338f4e8">lua2wx</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* luastr)
|
|
<a name="l00034"></a>00034 {
|
|
<a name="l00035"></a>00035 <span class="preprocessor">#if WXLUA_USE_WXSTR_CONVCURRENT</span>
|
|
<a name="l00036"></a>00036 <span class="preprocessor"></span>
|
|
<a name="l00037"></a>00037 <span class="keywordflow">if</span> (luastr == NULL) <span class="keywordflow">return</span> wxEmptyString; <span class="comment">// check for NULL</span>
|
|
<a name="l00038"></a>00038
|
|
<a name="l00039"></a>00039 <span class="keywordflow">return</span> wxString(luastr, *wxConvCurrent);
|
|
<a name="l00040"></a>00040
|
|
<a name="l00041"></a>00041 <span class="preprocessor">#else //!WXLUA_USE_WXSTR_CONVCURRENT</span>
|
|
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#if wxUSE_UNICODE</span>
|
|
<a name="l00043"></a>00043 <span class="preprocessor"></span> wxString str(luastr, wxConvUTF8);
|
|
<a name="l00044"></a>00044 <span class="preprocessor">#else</span>
|
|
<a name="l00045"></a>00045 <span class="preprocessor"></span> wxString str(wxConvUTF8.cMB2WC(luastr), *wxConvCurrent);
|
|
<a name="l00046"></a>00046 <span class="preprocessor">#endif // wxUSE_UNICODE</span>
|
|
<a name="l00047"></a>00047 <span class="preprocessor"></span>
|
|
<a name="l00048"></a>00048 <span class="keywordflow">if</span> (str.IsEmpty())
|
|
<a name="l00049"></a>00049 str = wxConvertMB2WX(luastr); <span class="comment">// old way that mostly works</span>
|
|
<a name="l00050"></a>00050
|
|
<a name="l00051"></a>00051 <span class="keywordflow">return</span> str;
|
|
<a name="l00052"></a>00052 <span class="preprocessor">#endif //WXLUA_USE_WXSTR_CONVCURRENT</span>
|
|
<a name="l00053"></a>00053 <span class="preprocessor"></span>}
|
|
<a name="l00054"></a>00054
|
|
<a name="l00055"></a>00055 <span class="comment">// Convert a wxString to 8-bit ANSI C Lua String</span>
|
|
<a name="l00056"></a><a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">00056</a> <span class="keyword">inline</span> <span class="keyword">const</span> <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxCharBuffer <a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(<span class="keyword">const</span> wxString& wxstr)
|
|
<a name="l00057"></a>00057 {
|
|
<a name="l00058"></a>00058 <span class="preprocessor">#if WXLUA_USE_WXSTR_CONVCURRENT</span>
|
|
<a name="l00059"></a>00059 <span class="preprocessor"></span> wxCharBuffer buffer(wxstr.mb_str(*wxConvCurrent));
|
|
<a name="l00060"></a>00060 <span class="keywordflow">return</span> buffer;
|
|
<a name="l00061"></a>00061
|
|
<a name="l00062"></a>00062 <span class="preprocessor">#else //!WXLUA_USE_WXSTR_CONVCURRENT</span>
|
|
<a name="l00063"></a>00063 <span class="preprocessor"></span> wxCharBuffer buffer(wxConvUTF8.cWC2MB(wxstr.wc_str(*wxConvCurrent))); <span class="comment">// skieu</span>
|
|
<a name="l00064"></a>00064
|
|
<a name="l00065"></a>00065 <span class="keywordflow">if</span> ((buffer.data() == NULL) && !wxstr.IsEmpty())
|
|
<a name="l00066"></a>00066 buffer = wxConvertWX2MB(wxstr.c_str()); <span class="comment">// old way that mostly works</span>
|
|
<a name="l00067"></a>00067
|
|
<a name="l00068"></a>00068 <span class="keywordflow">return</span> buffer;
|
|
<a name="l00069"></a>00069 <span class="preprocessor">#endif //WXLUA_USE_WXSTR_CONVCURRENT</span>
|
|
<a name="l00070"></a>00070 <span class="preprocessor"></span>}
|
|
<a name="l00071"></a>00071
|
|
<a name="l00072"></a>00072
|
|
<a name="l00073"></a>00073 <span class="comment">// Convert a wxString to 8-bit ANSI C Lua Buffer and store it</span>
|
|
<a name="l00074"></a><a class="code" href="classwxLuaCharBuffer.html">00074</a> <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaCharBuffer.html">wxLuaCharBuffer</a>
|
|
<a name="l00075"></a>00075 {
|
|
<a name="l00076"></a>00076 <span class="keyword">public</span>:
|
|
<a name="l00077"></a><a class="code" href="classwxLuaCharBuffer.html#a48b7cdcbcc02be7513ae17212c05e37c">00077</a> <a class="code" href="classwxLuaCharBuffer.html#a48b7cdcbcc02be7513ae17212c05e37c">wxLuaCharBuffer</a>(<span class="keyword">const</span> wxString &wxstr) : m_buffer(<a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(wxstr)) {}
|
|
<a name="l00078"></a>00078
|
|
<a name="l00079"></a><a class="code" href="classwxLuaCharBuffer.html#a27a6ba04d86b6ebefd310b9e3b001564">00079</a> <span class="keywordtype">size_t</span> <a class="code" href="classwxLuaCharBuffer.html#a27a6ba04d86b6ebefd310b9e3b001564">Length</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> strlen((<span class="keyword">const</span> <span class="keywordtype">char</span>*)m_buffer); }
|
|
<a name="l00080"></a><a class="code" href="classwxLuaCharBuffer.html#a10cddf8fb7f9eea348494ece843f20f6">00080</a> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="classwxLuaCharBuffer.html#a10cddf8fb7f9eea348494ece843f20f6">GetData</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<span class="keyword">const</span> <span class="keywordtype">char</span>*)m_buffer; }
|
|
<a name="l00081"></a>00081
|
|
<a name="l00082"></a><a class="code" href="classwxLuaCharBuffer.html#a7842f11bfc57b6d43f66935be1339fab">00082</a> <a class="code" href="classwxLuaCharBuffer.html#a7842f11bfc57b6d43f66935be1339fab">operator const char *</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_buffer; }
|
|
<a name="l00083"></a>00083
|
|
<a name="l00084"></a><a class="code" href="classwxLuaCharBuffer.html#ab488610cfc067f7f14294a579134fd4f">00084</a> wxCharBuffer m_buffer; <span class="comment">// member since non virtual destructor in wxCharBuffer</span>
|
|
<a name="l00085"></a>00085 };
|
|
<a name="l00086"></a>00086
|
|
<a name="l00087"></a>00087 <span class="comment">// ----------------------------------------------------------------------------</span>
|
|
<a name="l00088"></a>00088 <span class="comment">// Special keys used by wxLua in the LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00089"></a>00089 <span class="comment">//</span>
|
|
<a name="l00090"></a>00090 <span class="comment">// Note: We do not push a human readable string for these because Lua always</span>
|
|
<a name="l00091"></a>00091 <span class="comment">// makes a copy and hashes the string, this takes a considerable amount of</span>
|
|
<a name="l00092"></a>00092 <span class="comment">// time when benchmarked using valgrind.</span>
|
|
<a name="l00093"></a>00093 <span class="comment">// ----------------------------------------------------------------------------</span>
|
|
<a name="l00094"></a>00094
|
|
<a name="l00095"></a>00095 <span class="comment">// Light userdata used as keys in the Lua LUA_REGISTRYINDEX table for wxLua.</span>
|
|
<a name="l00096"></a>00096 <span class="comment">// Note that even though these keys have human readable names as values,</span>
|
|
<a name="l00097"></a>00097 <span class="comment">// they're not used, just the memory address.</span>
|
|
<a name="l00098"></a>00098
|
|
<a name="l00099"></a>00099 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a numerically keyed table indexed</span>
|
|
<a name="l00100"></a>00100 <span class="comment">// on the wxLua types where each item is a userdata metatable for a C++ class.</span>
|
|
<a name="l00101"></a>00101 <span class="comment">// Note: The wxLua types WXLUA_TXXX that correspond to the Lua LUA_TXXX types</span>
|
|
<a name="l00102"></a>00102 <span class="comment">// are not stored in this table since they do not use our metatables.</span>
|
|
<a name="l00103"></a>00103 <span class="comment">// The keys in this table are all > 1. They values are either tables or 0</span>
|
|
<a name="l00104"></a>00104 <span class="comment">// if the wxLuaBinding containing the wxLua type was not registered.</span>
|
|
<a name="l00105"></a>00105 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_types_key][wxLua type number] = { metatable for a C++ class }</span>
|
|
<a name="l00106"></a>00106 <span class="keyword">extern</span> <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a0ef6804bd2cb63f4fa705727f8871cbd">wxlua_lreg_types_key</a>;
|
|
<a name="l00107"></a>00107 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a numerically keyed table</span>
|
|
<a name="l00108"></a>00108 <span class="comment">// with references to Lua objects we want to keep a handle to. The object could be</span>
|
|
<a name="l00109"></a>00109 <span class="comment">// anything, a table, function, number, string, userdata...</span>
|
|
<a name="l00110"></a>00110 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_refs_key][ref number] = Lua object</span>
|
|
<a name="l00111"></a>00111 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#ac4ac0a3575fafde31e659ced85f69c4d">wxlua_lreg_refs_key</a>;
|
|
<a name="l00112"></a>00112 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a numerically keyed table</span>
|
|
<a name="l00113"></a>00113 <span class="comment">// with references to objects the wxLuaDebugData wants to keep a handle to by</span>
|
|
<a name="l00114"></a>00114 <span class="comment">// storing their value for lookup. It is used only for the wxLuaDebugData.</span>
|
|
<a name="l00115"></a>00115 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_debug_refs_key][ref number] = Lua object</span>
|
|
<a name="l00116"></a>00116 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a30c2d5556a4a278368b48fe0b7bb3fda">wxlua_lreg_debug_refs_key</a>;
|
|
<a name="l00117"></a>00117 <span class="comment">// The key that in the LUA_REGISTRYINDEX table that is a lookup table of string</span>
|
|
<a name="l00118"></a>00118 <span class="comment">// C++ classname keys and lightuserdata pointers to the associated wxLuaBindClass struct.</span>
|
|
<a name="l00119"></a>00119 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_debug_refs_key][wxLuaBindClass.name] = lightuserdata(&wxLuaBindClass)</span>
|
|
<a name="l00120"></a>00120 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a0bcf696ed6d6e2b4218e9a8852a164ef">wxlua_lreg_classes_key</a>;
|
|
<a name="l00121"></a>00121 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a table</span>
|
|
<a name="l00122"></a>00122 <span class="comment">// of Lua objects/functions assigned to wxLua userdata programatically in Lua.</span>
|
|
<a name="l00123"></a>00123 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_derivedmethods_key][lightuserdata(obj_ptr)] =</span>
|
|
<a name="l00124"></a>00124 <span class="comment">// {["derived func/value name"] = wxLuaObject(Lua function/value), ...}</span>
|
|
<a name="l00125"></a>00125 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a274b8b7aae6f647e3e69d098962b7b1d">wxlua_lreg_derivedmethods_key</a>;
|
|
<a name="l00126"></a>00126 <span class="comment">// The key in the LUA_REGISTRYINDEX table who's value is a lightuserdata</span>
|
|
<a name="l00127"></a>00127 <span class="comment">// of the wxLuaState for this lua_State.</span>
|
|
<a name="l00128"></a>00128 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_wxluastate_key] = lightuserdata(&wxLuaState)</span>
|
|
<a name="l00129"></a>00129 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a921299ed63513972e3bda3678fc835c0">wxlua_lreg_wxluastate_key</a>;
|
|
<a name="l00130"></a>00130 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a table of lightuserdata</span>
|
|
<a name="l00131"></a>00131 <span class="comment">// wxLuaBindings and the ref to the Lua table they were installed into.</span>
|
|
<a name="l00132"></a>00132 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_wxluabindings_key] = {lightuserdata(&wxLuaBinding) = wxlua_lreg_refs_key ref#, ...}</span>
|
|
<a name="l00133"></a>00133 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a80a0d4c84529abdcf6b46237431832ce">wxlua_lreg_wxluabindings_key</a>;
|
|
<a name="l00134"></a>00134 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a table of all</span>
|
|
<a name="l00135"></a>00135 <span class="comment">// objects that we've pushed into Lua using wxluaT_pushuserdatatype().</span>
|
|
<a name="l00136"></a>00136 <span class="comment">// Note: A single object like a wxWindow may be pushed with multiple wxLua types.</span>
|
|
<a name="l00137"></a>00137 <span class="comment">// e.g. wxWindow* w = wx.wxWindow() retrieve the window later from wxObject* wxEvent:GetEventObject()</span>
|
|
<a name="l00138"></a>00138 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_weakobjects_key][lightuserdata(obj_ptr)] =</span>
|
|
<a name="l00139"></a>00139 <span class="comment">// { wxLua type1 = weak fulluserdata, wxLua type2 = weak fulluserdata... }</span>
|
|
<a name="l00140"></a>00140 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#af255531a04d81a0d82556c0d1fe8e7e7">wxlua_lreg_weakobjects_key</a>;
|
|
<a name="l00141"></a>00141 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a table of all</span>
|
|
<a name="l00142"></a>00142 <span class="comment">// objects to delete that were added using wxluaO_addgcobject().</span>
|
|
<a name="l00143"></a>00143 <span class="comment">// Note that non wxObject classes use wxLUA_DECLARE_ENCAPSULATION so</span>
|
|
<a name="l00144"></a>00144 <span class="comment">// the key is the object pointer and the value is the wxObject encapsulation.</span>
|
|
<a name="l00145"></a>00145 <span class="comment">// Both the key and the value are the same if not encapsulated.</span>
|
|
<a name="l00146"></a>00146 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_gcobjects_key][lightuserdata(obj_ptr)] =</span>
|
|
<a name="l00147"></a>00147 <span class="comment">// lightuserdata(wxObject derived class)</span>
|
|
<a name="l00148"></a>00148 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a7ec5afec8a64a29e28fefec4a1105790">wxlua_lreg_gcobjects_key</a>;
|
|
<a name="l00149"></a>00149 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a table of all</span>
|
|
<a name="l00150"></a>00150 <span class="comment">// wxLuaEventCallbacks that we've created.</span>
|
|
<a name="l00151"></a>00151 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_evtcallbacks_key][lightuserdata(&wxLuaEventCallback)] =</span>
|
|
<a name="l00152"></a>00152 <span class="comment">// lightuserdata(&wxEvtHandler)</span>
|
|
<a name="l00153"></a>00153 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a034985fb7df51670c3b6a024329496fa">wxlua_lreg_evtcallbacks_key</a>;
|
|
<a name="l00154"></a>00154 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a table of wxWindow keys and</span>
|
|
<a name="l00155"></a>00155 <span class="comment">// wxLuaWinDestroyCallback values that we've created.</span>
|
|
<a name="l00156"></a>00156 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_windestroycallbacks_key][lightuserdata(&wxWindow)] =</span>
|
|
<a name="l00157"></a>00157 <span class="comment">// lightuserdata(wxLuaWinDestroyCallback)</span>
|
|
<a name="l00158"></a>00158 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#ae13b14073477671929c41823f198c33d">wxlua_lreg_windestroycallbacks_key</a>;
|
|
<a name="l00159"></a>00159 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a table of all</span>
|
|
<a name="l00160"></a>00160 <span class="comment">// top level wxWindows that we've created and need to destroy when closed.</span>
|
|
<a name="l00161"></a>00161 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_topwindows_key][lightuserdata(&wxWindow)] = 1</span>
|
|
<a name="l00162"></a>00162 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#aab2351a78a8949184e1910cc1f9e7463">wxlua_lreg_topwindows_key</a>;
|
|
<a name="l00163"></a>00163 <span class="comment">// The key in the LUA_REGISTRYINDEX table that has a boolean value</span>
|
|
<a name="l00164"></a>00164 <span class="comment">// of whether the Lua code has prepended a '_' to function name to indicate</span>
|
|
<a name="l00165"></a>00165 <span class="comment">// that they want the base class function called.</span>
|
|
<a name="l00166"></a>00166 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_callbaseclassfunc_key] = true/false</span>
|
|
<a name="l00167"></a>00167 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a91d0a86787b3a1de5921590ce6a0b3e8">wxlua_lreg_callbaseclassfunc_key</a>;
|
|
<a name="l00168"></a>00168 <span class="comment">// The key in the LUA_REGISTRYINDEX table that has a wxEventType (integer) value</span>
|
|
<a name="l00169"></a>00169 <span class="comment">// of the current wxEvent is that is being run or wxEVT_NULL if not in an event.</span>
|
|
<a name="l00170"></a>00170 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_wxeventtype_key] = wxEventType (wxEVT_NULL)</span>
|
|
<a name="l00171"></a>00171 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#af24ccc441c899b3028cfc5d4099c739a">wxlua_lreg_wxeventtype_key</a>;
|
|
<a name="l00172"></a>00172 <span class="comment">// The key in the LUA_REGISTRYINDEX table that has a wxLuaStateData class</span>
|
|
<a name="l00173"></a>00173 <span class="comment">// lightuserdata value for the wxLuaState.</span>
|
|
<a name="l00174"></a>00174 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_wxluastatedata_key] = lightuserdata(&wxLuaStateData)</span>
|
|
<a name="l00175"></a>00175 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#aba1ad42faf08e4b50bca48b5ba9d8ece">wxlua_lreg_wxluastatedata_key</a>;
|
|
<a name="l00176"></a>00176 <span class="comment">// The key in the LUA_REGISTRYINDEX table that is a weak keyed table of</span>
|
|
<a name="l00177"></a>00177 <span class="comment">// the tables wxLua pushed into the registry with their keys as values.</span>
|
|
<a name="l00178"></a>00178 <span class="comment">// This is used by the wxLuaDebugData to know if the table is one of the wxLua</span>
|
|
<a name="l00179"></a>00179 <span class="comment">// registry tables for better wxLuaStackDialog performance.</span>
|
|
<a name="l00180"></a>00180 <span class="comment">// LUA_REGISTRYINDEX[&wxlua_lreg_regtable_key][weak {wxlua_lreg_XXX_key table}] =</span>
|
|
<a name="l00181"></a>00181 <span class="comment">// lightuserdata(&wxlua_lreg_XXX_key)</span>
|
|
<a name="l00182"></a>00182 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#ab84cb2515893ab069d7d165208e68aad">wxlua_lreg_regtable_key</a>;
|
|
<a name="l00183"></a>00183
|
|
<a name="l00184"></a>00184 <span class="comment">// Light userdata used as keys in the metatables created for the class userdata objects.</span>
|
|
<a name="l00185"></a>00185 <span class="comment">// Note that even though these keys have values, they're not used, just the memory address.</span>
|
|
<a name="l00186"></a>00186
|
|
<a name="l00187"></a>00187 <span class="comment">// wxLua userdata metatable structure:</span>
|
|
<a name="l00188"></a>00188 <span class="comment">// {</span>
|
|
<a name="l00189"></a>00189 <span class="comment">// lightuserdata(&wxlua_metatable_type_key) = wxLua type number in wxlua_lreg_types_key table</span>
|
|
<a name="l00190"></a>00190 <span class="comment">// lightuserdata(&wxlua_metatable_wxluabindclass_key) = lightuserdata(&wxLuaBindClass)</span>
|
|
<a name="l00191"></a>00191 <span class="comment">// __gc = function(wxlua_wxLuaBindClass__gc)</span>
|
|
<a name="l00192"></a>00192 <span class="comment">// __index = function(wxlua_wxLuaBindClass__index)</span>
|
|
<a name="l00193"></a>00193 <span class="comment">// __newindex = function(wxlua_wxLuaBindClass__newindex)</span>
|
|
<a name="l00194"></a>00194 <span class="comment">// __tostring = function(wxlua_wxLuaBindClass__tostring)</span>
|
|
<a name="l00195"></a>00195 <span class="comment">// }</span>
|
|
<a name="l00196"></a>00196
|
|
<a name="l00197"></a>00197 <span class="comment">// The key of a metatable used for wxLua userdata that is the wxLua type number in the</span>
|
|
<a name="l00198"></a>00198 <span class="comment">// wxlua_lreg_types_key table this metatable is for.</span>
|
|
<a name="l00199"></a>00199 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a663c0f4ffbb1923edf3055b4c8c81ff9">wxlua_metatable_type_key</a>;
|
|
<a name="l00200"></a>00200 <span class="comment">// The key of a metatable used for wxLua userdata that stores a lightuserdata</span>
|
|
<a name="l00201"></a>00201 <span class="comment">// of the wxLuaBindClass struct for this class.</span>
|
|
<a name="l00202"></a>00202 extern <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(const <span class="keywordtype">char</span>*) <a class="code" href="wxlstate_8h.html#a8719cfeea23ebd1cb309de8296777da6">wxlua_metatable_wxluabindclass_key</a>;
|
|
<a name="l00203"></a>00203
|
|
<a name="l00204"></a>00204 <span class="comment">// ----------------------------------------------------------------------------</span>
|
|
<a name="l00205"></a>00205 <span class="comment">// Create one of the wxlua_lreg_XXX_key tables in the LUA_REGISTRYINDEX and</span>
|
|
<a name="l00206"></a>00206 <span class="comment">// properly set the wxlua_lreg_regtablekey_key too.</span>
|
|
<a name="l00207"></a>00207 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> <a class="code" href="wxlstate_8h.html#a78fe2540c7e61145be1372073f0c37f7">wxlua_lreg_createtable</a>(lua_State* L, <span class="keywordtype">void</span>* lightuserdata_reg_key, <span class="keywordtype">int</span> narr = 0, <span class="keywordtype">int</span> nrec = 0);
|
|
<a name="l00208"></a>00208
|
|
<a name="l00209"></a>00209 <span class="comment">// ----------------------------------------------------------------------------</span>
|
|
<a name="l00210"></a>00210 <span class="comment">// The functions below are Lua C helper functions, some are also part of the wxLuaState</span>
|
|
<a name="l00211"></a>00211 <span class="comment">// and you are recommended to use those if the wxLuaState is required. However</span>
|
|
<a name="l00212"></a>00212 <span class="comment">// in some cases it may not be necessary to create a wxLuaState and just</span>
|
|
<a name="l00213"></a>00213 <span class="comment">// calling these functions will suffice. Only the functions that do not</span>
|
|
<a name="l00214"></a>00214 <span class="comment">// require the internal data from the wxLuaState are separated here.</span>
|
|
<a name="l00215"></a>00215 <span class="comment">// ----------------------------------------------------------------------------</span>
|
|
<a name="l00216"></a>00216
|
|
<a name="l00217"></a>00217 <span class="comment">// Translate the LUA_ERRXXX integers into a human readable string.</span>
|
|
<a name="l00218"></a>00218 <span class="comment">// returns an empty string for an input of 0.</span>
|
|
<a name="l00219"></a>00219 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxString <a class="code" href="wxlstate_8h.html#ab2ae5dfea9cc867ed46ed094ce4e768f">wxlua_LUA_ERR_msg</a>(<span class="keywordtype">int</span> LUA_ERRx);
|
|
<a name="l00220"></a>00220
|
|
<a name="l00221"></a>00221 <span class="comment">// Get information from the return value of lua_pcall(), luaL_loadbuffer(), etc</span>
|
|
<a name="l00222"></a>00222 <span class="comment">// The errMsg input is filled with wxlua_LUA_ERR_msg() and if the current top</span>
|
|
<a name="l00223"></a>00223 <span class="comment">// is > than top it tries to get Lua's error string from the top of the stack.</span>
|
|
<a name="l00224"></a>00224 <span class="comment">// Returns true if the input status != 0 and the errMsg and line_num are filled.</span>
|
|
<a name="l00225"></a>00225 <span class="comment">// If errMsg and line_num aren't NULL then fill them with the msg and line.</span>
|
|
<a name="l00226"></a>00226 <span class="comment">// status is the return from lua_pcall(), luaL_loadbuffer(), etc, LUA_ERRxxx</span>
|
|
<a name="l00227"></a>00227 <span class="comment">// top is the lua_gettop from before the call that may have generated the error.</span>
|
|
<a name="l00228"></a>00228 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> <a class="code" href="wxlstate_8h.html#a34d4dc64c6615a3e7c4fea5f6fb5840f">wxlua_errorinfo</a>(lua_State* L, <span class="keywordtype">int</span> status, <span class="keywordtype">int</span> top, wxString* errMsg = NULL, <span class="keywordtype">int</span>* line_num = NULL);
|
|
<a name="l00229"></a>00229
|
|
<a name="l00230"></a>00230
|
|
<a name="l00231"></a>00231 <span class="comment">// Push the errorMsg on the stack and call luaL_error()</span>
|
|
<a name="l00232"></a>00232 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#a1abe07e896f1e813fc28da0e0d92961a">wxlua_error</a>(lua_State* L, const <span class="keywordtype">char</span>* errorMsg);
|
|
<a name="l00233"></a>00233 <a class="code" href="wxldefs_8h.html#a8b866331c104bad29e0e711e5279f717">wxLUA_UNICODE_ONLY</a>(<a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> inline <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#a1abe07e896f1e813fc28da0e0d92961a">wxlua_error</a>(lua_State* L, const wxString& errorMsg) { <a class="code" href="wxlstate_8h.html#a1abe07e896f1e813fc28da0e0d92961a">wxlua_error</a>(L, <a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(errorMsg)); })
|
|
<a name="l00234"></a>00234
|
|
<a name="l00235"></a>00235 <span class="comment">// Create an error message that the item at the stack_idx is not correct for a</span>
|
|
<a name="l00236"></a>00236 <span class="comment">// function call and call wxlua_argerrormsg().</span>
|
|
<a name="l00237"></a>00237 <span class="comment">// The expectedType string should tell the user what is valid input and is a</span>
|
|
<a name="l00238"></a>00238 <span class="comment">// string to be flexible for multiple valid types.</span>
|
|
<a name="l00239"></a>00239 <span class="comment">// The error message format is:</span>
|
|
<a name="l00240"></a>00240 <span class="comment">// "wxLua: Expected %s for parameter %d, but got a '%s'.", expectedType.c_str(), stack_idx, argType.c_str()</span>
|
|
<a name="l00241"></a>00241 <span class="comment">// Typical expectedType strings would be wxT("a 'number'")</span>
|
|
<a name="l00242"></a>00242 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#aba05dfc5f8a48e264d7463a7c6fee965">wxlua_argerror</a>(lua_State *L, <span class="keywordtype">int</span> stack_idx, <span class="keyword">const</span> wxString& expectedType);
|
|
<a name="l00243"></a>00243 <span class="comment">// Create an error message for an incorrect function call and call wxlua_error().</span>
|
|
<a name="l00244"></a>00244 <span class="comment">// The message created has this format:</span>
|
|
<a name="l00245"></a>00245 <span class="comment">// msg</span>
|
|
<a name="l00246"></a>00246 <span class="comment">// "functionNameCalled(argName1, argName2, ...)" <-- from wxlua_getLuaArgsMsg()</span>
|
|
<a name="l00247"></a>00247 <span class="comment">// "01. functionName(validArgName1, validArgName2, ...)" <-- from wxlua_getBindMethodArgsMsg()</span>
|
|
<a name="l00248"></a>00248 <span class="comment">// "02. ..."</span>
|
|
<a name="l00249"></a>00249 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#a34376827e7b3466173127fba976217d0">wxlua_argerrormsg</a>(lua_State *L, <span class="keyword">const</span> wxString& msg);
|
|
<a name="l00250"></a>00250
|
|
<a name="l00251"></a>00251 <span class="comment">// Get the userdata at the stack index, if null_ptr then set the pointer wrapped</span>
|
|
<a name="l00252"></a>00252 <span class="comment">// by Lua's userdata to NULL to clear it.</span>
|
|
<a name="l00253"></a>00253 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span>* LUACALL <a class="code" href="wxlstate_8h.html#ac5a0a65665274df59adbed667480e93e">wxlua_touserdata</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">bool</span> null_ptr = <span class="keyword">false</span>);
|
|
<a name="l00254"></a>00254
|
|
<a name="l00255"></a>00255 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00256"></a>00256 <span class="comment">// wxluaR_XXX - functions operate on the tables in Lua's LUA_REGISTRYINDEX which</span>
|
|
<a name="l00257"></a>00257 <span class="comment">// are keyed on lightuserdata that use the luaL_ref() integer reference mechanism</span>
|
|
<a name="l00258"></a>00258 <span class="comment">// to store objects. The 'R' stands for Registry or Reference.</span>
|
|
<a name="l00259"></a>00259 <span class="comment">//</span>
|
|
<a name="l00260"></a>00260 <span class="comment">// Possible values for the "void* lightuserdata_reg_key" are</span>
|
|
<a name="l00261"></a>00261 <span class="comment">// &wxlua_lreg_types_key, &wxlua_lreg_refs_key, &wxlua_lreg_debug_refs_key</span>
|
|
<a name="l00262"></a>00262 <span class="comment">// unless you are using these functions for your own table in the LUA_REGISTRYINDEX.</span>
|
|
<a name="l00263"></a>00263 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00264"></a>00264
|
|
<a name="l00265"></a>00265 <span class="comment">// Create a reference to the object at stack index in a table with the key</span>
|
|
<a name="l00266"></a>00266 <span class="comment">// lightuserdata_reg_key in the LUA_REGISTRYINDEX table. Does not pop the object.</span>
|
|
<a name="l00267"></a>00267 <span class="comment">// Returns the table index or LUA_REFNIL if the item on the stack is none or nil (an error).</span>
|
|
<a name="l00268"></a>00268 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#acbf0a32ad4b828026bd7f643557646d0">wxluaR_ref</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">void</span>* lightuserdata_reg_key);
|
|
<a name="l00269"></a>00269 <span class="comment">// Remove a reference to the object at the index in a table with the key</span>
|
|
<a name="l00270"></a>00270 <span class="comment">// lightuserdata_reg_key in the LUA_REGISTRYINDEX table, returns success.</span>
|
|
<a name="l00271"></a>00271 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a0578d177f35b4dd05177067425410009">wxluaR_unref</a>(lua_State* L, <span class="keywordtype">int</span> wxlref_idx, <span class="keywordtype">void</span>* lightuserdata_reg_key);
|
|
<a name="l00272"></a>00272 <span class="comment">// Push onto the top of the stack the object at the index in a table with the key</span>
|
|
<a name="l00273"></a>00273 <span class="comment">// lightuserdata_reg_key in the LUA_REGISTRYINDEX table, if the index is LUA_REFNIL or the</span>
|
|
<a name="l00274"></a>00274 <span class="comment">// value is nil it returns false and doesn't leave anything on the stack.</span>
|
|
<a name="l00275"></a>00275 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#ae7108b396d79179f517a7dc478c2cb43">wxluaR_getref</a>(lua_State* L, <span class="keywordtype">int</span> wxlref_idx, <span class="keywordtype">void</span>* lightuserdata_reg_key);
|
|
<a name="l00276"></a>00276 <span class="comment">// Is the item at the stack_idx in the table with the key lightuserdata_reg_key</span>
|
|
<a name="l00277"></a>00277 <span class="comment">// in the LUA_REGISTRYINDEX table. Returns the ref index or LUA_NOREF if it's not.</span>
|
|
<a name="l00278"></a>00278 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a982adf5274da2c4c7ea0411751a0e143">wxluaR_isrefed</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">void</span>* lightuserdata_reg_key);
|
|
<a name="l00279"></a>00279
|
|
<a name="l00280"></a>00280 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00281"></a>00281 <span class="comment">// wxluaO_XXX - functions operate on wxLua "Objects" which are userdata wrapping</span>
|
|
<a name="l00282"></a>00282 <span class="comment">// C++ class objects and are stored in the wxlua_lreg_weakobjects_key</span>
|
|
<a name="l00283"></a>00283 <span class="comment">// and the wxlua_lreg_gcobjects_key table in the LUA_REGISTRYINDEX.</span>
|
|
<a name="l00284"></a>00284 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00285"></a>00285
|
|
<a name="l00286"></a><a class="code" href="wxlstate_8h.html#a29f0120153918cc4e7b7b91913b0bef1">00286</a> <span class="keyword">enum</span> <a class="code" href="wxlstate_8h.html#a29f0120153918cc4e7b7b91913b0bef1">wxLuaGCObject_Flags</a>
|
|
<a name="l00287"></a>00287 {
|
|
<a name="l00288"></a><a class="code" href="wxlstate_8h.html#a29f0120153918cc4e7b7b91913b0bef1a955e0cb5738d3e7a9c7ce61a30169b02">00288</a> <a class="code" href="wxlstate_8h.html#a29f0120153918cc4e7b7b91913b0bef1a955e0cb5738d3e7a9c7ce61a30169b02">WXLUA_DELETE_OBJECT_LAST</a> = 0x0000, <span class="comment">// Delete the object only if this is the</span>
|
|
<a name="l00289"></a>00289 <span class="comment">// last userdata referece to it.</span>
|
|
<a name="l00290"></a>00290
|
|
<a name="l00291"></a><a class="code" href="wxlstate_8h.html#a29f0120153918cc4e7b7b91913b0bef1ade247b3e5ef9e545a9512ebaefa1bab8">00291</a> <a class="code" href="wxlstate_8h.html#a29f0120153918cc4e7b7b91913b0bef1ade247b3e5ef9e545a9512ebaefa1bab8">WXLUA_DELETE_OBJECT_ALL</a> = 0x0001, <span class="comment">// Delete the object and clear all</span>
|
|
<a name="l00292"></a>00292 <span class="comment">// userdata references to it.</span>
|
|
<a name="l00293"></a>00293 };
|
|
<a name="l00294"></a>00294
|
|
<a name="l00295"></a>00295 <span class="comment">// Track this wxObject and delete it when Lua calls the __gc method for it.</span>
|
|
<a name="l00296"></a>00296 <span class="comment">// The object is stored in the wxlua_lreg_gcobjects_key of the LUA_REGISTRYINDEX.</span>
|
|
<a name="l00297"></a>00297 <span class="comment">// The second version is used when a non-wxObject class is encapsulated and</span>
|
|
<a name="l00298"></a>00298 <span class="comment">// the obj_ptr points to the actual object that the wxObject encapsulates.</span>
|
|
<a name="l00299"></a>00299 <span class="comment">// Note that the lua userdata internal pointer is the obj_ptr and the</span>
|
|
<a name="l00300"></a>00300 <span class="comment">// wxobj is *only* stored in the wxlua_lreg_gcobjects_key.</span>
|
|
<a name="l00301"></a>00301 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#a0f23c00339db80dbf392740133c531aa">wxluaO_addgcobject</a>(lua_State* L, wxObject* wxobj);
|
|
<a name="l00302"></a>00302 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#a0f23c00339db80dbf392740133c531aa">wxluaO_addgcobject</a>(lua_State* L, <span class="keywordtype">void</span>* obj_ptr, wxObject* wxobj);
|
|
<a name="l00303"></a>00303 <span class="comment">// Remove this obj_ptr wrapped in a Lua userdata, udata, from the</span>
|
|
<a name="l00304"></a>00304 <span class="comment">// wxlua_lreg_gcobjects_key table of the LUA_REGISTRYINDEX.</span>
|
|
<a name="l00305"></a>00305 <span class="comment">// It is deleted depending on the flags enum wxLuaGCObject_Flags.</span>
|
|
<a name="l00306"></a>00306 <span class="comment">// If flags = WXLUA_DELETE_OBJECT_ALL or if this is the last userdata it will also remove all</span>
|
|
<a name="l00307"></a>00307 <span class="comment">// wxlua_lreg_weakobjects_key and wxlua_lreg_derivedmethods_key since the object is gone.</span>
|
|
<a name="l00308"></a>00308 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#aba83aa14c215deca6e72da965f29c4a4">wxluaO_deletegcobject</a>(lua_State *L, <span class="keywordtype">void</span>* udata, <span class="keywordtype">void</span> *obj_ptr, <span class="keywordtype">int</span> flags);
|
|
<a name="l00309"></a>00309 <span class="comment">// Remove this obj_ptr from the wxlua_lreg_gcobjects_key table of the</span>
|
|
<a name="l00310"></a>00310 <span class="comment">// LUA_REGISTRYINDEX. The Lua userdata for the object stays in Lua and it's</span>
|
|
<a name="l00311"></a>00311 <span class="comment">// assumed that someone else will delete the object (took ownership of it).</span>
|
|
<a name="l00312"></a>00312 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#afaaa576936abb264f61d78633b74f528">wxluaO_undeletegcobject</a>(lua_State *L, <span class="keywordtype">void</span> *obj_ptr);
|
|
<a name="l00313"></a>00313 <span class="comment">// Check if this obj_ptr is in the wxlua_lreg_gcobjects_key table of the</span>
|
|
<a name="l00314"></a>00314 <span class="comment">// LUA_REGISTRYINDEX.</span>
|
|
<a name="l00315"></a>00315 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a10a0351ed2d2abe300bf0e5db307cdd0">wxluaO_isgcobject</a>(lua_State *L, <span class="keywordtype">void</span> *obj_ptr);
|
|
<a name="l00316"></a>00316 <span class="comment">// Get a wxArrayString of the info in the wxlua_lreg_gcobjects_key LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00317"></a>00317 <span class="comment">// Strings are of the form "ClassName(&obj)"</span>
|
|
<a name="l00318"></a>00318 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxArrayString LUACALL <a class="code" href="wxlstate_8h.html#a1731f8112f747955ec5f3c15232429ba">wxluaO_getgcobjectinfo</a>(lua_State *L);
|
|
<a name="l00319"></a>00319
|
|
<a name="l00320"></a>00320 <span class="comment">// Track the obj_ptr and its Lua userdata at udata_stack_idx which is of the</span>
|
|
<a name="l00321"></a>00321 <span class="comment">// wxLua type in the wxlua_lreg_weakobjects_key table of the</span>
|
|
<a name="l00322"></a>00322 <span class="comment">// LUA_REGISTRYINDEX so we can push it again if needed.</span>
|
|
<a name="l00323"></a>00323 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#a877ac3a3e719283fbf39f4887daeb928">wxluaO_trackweakobject</a>(lua_State *L, <span class="keywordtype">int</span> udata_stack_idx, <span class="keywordtype">void</span> *obj_ptr, <span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00324"></a>00324 <span class="comment">// Remove the obj_ptr key from the wxlua_lreg_weakobjects_key table of</span>
|
|
<a name="l00325"></a>00325 <span class="comment">// the LUA_REGISTRYINDEX. It removes the metatable for the single Lua userdata,</span>
|
|
<a name="l00326"></a>00326 <span class="comment">// "udata", since this function is called before the object is deleted.</span>
|
|
<a name="l00327"></a>00327 <span class="comment">// e.g. p1 = wx.wxPoint(); p2 = p1; p2:delete(); p1:SetX(5) errors, but doesn't segfault.</span>
|
|
<a name="l00328"></a>00328 <span class="comment">// If udata == NULL it removes ALL tracked userdata for this obj_ptr and clears</span>
|
|
<a name="l00329"></a>00329 <span class="comment">// all of their metatables.</span>
|
|
<a name="l00330"></a>00330 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a76fa03ffe7ba99804c524d86e17260db">wxluaO_untrackweakobject</a>(lua_State *L, <span class="keywordtype">void</span>* udata, <span class="keywordtype">void</span> *obj_ptr);
|
|
<a name="l00331"></a>00331 <span class="comment">// Check if this object with the given wxLua type is in the wxlua_lreg_weakobjects_key</span>
|
|
<a name="l00332"></a>00332 <span class="comment">// table of the LUA_REGISTRYINDEX.</span>
|
|
<a name="l00333"></a>00333 <span class="comment">// If the object is found with the right wxLua type and push_on_stack is true</span>
|
|
<a name="l00334"></a>00334 <span class="comment">// the Lua userdata for the object is pushed on top of the stack. If it's not</span>
|
|
<a name="l00335"></a>00335 <span class="comment">// found then it returns false and nothing is left on the stack.</span>
|
|
<a name="l00336"></a>00336 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a1c0abab7b240281334eea23ce5cd5b94">wxluaO_istrackedweakobject</a>(lua_State *L, <span class="keywordtype">void</span> *obj_ptr, <span class="keywordtype">int</span> wxl_type, <span class="keywordtype">bool</span> push_on_stack);
|
|
<a name="l00337"></a>00337 <span class="comment">// Get a wxArrayString of the info in the wxlua_lreg_weakobjects_key LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00338"></a>00338 <span class="comment">// Strings are of the form "&obj_ptr = wxLuaTypeName1(&udata, type=wxLuaType), ..."</span>
|
|
<a name="l00339"></a>00339 <span class="comment">// If the object is casted to multiple types there will be wxLuaTypeName2(...) and so on.</span>
|
|
<a name="l00340"></a>00340 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxArrayString LUACALL <a class="code" href="wxlstate_8h.html#ad0f4e44fbd25af4537a7fe708f6736b1">wxluaO_gettrackedweakobjectinfo</a>(lua_State *L);
|
|
<a name="l00341"></a>00341
|
|
<a name="l00342"></a>00342 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00343"></a>00343 <span class="comment">// wxluaW_XXX - functions operate on tracked wxWindows stored in the</span>
|
|
<a name="l00344"></a>00344 <span class="comment">// wxlua_lreg_topwindows_key in Lua's LUA_REGISTRYINDEX.</span>
|
|
<a name="l00345"></a>00345 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00346"></a>00346
|
|
<a name="l00347"></a>00347 <span class="comment">// Add the wxObject which is presumably a wxWindow (this function checks)</span>
|
|
<a name="l00348"></a>00348 <span class="comment">// to the wxlua_lreg_topwindows_key table of the LUA_REGISTRYINDEX table if</span>
|
|
<a name="l00349"></a>00349 <span class="comment">// it has not already been added.</span>
|
|
<a name="l00350"></a>00350 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#a6acba6e5567b9a9c3d3e90f6fdb42456">wxluaW_addtrackedwindow</a>(lua_State *L, wxObject* wxobj);
|
|
<a name="l00351"></a>00351 <span class="comment">// Remove the wxWindow from the wxlua_lreg_topwindows_key table of the</span>
|
|
<a name="l00352"></a>00352 <span class="comment">// LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00353"></a>00353 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#af1bf3244574d51336b5efb38479c103f">wxluaW_removetrackedwindow</a>(lua_State *L, wxWindow* win);
|
|
<a name="l00354"></a>00354 <span class="comment">// Is this wxWindow or one of its parents already added to the</span>
|
|
<a name="l00355"></a>00355 <span class="comment">// wxlua_lreg_topwindows_key table of the LUA_REGISTRYINDEX table?</span>
|
|
<a name="l00356"></a>00356 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a1ea46fab0293690fb38fb3cee9ffccd0">wxluaW_istrackedwindow</a>(lua_State *L, wxWindow* win, <span class="keywordtype">bool</span> check_parents);
|
|
<a name="l00357"></a>00357 <span class="comment">// Get a wxArrayString of the info in the wxlua_lreg_topwindows_key LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00358"></a>00358 <span class="comment">// Strings are of the form "ClassName(&win id=wxWindowID)"</span>
|
|
<a name="l00359"></a>00359 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxArrayString LUACALL <a class="code" href="wxlstate_8h.html#affb2d1ff4f80af7ac7bb6a39ea15a70d">wxluaW_gettrackedwindowinfo</a>(lua_State *L);
|
|
<a name="l00360"></a>00360
|
|
<a name="l00361"></a>00361 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00362"></a>00362 <span class="comment">// wxluaT_XXX - functions operate on wxLua types which are integers.</span>
|
|
<a name="l00363"></a>00363 <span class="comment">// wxLua types for C++ classes are positive and the userdata metatables are</span>
|
|
<a name="l00364"></a>00364 <span class="comment">// stored in the wxlua_lreg_types_key table in Lua's LUA_REGISTRYINDEX.</span>
|
|
<a name="l00365"></a>00365 <span class="comment">// wxLua types matching LUA_TXXX types are negative, see WXLUA_TXXX.</span>
|
|
<a name="l00366"></a>00366 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00367"></a>00367
|
|
<a name="l00368"></a>00368 <span class="comment">// Allocate a new table (a metatable for a userdata) with a</span>
|
|
<a name="l00369"></a>00369 <span class="comment">// wxlua_metatable_type_key key equal to the input wxl_type and</span>
|
|
<a name="l00370"></a>00370 <span class="comment">// store it in the wxlua_lreg_types_key LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00371"></a>00371 <span class="comment">// Returns the index into the wxLua types table which is a new wxLua type.</span>
|
|
<a name="l00372"></a>00372 <span class="comment">// Leaves the new table on the top of the stack.</span>
|
|
<a name="l00373"></a>00373 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a6e860df2af8f36918348b8b92abfbfb4">wxluaT_newmetatable</a>(lua_State* L, <span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00374"></a>00374 <span class="comment">// Get the metatable for the wxLua type stored in the</span>
|
|
<a name="l00375"></a>00375 <span class="comment">// wxlua_lreg_types_key LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00376"></a>00376 <span class="comment">// Returns true if the type's metatable was found and is on the stack, nothing</span>
|
|
<a name="l00377"></a>00377 <span class="comment">// is left on the stack on failure.</span>
|
|
<a name="l00378"></a>00378 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#ae9010018526dd75ae4cb8571b8956fa5">wxluaT_getmetatable</a>(lua_State* L, <span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00379"></a>00379 <span class="comment">// Set the metatable of the userdata at top of stack to the table stored in the</span>
|
|
<a name="l00380"></a>00380 <span class="comment">// wxlua_lreg_types_key LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00381"></a>00381 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a5fb71259953328a8fd54939518cbe455">wxluaT_setmetatable</a>(lua_State* L, <span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00382"></a>00382
|
|
<a name="l00383"></a>00383 <span class="comment">// Get the numeric wxLua type of the item at the stack index.</span>
|
|
<a name="l00384"></a>00384 <span class="comment">// This is the wxLua equivalent of lua_type() but instead of returning</span>
|
|
<a name="l00385"></a>00385 <span class="comment">// LUA_TXXX it returns WXLUA_TXXX for standard types.</span>
|
|
<a name="l00386"></a>00386 <span class="comment">// If the object is a userdata it checks the metatable for the</span>
|
|
<a name="l00387"></a>00387 <span class="comment">// wxlua_metatable_type_key to get the wxLua type where the type is</span>
|
|
<a name="l00388"></a>00388 <span class="comment">// presumedly the index into the wxlua_lreg_types_key of the LUA_REGISTRYINDEX</span>
|
|
<a name="l00389"></a>00389 <span class="comment">// table and denotes what type of C++ object this is.</span>
|
|
<a name="l00390"></a>00390 <span class="comment">// Returns WXLUA_TUNKNOWN on failure.</span>
|
|
<a name="l00391"></a>00391 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a212261fffa8066de870a4cdb969d5180">wxluaT_type</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00392"></a>00392
|
|
<a name="l00393"></a>00393 <span class="comment">// Get a human readable name for the predefined WXLUA_TXXX or binding</span>
|
|
<a name="l00394"></a>00394 <span class="comment">// wxluatype_XXX wxLua types stored in the wxlua_lreg_types_key</span>
|
|
<a name="l00395"></a>00395 <span class="comment">// of the LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00396"></a>00396 <span class="comment">// This is the wxLua equivalent of lua_typename(L, luatype).</span>
|
|
<a name="l00397"></a>00397 <span class="comment">// If the lua_State is not NULL then if the type is a wxLua type for classes</span>
|
|
<a name="l00398"></a>00398 <span class="comment">// return the C++ class/struct name.</span>
|
|
<a name="l00399"></a>00399 <span class="comment">// Returns empty string if the type is unknown.</span>
|
|
<a name="l00400"></a>00400 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxString LUACALL <a class="code" href="wxlstate_8h.html#a6621fa5a456448acfd515112aa7b23e1">wxluaT_typename</a>(lua_State* L, <span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00401"></a>00401 <span class="comment">// Get a human readable name for the item at the stack index.</span>
|
|
<a name="l00402"></a>00402 <span class="comment">// This is the wxLua equivalent of luaL_typename(L, stack_idx).</span>
|
|
<a name="l00403"></a>00403 <span class="comment">// This function calls wxluaT_typename(L, wxluaT_type(L, stack_idx)) and is a</span>
|
|
<a name="l00404"></a>00404 <span class="comment">// convenience function.</span>
|
|
<a name="l00405"></a>00405 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxString LUACALL <a class="code" href="wxlstate_8h.html#a3d22f924c535006b6202120af11939ae">wxluaT_gettypename</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00406"></a>00406 <span class="comment">// Get the luaL_typename(L, stack_idx) == lua_typename(lua_type(L, stack_idx)) as a wxString.</span>
|
|
<a name="l00407"></a>00407 <span class="comment">// Returns one of the LUA_TXXX values.</span>
|
|
<a name="l00408"></a>00408 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxString LUACALL <a class="code" href="wxlstate_8h.html#acf6d708626f3c7194d1f2aebb7a73b6e">wxlua_luaL_typename</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00409"></a>00409
|
|
<a name="l00410"></a>00410 <span class="comment">// Get the wxLua type for the class or struct with the given name</span>
|
|
<a name="l00411"></a>00411 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a44d205938ab4c0eaacaea1d58face217">wxluaT_gettype</a>(lua_State* L, <span class="keyword">const</span> <span class="keywordtype">char</span>* name);
|
|
<a name="l00412"></a>00412 <span class="comment">// Get the wxLuaBindClass* for this wxLua type or NULL if the type is invalid.</span>
|
|
<a name="l00413"></a>00413 <span class="comment">// Gets the wxLuaBindClass from the metatable stored in the wxlua_lreg_types_key registry table</span>
|
|
<a name="l00414"></a>00414 <span class="comment">// for the classes that have been installed into Lua.</span>
|
|
<a name="l00415"></a>00415 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keyword">const</span> <a class="code" href="structwxLuaBindClass.html">wxLuaBindClass</a>* LUACALL <a class="code" href="wxlstate_8h.html#a4a7a8f2cc1d3b1ba337295b6d02ab97f">wxluaT_getclass</a>(lua_State* L, <span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00416"></a>00416 <span class="comment">// Get the wxLuaBindClass* for this class_name or NULL if the name is invalid.</span>
|
|
<a name="l00417"></a>00417 <span class="comment">// Gets the wxLuaBindClass from the wxlua_lreg_classes_key table in the LUA_REGISTRYINDEX.</span>
|
|
<a name="l00418"></a>00418 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keyword">const</span> <a class="code" href="structwxLuaBindClass.html">wxLuaBindClass</a>* LUACALL <a class="code" href="wxlstate_8h.html#a4a7a8f2cc1d3b1ba337295b6d02ab97f">wxluaT_getclass</a>(lua_State* L, <span class="keyword">const</span> <span class="keywordtype">char</span>* class_name);
|
|
<a name="l00419"></a>00419
|
|
<a name="l00420"></a>00420 <span class="comment">// Is the item at stack_idx of the userdata type with or derived from the the given wxLua type.</span>
|
|
<a name="l00421"></a>00421 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> <a class="code" href="wxlstate_8h.html#a1602757335e28069aa1d9416a5c53ac2">wxluaT_isuserdatatype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00422"></a>00422 <span class="comment">// Get the userdata object at the stack_idx that is of the wxLua class type or a</span>
|
|
<a name="l00423"></a>00423 <span class="comment">// class derived from the wxLua type. If the userdata does not have the correct type,</span>
|
|
<a name="l00424"></a>00424 <span class="comment">// or if the parameter isn't a userdata then wxlua_error() is called and NULL is returned.</span>
|
|
<a name="l00425"></a>00425 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span>* LUACALL <a class="code" href="wxlstate_8h.html#a4b840fe9dc39ed3114a3c4b271507335">wxluaT_getuserdatatype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00426"></a>00426 <span class="comment">// Push the obj_ptr onto the top of the stack wrapped in a newuserdata</span>
|
|
<a name="l00427"></a>00427 <span class="comment">// with its metatable set to the table from wxluaR_getref(L, wxl_type, &wxlua_lreg_types_key).</span>
|
|
<a name="l00428"></a>00428 <span class="comment">// Returns true if the wxLua type is known, the metatable set, and it's on the stack, nothing</span>
|
|
<a name="l00429"></a>00429 <span class="comment">// is pushed on the stack if this returns false.</span>
|
|
<a name="l00430"></a>00430 <span class="comment">// If the wxLua type is derived from the wxWindow type it will be added to the</span>
|
|
<a name="l00431"></a>00431 <span class="comment">// wxlua_lreg_windestroycallbacks_key table.</span>
|
|
<a name="l00432"></a>00432 <span class="comment">// If track=true then push the obj_ptr as a lightuser data key into the</span>
|
|
<a name="l00433"></a>00433 <span class="comment">// wxlua_lreg_weakobjects_key table of the Lua LUA_REGISTRYINDEX table so</span>
|
|
<a name="l00434"></a>00434 <span class="comment">// that if we need to push it again we just push the already created full userdata value.</span>
|
|
<a name="l00435"></a>00435 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a4cd81a70613d64cac4f0f363807df6a6">wxluaT_pushuserdatatype</a>(lua_State* L, <span class="keyword">const</span> <span class="keywordtype">void</span> *obj_ptr, <span class="keywordtype">int</span> wxl_type, <span class="keywordtype">bool</span> track = <span class="keyword">true</span>, <span class="keywordtype">bool</span> allow_NULL = <span class="keyword">false</span>);
|
|
<a name="l00436"></a>00436
|
|
<a name="l00437"></a>00437 <span class="comment">// ----------------------------------------------------------------------------</span>
|
|
<a name="l00438"></a>00438 <span class="comment">// Functions to get info about the wxLua types.</span>
|
|
<a name="l00439"></a>00439 <span class="comment">// Used to determine what to expect for a function call in the bindings.</span>
|
|
<a name="l00440"></a>00440 <span class="comment">// ----------------------------------------------------------------------------</span>
|
|
<a name="l00441"></a>00441
|
|
<a name="l00442"></a>00442 <span class="comment">// Is a class with the wxl_type equal to or derived from a class with the base_wxl_type.</span>
|
|
<a name="l00443"></a>00443 <span class="comment">// 0 means same class, +1 means base is parent, +2 base is grandparent, ...</span>
|
|
<a name="l00444"></a>00444 <span class="comment">// returns -1 if the wxLua type is not derived from the base type.</span>
|
|
<a name="l00445"></a>00445 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a1a5e4f51c5902cbd8e3047f7a99b871d">wxluaT_isderivedtype</a>(lua_State* L, <span class="keywordtype">int</span> wxl_type, <span class="keywordtype">int</span> base_wxl_type);
|
|
<a name="l00446"></a>00446 <span class="comment">// Same as above, but works directly with the wxLuaBindClasses.</span>
|
|
<a name="l00447"></a>00447 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a769186e214bfa3f0029e6c6addd9d42d">wxluaT_isderivedclass</a>(<span class="keyword">const</span> <a class="code" href="structwxLuaBindClass.html">wxLuaBindClass</a>* wxlClass, <span class="keyword">const</span> <a class="code" href="structwxLuaBindClass.html">wxLuaBindClass</a>* base_wxlClass);
|
|
<a name="l00448"></a>00448 <span class="comment">// Verify if the luatype = lua_type(L, stack_idx) is valid for the</span>
|
|
<a name="l00449"></a>00449 <span class="comment">// wxl_type which is one of the predefined WXLUA_TXXX or s_wxluaarg_XXX types.</span>
|
|
<a name="l00450"></a>00450 <span class="comment">// Returns 1 if it matches, 0 if it doesn't, -1 if the wxl_type is not known.</span>
|
|
<a name="l00451"></a>00451 <span class="comment">// Note that this function does not do a direct mapping between wxlua_luatowxluatype()</span>
|
|
<a name="l00452"></a>00452 <span class="comment">// and wxlua_wxluatoluatype() since it allows a small amount of coersion between types.</span>
|
|
<a name="l00453"></a>00453 <span class="comment">// If the input lua_State is not NULL it will account for the automatic conversion of</span>
|
|
<a name="l00454"></a>00454 <span class="comment">// (wxString, wxArrayString, wxArrayInt) from the Lua type to wxLua type.</span>
|
|
<a name="l00455"></a>00455 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a47f2034cabf94ca87dde758af863f4e2">wxlua_iswxluatype</a>(<span class="keywordtype">int</span> luatype, <span class="keywordtype">int</span> wxl_type, lua_State* L = NULL);
|
|
<a name="l00456"></a>00456 <span class="comment">// Get the wxLua type for the lua_type() = LUA_TXXX, returns -1 if unknown.</span>
|
|
<a name="l00457"></a>00457 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> <a class="code" href="wxlstate_8h.html#a00fa8bc9f668364c6a56b79a3d69738c">wxlua_luatowxluatype</a>(<span class="keywordtype">int</span> luatype);
|
|
<a name="l00458"></a>00458 <span class="comment">// Get the lua_type() = LUA_TXXX for the predefined WXLUA_TXXX types.</span>
|
|
<a name="l00459"></a>00459 <span class="comment">// returns -1 (LUA_TNONE) if the type was not one of the predefined types.</span>
|
|
<a name="l00460"></a>00460 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> <a class="code" href="wxlstate_8h.html#a63327ee17f8a4f24c7c96ac8db97e146">wxlua_wxluatoluatype</a>(<span class="keywordtype">int</span> wxluatype);
|
|
<a name="l00461"></a>00461
|
|
<a name="l00462"></a>00462 <span class="comment">// Is the object at the stack_idx a userdata object that wxLua has pushed into Lua?</span>
|
|
<a name="l00463"></a>00463 <span class="comment">// This should be the same as</span>
|
|
<a name="l00464"></a>00464 <span class="comment">// (lua_isuserdata(L, stack_idx) && !lua_islightuserdata(L, stack_idx))</span>
|
|
<a name="l00465"></a><a class="code" href="wxlstate_8h.html#a00a4b27cd869a94a2edb49866accd10a">00465</a> <span class="preprocessor">#define wxlua_iswxuserdata(L, stack_idx) (lua_type((L), (stack_idx)) == LUA_TUSERDATA)</span>
|
|
<a name="l00466"></a>00466 <span class="preprocessor"></span>
|
|
<a name="l00467"></a>00467 <span class="comment">// Helper functions to get numbers, booleans and strings safer.</span>
|
|
<a name="l00468"></a>00468 <span class="comment">// These validate that the object at the stack index specified is a string, bool,</span>
|
|
<a name="l00469"></a>00469 <span class="comment">// int, or double number object or that the object can be converted to it.</span>
|
|
<a name="l00470"></a>00470 <span class="comment">// Note: wxLua has a stricter sense of type than Lua and we don't want to</span>
|
|
<a name="l00471"></a>00471 <span class="comment">// always allow coersion between types since oftentimes there's an error.</span>
|
|
<a name="l00472"></a>00472 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> <a class="code" href="wxlstate_8h.html#a4c0ece81cd5c2a156feeda8d71e3e0f8">wxlua_iswxstringtype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00473"></a><a class="code" href="wxlstate_8h.html#a608577522e6393650240dddfba01d8b4">00473</a> <span class="preprocessor">#define wxlua_isstringtype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUA_TSTRING) == 1)</span>
|
|
<a name="l00474"></a><a class="code" href="wxlstate_8h.html#ac24c9e36c8ac2a1e9321fd3a8cba6b48">00474</a> <span class="preprocessor"></span><span class="preprocessor">#define wxlua_isbooleantype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUA_TBOOLEAN) == 1)</span>
|
|
<a name="l00475"></a><a class="code" href="wxlstate_8h.html#aa0e02f2c0ba42fa8125a87f7d1f3b862">00475</a> <span class="preprocessor"></span><span class="preprocessor">#define wxlua_isintegertype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUA_TINTEGER) == 1)</span>
|
|
<a name="l00476"></a><a class="code" href="wxlstate_8h.html#a49a0718d6216af2f681197473f206e36">00476</a> <span class="preprocessor"></span><span class="preprocessor">#define wxlua_isnumbertype(L, stack_idx) (wxlua_iswxluatype(lua_type(L, stack_idx), WXLUA_TNUMBER) == 1)</span>
|
|
<a name="l00477"></a>00477 <span class="preprocessor"></span>
|
|
<a name="l00478"></a>00478 <span class="comment">// After verifying using wxlua_isXXXtype return the value, else call</span>
|
|
<a name="l00479"></a>00479 <span class="comment">// wxlua_error() with a message that is appropriate for stack_idx to be a</span>
|
|
<a name="l00480"></a>00480 <span class="comment">// parameter to a function call. (These are used in the bindings)</span>
|
|
<a name="l00481"></a>00481 <span class="comment">// Note: The function wxLuaState::GetwxStringType does automatic conversion</span>
|
|
<a name="l00482"></a>00482 <span class="comment">// of both a Lua string and a userdata wxString to a wxString.</span>
|
|
<a name="l00483"></a>00483 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* LUACALL <a class="code" href="wxlstate_8h.html#aa15baee6edd4446f22cf1c393a1843a3">wxlua_getstringtype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00484"></a>00484 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxString LUACALL <a class="code" href="wxlstate_8h.html#abaad17f1e38dd7397d597ed0cbc1c4ef">wxlua_getwxStringtype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00485"></a>00485 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a77238c0018900d9c06b0163fa202c21d">wxlua_getbooleantype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00486"></a>00486 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">long</span> LUACALL <a class="code" href="wxlstate_8h.html#ab1921d0ee1911ca14ecf141891f90ae5">wxlua_getenumtype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00487"></a>00487 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">long</span> LUACALL <a class="code" href="wxlstate_8h.html#a5b0ffce73ad80800d0b756e49d31bf0e">wxlua_getintegertype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00488"></a>00488 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> LUACALL <a class="code" href="wxlstate_8h.html#ae108d14d839d23da917b0ce2d24c5363">wxlua_getuintegertype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00489"></a>00489 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">double</span> LUACALL <a class="code" href="wxlstate_8h.html#a7e0788737b729042ceddba8b630b4e53">wxlua_getnumbertype</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00490"></a>00490
|
|
<a name="l00491"></a>00491 <span class="comment">// Helper functions to get/set tables of strings and ints</span>
|
|
<a name="l00492"></a>00492 <span class="comment">// Validate that the object at the stack index specified is a table object.</span>
|
|
<a name="l00493"></a>00493 <span class="comment">// This assumes that each table array entry is a string/number</span>
|
|
<a name="l00494"></a>00494 <span class="comment">// or can be converted to a string/number using the</span>
|
|
<a name="l00495"></a>00495 <span class="comment">// wxlua_isstring/numbertype definitions of what is a string/number.</span>
|
|
<a name="l00496"></a>00496
|
|
<a name="l00497"></a>00497 <span class="comment">// Convert the table at stack index to a "new" array of const char* strings.</span>
|
|
<a name="l00498"></a>00498 <span class="comment">// Return a pointer to the array of strings. You need to delete the array, but not</span>
|
|
<a name="l00499"></a>00499 <span class="comment">// the individual strings since Lua should still have them during the life of the</span>
|
|
<a name="l00500"></a>00500 <span class="comment">// returned array, if not you will need to copy them.</span>
|
|
<a name="l00501"></a>00501 <span class="comment">// Returns the number of character strings in the array in count.</span>
|
|
<a name="l00502"></a>00502 <span class="comment">// See usage in the wxBitmap constructor for XPMs.</span>
|
|
<a name="l00503"></a>00503 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keyword">const</span> <span class="keywordtype">char</span>** LUACALL <a class="code" href="wxlstate_8h.html#ad3f311ca85fe28d4faf3f4dd81536a18">wxlua_getchararray</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span>& count);
|
|
<a name="l00504"></a>00504
|
|
<a name="l00505"></a>00505 <span class="comment">// Convert a table array or a wxArrayString at the stack_idx to an array of wxStrings.</span>
|
|
<a name="l00506"></a>00506 <span class="comment">// If it's a table, it must have integer keys and string or wxString values.</span>
|
|
<a name="l00507"></a>00507 <span class="comment">// Returns a pointer to a new array of wxStrings and set the size in count.</span>
|
|
<a name="l00508"></a>00508 <span class="comment">// You must delete the return value if not NULL.</span>
|
|
<a name="l00509"></a>00509 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxString* LUACALL <a class="code" href="wxlstate_8h.html#a9d0af8f1eee0d4615751565f3f2fa393">wxlua_getwxStringarray</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span>& count);
|
|
<a name="l00510"></a>00510 <span class="comment">// Convert a table array or a wxArrayInt at the stack_idx to an array of integers.</span>
|
|
<a name="l00511"></a>00511 <span class="comment">// If it's a table, it must have integer keys and values.</span>
|
|
<a name="l00512"></a>00512 <span class="comment">// Returns a pointer to a new array of ints and set the size in count</span>
|
|
<a name="l00513"></a>00513 <span class="comment">// You must delete the return value if not NULL.</span>
|
|
<a name="l00514"></a>00514 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span>* LUACALL <a class="code" href="wxlstate_8h.html#a608c006132ed91d53ce42a4221de285f">wxlua_getintarray</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span>& count);
|
|
<a name="l00515"></a>00515
|
|
<a name="l00516"></a>00516 <span class="comment">// Convert a table array or a wxArrayString object at the stack_idx to a wxArrayString.</span>
|
|
<a name="l00517"></a>00517 <span class="comment">// If it's a table, it must have integer keys and string or wxString values.</span>
|
|
<a name="l00518"></a>00518 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaSmartwxArrayString.html">wxLuaSmartwxArrayString</a> LUACALL <a class="code" href="wxlstate_8h.html#a0cf1f6516b7828d8f58e8fca47b0751d">wxlua_getwxArrayString</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00519"></a>00519 <span class="comment">// Convert a table array or a wxSortedArrayString object at the stack_idx to a wxSortedArrayString.</span>
|
|
<a name="l00520"></a>00520 <span class="comment">// If it's a table, it must have integer keys and string or wxString values.</span>
|
|
<a name="l00521"></a>00521 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaSmartwxSortedArrayString.html">wxLuaSmartwxSortedArrayString</a> LUACALL <a class="code" href="wxlstate_8h.html#a48c3f8a2da56e596561547086a5b6d5e">wxlua_getwxSortedArrayString</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00522"></a>00522 <span class="comment">// Convert a table array or a wxArrayInt object at the stack_idx to a wxArrayInt.</span>
|
|
<a name="l00523"></a>00523 <span class="comment">// If it's a table, it must have integer keys and values.</span>
|
|
<a name="l00524"></a>00524 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaSmartwxArrayInt.html">wxLuaSmartwxArrayInt</a> LUACALL <a class="code" href="wxlstate_8h.html#a1d55c218b354f79810dbe96a5adf96a8">wxlua_getwxArrayInt</a>(lua_State* L, <span class="keywordtype">int</span> stack_idx);
|
|
<a name="l00525"></a>00525
|
|
<a name="l00526"></a>00526
|
|
<a name="l00527"></a>00527 <span class="comment">// Creates a Lua table array and pushes Lua strings into it, returns the number of items added.</span>
|
|
<a name="l00528"></a>00528 <span class="comment">// The table is left on the stack.</span>
|
|
<a name="l00529"></a>00529 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a4fae9b1e2b6a0669ddb701581edf24c7">wxlua_pushwxArrayStringtable</a>(lua_State* L, <span class="keyword">const</span> wxArrayString& strArray);
|
|
<a name="l00530"></a>00530 <span class="comment">// Creates a Lua table array and pushes the integers into it, returns the number of items added.</span>
|
|
<a name="l00531"></a>00531 <span class="comment">// The table is left on the stack.</span>
|
|
<a name="l00532"></a>00532 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> LUACALL <a class="code" href="wxlstate_8h.html#a75ae92f66c6689bad6470f689a7d190d">wxlua_pushwxArrayInttable</a>(lua_State* L, <span class="keyword">const</span> wxArrayInt& intArray);
|
|
<a name="l00533"></a>00533 <span class="comment">// Push the wxString into Lua after converting it.</span>
|
|
<a name="l00534"></a>00534 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#ab5978d0116530dd0844a50120988771f">wxlua_pushwxString</a>(lua_State* L, <span class="keyword">const</span> wxString& str);
|
|
<a name="l00535"></a>00535
|
|
<a name="l00536"></a>00536 <span class="comment">// Helper function to concatenate a wxArrayString into a wxString.</span>
|
|
<a name="l00537"></a>00537 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxString <a class="code" href="wxlstate_8h.html#ab9470cf3e371887731d92e912a085319">wxlua_concatwxArrayString</a>(<span class="keyword">const</span> wxArrayString& arr, <span class="keyword">const</span> wxString& sep = wxT(<span class="stringliteral">"\n"</span>));
|
|
<a name="l00538"></a>00538
|
|
<a name="l00539"></a>00539
|
|
<a name="l00540"></a>00540 <span class="comment">// Push the program args into a global table called "args" as the Lua executable does.</span>
|
|
<a name="l00541"></a>00541 <span class="comment">// start_n is the arg to start pushing until max args "argc".</span>
|
|
<a name="l00542"></a>00542 <span class="comment">// returns the number of args pushed.</span>
|
|
<a name="l00543"></a>00543 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">int</span> <a class="code" href="wxlstate_8h.html#aaf858c7e146ec726f175df7c78e42a68">wxlua_pushargs</a>(lua_State* L, wxChar **argv, <span class="keywordtype">int</span> argc, <span class="keywordtype">int</span> start_n);
|
|
<a name="l00544"></a>00544
|
|
<a name="l00545"></a>00545 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00546"></a>00546 <span class="comment">// Derived class member functions for classes in wxLua. The data is stored</span>
|
|
<a name="l00547"></a>00547 <span class="comment">// in the wxlua_lreg_derivedmethods_key table in the LUA_REGISTRYINDEX.</span>
|
|
<a name="l00548"></a>00548 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00549"></a>00549
|
|
<a name="l00550"></a>00550 <span class="comment">// Add this derived method, a Lua function or value the user has set to a</span>
|
|
<a name="l00551"></a>00551 <span class="comment">// wxLua userdata object that we will push onto the stack when they access</span>
|
|
<a name="l00552"></a>00552 <span class="comment">// the __index of the object with the "method_name". The obj_ptr is the</span>
|
|
<a name="l00553"></a>00553 <span class="comment">// object the Lua userdata stores and the new wxLuaObject wraps the Lua</span>
|
|
<a name="l00554"></a>00554 <span class="comment">// function or value which will be deleted by wxLua when the userdata is deleted.</span>
|
|
<a name="l00555"></a>00555 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a1110e8f522280bc418efc5ec47ef585c">wxlua_setderivedmethod</a>(lua_State* L, <span class="keywordtype">void</span> *obj_ptr, <span class="keyword">const</span> <span class="keywordtype">char</span> *method_name, <a class="code" href="classwxLuaObject.html">wxLuaObject</a>* wxlObj);
|
|
<a name="l00556"></a>00556 <span class="comment">// Is there a derived method for the given obj_ptr with the method_name that was</span>
|
|
<a name="l00557"></a>00557 <span class="comment">// added by calling wxlua_setderivedmethod()?</span>
|
|
<a name="l00558"></a>00558 <span class="comment">// If push_method then push the method onto the stack.</span>
|
|
<a name="l00559"></a>00559 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a602bc60e4737a25c6202d86c7c2f6c2b">wxlua_hasderivedmethod</a>(lua_State* L, <span class="keywordtype">void</span> *obj_ptr, <span class="keyword">const</span> <span class="keywordtype">char</span> *method_name, <span class="keywordtype">bool</span> push_method);
|
|
<a name="l00560"></a>00560 <span class="comment">// Remove any derived functions or values for the obj_ptr that have been added with</span>
|
|
<a name="l00561"></a>00561 <span class="comment">// wxlua_setderivedmethod().</span>
|
|
<a name="l00562"></a>00562 <span class="comment">// This is called when an object is being garbage collected by wxluaO_deletegcobject()</span>
|
|
<a name="l00563"></a>00563 <span class="comment">// and probably shouldn't be called otherwise.</span>
|
|
<a name="l00564"></a>00564 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#abfb64621a5e2ba46114e81a28731c79f">wxlua_removederivedmethods</a>(lua_State* L, <span class="keywordtype">void</span> *obj_ptr);
|
|
<a name="l00565"></a>00565
|
|
<a name="l00566"></a>00566 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00567"></a>00567 <span class="comment">// Other functions for wxLua's keys in the LUA_REGISTRYINDEX</span>
|
|
<a name="l00568"></a>00568 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00569"></a>00569
|
|
<a name="l00570"></a>00570 <span class="comment">// Get the wxlua_lreg_callbaseclassfunc_key value of the LUA_REGISTRYINDEX table</span>
|
|
<a name="l00571"></a>00571 <span class="comment">// to determines whether a virtual C++ class member function should call its own</span>
|
|
<a name="l00572"></a>00572 <span class="comment">// base class function or a wxLua derived method if it exists.</span>
|
|
<a name="l00573"></a>00573 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">bool</span> LUACALL <a class="code" href="wxlstate_8h.html#a99b292a455b84ee8f2f701ff3619d1f7">wxlua_getcallbaseclassfunction</a>(lua_State* L);
|
|
<a name="l00574"></a>00574 <span class="comment">// Set if the class member function call in Lua has a prepended '_' to imply that</span>
|
|
<a name="l00575"></a>00575 <span class="comment">// the user wants the base class function and not the derived method in the</span>
|
|
<a name="l00576"></a>00576 <span class="comment">// wxlua_lreg_derivedmethods_key table.</span>
|
|
<a name="l00577"></a>00577 <span class="comment">// Sets the wxlua_lreg_callbaseclassfunc_key value of the LUA_REGISTRYINDEX table.</span>
|
|
<a name="l00578"></a>00578 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#a9d1c33c0999cd1ea92d9dafb83196fa8">wxlua_setcallbaseclassfunction</a>(lua_State* L, <span class="keywordtype">bool</span> call_base);
|
|
<a name="l00579"></a>00579
|
|
<a name="l00580"></a>00580 <span class="comment">// Get the wxlua_lreg_wxeventtype_key value of the LUA_REGISTRYINDEX table</span>
|
|
<a name="l00581"></a>00581 <span class="comment">// to see if we're currently in a wxEvent callback.</span>
|
|
<a name="l00582"></a>00582 <span class="comment">// Returns wxEVT_NULL if not in an event handler.</span>
|
|
<a name="l00583"></a>00583 <span class="comment">// Be careful about destroying Lua when in an event handler.</span>
|
|
<a name="l00584"></a>00584 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> wxEventType LUACALL <a class="code" href="wxlstate_8h.html#a5442b3e5a2f8dca8fb920c00279385ac">wxlua_getwxeventtype</a>(lua_State* L);
|
|
<a name="l00585"></a>00585 <span class="comment">// Set the wxlua_lreg_wxeventtype_key value of the LUA_REGISTRYINDEX table</span>
|
|
<a name="l00586"></a>00586 <span class="comment">// with the current wxEventType we're in or wxEVT_NULL if none.</span>
|
|
<a name="l00587"></a>00587 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <span class="keywordtype">void</span> LUACALL <a class="code" href="wxlstate_8h.html#a3f5c8427ae033a7da28754a6e37acf0a">wxlua_setwxeventtype</a>(lua_State* L, wxEventType evt_type);
|
|
<a name="l00588"></a>00588
|
|
<a name="l00589"></a>00589 <span class="comment">// Get the wxlua_lreg_wxluastatedata_key wxLuaStateData value from</span>
|
|
<a name="l00590"></a>00590 <span class="comment">// the LUA_REGISTRYINDEX table for the owner wxLuaState.</span>
|
|
<a name="l00591"></a>00591 <span class="comment">// Note: It returns NULL if the lua_State is about to be closed.</span>
|
|
<a name="l00592"></a>00592 <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaStateData.html">wxLuaStateData</a>* LUACALL <a class="code" href="wxlstate_8h.html#a4c7701b4b056e2f84f380be559bb2482">wxlua_getwxluastatedata</a>(lua_State* L);
|
|
<a name="l00593"></a>00593
|
|
<a name="l00594"></a>00594 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00595"></a>00595 <span class="comment">// wxLuaStateData - the internal data for the wxLuaState.</span>
|
|
<a name="l00596"></a>00596 <span class="comment">// All members of this class should be accessed through the wxLuaState.</span>
|
|
<a name="l00597"></a>00597 <span class="comment">// It is public only for people who need to get at the internals, there are</span>
|
|
<a name="l00598"></a>00598 <span class="comment">// absolutely no guarantees that things won't change.</span>
|
|
<a name="l00599"></a>00599 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00600"></a>00600
|
|
<a name="l00601"></a><a class="code" href="classwxLuaStateData.html">00601</a> <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaStateData.html">wxLuaStateData</a>
|
|
<a name="l00602"></a>00602 {
|
|
<a name="l00603"></a>00603 <span class="keyword">public</span>:
|
|
<a name="l00604"></a>00604 <a class="code" href="classwxLuaStateData.html">wxLuaStateData</a>();
|
|
<a name="l00605"></a>00605 ~<a class="code" href="classwxLuaStateData.html">wxLuaStateData</a>();
|
|
<a name="l00606"></a>00606
|
|
<a name="l00607"></a><a class="code" href="classwxLuaStateData.html#a1fd10c4e7f8cfcc7cd73fe3f8bb59c26">00607</a> <span class="keywordtype">bool</span> m_is_running; <span class="comment">// is the lua_State running a script</span>
|
|
<a name="l00608"></a><a class="code" href="classwxLuaStateData.html#ae5ffbed5dbd5df2cfbaf79d85758c482">00608</a> <span class="keywordtype">bool</span> m_is_closing; <span class="comment">// are we currently being closed</span>
|
|
<a name="l00609"></a>00609
|
|
<a name="l00610"></a><a class="code" href="classwxLuaStateData.html#a3c0f81c815fb446094740e0be33de989">00610</a> <span class="keywordtype">int</span> m_lua_debug_hook_count; <span class="comment">// values from wxLuaState::SetLuaDebugHook()</span>
|
|
<a name="l00611"></a><a class="code" href="classwxLuaStateData.html#a16aa632cff2de6c2ee2e2cab9a03b9a1">00611</a> <span class="keywordtype">int</span> m_lua_debug_hook_yield;
|
|
<a name="l00612"></a><a class="code" href="classwxLuaStateData.html#a3a8aa4724cd09403d7269e7258435a9e">00612</a> <span class="keywordtype">int</span> m_lua_debug_hook;
|
|
<a name="l00613"></a><a class="code" href="classwxLuaStateData.html#adee2d0bdd61585268fc43c18bd0d1116">00613</a> <span class="keywordtype">bool</span> m_lua_debug_hook_send_evt;
|
|
<a name="l00614"></a>00614
|
|
<a name="l00615"></a><a class="code" href="classwxLuaStateData.html#aa7500e45a81ca35fc3fe1b66c2aa38fd">00615</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> m_last_debug_hook_time; <span class="comment">// last time the debug hook was called</span>
|
|
<a name="l00616"></a>00616
|
|
<a name="l00617"></a><a class="code" href="classwxLuaStateData.html#abb85e04d6c6dd5a5b31ec55c3c3fdd8f">00617</a> <span class="keywordtype">bool</span> m_debug_hook_break; <span class="comment">// should the lua_State break for next debug_hook</span>
|
|
<a name="l00618"></a><a class="code" href="classwxLuaStateData.html#a375859ee7c4407fb3c5588b39705de2d">00618</a> wxString m_debug_hook_break_msg; <span class="comment">// message when breaking in the debug_hook</span>
|
|
<a name="l00619"></a>00619
|
|
<a name="l00620"></a><a class="code" href="classwxLuaStateData.html#aa6142d41d0fc7ce6cac933f84783859f">00620</a> wxEvtHandler *m_evtHandler; <span class="comment">// event handler to send wxLuaEvents to</span>
|
|
<a name="l00621"></a><a class="code" href="classwxLuaStateData.html#a7bf17e9f06b93c3f83be27418304db8b">00621</a> wxWindowID m_id; <span class="comment">// event id to send the events with</span>
|
|
<a name="l00622"></a>00622 };
|
|
<a name="l00623"></a>00623
|
|
<a name="l00624"></a>00624 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00625"></a>00625 <span class="comment">// wxLuaStateRefData - the internal data for the wxLuaState.</span>
|
|
<a name="l00626"></a>00626 <span class="comment">// please use the wxLuaState accessor functions</span>
|
|
<a name="l00627"></a>00627 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00628"></a>00628
|
|
<a name="l00629"></a>00629 <span class="preprocessor">#include "wx/hashmap.h"</span>
|
|
<a name="l00630"></a>00630 <a class="code" href="wxlstate_8h.html#a4c1f792577935b5d59ee347f9109c633">WX_DECLARE_VOIDPTR_HASH_MAP_WITH_DECL</a>(<a class="code" href="classwxLuaState.html">wxLuaState</a> *, wxHashMapLuaState, <span class="keyword">class</span> <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a>);
|
|
<a name="l00631"></a>00631
|
|
<a name="l00632"></a><a class="code" href="classwxLuaStateRefData.html">00632</a> <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaStateRefData.html">wxLuaStateRefData</a> : <span class="keyword">public</span> wxObjectRefData
|
|
<a name="l00633"></a>00633 {
|
|
<a name="l00634"></a>00634 <span class="keyword">public</span>:
|
|
<a name="l00635"></a>00635 <a class="code" href="classwxLuaStateRefData.html">wxLuaStateRefData</a>(<span class="keywordtype">bool</span> create_data = <span class="keyword">true</span>);
|
|
<a name="l00636"></a>00636 <span class="keyword">virtual</span> ~<a class="code" href="classwxLuaStateRefData.html">wxLuaStateRefData</a>();
|
|
<a name="l00637"></a>00637
|
|
<a name="l00638"></a>00638 <span class="comment">// destroy and cleanup the lua_State, returns success</span>
|
|
<a name="l00639"></a>00639 <span class="comment">// if 'force' = true then make sure all wxWindows are destroyed.</span>
|
|
<a name="l00640"></a>00640 <span class="keywordtype">bool</span> CloseLuaState(<span class="keywordtype">bool</span> force);
|
|
<a name="l00641"></a>00641 <span class="comment">// clear all wxLuaEventCallbacks and wxLuaWinDestroyCallbacks on destruction</span>
|
|
<a name="l00642"></a>00642 <span class="keywordtype">void</span> ClearCallbacks();
|
|
<a name="l00643"></a>00643
|
|
<a name="l00644"></a>00644 <span class="comment">// ------------------------------------------------------------------------</span>
|
|
<a name="l00645"></a>00645
|
|
<a name="l00646"></a><a class="code" href="classwxLuaStateRefData.html#a55361195d24f0fc248de2acb090f84a3">00646</a> lua_State* m_lua_State; <span class="comment">// the lua_State that "is" Lua</span>
|
|
<a name="l00647"></a><a class="code" href="classwxLuaStateRefData.html#a6c977816cfdec8f29531e99e32ae2538">00647</a> <span class="keywordtype">bool</span> m_lua_State_static; <span class="comment">// lua_close() the lua_State if !static</span>
|
|
<a name="l00648"></a><a class="code" href="classwxLuaStateRefData.html#a756bf884311f556e99ea2b4e71d9b725">00648</a> <span class="keywordtype">bool</span> m_lua_State_coroutine; <span class="comment">// this is a coroutine, don't close it</span>
|
|
<a name="l00649"></a>00649
|
|
<a name="l00650"></a><a class="code" href="classwxLuaStateRefData.html#a02dde1df32ae7c7749b63a829b12ed05">00650</a> <a class="code" href="classwxLuaStateData.html">wxLuaStateData</a>* m_wxlStateData; <span class="comment">// the data shared for this state</span>
|
|
<a name="l00651"></a><a class="code" href="classwxLuaStateRefData.html#acc0ef3bdd953f88a8506fa42de6e2120">00651</a> <span class="keywordtype">bool</span> m_own_stateData; <span class="comment">// not a coroutine when true, so delete it when done</span>
|
|
<a name="l00652"></a>00652 };
|
|
<a name="l00653"></a>00653
|
|
<a name="l00654"></a>00654 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00655"></a>00655 <span class="comment">// wxLuaState - a ref counted class to interface between C++ and Lua's C lua_State</span>
|
|
<a name="l00656"></a>00656 <span class="comment">//----------------------------------------------------------------------------</span>
|
|
<a name="l00657"></a>00657
|
|
<a name="l00658"></a>00658 <span class="comment">// enum wxLuaState_Type is for the function</span>
|
|
<a name="l00659"></a>00659 <span class="comment">// wxLuaState::Create(lua_State* L, int state_type = wxLUASTATE_GETSTATE);</span>
|
|
<a name="l00660"></a><a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1">00660</a> <span class="keyword">enum</span> <a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1">wxLuaState_Type</a>
|
|
<a name="l00661"></a>00661 {
|
|
<a name="l00662"></a><a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1aa45d65bc60575889af53a41b330b27b9">00662</a> <a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1aa45d65bc60575889af53a41b330b27b9">wxLUASTATE_GETSTATE</a> = 1, <span class="comment">// Attach to a previously created wxLuaState's</span>
|
|
<a name="l00663"></a>00663 <span class="comment">// lua_State refing the existing wxLuaStateRefData</span>
|
|
<a name="l00664"></a>00664
|
|
<a name="l00665"></a><a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1a3932f86f62ab04efe4d37aee9aa34802">00665</a> <a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1a3932f86f62ab04efe4d37aee9aa34802">wxLUASTATE_SETSTATE</a> = 2, <span class="comment">// Set the lua_State for the wxLuaState.</span>
|
|
<a name="l00666"></a>00666 <span class="comment">// Does not call lua_openlibs() so you should have</span>
|
|
<a name="l00667"></a>00667 <span class="comment">// called before setting it to the wxLuaState.</span>
|
|
<a name="l00668"></a>00668
|
|
<a name="l00669"></a>00669 <span class="comment">// The values below are to be ored with wxLUASTATE_SETSTATE only.</span>
|
|
<a name="l00670"></a><a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1a58f35479bcc2796b33a8ac067c6109a3">00670</a> <a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1a58f35479bcc2796b33a8ac067c6109a3">wxLUASTATE_STATICSTATE</a> = 0x10, <span class="comment">// The lua_State is static and the wxLuaState</span>
|
|
<a name="l00671"></a>00671 <span class="comment">// will not lua_close() it when Destroy()ed.</span>
|
|
<a name="l00672"></a><a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1aa79da132f935b36c1bed3081a2efdf8e">00672</a> <a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1aa79da132f935b36c1bed3081a2efdf8e">wxLUASTATE_OPENBINDINGS</a> = 0x20, <span class="comment">// Install all the bindings in</span>
|
|
<a name="l00673"></a>00673 <span class="comment">// wxLuaBinding::GetBindingList() into the</span>
|
|
<a name="l00674"></a>00674 <span class="comment">// lua_State. You may install the bindings</span>
|
|
<a name="l00675"></a>00675 <span class="comment">// one at a time using</span>
|
|
<a name="l00676"></a>00676 <span class="comment">// wxLuaState::RegisterBinding(wxLuaBinding*)</span>
|
|
<a name="l00677"></a>00677 };
|
|
<a name="l00678"></a>00678
|
|
<a name="l00679"></a>00679 <span class="comment">// an invalid wxLuaState for comparison (like wxNullBitmap)</span>
|
|
<a name="l00680"></a>00680 <span class="keyword">extern</span> <a class="code" href="wxldefs_8h.html#acafd4cb79bea822563bac70e088c38ca">WXDLLIMPEXP_DATA_WXLUA</a>(<a class="code" href="classwxLuaState.html">wxLuaState</a>) wxNullLuaState;
|
|
<a name="l00681"></a>00681
|
|
<a name="l00682"></a><a class="code" href="classwxLuaState.html">00682</a> class <a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaState.html">wxLuaState</a> : public wxObject
|
|
<a name="l00683"></a>00683 {
|
|
<a name="l00684"></a>00684 <span class="keyword">public</span>:
|
|
<a name="l00685"></a>00685 <span class="comment">// Default constructor or if create=true then</span>
|
|
<a name="l00686"></a>00686 <span class="comment">// call the function Create(wxEvtHandler=NULL, id=wxID_ANY).</span>
|
|
<a name="l00687"></a><a class="code" href="classwxLuaState.html#a40c4a82d65e02d0f5e05dc197b85b978">00687</a> <a class="code" href="classwxLuaState.html#a40c4a82d65e02d0f5e05dc197b85b978">wxLuaState</a>(<span class="keywordtype">bool</span> create = <span class="keyword">false</span>) { <span class="keywordflow">if</span> (create) Create(); }
|
|
<a name="l00688"></a>00688 <span class="comment">// Create a new lua_State and add the bindings.</span>
|
|
<a name="l00689"></a>00689 <span class="comment">// Calls the function Create(wxEvtHandler, id).</span>
|
|
<a name="l00690"></a><a class="code" href="classwxLuaState.html#a4b5fc9220225ac38714ce19f2cfdb685">00690</a> <a class="code" href="classwxLuaState.html#a4b5fc9220225ac38714ce19f2cfdb685">wxLuaState</a>(wxEvtHandler *handler, wxWindowID <span class="keywordtype">id</span> = wxID_ANY) { Create(handler, <span class="keywordtype">id</span>); }
|
|
<a name="l00691"></a>00691 <span class="comment">// Create a wxLuaState from an existing lua_State.</span>
|
|
<a name="l00692"></a>00692 <span class="comment">// Calls the function Create(lua_State, state_type), state_type is enum wxLuaState_Type.</span>
|
|
<a name="l00693"></a><a class="code" href="classwxLuaState.html#aea3cc02faf6b2f7ccf8c9fe5f2869a73">00693</a> <span class="keyword">inline</span> <a class="code" href="classwxLuaState.html#aea3cc02faf6b2f7ccf8c9fe5f2869a73">wxLuaState</a>(lua_State* L, <span class="keywordtype">int</span> state_type = <a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1aa45d65bc60575889af53a41b330b27b9">wxLUASTATE_GETSTATE</a>) { Create(L, state_type); }
|
|
<a name="l00694"></a>00694 <span class="comment">// Copy constructor, refs existing wxLuaState</span>
|
|
<a name="l00695"></a><a class="code" href="classwxLuaState.html#a11a2f90ab5b8241f021c8d83fe43cc37">00695</a> <span class="keyword">inline</span> <a class="code" href="classwxLuaState.html#a11a2f90ab5b8241f021c8d83fe43cc37">wxLuaState</a>(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>& wxlState) { Ref(wxlState); }
|
|
<a name="l00696"></a>00696
|
|
<a name="l00697"></a>00697 <span class="comment">// ALWAYS Destroy() the wxLuaState instead of calling UnRef(), else circular</span>
|
|
<a name="l00698"></a>00698 <span class="comment">// destruction since ref count goes to 0 before actually destroying the lua_State</span>
|
|
<a name="l00699"></a><a class="code" href="classwxLuaState.html#a1828153013431847f30fe12be0da5631">00699</a> <span class="keyword">virtual</span> <a class="code" href="classwxLuaState.html#a1828153013431847f30fe12be0da5631">~wxLuaState</a>() { Destroy(); }
|
|
<a name="l00700"></a>00700
|
|
<a name="l00701"></a>00701 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00702"></a>00702
|
|
<a name="l00703"></a>00703 <span class="comment">// Ref the given wxLuaState</span>
|
|
<a name="l00704"></a>00704 <span class="keywordtype">void</span> Create(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>& wxlState);
|
|
<a name="l00705"></a>00705 <span class="comment">// Create a new lua_State and send wxLuaEvents to this handler.</span>
|
|
<a name="l00706"></a>00706 <span class="comment">// The handler may be NULL to not send events to anyone.</span>
|
|
<a name="l00707"></a>00707 <span class="comment">// Calls the function Create(lua_State, wxLUASTATE_USESTATE).</span>
|
|
<a name="l00708"></a>00708 <span class="keywordtype">bool</span> Create(wxEvtHandler *handler = NULL, wxWindowID <span class="keywordtype">id</span> = wxID_ANY);
|
|
<a name="l00709"></a>00709 <span class="comment">// Create a wxLuaState from an existing lua_State.</span>
|
|
<a name="l00710"></a>00710 <span class="comment">// See enum wxLuaState_Type for infomation about state_type.</span>
|
|
<a name="l00711"></a>00711 <span class="keywordtype">bool</span> Create(lua_State* L, <span class="keywordtype">int</span> state_type = <a class="code" href="wxlstate_8h.html#a1c0edb51752e95310d3fa8dc274d18c1aa45d65bc60575889af53a41b330b27b9">wxLUASTATE_GETSTATE</a>);
|
|
<a name="l00712"></a>00712
|
|
<a name="l00713"></a>00713 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00714"></a>00714
|
|
<a name="l00715"></a>00715 <span class="comment">// Is this wxLuaState valid, has refed data and its lua_State is created</span>
|
|
<a name="l00716"></a>00716 <span class="keywordtype">bool</span> Ok() <span class="keyword">const</span>;
|
|
<a name="l00717"></a>00717
|
|
<a name="l00718"></a>00718 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00719"></a>00719
|
|
<a name="l00720"></a>00720 <span class="comment">// Destroy the refed data, use this instead of wxObject::UnRef().</span>
|
|
<a name="l00721"></a>00721 <span class="comment">// Only calls lua_close(L) if this is the last refed state and this was</span>
|
|
<a name="l00722"></a>00722 <span class="comment">// created without the wxLUASTATE_STATICSTATE flag.</span>
|
|
<a name="l00723"></a>00723 <span class="comment">// Note: if you have a top level window (wxFrame) open in Lua and exit the</span>
|
|
<a name="l00724"></a>00724 <span class="comment">// C++ program your program will seem to "hang" because wxApp doesn't</span>
|
|
<a name="l00725"></a>00725 <span class="comment">// exit with a top level window open. Call CloseLuaState(true) to ensure</span>
|
|
<a name="l00726"></a>00726 <span class="comment">// all non parented (top level) windows are destroyed.</span>
|
|
<a name="l00727"></a>00727 <span class="comment">// You must always call CloseLuaState() when you want to close Lua instead</span>
|
|
<a name="l00728"></a>00728 <span class="comment">// of hoping that when you call Destroy() you have the last refed instance.</span>
|
|
<a name="l00729"></a>00729 <span class="keywordtype">void</span> Destroy();
|
|
<a name="l00730"></a>00730 <span class="comment">// Close the lua_State and if 'force' close all attached wxWindows</span>
|
|
<a name="l00731"></a>00731 <span class="comment">// if !force then popup a dialog to ask if all wxWindows should be destroyed.</span>
|
|
<a name="l00732"></a>00732 <span class="comment">// Only calls lua_close(L) if this is the last refed state and this was</span>
|
|
<a name="l00733"></a>00733 <span class="comment">// created without the wxLUASTATE_STATICSTATE flag.</span>
|
|
<a name="l00734"></a>00734 <span class="keywordtype">bool</span> CloseLuaState(<span class="keywordtype">bool</span> force);
|
|
<a name="l00735"></a>00735 <span class="comment">// Are we currently being closed? Used when the garbage collector is running when</span>
|
|
<a name="l00736"></a>00736 <span class="comment">// we don't care about cleaning Lua up so just delete the data. (internal use)</span>
|
|
<a name="l00737"></a>00737 <span class="keywordtype">bool</span> IsClosing() <span class="keyword">const</span>;
|
|
<a name="l00738"></a>00738
|
|
<a name="l00739"></a>00739 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00740"></a>00740
|
|
<a name="l00741"></a>00741 <span class="comment">// Get the lua_State</span>
|
|
<a name="l00742"></a>00742 lua_State* GetLuaState() <span class="keyword">const</span>;
|
|
<a name="l00743"></a>00743 <span class="comment">// Get the ref data (internal use)</span>
|
|
<a name="l00744"></a><a class="code" href="classwxLuaState.html#acfb685c8bd02c654a5b18db4f92458ab">00744</a> <a class="code" href="classwxLuaStateRefData.html">wxLuaStateRefData</a>* <a class="code" href="classwxLuaState.html#acfb685c8bd02c654a5b18db4f92458ab">GetLuaStateRefData</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> (<a class="code" href="classwxLuaStateRefData.html">wxLuaStateRefData</a>*)GetRefData(); }
|
|
<a name="l00745"></a>00745 <span class="comment">// Get the data for the lua_State in the ref data (internal use)</span>
|
|
<a name="l00746"></a>00746 <a class="code" href="classwxLuaStateData.html">wxLuaStateData</a>* GetLuaStateData() <span class="keyword">const</span>;
|
|
<a name="l00747"></a>00747
|
|
<a name="l00748"></a>00748 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00749"></a>00749
|
|
<a name="l00750"></a>00750 <span class="comment">// Get the wxLuaState from the corresponding lua_State</span>
|
|
<a name="l00751"></a>00751 <span class="comment">// returns wxNullLuaState if none found.</span>
|
|
<a name="l00752"></a>00752 <span class="keyword">static</span> <a class="code" href="classwxLuaState.html">wxLuaState</a> GetwxLuaState(lua_State* L);
|
|
<a name="l00753"></a>00753 <span class="comment">// A mapping between hashmap[lua_State* L] = wxLuaState*</span>
|
|
<a name="l00754"></a>00754 <span class="comment">// Note: The hashed new wxLuaState is not Refed since we want to know when</span>
|
|
<a name="l00755"></a>00755 <span class="comment">// the ref count goes to 1 for cleanup and it is deleted when</span>
|
|
<a name="l00756"></a>00756 <span class="comment">// its wxLuaStateRefData is finally deleted.</span>
|
|
<a name="l00757"></a>00757 <span class="comment">// Note: The coroutine lua_States are not hashed since we cannot know when</span>
|
|
<a name="l00758"></a>00758 <span class="comment">// they are created or deleted. We must create wxLuaStates for them on the fly.</span>
|
|
<a name="l00759"></a><a class="code" href="classwxLuaState.html#ab8261cd3629c21d1cbaeb5a6e0777272">00759</a> <span class="keyword">static</span> wxHashMapLuaState s_wxHashMapLuaState;
|
|
<a name="l00760"></a>00760
|
|
<a name="l00761"></a>00761 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00762"></a>00762
|
|
<a name="l00763"></a>00763 <span class="comment">// In order for wxLua scripts to work from a C++ program's wxApp::OnInit()</span>
|
|
<a name="l00764"></a>00764 <span class="comment">// and the Lua module you may have to set this variable to force the wxLua</span>
|
|
<a name="l00765"></a>00765 <span class="comment">// code "wx.wxGetApp:MainLoop()" to not call wxApp::MainLoop().</span>
|
|
<a name="l00766"></a>00766 <span class="comment">// The issue is that within the function wxApp::OnInit() wxApp::IsMainLoopRunning()</span>
|
|
<a name="l00767"></a>00767 <span class="comment">// returns false, but it will be running after OnInit() returns so we should</span>
|
|
<a name="l00768"></a>00768 <span class="comment">// silently ignore the Lua code wanting to prematurely start the MainLoop.</span>
|
|
<a name="l00769"></a>00769 <span class="comment">// Initialized to false, meaning not set.</span>
|
|
<a name="l00770"></a>00770 <span class="comment">// Set to true for the Lua code "wx.wxGetApp:MainLoop()" to not call</span>
|
|
<a name="l00771"></a>00771 <span class="comment">// the app's MainLoop() function.</span>
|
|
<a name="l00772"></a>00772 <span class="comment">//</span>
|
|
<a name="l00773"></a>00773 <span class="comment">// See the wxLua apps for usage.</span>
|
|
<a name="l00774"></a><a class="code" href="classwxLuaState.html#a99bc71c83ae038a25f7cb00fee3a5583">00774</a> <span class="keyword">static</span> <span class="keywordtype">bool</span> sm_wxAppMainLoop_will_run;
|
|
<a name="l00775"></a>00775
|
|
<a name="l00776"></a>00776 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00777"></a>00777
|
|
<a name="l00778"></a>00778 <span class="comment">// Get/Set the event handler that the wxLuaEvents from this will be sent to, can be NULL.</span>
|
|
<a name="l00779"></a>00779 <span class="comment">// See wxEVT_LUA_XXX for a list of possible events that may be sent.</span>
|
|
<a name="l00780"></a>00780 <span class="keywordtype">void</span> SetEventHandler(wxEvtHandler *evtHandler);
|
|
<a name="l00781"></a>00781 wxEvtHandler *GetEventHandler() <span class="keyword">const</span>;
|
|
<a name="l00782"></a>00782 <span class="comment">// Get/Set the wxWindowID that the wxLuaEvents will be sent with.</span>
|
|
<a name="l00783"></a>00783 <span class="keywordtype">void</span> SetId(wxWindowID <span class="keywordtype">id</span>);
|
|
<a name="l00784"></a>00784 wxWindowID GetId() <span class="keyword">const</span>;
|
|
<a name="l00785"></a>00785
|
|
<a name="l00786"></a>00786 <span class="comment">// Sends the input wxLuaEvent, after checking that this is valid, to the</span>
|
|
<a name="l00787"></a>00787 <span class="comment">// set wxEventHandler (may be NULL), see constructor or SetEventHandler().</span>
|
|
<a name="l00788"></a>00788 <span class="comment">// returns wxEvtHandler::ProcessEvent(event)</span>
|
|
<a name="l00789"></a>00789 <span class="keywordtype">bool</span> SendEvent( <a class="code" href="classwxLuaEvent.html">wxLuaEvent</a> &event ) <span class="keyword">const</span>;
|
|
<a name="l00790"></a>00790
|
|
<a name="l00791"></a>00791 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00792"></a>00792
|
|
<a name="l00793"></a>00793 <span class="comment">// Run a Lua file from disk using lua_loadfile() then LuaPCall().</span>
|
|
<a name="l00794"></a>00794 <span class="comment">// Leaves nresults on the stack, use LUA_MULTRET to leave them all.</span>
|
|
<a name="l00795"></a>00795 <span class="comment">// Returns 0 on success or Lua's error code.</span>
|
|
<a name="l00796"></a>00796 <span class="comment">// Sends a wxEVT_LUA_ERROR wxLuaEvent on error.</span>
|
|
<a name="l00797"></a>00797 <span class="keywordtype">int</span> RunFile(<span class="keyword">const</span> wxString &fileName, <span class="keywordtype">int</span> nresults = 0);
|
|
<a name="l00798"></a>00798 <span class="comment">// Run a string that contains Lua code using luaL_loadbuffer() then LuaPCall().</span>
|
|
<a name="l00799"></a>00799 <span class="comment">// Leaves nresults on the stack, use LUA_MULTRET to leave them all.</span>
|
|
<a name="l00800"></a>00800 <span class="comment">// Returns 0 on success or Lua's error code.</span>
|
|
<a name="l00801"></a>00801 <span class="comment">// Sends a wxEVT_LUA_ERROR wxLuaEvent on error.</span>
|
|
<a name="l00802"></a>00802 <span class="keywordtype">int</span> RunString(<span class="keyword">const</span> wxString &script, <span class="keyword">const</span> wxString& name = wxEmptyString, <span class="keywordtype">int</span> nresults = 0);
|
|
<a name="l00803"></a>00803 <span class="comment">// Run a char array #included from bin2c compilation or something else</span>
|
|
<a name="l00804"></a>00804 <span class="comment">// using luaL_loadbuffer() then LuaPCall().</span>
|
|
<a name="l00805"></a>00805 <span class="comment">// Leaves nresults on the stack, use LUA_MULTRET to leave them all.</span>
|
|
<a name="l00806"></a>00806 <span class="comment">// Returns 0 on success or Lua's error code.</span>
|
|
<a name="l00807"></a>00807 <span class="comment">// Sends a wxEVT_LUA_ERROR wxLuaEvent on error.</span>
|
|
<a name="l00808"></a>00808 <span class="keywordtype">int</span> RunBuffer(<span class="keyword">const</span> <span class="keywordtype">char</span> buf[], <span class="keywordtype">size_t</span> size, <span class="keyword">const</span> wxString &name = wxT(<span class="stringliteral">"= lua"</span>), <span class="keywordtype">int</span> nresults = 0);
|
|
<a name="l00809"></a>00809
|
|
<a name="l00810"></a><a class="code" href="classwxLuaState.html#a30853179a57c38807b6a2a2643566bc2">00810</a> <span class="keywordtype">int</span> <a class="code" href="classwxLuaState.html#a30853179a57c38807b6a2a2643566bc2">LuaDoString</a>(<span class="keyword">const</span> wxString &script, <span class="keyword">const</span> wxString& name = wxEmptyString, <span class="keywordtype">int</span> nresults = 0) { <span class="keywordflow">return</span> RunString(script, name, nresults); }
|
|
<a name="l00811"></a><a class="code" href="classwxLuaState.html#aa45f60f72e9fe110ee4c766ebed2dec6">00811</a> <span class="keywordtype">int</span> <a class="code" href="classwxLuaState.html#aa45f60f72e9fe110ee4c766ebed2dec6">LuaDoFile</a>(<span class="keyword">const</span> wxString &filename, <span class="keywordtype">int</span> nresults = 0) { <span class="keywordflow">return</span> RunFile(filename, nresults); }
|
|
<a name="l00812"></a><a class="code" href="classwxLuaState.html#a2badd11ef8383e2b529b50e59c5819d4">00812</a> <span class="keywordtype">int</span> <a class="code" href="classwxLuaState.html#a2badd11ef8383e2b529b50e59c5819d4">LuaDoBuffer</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *buffer, <span class="keywordtype">size_t</span> len, <span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keywordtype">int</span> nresults = 0) { <span class="keywordflow">return</span> RunBuffer(buffer, len, <a class="code" href="wxlstate_8h.html#aaa3dbc7e667edd1e7409725fe338f4e8">lua2wx</a>(name), nresults); }
|
|
<a name="l00813"></a>00813
|
|
<a name="l00814"></a>00814 <span class="comment">// Is a program running now, running state is set for Run/File/String/Buffer</span>
|
|
<a name="l00815"></a>00815 <span class="keywordtype">bool</span> IsRunning() <span class="keyword">const</span>;
|
|
<a name="l00816"></a>00816
|
|
<a name="l00817"></a>00817 <span class="comment">// Replacement for lua_pcall()</span>
|
|
<a name="l00818"></a>00818 <span class="comment">// Returns 0 on success or Lua's error code.</span>
|
|
<a name="l00819"></a>00819 <span class="comment">// Sends a wxEVT_LUA_ERROR wxLuaEvent on error.</span>
|
|
<a name="l00820"></a>00820 <span class="comment">// narg is the number of args to the function to call.</span>
|
|
<a name="l00821"></a>00821 <span class="comment">// nresults is the number of values expected to be returned and Lua</span>
|
|
<a name="l00822"></a>00822 <span class="comment">// will adjust the stack to match.</span>
|
|
<a name="l00823"></a>00823 <span class="comment">// Use LUA_MULTRET for a variable number of returns.</span>
|
|
<a name="l00824"></a>00824 <span class="keywordtype">int</span> LuaPCall(<span class="keywordtype">int</span> narg, <span class="keywordtype">int</span> nresults);
|
|
<a name="l00825"></a>00825
|
|
<a name="l00826"></a>00826 <span class="comment">//</span>
|
|
<a name="l00827"></a>00827 <span class="keywordtype">bool</span> SendLuaErrorEvent(<span class="keywordtype">int</span> status, <span class="keywordtype">int</span> top);
|
|
<a name="l00828"></a>00828
|
|
<a name="l00829"></a>00829 <span class="comment">// Get the wxEventType that Lua may currently be in, wxEVT_NULL if not in an</span>
|
|
<a name="l00830"></a>00830 <span class="comment">// event handler. Be careful about destroying Lua when in an event handler.</span>
|
|
<a name="l00831"></a>00831 <span class="comment">// See wxlua_getwxeventtype()</span>
|
|
<a name="l00832"></a>00832 wxEventType GetInEventType() <span class="keyword">const</span>;
|
|
<a name="l00833"></a>00833 <span class="comment">// Set the wxEventType that the Lua code is currently running (internal use).</span>
|
|
<a name="l00834"></a>00834 <span class="comment">// See wxlua_setwxeventtype()</span>
|
|
<a name="l00835"></a>00835 <span class="keywordtype">void</span> SetInEventType(wxEventType eventType);
|
|
<a name="l00836"></a>00836
|
|
<a name="l00837"></a>00837 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00838"></a>00838
|
|
<a name="l00839"></a>00839 <span class="comment">// Try to compile the Lua program. Creates new lua_State to test for syntax</span>
|
|
<a name="l00840"></a>00840 <span class="comment">// errors and sends error events. See wxlua_errorinfo() for errMsg and line_num.</span>
|
|
<a name="l00841"></a>00841 <span class="keywordtype">int</span> CompileString(<span class="keyword">const</span> wxString &script, <span class="keyword">const</span> wxString& name = wxEmptyString,
|
|
<a name="l00842"></a>00842 wxString* errMsg = NULL, <span class="keywordtype">int</span>* line_num = NULL);
|
|
<a name="l00843"></a>00843 <span class="keywordtype">int</span> CompileBuffer(<span class="keyword">const</span> <span class="keywordtype">char</span> buf[], <span class="keywordtype">size_t</span> size, <span class="keyword">const</span> wxString &name = wxEmptyString,
|
|
<a name="l00844"></a>00844 wxString* errMsg = NULL, <span class="keywordtype">int</span>* line_num = NULL);
|
|
<a name="l00845"></a>00845
|
|
<a name="l00846"></a>00846 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00847"></a>00847
|
|
<a name="l00848"></a>00848 <span class="comment">// Break a currently running Lua program by setting the Lua debug hook to</span>
|
|
<a name="l00849"></a>00849 <span class="comment">// be called for anything and breaking as soon as possible by calling</span>
|
|
<a name="l00850"></a>00850 <span class="comment">// wxlua_error() with the message</span>
|
|
<a name="l00851"></a>00851 <span class="keywordtype">void</span> DebugHookBreak(<span class="keyword">const</span> wxString &message = wxT(<span class="stringliteral">"Lua interpreter stopped"</span>));
|
|
<a name="l00852"></a>00852 <span class="comment">// Clear a previously set DebugHookBreak(), resetting the debug hook</span>
|
|
<a name="l00853"></a>00853 <span class="comment">// to the previous values</span>
|
|
<a name="l00854"></a>00854 <span class="keywordtype">void</span> ClearDebugHookBreak();
|
|
<a name="l00855"></a>00855 <span class="comment">// Has DebugHookBreak() been called and we're waiting for the next hook call?</span>
|
|
<a name="l00856"></a>00856 <span class="keywordtype">bool</span> GetDebugHookBreak() <span class="keyword">const</span>;
|
|
<a name="l00857"></a>00857 <span class="comment">// Get the message that will be sent when from a DebugHookBreak() call</span>
|
|
<a name="l00858"></a>00858 wxString GetDebugHookBreakMessage() <span class="keyword">const</span>;
|
|
<a name="l00859"></a>00859
|
|
<a name="l00860"></a>00860 <span class="comment">// Have Lua run an internal hook function with this mask</span>
|
|
<a name="l00861"></a>00861 <span class="comment">// hook = LUA_MASKCALL | LUA_MASKRET | LUA_MASKLINE | LUA_MASKCOUNT</span>
|
|
<a name="l00862"></a>00862 <span class="comment">// Every count hook mask a wxEVT_LUA_DEBUG_HOOK event is sent if send_debug_evt.</span>
|
|
<a name="l00863"></a>00863 <span class="comment">// If yield_ms > 0 then wxYield is called every yield milliseconds.</span>
|
|
<a name="l00864"></a>00864 <span class="comment">// Turn the hook off with count < 1</span>
|
|
<a name="l00865"></a>00865 <span class="comment">// see lua_sethook() function</span>
|
|
<a name="l00866"></a>00866 <span class="keywordtype">void</span> SetLuaDebugHook(<span class="keywordtype">int</span> hook = LUA_MASKCALL|LUA_MASKRET|LUA_MASKLINE|LUA_MASKCOUNT,
|
|
<a name="l00867"></a>00867 <span class="keywordtype">int</span> count = 1000, <span class="keywordtype">int</span> yield_ms = 100,
|
|
<a name="l00868"></a>00868 <span class="keywordtype">bool</span> send_debug_evt = <span class="keyword">false</span>);
|
|
<a name="l00869"></a>00869 <span class="keywordtype">int</span> GetLuaDebugHook() <span class="keyword">const</span>;
|
|
<a name="l00870"></a>00870 <span class="keywordtype">int</span> GetLuaDebugHookCount() <span class="keyword">const</span>;
|
|
<a name="l00871"></a>00871 <span class="keywordtype">int</span> GetLuaDebugHookYield() <span class="keyword">const</span>;
|
|
<a name="l00872"></a>00872 <span class="keywordtype">bool</span> GetLuaDebugHookSendEvt() <span class="keyword">const</span>;
|
|
<a name="l00873"></a>00873
|
|
<a name="l00874"></a>00874 <span class="comment">// Internally updated time that the debug hook was last called when running</span>
|
|
<a name="l00875"></a>00875 <span class="comment">// Lua code and SetLuaDebugHook is turned on</span>
|
|
<a name="l00876"></a>00876 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> GetLastLuaDebugHookTime() <span class="keyword">const</span>;
|
|
<a name="l00877"></a>00877 <span class="comment">// Set to an specific time to control debug timing</span>
|
|
<a name="l00878"></a>00878 <span class="keywordtype">void</span> SetLastLuaDebugHookTime(<span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> t);
|
|
<a name="l00879"></a>00879
|
|
<a name="l00880"></a>00880 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00881"></a>00881 <span class="comment">// Binding functions</span>
|
|
<a name="l00882"></a>00882
|
|
<a name="l00883"></a>00883 <span class="comment">// Registers a new C function for Lua, see usage in wxlstate.cpp</span>
|
|
<a name="l00884"></a>00884 <span class="keywordtype">void</span> RegisterFunction(lua_CFunction func, <span class="keyword">const</span> <span class="keywordtype">char</span>* funcName);
|
|
<a name="l00885"></a>00885 <a class="code" href="wxldefs_8h.html#a8b866331c104bad29e0e711e5279f717">wxLUA_UNICODE_ONLY</a>(<span class="keywordtype">void</span> RegisterFunction(lua_CFunction func, <span class="keyword">const</span> wxString &funcName) { RegisterFunction(func, <a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(funcName)); })
|
|
<a name="l00886"></a>00886
|
|
<a name="l00887"></a>00887 <span class="comment">// Register a single wxLuaBinding, returns true on success. Nothing is</span>
|
|
<a name="l00888"></a>00888 <span class="comment">// left on the stack.</span>
|
|
<a name="l00889"></a>00889 <span class="keywordtype">bool</span> RegisterBinding(<a class="code" href="classwxLuaBinding.html">wxLuaBinding</a>* binding);
|
|
<a name="l00890"></a>00890 <span class="comment">// Register all the bindings in the wxLuaBinding::GetBindingList(), this is done</span>
|
|
<a name="l00891"></a>00891 <span class="comment">// automatically if the wxLuaState is created with wxLUASTATE_OPENBINDINGS.</span>
|
|
<a name="l00892"></a>00892 <span class="keywordtype">bool</span> RegisterBindings();
|
|
<a name="l00893"></a>00893
|
|
<a name="l00894"></a>00894 <span class="comment">// Get the installed wxLuaBinding with the given</span>
|
|
<a name="l00895"></a>00895 <span class="comment">// wxLuaBinding::GetBindingName() or NULL for no match.</span>
|
|
<a name="l00896"></a>00896 <span class="comment">// See wxLuaBinding::GetLuaBinding().</span>
|
|
<a name="l00897"></a>00897 <a class="code" href="classwxLuaBinding.html">wxLuaBinding</a>* GetLuaBinding(<span class="keyword">const</span> wxString& bindingName) <span class="keyword">const</span>;
|
|
<a name="l00898"></a>00898
|
|
<a name="l00899"></a>00899 <span class="comment">// Get wxLuaBindClass for given Lua Tag using wxLuaBindClass::wxluatype,</span>
|
|
<a name="l00900"></a>00900 <span class="comment">// returns NULL on failure. See wxluaT_getclass().</span>
|
|
<a name="l00901"></a>00901 <span class="keyword">const</span> <a class="code" href="structwxLuaBindClass.html">wxLuaBindClass</a>* GetBindClass(<span class="keywordtype">int</span> iClassTag) <span class="keyword">const</span>;
|
|
<a name="l00902"></a>00902 <span class="comment">// Get wxLuaBindClass for given class name using wxLuaBindClass::name,</span>
|
|
<a name="l00903"></a>00903 <span class="comment">// returns NULL on failure. See wxluaT_getclass().</span>
|
|
<a name="l00904"></a>00904 <span class="keyword">const</span> <a class="code" href="structwxLuaBindClass.html">wxLuaBindClass</a>* GetBindClass(<span class="keyword">const</span> <span class="keywordtype">char</span>* className) <span class="keyword">const</span>;
|
|
<a name="l00905"></a>00905 <span class="comment">// Get the first wxLuaBindClass that has this particular wxLuaBindMethod</span>
|
|
<a name="l00906"></a>00906 <span class="comment">// returns NULL on failure. See wxLuaBinding::GetBindClass().</span>
|
|
<a name="l00907"></a>00907 <span class="keyword">const</span> <a class="code" href="structwxLuaBindClass.html">wxLuaBindClass</a>* GetBindClass(<span class="keyword">const</span> <a class="code" href="structwxLuaBindMethod.html">wxLuaBindMethod</a>* wxlMethod) <span class="keyword">const</span>;
|
|
<a name="l00908"></a>00908 <span class="comment">// Get the first wxLuaBindClass that has this particular wxLuaBindCFunc in its methods</span>
|
|
<a name="l00909"></a>00909 <span class="comment">// returns NULL on failure. See wxLuaBinding::GetBindClass().</span>
|
|
<a name="l00910"></a>00910 <span class="keyword">const</span> <a class="code" href="structwxLuaBindClass.html">wxLuaBindClass</a>* GetBindClass(<span class="keyword">const</span> <a class="code" href="structwxLuaBindCFunc.html">wxLuaBindCFunc</a>* wxlCFunc) <span class="keyword">const</span>;
|
|
<a name="l00911"></a>00911 <span class="comment">// See wxluaT_isderivedtype().</span>
|
|
<a name="l00912"></a>00912 <span class="keywordtype">int</span> IsDerivedType(<span class="keywordtype">int</span> wxl_type, <span class="keywordtype">int</span> base_wxl_type) <span class="keyword">const</span>;
|
|
<a name="l00913"></a>00913 <span class="comment">// Get wxLuaBindEvent for given wxEventType (wxEvent::GetEventType()) by finding</span>
|
|
<a name="l00914"></a>00914 <span class="comment">// the matching wxLuaBindEvent::eventType.</span>
|
|
<a name="l00915"></a>00915 <span class="comment">// See wxLuaBinding::GetBindEvent().</span>
|
|
<a name="l00916"></a>00916 <span class="keyword">const</span> <a class="code" href="structwxLuaBindEvent.html">wxLuaBindEvent</a>* GetBindEvent(wxEventType eventType) <span class="keyword">const</span>;
|
|
<a name="l00917"></a>00917
|
|
<a name="l00918"></a>00918 <span class="comment">// See wxlua_setcallbaseclassfunction() and wxlua_getcallbaseclassfunction().</span>
|
|
<a name="l00919"></a>00919 <span class="keywordtype">void</span> SetCallBaseClassFunction(<span class="keywordtype">bool</span> call_base);
|
|
<a name="l00920"></a>00920 <span class="keywordtype">bool</span> GetCallBaseClassFunction();
|
|
<a name="l00921"></a>00921
|
|
<a name="l00922"></a>00922 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00923"></a>00923 <span class="comment">// memory tracking functions (internal use)</span>
|
|
<a name="l00924"></a>00924
|
|
<a name="l00925"></a>00925 <span class="comment">// See wxluaO_addgcobject().</span>
|
|
<a name="l00926"></a>00926 <span class="keywordtype">void</span> AddGCObject(wxObject *wxobj);
|
|
<a name="l00927"></a>00927 <span class="comment">// See wxluaO_addgcobject().</span>
|
|
<a name="l00928"></a>00928 <span class="keywordtype">void</span> AddGCObject(<span class="keywordtype">void</span>* obj_ptr, wxObject *wxobj);
|
|
<a name="l00929"></a>00929 <span class="comment">// See wxluaO_deletegcobject().</span>
|
|
<a name="l00930"></a>00930 <span class="keywordtype">bool</span> DeleteGCObject(<span class="keywordtype">void</span>* udata, <span class="keywordtype">void</span> *obj_ptr, <span class="keywordtype">int</span> flags);
|
|
<a name="l00931"></a>00931 <span class="comment">// See wxluaO_isgcobject().</span>
|
|
<a name="l00932"></a>00932 <span class="keywordtype">bool</span> IsGCObject(<span class="keywordtype">void</span> *obj_ptr) <span class="keyword">const</span>;
|
|
<a name="l00933"></a>00933 <span class="comment">// See wxluaO_getgcobjectinfo().</span>
|
|
<a name="l00934"></a>00934 wxArrayString GetGCObjectInfo() <span class="keyword">const</span>;
|
|
<a name="l00935"></a>00935
|
|
<a name="l00936"></a>00936 <span class="comment">// Add a wxWindow to track and delete when we're closed, only track</span>
|
|
<a name="l00937"></a>00937 <span class="comment">// the parent window, not its children. returns true if it was added.</span>
|
|
<a name="l00938"></a>00938 <span class="comment">// Note: wxObject is used as the base class since we blindly call this</span>
|
|
<a name="l00939"></a>00939 <span class="comment">// function for all objects with classinfo in the bindings and we</span>
|
|
<a name="l00940"></a>00940 <span class="comment">// want to minimize the code in the bindings.</span>
|
|
<a name="l00941"></a>00941 <span class="keywordtype">void</span> AddTrackedWindow(wxObject *win);
|
|
<a name="l00942"></a>00942 <span class="comment">// Don't track this window anymore and don't delete it.</span>
|
|
<a name="l00943"></a>00943 <span class="keywordtype">void</span> RemoveTrackedWindow(wxWindow *win);
|
|
<a name="l00944"></a>00944 <span class="comment">// Is this window tracked, if check_parents see if a parent of it is.</span>
|
|
<a name="l00945"></a>00945 <span class="keywordtype">bool</span> IsTrackedWindow(wxWindow *win, <span class="keywordtype">bool</span> check_parents = <span class="keyword">true</span>) <span class="keyword">const</span>;
|
|
<a name="l00946"></a>00946 <span class="comment">// Get an array of strings "wxWindow_classname(&win id=wxWindowID)"</span>
|
|
<a name="l00947"></a>00947 wxArrayString GetTrackedWindowInfo() <span class="keyword">const</span>;
|
|
<a name="l00948"></a>00948
|
|
<a name="l00949"></a>00949 <span class="comment">// delete all stray wxWindow derived classes that have been destroyed</span>
|
|
<a name="l00950"></a>00950 <span class="comment">// by wxWidgets (eg. a child window)</span>
|
|
<a name="l00951"></a>00951 <span class="comment">// This function does not need to be called ever, for debugging perhaps?</span>
|
|
<a name="l00952"></a>00952 <span class="keywordtype">void</span> GarbageCollectWindows(<span class="keywordtype">bool</span> closeWindows);
|
|
<a name="l00953"></a>00953
|
|
<a name="l00954"></a>00954 <span class="comment">// Add or remove a tracked wxLuaEventCallback connected to a wxEvtHandler</span>
|
|
<a name="l00955"></a>00955 <span class="keywordtype">void</span> AddTrackedEventCallback(<a class="code" href="classwxLuaEventCallback.html">wxLuaEventCallback</a>* callback);
|
|
<a name="l00956"></a>00956 <span class="keywordtype">bool</span> RemoveTrackedEventCallback(<a class="code" href="classwxLuaEventCallback.html">wxLuaEventCallback</a>* callback);
|
|
<a name="l00957"></a>00957 <span class="comment">// Get an array of strings "wxEVT_XXX (wxEventType #) count#"</span>
|
|
<a name="l00958"></a>00958 wxArrayString GetTrackedEventCallbackInfo() <span class="keyword">const</span>;
|
|
<a name="l00959"></a>00959
|
|
<a name="l00960"></a>00960 <span class="comment">// Add or remove a tracked wxLuaWinDestroyCallback connected to wxEVT_DESTROY.</span>
|
|
<a name="l00961"></a>00961 <span class="keywordtype">void</span> AddTrackedWinDestroyCallback(<a class="code" href="classwxLuaWinDestroyCallback.html">wxLuaWinDestroyCallback</a>* callback);
|
|
<a name="l00962"></a>00962 <span class="keywordtype">bool</span> RemoveTrackedWinDestroyCallback(<a class="code" href="classwxLuaWinDestroyCallback.html">wxLuaWinDestroyCallback</a>* callback);
|
|
<a name="l00963"></a>00963 <span class="comment">// Get an array of strings "wxWindow_classname count#"</span>
|
|
<a name="l00964"></a>00964 wxArrayString GetTrackedWinDestroyCallbackInfo() <span class="keyword">const</span>;
|
|
<a name="l00965"></a>00965
|
|
<a name="l00966"></a>00966 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00967"></a>00967
|
|
<a name="l00968"></a>00968 <span class="comment">// Push the errorMsg on the stack and call wxlua_error()</span>
|
|
<a name="l00969"></a>00969 <span class="keywordtype">void</span> wxlua_Error(<span class="keyword">const</span> <span class="keywordtype">char</span> *errorMsg) <span class="keyword">const</span>;
|
|
<a name="l00970"></a>00970 <a class="code" href="wxldefs_8h.html#a8b866331c104bad29e0e711e5279f717">wxLUA_UNICODE_ONLY</a>(<span class="keywordtype">void</span> wxlua_Error(<span class="keyword">const</span> wxString& errorMsg) <span class="keyword">const</span> { wxlua_Error(<a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(errorMsg)); })
|
|
<a name="l00971"></a>00971
|
|
<a name="l00972"></a>00972 <span class="keywordtype">void</span>* wxlua_ToUserdata(<span class="keywordtype">int</span> stack_idx, <span class="keywordtype">bool</span> null_ptr = <span class="keyword">false</span>) <span class="keyword">const</span>;
|
|
<a name="l00973"></a>00973
|
|
<a name="l00974"></a>00974 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00975"></a>00975 <span class="comment">// wxLua Lua Registry Table Functions</span>
|
|
<a name="l00976"></a>00976
|
|
<a name="l00977"></a>00977 <span class="keywordtype">int</span> wxluaR_Ref(<span class="keywordtype">int</span> stack_idx, <span class="keywordtype">void</span>* lightuserdata_reg_key);
|
|
<a name="l00978"></a>00978 <span class="keywordtype">bool</span> wxluaR_Unref(<span class="keywordtype">int</span> wxlref_index, <span class="keywordtype">void</span>* lightuserdata_reg_key);
|
|
<a name="l00979"></a>00979 <span class="keywordtype">bool</span> wxluaR_GetRef(<span class="keywordtype">int</span> wxlref_index, <span class="keywordtype">void</span>* lightuserdata_reg_key);
|
|
<a name="l00980"></a>00980
|
|
<a name="l00981"></a>00981 <span class="keywordtype">int</span> wxluaT_NewMetatable(<span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00982"></a>00982 <span class="keywordtype">bool</span> wxluaT_SetMetatable(<span class="keywordtype">int</span> wxl_type);
|
|
<a name="l00983"></a>00983 <span class="keywordtype">int</span> wxluaT_Type(<span class="keywordtype">int</span> stack_idx) <span class="keyword">const</span>;
|
|
<a name="l00984"></a>00984
|
|
<a name="l00985"></a>00985 <span class="keywordtype">bool</span> wxluaT_PushUserDataType(<span class="keyword">const</span> <span class="keywordtype">void</span> *obj_ptr, <span class="keywordtype">int</span> wxl_type, <span class="keywordtype">bool</span> track);
|
|
<a name="l00986"></a>00986
|
|
<a name="l00987"></a>00987 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l00988"></a>00988 <span class="comment">// wxLua get data type</span>
|
|
<a name="l00989"></a>00989
|
|
<a name="l00990"></a>00990 <span class="comment">// See wxlua_iswxluatype().</span>
|
|
<a name="l00991"></a>00991 <span class="keywordtype">int</span> IswxLuaType(<span class="keywordtype">int</span> luatype, <span class="keywordtype">int</span> wxl_type) <span class="keyword">const</span>;
|
|
<a name="l00992"></a>00992 <span class="comment">// See wxluaT_isuserdatatype().</span>
|
|
<a name="l00993"></a>00993 <span class="keywordtype">bool</span> IsUserDataType(<span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span> wxl_type) <span class="keyword">const</span>;
|
|
<a name="l00994"></a>00994 <span class="comment">// See wxluaT_getuserdatatype().</span>
|
|
<a name="l00995"></a>00995 <span class="keywordtype">void</span>* GetUserDataType(<span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span> iTag) <span class="keyword">const</span>;
|
|
<a name="l00996"></a>00996
|
|
<a name="l00997"></a>00997 <span class="comment">// helper functions to get numbers, booleans and strings safer</span>
|
|
<a name="l00998"></a>00998
|
|
<a name="l00999"></a>00999 <span class="comment">// See wxlua_getstringtype().</span>
|
|
<a name="l01000"></a>01000 <span class="keyword">const</span> <span class="keywordtype">char</span>* GetStringType(<span class="keywordtype">int</span> stack_idx);
|
|
<a name="l01001"></a>01001 <span class="comment">// See wxlua_getwxStringtype().</span>
|
|
<a name="l01002"></a>01002 wxString GetwxStringType(<span class="keywordtype">int</span> stack_idx);
|
|
<a name="l01003"></a>01003 <span class="comment">// See wxlua_getbooleantype().</span>
|
|
<a name="l01004"></a>01004 <span class="keywordtype">bool</span> GetBooleanType(<span class="keywordtype">int</span> stack_idx);
|
|
<a name="l01005"></a>01005 <span class="comment">// See wxlua_getintegertype().</span>
|
|
<a name="l01006"></a>01006 <span class="keywordtype">long</span> GetIntegerType(<span class="keywordtype">int</span> stack_idx);
|
|
<a name="l01007"></a>01007 <span class="comment">// See wxlua_getnumbertype().</span>
|
|
<a name="l01008"></a>01008 <span class="keywordtype">double</span> GetNumberType(<span class="keywordtype">int</span> stack_idx);
|
|
<a name="l01009"></a>01009
|
|
<a name="l01010"></a>01010 <span class="comment">// See wxlua_isXXXtype().</span>
|
|
<a name="l01011"></a>01011 <span class="keywordtype">bool</span> IsStringType(<span class="keywordtype">int</span> stack_idx) <span class="keyword">const</span>;
|
|
<a name="l01012"></a>01012 <span class="keywordtype">bool</span> IswxStringType(<span class="keywordtype">int</span> stack_idx) <span class="keyword">const</span>;
|
|
<a name="l01013"></a>01013 <span class="keywordtype">bool</span> IsBooleanType(<span class="keywordtype">int</span> stack_idx) <span class="keyword">const</span>;
|
|
<a name="l01014"></a>01014 <span class="keywordtype">bool</span> IsIntegerType(<span class="keywordtype">int</span> stack_idx) <span class="keyword">const</span>;
|
|
<a name="l01015"></a>01015 <span class="keywordtype">bool</span> IsNumberType(<span class="keywordtype">int</span> stack_idx) <span class="keyword">const</span>;
|
|
<a name="l01016"></a>01016
|
|
<a name="l01017"></a>01017 <span class="comment">// See wxlua_getwxStringarray().</span>
|
|
<a name="l01018"></a>01018 wxString* GetwxStringArray(<span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span> &count);
|
|
<a name="l01019"></a>01019 <span class="comment">// See wxlua_getwxArrayString().</span>
|
|
<a name="l01020"></a>01020 <a class="code" href="classwxLuaSmartwxArrayString.html">wxLuaSmartwxArrayString</a> GetwxArrayString(<span class="keywordtype">int</span> stack_idx);
|
|
<a name="l01021"></a>01021 <span class="comment">// See wxlua_getchararray().</span>
|
|
<a name="l01022"></a>01022 <span class="keyword">const</span> <span class="keywordtype">char</span>** GetCharArray(<span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span> &count);
|
|
<a name="l01023"></a>01023
|
|
<a name="l01024"></a>01024 <span class="comment">// See wxlua_getintarray().</span>
|
|
<a name="l01025"></a>01025 <span class="keywordtype">int</span>* GetIntArray(<span class="keywordtype">int</span> stack_idx, <span class="keywordtype">int</span> &count);
|
|
<a name="l01026"></a>01026 <span class="comment">// See wxlua_getwxArrayInt().</span>
|
|
<a name="l01027"></a>01027 <a class="code" href="classwxLuaSmartwxArrayInt.html">wxLuaSmartwxArrayInt</a> GetwxArrayInt(<span class="keywordtype">int</span> stack_idx);
|
|
<a name="l01028"></a>01028
|
|
<a name="l01029"></a>01029 <span class="comment">// See wxlua_pushwxArrayStringtable().</span>
|
|
<a name="l01030"></a>01030 <span class="keywordtype">int</span> PushwxArrayStringTable(<span class="keyword">const</span> wxArrayString &strArray);
|
|
<a name="l01031"></a>01031 <span class="comment">// See wxlua_pushwxArrayInttable().</span>
|
|
<a name="l01032"></a>01032 <span class="keywordtype">int</span> PushwxArrayIntTable(<span class="keyword">const</span> wxArrayInt &intArray);
|
|
<a name="l01033"></a>01033
|
|
<a name="l01034"></a>01034 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01035"></a>01035
|
|
<a name="l01036"></a>01036 <span class="comment">// See wxluaT_typename().</span>
|
|
<a name="l01037"></a>01037 wxString GetwxLuaTypeName(<span class="keywordtype">int</span> wxl_type) <span class="keyword">const</span>;
|
|
<a name="l01038"></a>01038
|
|
<a name="l01039"></a>01039 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01040"></a>01040
|
|
<a name="l01041"></a>01041 <span class="comment">// See wxlua_setderivedmethod</span>
|
|
<a name="l01042"></a>01042 <span class="keywordtype">bool</span> SetDerivedMethod(<span class="keywordtype">void</span> *obj_ptr, <span class="keyword">const</span> <span class="keywordtype">char</span> *method_name, <a class="code" href="classwxLuaObject.html">wxLuaObject</a>* wxlObj);
|
|
<a name="l01043"></a>01043 <span class="comment">// See wxlua_hasderivedmethod().</span>
|
|
<a name="l01044"></a>01044 <span class="keywordtype">bool</span> HasDerivedMethod(<span class="keywordtype">void</span> *obj_ptr, <span class="keyword">const</span> <span class="keywordtype">char</span> *method_name, <span class="keywordtype">bool</span> push_method) <span class="keyword">const</span>;
|
|
<a name="l01045"></a>01045 <span class="comment">// See wxlua_removederivedmethods()</span>
|
|
<a name="l01046"></a>01046 <span class="keywordtype">bool</span> RemoveDerivedMethods(<span class="keywordtype">void</span> *obj_ptr) <span class="keyword">const</span>;
|
|
<a name="l01047"></a>01047 <span class="comment">// Find a derived method given an object and and a method name.</span>
|
|
<a name="l01048"></a>01048 <span class="comment">// If the method can be found, return the valid wxLuaState it belongs to.</span>
|
|
<a name="l01049"></a>01049 <span class="comment">// This function can be used for classes that implement virtual functions to</span>
|
|
<a name="l01050"></a>01050 <span class="comment">// try to find a wxLuaState that may have overridden the function to call it.</span>
|
|
<a name="l01051"></a>01051 <span class="comment">// It is probably easier to merely make a wxLuaState a class member for</span>
|
|
<a name="l01052"></a>01052 <span class="comment">// faster lookup though.</span>
|
|
<a name="l01053"></a>01053 <span class="keyword">static</span> <a class="code" href="classwxLuaState.html">wxLuaState</a> GetDerivedMethodState(<span class="keywordtype">void</span> *obj_ptr, <span class="keyword">const</span> <span class="keywordtype">char</span> *method_name);
|
|
<a name="l01054"></a>01054
|
|
<a name="l01055"></a>01055 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01056"></a>01056 <span class="comment">// C++ interface for the lua_State functions</span>
|
|
<a name="l01057"></a>01057 <span class="comment">// functions prepended by lua_XXX directly call the 'C' lua_XXX function</span>
|
|
<a name="l01058"></a>01058 <span class="comment">// The function names have been capitalized to allow case sensitive searching</span>
|
|
<a name="l01059"></a>01059 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01060"></a>01060 <span class="comment">// Raw basic Lua stack functions, lua.h</span>
|
|
<a name="l01061"></a>01061
|
|
<a name="l01062"></a>01062 <span class="keywordtype">int</span> lua_GetTop() <span class="keyword">const</span>;
|
|
<a name="l01063"></a>01063 <span class="keywordtype">void</span> lua_SetTop(<span class="keywordtype">int</span> index);
|
|
<a name="l01064"></a>01064 <span class="keywordtype">void</span> lua_PushValue(<span class="keywordtype">int</span> index);
|
|
<a name="l01065"></a>01065 <span class="keywordtype">void</span> lua_Remove(<span class="keywordtype">int</span> index);
|
|
<a name="l01066"></a>01066 <span class="keywordtype">void</span> lua_Pop(<span class="keywordtype">int</span> count);
|
|
<a name="l01067"></a>01067 <span class="keywordtype">void</span> lua_Insert(<span class="keywordtype">int</span> index);
|
|
<a name="l01068"></a>01068 <span class="keywordtype">void</span> lua_Replace(<span class="keywordtype">int</span> index);
|
|
<a name="l01069"></a>01069 <span class="keywordtype">int</span> lua_CheckStack(<span class="keywordtype">int</span> size);
|
|
<a name="l01070"></a>01070 <span class="keywordtype">void</span> lua_XMove(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>& to, <span class="keywordtype">int</span> n);
|
|
<a name="l01071"></a>01071
|
|
<a name="l01072"></a>01072 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01073"></a>01073 <span class="comment">// Raw Lua accesses functions (stack -> C), lua.h</span>
|
|
<a name="l01074"></a>01074
|
|
<a name="l01075"></a>01075 <span class="keywordtype">bool</span> lua_IsNumber(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01076"></a>01076 <span class="keywordtype">bool</span> lua_IsString(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01077"></a>01077 <span class="keywordtype">bool</span> lua_IsCFunction(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01078"></a>01078 <span class="keywordtype">bool</span> lua_IsUserdata(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01079"></a>01079 <span class="keywordtype">int</span> lua_Type(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01080"></a>01080 wxString lua_TypeName(<span class="keywordtype">int</span> type) <span class="keyword">const</span>;
|
|
<a name="l01081"></a>01081
|
|
<a name="l01082"></a>01082 <span class="keywordtype">int</span> lua_Equal(<span class="keywordtype">int</span> index1, <span class="keywordtype">int</span> index2) <span class="keyword">const</span>;
|
|
<a name="l01083"></a>01083 <span class="keywordtype">int</span> lua_RawEqual(<span class="keywordtype">int</span> index1, <span class="keywordtype">int</span> index2) <span class="keyword">const</span>;
|
|
<a name="l01084"></a>01084 <span class="keywordtype">int</span> lua_LessThan(<span class="keywordtype">int</span> index1, <span class="keywordtype">int</span> index2) <span class="keyword">const</span>;
|
|
<a name="l01085"></a>01085
|
|
<a name="l01086"></a>01086 <span class="keywordtype">double</span> lua_ToNumber(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01087"></a>01087 <span class="keywordtype">int</span> lua_ToInteger(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01088"></a>01088 <span class="keywordtype">int</span> lua_ToBoolean(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01089"></a>01089 <span class="keyword">const</span> <span class="keywordtype">char</span>* lua_ToString(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01090"></a>01090 wxString lua_TowxString(<span class="keywordtype">int</span> index) <span class="keyword">const</span>; <span class="comment">// wxLua added</span>
|
|
<a name="l01091"></a>01091 <span class="keywordtype">size_t</span> lua_StrLen(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01092"></a>01092 <span class="keywordtype">size_t</span> luaL_ObjLen(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01093"></a>01093 lua_CFunction lua_ToCFunction(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01094"></a>01094 <span class="keywordtype">void</span>* lua_ToUserdata(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01095"></a>01095 <a class="code" href="classwxLuaState.html">wxLuaState</a> lua_ToThread(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01096"></a>01096 <span class="keyword">const</span> <span class="keywordtype">void</span>* lua_ToPointer(<span class="keywordtype">int</span> index) <span class="keyword">const</span>;
|
|
<a name="l01097"></a>01097
|
|
<a name="l01098"></a>01098 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01099"></a>01099 <span class="comment">// Raw Lua push functions (C -> stack), lua.h</span>
|
|
<a name="l01100"></a>01100
|
|
<a name="l01101"></a>01101 <span class="keywordtype">void</span> lua_PushNil();
|
|
<a name="l01102"></a>01102 <span class="keywordtype">void</span> lua_PushNumber(lua_Number n);
|
|
<a name="l01103"></a>01103 <span class="keywordtype">void</span> lua_PushInteger(lua_Integer n);
|
|
<a name="l01104"></a>01104 <span class="keywordtype">void</span> lua_PushLString(<span class="keyword">const</span> <span class="keywordtype">char</span>* s, <span class="keywordtype">size_t</span> len);
|
|
<a name="l01105"></a>01105 <span class="keywordtype">void</span> lua_PushString(<span class="keyword">const</span> <span class="keywordtype">char</span>* s);
|
|
<a name="l01106"></a>01106 <a class="code" href="wxldefs_8h.html#a8b866331c104bad29e0e711e5279f717">wxLUA_UNICODE_ONLY</a>(<span class="keywordtype">void</span> lua_PushString(<span class="keyword">const</span> wxString& s) { lua_PushString(<a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(s)); })
|
|
<a name="l01107"></a>01107 <span class="comment">//wxString lua_PushVfString();</span>
|
|
<a name="l01108"></a>01108 <span class="comment">//wxString lua_PushFString();</span>
|
|
<a name="l01109"></a>01109 <span class="keywordtype">void</span> lua_PushCClosure(lua_CFunction fn, <span class="keywordtype">int</span> n);
|
|
<a name="l01110"></a>01110 <span class="keywordtype">void</span> lua_PushBoolean(<span class="keywordtype">bool</span> b);
|
|
<a name="l01111"></a>01111 <span class="keywordtype">void</span> lua_PushLightUserdata(<span class="keywordtype">void</span>* p);
|
|
<a name="l01112"></a>01112 <span class="comment">//void lua_PushThread(lua_State* L);</span>
|
|
<a name="l01113"></a>01113
|
|
<a name="l01114"></a>01114 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01115"></a>01115 <span class="comment">// Raw Lua get functions (Lua -> stack), lua.h</span>
|
|
<a name="l01116"></a>01116
|
|
<a name="l01117"></a>01117 <span class="keywordtype">void</span> lua_GetTable(<span class="keywordtype">int</span> idx);
|
|
<a name="l01118"></a>01118 <span class="keywordtype">void</span> lua_GetField(<span class="keywordtype">int</span> idx, <span class="keyword">const</span> <span class="keywordtype">char</span>* k);
|
|
<a name="l01119"></a>01119 <a class="code" href="wxldefs_8h.html#a8b866331c104bad29e0e711e5279f717">wxLUA_UNICODE_ONLY</a>(<span class="keywordtype">void</span> lua_GetField(<span class="keywordtype">int</span> idx, <span class="keyword">const</span> wxString& k) { lua_GetField(idx, <a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(k)); })
|
|
<a name="l01120"></a>01120 <span class="keywordtype">void</span> lua_RawGet(<span class="keywordtype">int</span> idx);
|
|
<a name="l01121"></a>01121 <span class="keywordtype">void</span> lua_RawGeti(<span class="keywordtype">int</span> idx, <span class="keywordtype">int</span> n);
|
|
<a name="l01122"></a>01122 <span class="keywordtype">void</span> lua_CreateTable(<span class="keywordtype">int</span> narr, <span class="keywordtype">int</span> nrec);
|
|
<a name="l01123"></a>01123 <span class="keywordtype">void</span> lua_NewTable();
|
|
<a name="l01124"></a>01124 <span class="keywordtype">void</span>* lua_NewUserdata(<span class="keywordtype">size_t</span> sz);
|
|
<a name="l01125"></a>01125 <span class="keywordtype">int</span> lua_GetMetatable(<span class="keywordtype">int</span> objindex);
|
|
<a name="l01126"></a>01126 <span class="keywordtype">void</span> lua_GetFenv(<span class="keywordtype">int</span> idx);
|
|
<a name="l01127"></a>01127
|
|
<a name="l01128"></a>01128 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01129"></a>01129 <span class="comment">// Raw Lua set functions (stack -> Lua), lua.h</span>
|
|
<a name="l01130"></a>01130
|
|
<a name="l01131"></a>01131 <span class="keywordtype">void</span> lua_SetTable(<span class="keywordtype">int</span> idx);
|
|
<a name="l01132"></a>01132 <span class="keywordtype">void</span> lua_SetField(<span class="keywordtype">int</span> idx, <span class="keyword">const</span> <span class="keywordtype">char</span>* k);
|
|
<a name="l01133"></a>01133 <a class="code" href="wxldefs_8h.html#a8b866331c104bad29e0e711e5279f717">wxLUA_UNICODE_ONLY</a>(<span class="keywordtype">void</span> lua_SetField(<span class="keywordtype">int</span> idx, <span class="keyword">const</span> wxString& k) { lua_SetField(idx, <a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(k)); })
|
|
<a name="l01134"></a>01134 <span class="keywordtype">void</span> lua_RawSet(<span class="keywordtype">int</span> idx);
|
|
<a name="l01135"></a>01135 <span class="keywordtype">void</span> lua_RawSeti(<span class="keywordtype">int</span> idx, <span class="keywordtype">int</span> n);
|
|
<a name="l01136"></a>01136 <span class="keywordtype">int</span> lua_SetMetatable(<span class="keywordtype">int</span> objindex);
|
|
<a name="l01137"></a>01137 <span class="keywordtype">int</span> lua_SetFenv(<span class="keywordtype">int</span> idx);
|
|
<a name="l01138"></a>01138
|
|
<a name="l01139"></a>01139 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01140"></a>01140 <span class="comment">// Raw Lua `load' and `call' functions (load and run Lua code), lua.h</span>
|
|
<a name="l01141"></a>01141
|
|
<a name="l01142"></a>01142 <span class="keywordtype">void</span> lua_Call(<span class="keywordtype">int</span> nargs, <span class="keywordtype">int</span> nresults);
|
|
<a name="l01143"></a>01143 <span class="keywordtype">int</span> lua_PCall(<span class="keywordtype">int</span> nargs, <span class="keywordtype">int</span> nresults, <span class="keywordtype">int</span> errfunc);
|
|
<a name="l01144"></a>01144 <span class="keywordtype">int</span> lua_CPCall(lua_CFunction func, <span class="keywordtype">void</span> *ud);
|
|
<a name="l01145"></a>01145 <span class="keywordtype">int</span> lua_Load(lua_Reader reader, <span class="keywordtype">void</span> *dt, <span class="keyword">const</span> <span class="keywordtype">char</span>* chunkname);
|
|
<a name="l01146"></a>01146 <a class="code" href="wxldefs_8h.html#a8b866331c104bad29e0e711e5279f717">wxLUA_UNICODE_ONLY</a>(<span class="keywordtype">int</span> lua_Load(lua_Reader reader, <span class="keywordtype">void</span> *dt, <span class="keyword">const</span> wxString& chunkname) { <span class="keywordflow">return</span> lua_Load(reader, dt, <a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(chunkname)); })
|
|
<a name="l01147"></a>01147
|
|
<a name="l01148"></a>01148 <span class="keywordtype">int</span> lua_Dump(lua_Writer writer, <span class="keywordtype">void</span> *data);
|
|
<a name="l01149"></a>01149
|
|
<a name="l01150"></a>01150 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01151"></a>01151 <span class="comment">// Raw Lua coroutine functions, lua.h</span>
|
|
<a name="l01152"></a>01152
|
|
<a name="l01153"></a>01153 <span class="keywordtype">int</span> lua_Yield(<span class="keywordtype">int</span> nresults);
|
|
<a name="l01154"></a>01154 <span class="keywordtype">int</span> lua_Resume(<span class="keywordtype">int</span> narg);
|
|
<a name="l01155"></a>01155 <span class="keywordtype">int</span> lua_Status();
|
|
<a name="l01156"></a>01156
|
|
<a name="l01157"></a>01157 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01158"></a>01158 <span class="comment">// Raw Lua garbage-collection functions, lua.h</span>
|
|
<a name="l01159"></a>01159
|
|
<a name="l01160"></a>01160 <span class="keywordtype">int</span> lua_GetGCCount();
|
|
<a name="l01161"></a>01161
|
|
<a name="l01162"></a>01162 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01163"></a>01163 <span class="comment">// Raw Lua miscellaneous functions, lua.h</span>
|
|
<a name="l01164"></a>01164
|
|
<a name="l01165"></a>01165 wxString lua_Version() <span class="keyword">const</span>;
|
|
<a name="l01166"></a>01166 <span class="keywordtype">int</span> lua_Error();
|
|
<a name="l01167"></a>01167 <span class="keywordtype">int</span> lua_Next(<span class="keywordtype">int</span> idx);
|
|
<a name="l01168"></a>01168 <span class="keywordtype">void</span> lua_Concat(<span class="keywordtype">int</span> n);
|
|
<a name="l01169"></a>01169
|
|
<a name="l01170"></a>01170 <span class="comment">//LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);</span>
|
|
<a name="l01171"></a>01171 <span class="comment">//LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);</span>
|
|
<a name="l01172"></a>01172
|
|
<a name="l01173"></a>01173 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01174"></a>01174 <span class="comment">// Raw Lua some useful "macros", lua.h</span>
|
|
<a name="l01175"></a>01175
|
|
<a name="l01176"></a>01176 <span class="comment">//lua_boxpointer(L,u)</span>
|
|
<a name="l01177"></a>01177 <span class="comment">//lua_unboxpointer(L,i)</span>
|
|
<a name="l01178"></a>01178 <span class="comment">//lua_pop(L,n) lua_settop(L, -(n)-1)</span>
|
|
<a name="l01179"></a>01179
|
|
<a name="l01180"></a>01180 <span class="keywordtype">void</span> lua_Register(<span class="keyword">const</span> <span class="keywordtype">char</span>* funcName, lua_CFunction f);
|
|
<a name="l01181"></a>01181 <a class="code" href="wxldefs_8h.html#a8b866331c104bad29e0e711e5279f717">wxLUA_UNICODE_ONLY</a>(<span class="keywordtype">void</span> lua_Register(<span class="keyword">const</span> wxString& funcName, lua_CFunction f) { lua_Register(<a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(funcName), f); })
|
|
<a name="l01182"></a>01182 <span class="keywordtype">void</span> lua_PushCFunction(lua_CFunction f);
|
|
<a name="l01183"></a>01183
|
|
<a name="l01184"></a>01184 <span class="keywordtype">bool</span> lua_IsFunction(<span class="keywordtype">int</span> idx) <span class="keyword">const</span>;
|
|
<a name="l01185"></a>01185 <span class="keywordtype">bool</span> lua_IsTable(<span class="keywordtype">int</span> idx) <span class="keyword">const</span>;
|
|
<a name="l01186"></a>01186 <span class="keywordtype">bool</span> lua_IsLightUserdata(<span class="keywordtype">int</span> idx) <span class="keyword">const</span>;
|
|
<a name="l01187"></a>01187 <span class="keywordtype">bool</span> lua_IsNil(<span class="keywordtype">int</span> idx) <span class="keyword">const</span>;
|
|
<a name="l01188"></a>01188 <span class="keywordtype">bool</span> lua_IsBoolean(<span class="keywordtype">int</span> idx) <span class="keyword">const</span>;
|
|
<a name="l01189"></a>01189 <span class="keywordtype">bool</span> lua_IsThread(<span class="keywordtype">int</span> idx) <span class="keyword">const</span>;
|
|
<a name="l01190"></a>01190 <span class="keywordtype">bool</span> lua_IsNone(<span class="keywordtype">int</span> idx) <span class="keyword">const</span>;
|
|
<a name="l01191"></a>01191 <span class="keywordtype">bool</span> lua_IsNoneOrNil(<span class="keywordtype">int</span> idx) <span class="keyword">const</span>;
|
|
<a name="l01192"></a>01192
|
|
<a name="l01193"></a>01193 <span class="comment">//lua_pushliteral(L, s) lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)</span>
|
|
<a name="l01194"></a>01194
|
|
<a name="l01195"></a>01195 <span class="keywordtype">void</span> lua_SetGlobal(<span class="keyword">const</span> <span class="keywordtype">char</span>* s);
|
|
<a name="l01196"></a>01196 <span class="keywordtype">void</span> lua_GetGlobal(<span class="keyword">const</span> <span class="keywordtype">char</span>* s);
|
|
<a name="l01197"></a>01197
|
|
<a name="l01198"></a>01198 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01199"></a>01199 <span class="comment">// Raw Lua Debug functions, lua.h</span>
|
|
<a name="l01200"></a>01200
|
|
<a name="l01201"></a>01201 <span class="keywordtype">int</span> lua_GetStack(<span class="keywordtype">int</span> level, lua_Debug* ar);
|
|
<a name="l01202"></a>01202 <span class="keywordtype">int</span> lua_GetInfo(<span class="keyword">const</span> <span class="keywordtype">char</span>* what, lua_Debug* ar);
|
|
<a name="l01203"></a>01203 <a class="code" href="wxldefs_8h.html#a8b866331c104bad29e0e711e5279f717">wxLUA_UNICODE_ONLY</a>(<span class="keywordtype">int</span> lua_GetInfo(<span class="keyword">const</span> wxString& what, lua_Debug* ar) { <span class="keywordflow">return</span> lua_GetInfo(<a class="code" href="wxlstate_8h.html#a41976a7549ef4bfa7e9a1147dc7b4d55">wx2lua</a>(what), ar); })
|
|
<a name="l01204"></a>01204 <span class="keyword">const</span> <span class="keywordtype">char</span>* lua_GetLocal(<span class="keyword">const</span> lua_Debug* ar, <span class="keywordtype">int</span> n);
|
|
<a name="l01205"></a>01205 <span class="keyword">const</span> <span class="keywordtype">char</span>* lua_SetLocal(<span class="keyword">const</span> lua_Debug* ar, <span class="keywordtype">int</span> n);
|
|
<a name="l01206"></a>01206 <span class="keyword">const</span> <span class="keywordtype">char</span>* lua_GetUpvalue(<span class="keywordtype">int</span> funcindex, <span class="keywordtype">int</span> n);
|
|
<a name="l01207"></a>01207 <span class="keyword">const</span> <span class="keywordtype">char</span>* lua_SetUpvalue(<span class="keywordtype">int</span> funcindex, <span class="keywordtype">int</span> n);
|
|
<a name="l01208"></a>01208
|
|
<a name="l01209"></a>01209 <span class="keywordtype">int</span> lua_SetHook(lua_Hook func, <span class="keywordtype">int</span> mask, <span class="keywordtype">int</span> count);
|
|
<a name="l01210"></a>01210 lua_Hook lua_GetHook();
|
|
<a name="l01211"></a>01211 <span class="keywordtype">int</span> lua_GetHookMask();
|
|
<a name="l01212"></a>01212 <span class="keywordtype">int</span> lua_GetHookCount();
|
|
<a name="l01213"></a>01213
|
|
<a name="l01214"></a>01214 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01215"></a>01215 <span class="comment">// Raw Lua auxlib functions, lauxlib.h</span>
|
|
<a name="l01216"></a>01216
|
|
<a name="l01217"></a>01217 <span class="keywordtype">void</span> luaI_OpenLib(<span class="keyword">const</span> <span class="keywordtype">char</span> *libname, <span class="keyword">const</span> luaL_reg *l, <span class="keywordtype">int</span> nup);
|
|
<a name="l01218"></a>01218 <span class="keywordtype">void</span> luaL_Register(<span class="keyword">const</span> <span class="keywordtype">char</span> *libname, <span class="keyword">const</span> luaL_reg *l);
|
|
<a name="l01219"></a>01219 <span class="keywordtype">int</span> luaL_GetMetafield(<span class="keywordtype">int</span> obj, <span class="keyword">const</span> <span class="keywordtype">char</span> *e);
|
|
<a name="l01220"></a>01220 <span class="keywordtype">int</span> luaL_CallMeta(<span class="keywordtype">int</span> obj, <span class="keyword">const</span> <span class="keywordtype">char</span> *e);
|
|
<a name="l01221"></a>01221 <span class="keywordtype">int</span> luaL_TypeError(<span class="keywordtype">int</span> narg, <span class="keyword">const</span> <span class="keywordtype">char</span> *tname);
|
|
<a name="l01222"></a>01222 <span class="keywordtype">int</span> luaL_ArgError(<span class="keywordtype">int</span> numarg, <span class="keyword">const</span> <span class="keywordtype">char</span> *extramsg);
|
|
<a name="l01223"></a>01223 <span class="keyword">const</span> <span class="keywordtype">char</span> *luaL_CheckLString(<span class="keywordtype">int</span> numArg, <span class="keywordtype">size_t</span> *l);
|
|
<a name="l01224"></a>01224 <span class="keyword">const</span> <span class="keywordtype">char</span> *luaL_OptLString(<span class="keywordtype">int</span> numArg, <span class="keyword">const</span> <span class="keywordtype">char</span> *def, <span class="keywordtype">size_t</span> *len);
|
|
<a name="l01225"></a>01225 lua_Number luaL_CheckNumber(<span class="keywordtype">int</span> numArg);
|
|
<a name="l01226"></a>01226 lua_Number luaL_OptNumber(<span class="keywordtype">int</span> nArg, lua_Number def);
|
|
<a name="l01227"></a>01227 lua_Integer luaL_CheckInteger(<span class="keywordtype">int</span> numArg);
|
|
<a name="l01228"></a>01228 lua_Integer luaL_OptInteger(<span class="keywordtype">int</span> nArg, lua_Integer def);
|
|
<a name="l01229"></a>01229
|
|
<a name="l01230"></a>01230 <span class="keywordtype">void</span> luaL_CheckStack(<span class="keywordtype">int</span> sz, <span class="keyword">const</span> <span class="keywordtype">char</span> *msg);
|
|
<a name="l01231"></a>01231 <span class="keywordtype">void</span> luaL_CheckType(<span class="keywordtype">int</span> narg, <span class="keywordtype">int</span> t);
|
|
<a name="l01232"></a>01232 <span class="keywordtype">void</span> luaL_CheckAny(<span class="keywordtype">int</span> narg);
|
|
<a name="l01233"></a>01233
|
|
<a name="l01234"></a>01234 <span class="keywordtype">int</span> luaL_NewMetatable(<span class="keyword">const</span> <span class="keywordtype">char</span> *tname);
|
|
<a name="l01235"></a>01235 <span class="keywordtype">void</span> luaL_GetMetatable(<span class="keyword">const</span> <span class="keywordtype">char</span> *tname);
|
|
<a name="l01236"></a>01236 <span class="keywordtype">void</span> *luaL_CheckUdata(<span class="keywordtype">int</span> ud, <span class="keyword">const</span> <span class="keywordtype">char</span> *tname);
|
|
<a name="l01237"></a>01237
|
|
<a name="l01238"></a>01238 <span class="keywordtype">void</span> luaL_Where(<span class="keywordtype">int</span> lvl);
|
|
<a name="l01239"></a>01239 <span class="keywordtype">int</span> luaL_Error(<span class="keyword">const</span> <span class="keywordtype">char</span> *fmt, ...);
|
|
<a name="l01240"></a>01240
|
|
<a name="l01241"></a>01241 <span class="keywordtype">int</span> luaL_CheckOption(<span class="keywordtype">int</span> narg, <span class="keyword">const</span> <span class="keywordtype">char</span> *def, <span class="keyword">const</span> <span class="keywordtype">char</span> *<span class="keyword">const</span> lst[]);
|
|
<a name="l01242"></a>01242
|
|
<a name="l01243"></a>01243 <span class="keywordtype">int</span> luaL_Ref(<span class="keywordtype">int</span> t);
|
|
<a name="l01244"></a>01244 <span class="keywordtype">void</span> luaL_Unref(<span class="keywordtype">int</span> t, <span class="keywordtype">int</span> ref);
|
|
<a name="l01245"></a>01245
|
|
<a name="l01246"></a>01246 <span class="keywordtype">int</span> luaL_LoadFile(<span class="keyword">const</span> <span class="keywordtype">char</span> *filename);
|
|
<a name="l01247"></a>01247 <span class="keywordtype">int</span> luaL_LoadBuffer(<span class="keyword">const</span> <span class="keywordtype">char</span> *buff, <span class="keywordtype">size_t</span> sz, <span class="keyword">const</span> <span class="keywordtype">char</span> *name);
|
|
<a name="l01248"></a>01248 <span class="keywordtype">int</span> luaL_LoadString(<span class="keyword">const</span> <span class="keywordtype">char</span> *s);
|
|
<a name="l01249"></a>01249
|
|
<a name="l01250"></a>01250 <span class="comment">//LUALIB_API lua_State *(luaL_newstate) (void);</span>
|
|
<a name="l01251"></a>01251 <span class="comment">//LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, const char *r);</span>
|
|
<a name="l01252"></a>01252 <span class="comment">//LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx, const char *fname, int szhint);</span>
|
|
<a name="l01253"></a>01253
|
|
<a name="l01254"></a>01254 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01255"></a>01255 <span class="comment">// Raw Lua some useful macros, lauxlib.h</span>
|
|
<a name="l01256"></a>01256
|
|
<a name="l01257"></a>01257 <span class="keywordtype">void</span> luaL_ArgCheck(<span class="keywordtype">bool</span> condition, <span class="keywordtype">int</span> numarg, <span class="keyword">const</span> <span class="keywordtype">char</span>* extramsg);
|
|
<a name="l01258"></a>01258 <span class="keyword">const</span> <span class="keywordtype">char</span>* luaL_CheckString(<span class="keywordtype">int</span> numArg);
|
|
<a name="l01259"></a>01259 <span class="keyword">const</span> <span class="keywordtype">char</span>* luaL_OptString(<span class="keywordtype">int</span> numArg, <span class="keyword">const</span> <span class="keywordtype">char</span>* def);
|
|
<a name="l01260"></a>01260 <span class="keywordtype">int</span> luaL_CheckInt(<span class="keywordtype">int</span> numArg);
|
|
<a name="l01261"></a>01261 <span class="keywordtype">int</span> luaL_OptInt(<span class="keywordtype">int</span> numArg, <span class="keywordtype">int</span> def);
|
|
<a name="l01262"></a>01262 <span class="keywordtype">long</span> luaL_CheckLong(<span class="keywordtype">int</span> numArg);
|
|
<a name="l01263"></a>01263 <span class="keywordtype">long</span> luaL_OptLong(<span class="keywordtype">int</span> numArg, <span class="keywordtype">int</span> def);
|
|
<a name="l01264"></a>01264
|
|
<a name="l01265"></a>01265 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01266"></a>01266 <span class="comment">// others</span>
|
|
<a name="l01267"></a>01267
|
|
<a name="l01268"></a>01268 <span class="keywordtype">void</span> GetGlobals();
|
|
<a name="l01269"></a>01269
|
|
<a name="l01270"></a>01270 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01271"></a>01271 <span class="comment">// LUA_PATH</span>
|
|
<a name="l01272"></a>01272
|
|
<a name="l01273"></a>01273 wxString GetLuaPath();
|
|
<a name="l01274"></a>01274 <span class="keywordtype">void</span> AddLuaPath(<span class="keyword">const</span> wxPathList& pathlist);
|
|
<a name="l01275"></a>01275 <span class="keywordtype">void</span> AddLuaPath(<span class="keyword">const</span> wxFileName& filename);
|
|
<a name="l01276"></a>01276
|
|
<a name="l01277"></a>01277 <span class="comment">// -----------------------------------------------------------------------</span>
|
|
<a name="l01278"></a>01278 <span class="comment">// operators</span>
|
|
<a name="l01279"></a>01279
|
|
<a name="l01280"></a><a class="code" href="classwxLuaState.html#a3df55baaea0d7efff6635657a4713e69">01280</a> <span class="keywordtype">bool</span> operator == (<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>& wxlState)<span class="keyword"> const</span>
|
|
<a name="l01281"></a>01281 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_refData == wxlState.m_refData; }
|
|
<a name="l01282"></a><a class="code" href="classwxLuaState.html#a72da0448716c6c1214c9f1eead156e9d">01282</a> <span class="keywordtype">bool</span> operator != (<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>& wxlState)<span class="keyword"> const</span>
|
|
<a name="l01283"></a>01283 <span class="keyword"> </span>{ <span class="keywordflow">return</span> m_refData != wxlState.m_refData; }
|
|
<a name="l01284"></a>01284
|
|
<a name="l01285"></a><a class="code" href="classwxLuaState.html#abece378a15d84eb6404556b8f3ab299b">01285</a> <a class="code" href="classwxLuaState.html">wxLuaState</a>& operator = (<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>& wxlState)
|
|
<a name="l01286"></a>01286 {
|
|
<a name="l01287"></a>01287 <span class="keywordflow">if</span> ( (*<span class="keyword">this</span>) != wxlState )
|
|
<a name="l01288"></a>01288 Create(wxlState);
|
|
<a name="l01289"></a>01289 <span class="keywordflow">return</span> *<span class="keyword">this</span>;
|
|
<a name="l01290"></a>01290 }
|
|
<a name="l01291"></a>01291
|
|
<a name="l01292"></a>01292 <span class="keyword">private</span>:
|
|
<a name="l01293"></a>01293 <span class="comment">// ref counting code</span>
|
|
<a name="l01294"></a>01294 <span class="keyword">virtual</span> wxObjectRefData *CreateRefData() <span class="keyword">const</span>;
|
|
<a name="l01295"></a>01295 <span class="comment">//virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;</span>
|
|
<a name="l01296"></a>01296
|
|
<a name="l01297"></a>01297 DECLARE_DYNAMIC_CLASS(<a class="code" href="classwxLuaState.html">wxLuaState</a>)
|
|
<a name="l01298"></a>01298 };
|
|
<a name="l01299"></a>01299
|
|
<a name="l01300"></a>01300 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
<a name="l01301"></a>01301 <span class="comment">// wxLuaEvent - An event sent from the wxLuaState to the set wxEvtHandler</span>
|
|
<a name="l01302"></a>01302 <span class="comment">// to alert the handler of print,</span>
|
|
<a name="l01303"></a>01303 <span class="comment">//-----------------------------------------------------------------------------</span>
|
|
<a name="l01304"></a>01304
|
|
<a name="l01305"></a><a class="code" href="classwxLuaEvent.html">01305</a> <span class="keyword">class </span><a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a> <a class="code" href="classwxLuaEvent.html">wxLuaEvent</a>: <span class="keyword">public</span> wxNotifyEvent
|
|
<a name="l01306"></a>01306 {
|
|
<a name="l01307"></a>01307 <span class="keyword">public</span>:
|
|
<a name="l01308"></a>01308 <a class="code" href="classwxLuaEvent.html">wxLuaEvent</a>(wxEventType commandType = wxEVT_NULL, wxWindowID <span class="keywordtype">id</span> = wxID_ANY,
|
|
<a name="l01309"></a>01309 <span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>& wxlState = wxNullLuaState);
|
|
<a name="l01310"></a>01310
|
|
<a name="l01311"></a>01311 <a class="code" href="classwxLuaEvent.html">wxLuaEvent</a>(<span class="keyword">const</span> <a class="code" href="classwxLuaEvent.html">wxLuaEvent</a> &event);
|
|
<a name="l01312"></a>01312
|
|
<a name="l01313"></a>01313 <span class="comment">// use GetString method to retrieve info</span>
|
|
<a name="l01314"></a>01314
|
|
<a name="l01315"></a>01315 <span class="comment">// Get the line number in the code, -1 if unknown</span>
|
|
<a name="l01316"></a><a class="code" href="classwxLuaEvent.html#a3f313da9471c84e45f4f9cd235a774dd">01316</a> <span class="keywordtype">int</span> <a class="code" href="classwxLuaEvent.html#a3f313da9471c84e45f4f9cd235a774dd">GetLineNum</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_commandInt; }
|
|
<a name="l01317"></a>01317
|
|
<a name="l01318"></a><a class="code" href="classwxLuaEvent.html#a5d35048cd8c9f792e28cdcf6f4dd4d48">01318</a> <a class="code" href="classwxLuaState.html">wxLuaState</a> <a class="code" href="classwxLuaEvent.html#a5d35048cd8c9f792e28cdcf6f4dd4d48">GetwxLuaState</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_wxlState; }
|
|
<a name="l01319"></a><a class="code" href="classwxLuaEvent.html#aad50d49ee94f015ebe76a53545101ceb">01319</a> <span class="keywordtype">void</span> <a class="code" href="classwxLuaEvent.html#aad50d49ee94f015ebe76a53545101ceb">SetwxLuaState</a>(<span class="keyword">const</span> <a class="code" href="classwxLuaState.html">wxLuaState</a>& wxlState) { m_wxlState = wxlState; }
|
|
<a name="l01320"></a>01320
|
|
<a name="l01321"></a><a class="code" href="classwxLuaEvent.html#a73ac60e2bbc9fa56ff429ff32502be4e">01321</a> lua_State *<a class="code" href="classwxLuaEvent.html#a73ac60e2bbc9fa56ff429ff32502be4e">GetLuaState</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_wxlState.GetLuaState(); }
|
|
<a name="l01322"></a>01322 <span class="comment">// non null only for wxEVT_LUA_DEBUG_HOOK</span>
|
|
<a name="l01323"></a><a class="code" href="classwxLuaEvent.html#afce48025c217326241b036569da11531">01323</a> lua_Debug *<a class="code" href="classwxLuaEvent.html#afce48025c217326241b036569da11531">GetLuaDebug</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> m_lua_Debug; }
|
|
<a name="l01324"></a>01324
|
|
<a name="l01325"></a>01325 <span class="comment">// If called from a wxEVT_LUA_DEBUG_HOOK the interpreter will stop</span>
|
|
<a name="l01326"></a><a class="code" href="classwxLuaEvent.html#aac67e64dcdff6cef29814ff4e88e3107">01326</a> <span class="keywordtype">void</span> <a class="code" href="classwxLuaEvent.html#aac67e64dcdff6cef29814ff4e88e3107">DebugHookBreak</a>(<span class="keywordtype">bool</span> stop) { m_debug_hook_break = stop; }
|
|
<a name="l01327"></a>01327
|
|
<a name="l01328"></a>01328 <span class="comment">// implementation</span>
|
|
<a name="l01329"></a><a class="code" href="classwxLuaEvent.html#a12bd4308b8070f961e7be81e213f1c43">01329</a> <span class="keyword">virtual</span> wxEvent *<a class="code" href="classwxLuaEvent.html#a12bd4308b8070f961e7be81e213f1c43">Clone</a>()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classwxLuaEvent.html">wxLuaEvent</a>(*<span class="keyword">this</span>); }
|
|
<a name="l01330"></a>01330
|
|
<a name="l01331"></a><a class="code" href="classwxLuaEvent.html#a40b6efe1f9a7fc7df4efdc4c6475e4ed">01331</a> <a class="code" href="classwxLuaState.html">wxLuaState</a> m_wxlState;
|
|
<a name="l01332"></a><a class="code" href="classwxLuaEvent.html#a4e546d4f0fcda8df7b55d702e99564ee">01332</a> <span class="keywordtype">bool</span> m_debug_hook_break;
|
|
<a name="l01333"></a><a class="code" href="classwxLuaEvent.html#a6880399f0d046a520b0a7241e836c635">01333</a> lua_Debug *m_lua_Debug;
|
|
<a name="l01334"></a>01334 };
|
|
<a name="l01335"></a>01335
|
|
<a name="l01336"></a>01336 BEGIN_DECLARE_EVENT_TYPES()
|
|
<a name="l01337"></a>01337 <span class="comment">// A wxLuaState is being created, sent at the end of</span>
|
|
<a name="l01338"></a>01338 <span class="comment">// wxLuaState(wxEvtHandler, win id) or Create(wxEvtHandler, win id)</span>
|
|
<a name="l01339"></a>01339 DECLARE_EXPORTED_EVENT_TYPE(<a class="code" href="wxldefs_8h.html#ad8b07fc8dd8f30300e284b64f734b026">WXDLLIMPEXP_WXLUA</a>, wxEVT_LUA_CREATION, 0)
|
|
<a name="l01340"></a>01340 <span class="comment">// Lua's print(...) statements and such, check GetString()</span>
|
|
<a name="l01341"></a>01341 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_PRINT, 0)
|
|
<a name="l01342"></a>01342 <span class="comment">// an error in Lua has occurred, check GetString() for message</span>
|
|
<a name="l01343"></a>01343 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_ERROR, 0)
|
|
<a name="l01344"></a>01344 <span class="comment">// see LuaDebugHook function</span>
|
|
<a name="l01345"></a>01345 DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_DEBUG_HOOK, 0)
|
|
<a name="l01346"></a>01346 <span class="comment">// after app starts, first idle</span>
|
|
<a name="l01347"></a>01347 <span class="comment">//DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_INIT, 0)</span>
|
|
<a name="l01348"></a>01348 <span class="comment">//DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WXLUA, wxEVT_LUA_DEBUGGERATTACHED, 0)</span>
|
|
<a name="l01349"></a>01349 END_DECLARE_EVENT_TYPES()
|
|
<a name="l01350"></a>01350
|
|
<a name="l01351"></a><a class="code" href="wxlstate_8h.html#a457fe986cc2a5959a60f80e0b256779e">01351</a> typedef <span class="keywordtype">void</span> (wxEvtHandler::*<a class="code" href="wxlstate_8h.html#a457fe986cc2a5959a60f80e0b256779e">wxLuaEventFunction</a>)(<a class="code" href="classwxLuaEvent.html">wxLuaEvent</a>&);
|
|
<a name="l01352"></a>01352
|
|
<a name="l01353"></a><a class="code" href="wxlstate_8h.html#abbf5c699733040a5d1d7343ec2fd0f06">01353</a> <span class="preprocessor">#define wxLuaEventHandler(func) \</span>
|
|
<a name="l01354"></a>01354 <span class="preprocessor"> (wxObjectEventFunction)(wxEventFunction)(wxCommandEventFunction)(wxNotifyEventFunction)wxStaticCastEvent(wxLuaEventFunction, &func)</span>
|
|
<a name="l01355"></a>01355 <span class="preprocessor"></span>
|
|
<a name="l01356"></a><a class="code" href="wxlstate_8h.html#a09517e61d8b14a3b9844c4c68889a4ad">01356</a> <span class="preprocessor">#define wx__DECLARE_WXLUAEVT(evt, id, fn) wx__DECLARE_EVT1(evt, id, wxLuaEventHandler(fn))</span>
|
|
<a name="l01357"></a>01357 <span class="preprocessor"></span>
|
|
<a name="l01358"></a><a class="code" href="wxlstate_8h.html#a7ba13cec8f4b41c534c38eaf7d04d0d0">01358</a> <span class="preprocessor">#define EVT_LUA_CREATION(id, fn) wx__DECLARE_WXLUAEVT(wxEVT_LUA_CREATION, id, fn)</span>
|
|
<a name="l01359"></a><a class="code" href="wxlstate_8h.html#a9c893c39ff1ac22b6b1e40ad26b813f7">01359</a> <span class="preprocessor"></span><span class="preprocessor">#define EVT_LUA_PRINT(id, fn) wx__DECLARE_WXLUAEVT(wxEVT_LUA_PRINT, id, fn)</span>
|
|
<a name="l01360"></a><a class="code" href="wxlstate_8h.html#ae33e9376bcf204d4b1dbe553ddd5fea4">01360</a> <span class="preprocessor"></span><span class="preprocessor">#define EVT_LUA_ERROR(id, fn) wx__DECLARE_WXLUAEVT(wxEVT_LUA_ERROR, id, fn)</span>
|
|
<a name="l01361"></a><a class="code" href="wxlstate_8h.html#a01f8bccaa7ef35d0e9750795cf60acb4">01361</a> <span class="preprocessor"></span><span class="preprocessor">#define EVT_LUA_DEBUG_HOOK(id, fn) wx__DECLARE_WXLUAEVT(wxEVT_LUA_DEBUG_HOOK, id, fn)</span>
|
|
<a name="l01362"></a>01362 <span class="preprocessor"></span>
|
|
<a name="l01363"></a>01363 <span class="preprocessor">#endif // _WXLSTATE_H_</span>
|
|
</pre></div></div>
|
|
<hr class="footer"/><address style="text-align: right;"><small>Generated on Tue Jul 13 10:30:39 2010 for wxLua by
|
|
<a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
|
|
</body>
|
|
</html>
|