From: John L. <jr...@us...> - 2007-06-08 22:50:25
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18758/wxLua/samples Modified Files: bindings.wx.lua Log Message: Add some functions to compare the wxlua tags type to lua_type() within lua also get the tag number for any object in lua Cleanup the bindings.wx.lua to make it more useful Index: bindings.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/bindings.wx.lua,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** bindings.wx.lua 8 Jun 2007 01:36:32 -0000 1.1 --- bindings.wx.lua 8 Jun 2007 22:50:18 -0000 1.2 *************** *** 5,9 **** -- Modified by: -- Created: 5/7/2007 ! -- RCS-ID: -- Copyright: (c) John Labenski -- Licence: wxWidgets licence --- 5,9 ---- -- Modified by: -- Created: 5/7/2007 ! -- RCS-ID: -- Copyright: (c) John Labenski -- Licence: wxWidgets licence *************** *** 18,32 **** local lens = {} ! for i = 1, #keys do lens[i] = string.len(keys[i]) end ! ! for i = 1, #t do local u = t[i] for k = 1, #keys do local len = string.len(tostring(u[keys[k]])) ! if (len > lens[k]) then ! lens[k] = len end end --- 18,32 ---- local lens = {} ! for i = 1, #keys do lens[i] = string.len(keys[i]) end ! ! for i = 1, #t do local u = t[i] for k = 1, #keys do local len = string.len(tostring(u[keys[k]])) ! if (len > lens[k]) then ! lens[k] = len end end *************** *** 41,45 **** print(s) ! for i = 1, #t do local u = t[i] local s = "" --- 41,45 ---- print(s) ! for i = 1, #t do local u = t[i] local s = "" *************** *** 55,67 **** function DumpBindingInfo(binding) ! print("Binding Name : "..tostring(binding.GetBindingName)) ! print("Lua Namespace : "..tostring(binding.GetLuaNamespace)) ! ! print("Class Count : "..tostring(binding.GetClassCount)) ! print("Define Count : "..tostring(binding.GetDefineCount)) ! print("Event Count : "..tostring(binding.GetEventCount)) ! print("Object Count : "..tostring(binding.GetObjectCount)) ! print("Function Count : "..tostring(binding.GetFunctionCount)) if true then --- 55,67 ---- function DumpBindingInfo(binding) ! print("GetBindingName : "..tostring(binding.GetBindingName)) ! print("GetLuaNamespace : "..tostring(binding.GetLuaNamespace)) + print("GetClassCount : "..tostring(binding.GetClassCount)) + print("GetDefineCount : "..tostring(binding.GetDefineCount)) + print("GetStringCount : "..tostring(binding.GetStringCount)) + print("GetEventCount : "..tostring(binding.GetEventCount)) + print("GetObjectCount : "..tostring(binding.GetObjectCount)) + print("GetFunctionCount : "..tostring(binding.GetFunctionCount)) if true then *************** *** 100,104 **** ColumnDumpTable(binding.GetObjectArray, keys) end ! end --- 100,104 ---- ColumnDumpTable(binding.GetObjectArray, keys) end ! end *************** *** 108,184 **** -- ---------------------------------------------------------------------------- -- A wxLua program to view the bindings in a wxListCtrl -- ---------------------------------------------------------------------------- ! ID_LISTCTRL = 1000 ! listData = {} -- store the table currently displayed by the listCtrl ! list_level = 1 ! img_normal = 0 ! img_folder = 1 ! listColWidths = {} -- stored by "object_type" name function SaveListColWidths(level) ! if not listColWidths[listData[level].object_type] then ! listColWidths[listData[level].object_type] = {} end ! for col = 1, listCtrl:GetColumnCount() do ! listColWidths[listData[level].object_type][col] = listCtrl:GetColumnWidth(col-1) end end function GotoBindingLevel(listCtrl, level) listCtrl:DeleteAllItems() ! ! local lc_item = 0 ! for col = 1, listCtrl:GetColumnCount() do listCtrl:DeleteColumn(0) end ! ! for col = 1, #listData[level].cols do ! listCtrl:InsertColumn(col-1, listData[level].cols[col], wx.wxLIST_FORMAT_LEFT, -1) ! ! if listData[level].folder and listData[level].folder[col] then ! listCtrl:SetColumnImage(col-1, img_folder) end - end ! if listColWidths[listData[level].object_type] then ! for col = 1, #listColWidths[listData[level].object_type] do ! listCtrl:SetColumnWidth(col-1, listColWidths[listData[level].object_type][col]) end end ! ! for i = 1, #listData[level] do ! local d = listData[level][i] ! local info = wx.wxListItem() info:SetId(lc_item+1) info:SetText(tostring(d[1])) lc_item = listCtrl:InsertItem(info) ! info:SetId(lc_item) ! if (d[1] ~= "..") then ! for col = 2, #listData[level].cols do listCtrl:SetItem(lc_item, col-1, tostring(d[col])) end end end end function CreatewxLuaBindClass(tbl) local keys = { "name", "methods", "methods_n", "classInfo", "class_tag", "baseclassName", "baseclass", "enums", "enums_n" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindClass") ! -- these are expandable ! t.folder = {} ! t.folder[2] = true ! t.folder[7] = true ! t.folder[8] = true return t end --- 108,341 ---- -- ---------------------------------------------------------------------------- + -- ---------------------------------------------------------------------------- -- A wxLua program to view the bindings in a wxListCtrl -- ---------------------------------------------------------------------------- + -- ---------------------------------------------------------------------------- ! frame = nil ! listCtrl = nil ! ID_LISTCTRL = 1000 -- id of the listctrl ! img_normal = 0 -- a "file" image in the listctrl ! img_folder = 1 -- a "folder" image in the listctrl ! listColWidths = {} -- stored by "object_type" name + list_level = 1 -- where are we in the listData + listData = {} -- store the table currently displayed by the listCtrl + -- { {"col1", "col2", ... ["icon"] = img_normal, ["color"] = wx.wxBLUE }, + -- {"col1", "col2", ... The icon and color are optional }, + -- { ... }, + -- ["col_labels"] = { "col label 1", "col label 2", ...}, + -- ["col_icons"] = { nil, nil, img_folder,... }, -- the 3rd col has folder icon + -- ["object_type"] = "wxLuaBindClass", -- or something else readable + -- ["list_item"] = last selected list item or nil if not set + + -- ---------------------------------------------------------------------------- + -- Save the current listctrl settings into the listColWidths table + -- ---------------------------------------------------------------------------- function SaveListColWidths(level) ! local object_type = listData[level].object_type ! ! if not listColWidths[object_type] then ! listColWidths[object_type] = {} end ! for col = 1, listCtrl:GetColumnCount() do ! listColWidths[object_type][col] = listCtrl:GetColumnWidth(col-1) end end + -- ---------------------------------------------------------------------------- + -- Go to a binding level which already must exist in the listData table + -- ---------------------------------------------------------------------------- function GotoBindingLevel(listCtrl, level) + local data = listData[level] + + -- Do we calculate what widths to use for the cols or use previous values? + local auto_col_widths = false + if listColWidths[data.object_type] == nil then + auto_col_widths = true + listColWidths[data.object_type] = {} + end + + -- Wipe items and all cols and recreate them with appropriate names listCtrl:DeleteAllItems() ! for col = 1, listCtrl:GetColumnCount() do listCtrl:DeleteColumn(0) end ! ! -- Add the cols ! for col = 1, #data.col_labels do ! listCtrl:InsertColumn(col-1, data.col_labels[col], wx.wxLIST_FORMAT_LEFT, -1) ! ! if data.col_icons and data.col_icons[col] then ! listCtrl:SetColumnImage(col-1, data.col_icons[col]) end ! if auto_col_widths then ! local w = listCtrl:GetTextExtent(data.col_labels[col]) ! if data.col_icons and data.col_icons[col] then ! w = w + 20 ! end ! if w > (listColWidths[data.object_type][col] or 0) - 20 then ! listColWidths[data.object_type][col] = w + 20 ! end end end ! ! -- Add the items ! local lc_item = 0 ! ! for i = 1, #data do ! local d = data[i] ! local info = wx.wxListItem() info:SetId(lc_item+1) info:SetText(tostring(d[1])) + if (d.icon) then + info:SetImage(d.icon) + end + if (d.color) then + info:SetTextColour(d.color) + end lc_item = listCtrl:InsertItem(info) ! ! if auto_col_widths then ! local w = listCtrl:GetTextExtent(tostring(d[1])) ! if w > (listColWidths[data.object_type][1] or 0) - 25 then ! listColWidths[data.object_type][1] = w + 25 ! end ! end ! if (d[1] ~= "..") then ! for col = 2, #listData[level].col_labels do listCtrl:SetItem(lc_item, col-1, tostring(d[col])) + + if auto_col_widths then + local w = listCtrl:GetTextExtent(tostring(d[col])) + if w > (listColWidths[data.object_type][col] or 0) - 20 then + listColWidths[data.object_type][col] = w + 20 + end + end + end + else + if data.class_name then + listCtrl:SetItem(lc_item, 1, tostring(data.class_name)) end end end + + -- Set the column widths + if listColWidths[data.object_type] then + for col = 1, #listColWidths[data.object_type] do + listCtrl:SetColumnWidth(col-1, listColWidths[data.object_type][col]) + end + end + + -- Try to reselect the item if we're going up a level + if data.list_item and (data.list_item < listCtrl:GetItemCount()) then + listCtrl:SetItemState(data.list_item, wx.wxLIST_STATE_FOCUSED, wx.wxLIST_STATE_FOCUSED); + listCtrl:SetItemState(data.list_item, wx.wxLIST_STATE_SELECTED, wx.wxLIST_STATE_SELECTED); + listCtrl:EnsureVisible(data.list_item) + end + + -- Finally set the status text of where we are + local s = {} + for i = 1, level do + table.insert(s, listData[i].object_type) + end + frame:SetStatusText(table.concat(s, "->")) end + -- ---------------------------------------------------------------------------- + -- Convert the wxLuaMethod_Type enum into a readable string + -- ---------------------------------------------------------------------------- + function ConvertwxLuaMethod_Type(t_) + local s = {} + local t = t_ + if (t - wx.WXLUAMETHOD_OVERLOAD_BASE) >= 0 then + --table.insert(s, "OverloadBase") -- nobody should care about this + t = t - wx.WXLUAMETHOD_OVERLOAD_BASE + end + if (t - wx.WXLUAMETHOD_OVERLOAD) >= 0 then + table.insert(s, "Overload") + t = t - wx.WXLUAMETHOD_OVERLOAD + end + if (t - wx.WXLUAMETHOD_STATIC) >= 0 then + table.insert(s, "Static") + t = t - wx.WXLUAMETHOD_STATIC + end + if (t - wx.WXLUAMETHOD_SETPROP) >= 0 then + table.insert(s, "SetProp") + t = t - wx.WXLUAMETHOD_SETPROP + end + if (t - wx.WXLUAMETHOD_GETPROP) >= 0 then + table.insert(s, "GetProp") + t = t - wx.WXLUAMETHOD_GETPROP + end + if (t - wx.WXLUAMETHOD_CFUNCTION) >= 0 then + table.insert(s, "CFunc") + t = t - wx.WXLUAMETHOD_CFUNCTION + end + if (t - wx.WXLUAMETHOD_METHOD) >= 0 then + table.insert(s, "Method") + t = t - wx.WXLUAMETHOD_METHOD + end + if (t - wx.WXLUAMETHOD_CONSTRUCTOR) >= 0 then + table.insert(s, "Constructor") + t = t - wx.WXLUAMETHOD_CONSTRUCTOR + end + + assert(t == 0, "The wxLuaMethod_Type is not handled correctly "..tostring(t)) + + -- nobody should care about this and it's confusing + t = t_ + if (t - wx.WXLUAMETHOD_OVERLOAD_BASE) >= 0 then + t = t - wx.WXLUAMETHOD_OVERLOAD_BASE + end + + return string.format("0x%X (", t)..table.concat(s, ", ")..")" + end + + -- ---------------------------------------------------------------------------- + -- Create tables from the different binding structs type + -- ---------------------------------------------------------------------------- function CreatewxLuaBindClass(tbl) local keys = { "name", "methods", "methods_n", "classInfo", "class_tag", "baseclassName", "baseclass", "enums", "enums_n" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindClass") ! -- Convert the classinfo userdata into something more readable ! for i = 2, #t do ! if (type(t[i][2]) == "table") then ! t[i].icon = img_folder ! end ! ! local classInfo = t[i][4] ! if type(classInfo) == "userdata" then ! local s = classInfo:GetClassName() ! ! local b1 = classInfo:GetBaseClassName1() ! local b2 = classInfo:GetBaseClassName2() ! ! if (string.len(b1) > 0) then ! s = s.." ("..b1..")" ! end ! if (string.len(b2) > 0) then ! s = s.."("..b2..")" ! end ! ! t[i][4] = s ! end ! end ! ! -- these columns are expandable ! t.col_icons = {} ! t.col_icons[2] = img_folder ! t.col_icons[7] = img_folder ! t.col_icons[8] = img_folder return t end *************** *** 187,199 **** local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindMethod") ! -- these are expandable ! t.folder = {} ! t.folder[3] = true ! t.folder[5] = true return t end function CreatewxLuaBindDefine(tbl) local keys = { "name", "value" } ! return CreatewxLuaBindTable(tbl, keys, "wxLuaBindDefine") end function CreatewxLuaBindString(tbl) --- 344,392 ---- local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindMethod") ! -- we add in the cfuncs here so we don't have to click so much ! t.col_labels = { "name", "type", "funcs", "funcs_n", "basemethod", "minargs", "maxargs", "argtag_names", "argtags" } ! ! local i = 1 -- starts at 2 ! ! while (i < #t) do ! i = i + 1 ! ! t[i][2] = ConvertwxLuaMethod_Type(t[i][2]) ! ! if (type(t[i][3]) == "table") then ! local cfunc_t = CreatewxLuaBindCFunc(t[i][3]) ! t[i].color = wx.wxBLUE ! t[i][6] = "" ! t[i][7] = "" ! t[i][8] = "" ! t[i][9] = "" ! -- keys for CFunc = { "func", "type", "minargs", "maxargs", "argtag_names", "argtags" } ! for j = 2, #cfunc_t do ! table.insert(t, i+j-1, {"", cfunc_t[j][2], cfunc_t[j][1], "", "", cfunc_t[j][3], cfunc_t[j][4], cfunc_t[j][5], cfunc_t[j][6]}) ! end ! ! i = i + #cfunc_t - 1 -- skip over the newly added items ! end ! end ! ! -- these columns are expandable ! t.col_icons = {} ! t.col_icons[3] = img_folder ! t.col_icons[5] = img_folder return t end function CreatewxLuaBindDefine(tbl) local keys = { "name", "value" } ! local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindDefine") ! ! for i = 2, #t do ! -- these are often enums or flags, it's easier to see them as hex ! local n = tonumber(t[i][2]) ! if n > 0 then ! t[i][2] = t[i][2]..string.format(" (0x%X)", n) ! end ! end ! ! return t end function CreatewxLuaBindString(tbl) *************** *** 203,221 **** function CreatewxLuaBindEvent(tbl) local keys = { "name", "eventType", "class_tag" } ! return CreatewxLuaBindTable(tbl, keys, "wxLuaBindEvent") end function CreatewxLuaBindObject(tbl) local keys = { "name", "object", "class_tag" } ! return CreatewxLuaBindTable(tbl, keys, "wxLuaBindObject") end function CreatewxLuaBindCFunc(tbl) ! local keys = { "func", "type", "minargs", "maxargs", "argtags", "argtags_name" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindCFunc") ! for i = 2, #t do ! t[i][5] = table.concat(t[i][5], ", ") ! t[i][6] = table.concat(t[i][6], ", ") end ! return t end --- 396,440 ---- function CreatewxLuaBindEvent(tbl) local keys = { "name", "eventType", "class_tag" } ! local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindEvent") ! ! -- Add the tag name the event uses ! for i = 2, #t do ! t[i][3] = t[i][3].." ("..wx.wxlua_typename(t[i][3])..")" ! end ! ! return t end function CreatewxLuaBindObject(tbl) local keys = { "name", "object", "class_tag" } ! local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindObject") ! ! -- Add the tag name to the user data ! for i = 2, #t do ! t[i][3] = t[i][3].." ("..wx.wxlua_typename(t[i][3])..")" ! end ! ! return t end function CreatewxLuaBindCFunc(tbl) ! local keys = { "func", "type", "minargs", "maxargs", "argtags" } local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindCFunc") ! ! t.col_labels[5] ="argtags_names" -- swap these two ! t.col_labels[6] ="argtags" ! ! -- we don't want to show the table, just show the values and convert them to strings for i = 2, #t do ! local args = t[i][5] ! local arg_names = {} ! ! for j = 1, #args do ! table.insert(arg_names, wx.wxlua_typename(args[j])) ! end ! ! t[i][2] = ConvertwxLuaMethod_Type(t[i][2]) ! t[i][5] = table.concat(arg_names, ", ") -- swap these two ! t[i][6] = table.concat(args, ", ") end ! return t end *************** *** 223,228 **** function CreatewxLuaBindTable(tbl, keys, object_type) local t = { ! {".."}, ! ["cols"] = keys, ["object_type"] = object_type } --- 442,447 ---- function CreatewxLuaBindTable(tbl, keys, object_type) local t = { ! {"..", ["icon"] = img_folder}, ! ["col_labels"] = keys, ["object_type"] = object_type } *************** *** 236,240 **** table.insert(item, val) else ! table.insert(item, 0) end end --- 455,459 ---- table.insert(item, val) else ! table.insert(item, "") end end *************** *** 246,275 **** function main() ! frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua Binding Browser") panel = wx.wxPanel(frame, wx.wxID_ANY) ! ! ! ! listCtrl = wx.wxListView(panel, ID_LISTCTRL, wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxLC_REPORT + wx.wxLC_SINGLE_SEL + wx.wxLC_HRULES + wx.wxLC_VRULES) ! imageList = wx.wxImageList(16, 16, true) ! imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_NORMAL_FILE, wx.wxART_MENU)) ! imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_FILE_OPEN, wx.wxART_MENU)) listCtrl:SetImageList(imageList, wx.wxIMAGE_LIST_SMALL); ! listData[1] = { ! {"wx", "wxLuaBinding_wx"}, ! {"wx", "wxLuaBinding_wxstc"}, ! {"wx", "wxLuaBinding_wxluasocket"}, ! ["cols"] = { "Lua Namespace", "Binding userdata" }, ! ["object_type"] = "Root" } GotoBindingLevel(listCtrl, 1) ! ! listCtrl:Connect(wx.wxEVT_COMMAND_LIST_ITEM_ACTIVATED, function(event) local index = event:GetIndex() --- 465,536 ---- function main() ! frame = wx.wxFrame(wx.NULL, wx.wxID_ANY, "wxLua Binding Browser") + + -- Create the menu bar + local fileMenu = wx.wxMenu() + fileMenu:Append(wx.wxID_EXIT, "E&xit", "Quit the program") + + local helpMenu = wx.wxMenu() + helpMenu:Append(wx.wxID_ABOUT, "&About", "About the wxLua Binding Application") + helpMenu:Append(wx.wxID_HELP, "&Help", "How to use the wxLua Binding Application") + + local menuBar = wx.wxMenuBar() + menuBar:Append(fileMenu, "&File") + menuBar:Append(helpMenu, "&Help") + frame:SetMenuBar(menuBar) + + frame:Connect(wx.wxID_EXIT, wx.wxEVT_COMMAND_MENU_SELECTED, + function (event) frame:Close(true) end ) + + -- connect the selection event of the about menu item + frame:Connect(wx.wxID_ABOUT, wx.wxEVT_COMMAND_MENU_SELECTED, + function (event) + wx.wxMessageBox('This is the "About" dialog of the Bindings wxLua sample.\n'.. + "You can view the C++ bindings by navigating the wxListCtrl.\n".. + wx.wxLUA_VERSION_STRING.." built with "..wx.wxVERSION_STRING, + "About wxLua Bindings", + wx.wxOK + wx.wxICON_INFORMATION, + frame) + end ) + frame:Connect(wx.wxID_HELP, wx.wxEVT_COMMAND_MENU_SELECTED, + function (event) + wx.wxMessageBox("Select the C++ bindings to view and then you can see the items that\n".. + "have been wrapped. You can expand items that have a folder icon \n".. + " in the column header by double clicking on the item's column. \n".. + "Use the '..' to go up a level.\n\n".. + "This data is from the structs declared in \n".. + "wxLua/modules/wxlua/include/wxlbind.h.", + "Help on wxLua Bindings", + wx.wxOK + wx.wxICON_INFORMATION, + frame) + end ) + + + frame:CreateStatusBar(1) + frame:SetStatusText("Welcome to wxLua.") + + -- Create the windows panel = wx.wxPanel(frame, wx.wxID_ANY) ! listCtrl = wx.wxListView(panel, ID_LISTCTRL, wx.wxDefaultPosition, wx.wxDefaultSize, wx.wxLC_REPORT + wx.wxLC_SINGLE_SEL + wx.wxLC_HRULES + wx.wxLC_VRULES) ! imageList = wx.wxImageList(16, 16, true) ! imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_NORMAL_FILE, wx.wxART_MENU, wx.wxSize(16,16))) ! imageList:Add(wx.wxArtProvider.GetBitmap(wx.wxART_FOLDER, wx.wxART_MENU, wx.wxSize(16,16))) listCtrl:SetImageList(imageList, wx.wxIMAGE_LIST_SMALL); ! listData[1] = { ! {"wx", "wxLuaBinding_wx", ["icon"] = img_folder }, ! {"wx", "wxLuaBinding_wxstc", ["icon"] = img_folder }, ! {"wx", "wxLuaBinding_wxluasocket", ["icon"] = img_folder }, ! ["col_labels"] = { "Lua Namespace", "Binding userdata" }, ! ["object_type"] = " " } GotoBindingLevel(listCtrl, 1) ! ! listCtrl:Connect(wx.wxEVT_COMMAND_LIST_ITEM_ACTIVATED, function(event) local index = event:GetIndex() *************** *** 279,283 **** --local col = event:GetColumn() -- both of these don't work in MSW --local pt = event:GetPoint() ! local mousePos = wx.wxGetMousePosition() local framePos = frame:GetPosition() --- 540,544 ---- --local col = event:GetColumn() -- both of these don't work in MSW --local pt = event:GetPoint() ! local mousePos = wx.wxGetMousePosition() local framePos = frame:GetPosition() *************** *** 288,292 **** --print(x, mousePos:GetX(), scrollPos, framePos:GetX(), winPos:GetX()) ! for c = 1, listCtrl:GetColumnCount() do w = w + listCtrl:GetColumnWidth(c-1) --- 549,553 ---- --print(x, mousePos:GetX(), scrollPos, framePos:GetX(), winPos:GetX()) ! for c = 1, listCtrl:GetColumnCount() do w = w + listCtrl:GetColumnWidth(c-1) *************** *** 296,304 **** end end ! SaveListColWidths(list_level) ! if (itemText == "..") then - list_level = list_level - 1 GotoBindingLevel(listCtrl, list_level) --- 557,564 ---- end end ! SaveListColWidths(list_level) ! if (itemText == "..") then list_level = list_level - 1 GotoBindingLevel(listCtrl, list_level) *************** *** 308,335 **** binding = binding[listData[1][index+1][i]] end ! listData[2] = { ! {".."}, {"GetBindingName", tostring(binding.GetBindingName)}, {"GetLuaNamespace", tostring(binding.GetLuaNamespace)}, ! {"GetClassCount", tostring(binding.GetClassCount)}, ! {"GetDefineCount", tostring(binding.GetDefineCount)}, ! {"GetEventCount", tostring(binding.GetEventCount)}, ! {"GetObjectCount", tostring(binding.GetObjectCount)}, ! {"GetFunctionCount", tostring(binding.GetFunctionCount)}, ! ! {"GetClassArray", "Click to view classes"}, ! {"GetFunctionArray", "Click to view functions"}, ! {"GetDefineArray", "Click to view defines"}, ! {"GetStringArray", "Click to view strings"}, ! {"GetEventArray", "Click to view events"}, ! {"GetObjectArray", "Click to view objects"}, ! ! ["cols"] = {"Function Name", "Value"}, ! ["folder"] = { false, true }, ["binding"] = binding, ["object_type"] = "wxLuaBinding" } ! list_level = list_level + 1 GotoBindingLevel(listCtrl, list_level) --- 568,590 ---- binding = binding[listData[1][index+1][i]] end ! listData[2] = { ! {"..", ["icon"] = img_folder}, {"GetBindingName", tostring(binding.GetBindingName)}, {"GetLuaNamespace", tostring(binding.GetLuaNamespace)}, ! ! {"GetClassArray", "GetClassCount : "..tostring(binding.GetClassCount), ["icon"] = img_folder}, ! {"GetFunctionArray", "GetFunctionCount : "..tostring(binding.GetFunctionCount), ["icon"] = img_folder}, ! {"GetDefineArray", "GetDefineCount : "..tostring(binding.GetDefineCount), ["icon"] = img_folder}, ! {"GetStringArray", "GetStringCount : "..tostring(binding.GetStringCount), ["icon"] = img_folder}, ! {"GetEventArray", "GetEventCount : "..tostring(binding.GetEventCount), ["icon"] = img_folder}, ! {"GetObjectArray", "GetObjectCount : "..tostring(binding.GetObjectCount), ["icon"] = img_folder}, ! ! ["col_labels"] = {"Function Name", "Value"}, ["binding"] = binding, ["object_type"] = "wxLuaBinding" } ! ! listData[list_level].list_item = index list_level = list_level + 1 GotoBindingLevel(listCtrl, list_level) *************** *** 338,342 **** local t = nil ! if (itemText == "GetClassArray") then t = CreatewxLuaBindClass(binding.GetClassArray) --- 593,597 ---- local t = nil ! if (itemText == "GetClassArray") then t = CreatewxLuaBindClass(binding.GetClassArray) *************** *** 354,357 **** --- 609,613 ---- if t ~= nil then + listData[list_level].list_item = index list_level = list_level + 1 listData[list_level] = t *************** *** 360,364 **** elseif (index > 0) and listData[list_level].object_type == "wxLuaBindClass" then local t = nil ! if ((col == 0) or (col == 1)) and (type(listData[list_level][index+1][2]) == "table") then t = CreatewxLuaBindMethod(listData[list_level][index+1][2]) --- 616,620 ---- elseif (index > 0) and listData[list_level].object_type == "wxLuaBindClass" then local t = nil ! if ((col == 0) or (col == 1)) and (type(listData[list_level][index+1][2]) == "table") then t = CreatewxLuaBindMethod(listData[list_level][index+1][2]) *************** *** 370,373 **** --- 626,632 ---- if t ~= nil then + t.class_name = listCtrl:GetItemText(index) + + listData[list_level].list_item = index list_level = list_level + 1 listData[list_level] = t *************** *** 376,387 **** elseif (index > 0) and listData[list_level].object_type == "wxLuaBindMethod" then local t = nil ! ! if (col == 2) and (type(listData[list_level][index+1][col+1]) == "table") then ! t = CreatewxLuaBindCFunc(listData[list_level][index+1][col+1]) elseif (col == 4) and (type(listData[list_level][index+1][col+1]) == "userdata") then t = CreatewxLuaBindMethod({listData[list_level][index+1][col+1]}) end if t ~= nil then list_level = list_level + 1 listData[list_level] = t --- 635,649 ---- elseif (index > 0) and listData[list_level].object_type == "wxLuaBindMethod" then local t = nil ! ! if ((col == 0) or (col == 2)) and (type(listData[list_level][index+1][3]) == "table") then ! t = CreatewxLuaBindCFunc(listData[list_level][index+1][3]) ! t.class_name = listData[list_level].class_name elseif (col == 4) and (type(listData[list_level][index+1][col+1]) == "userdata") then t = CreatewxLuaBindMethod({listData[list_level][index+1][col+1]}) + t.class_name = listData[list_level][index+1][col+1].class_name end if t ~= nil then + listData[list_level].list_item = index list_level = list_level + 1 listData[list_level] = t *************** *** 389,393 **** end end ! event:Skip(); end) --- 651,655 ---- end end ! event:Skip(); end) *************** *** 395,399 **** rootSizer = wx.wxBoxSizer(wx.wxVERTICAL); ! rootSizer:Add(listCtrl, 1, wx.wxEXPAND + wx.wxALL, 5); rootSizer:SetMinSize(450, 400); panel:SetSizer(rootSizer); --- 657,661 ---- rootSizer = wx.wxBoxSizer(wx.wxVERTICAL); ! rootSizer:Add(listCtrl, 1, wx.wxEXPAND + wx.wxALL, 0); rootSizer:SetMinSize(450, 400); panel:SetSizer(rootSizer); |