From: John L. <jr...@us...> - 2007-06-14 23:59:53
|
Update of /cvsroot/wxlua/wxLua/samples In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv16698/wxLua/samples Modified Files: bindings.wx.lua Log Message: Add "voidptr_long" binding tag to allow using void* as a number Speed up bindings by using numbers as keys in the registry (avoid lua doing a string copy) Get rid of wxLuaState::GetXXXTag functions, something better needs to be implemented, using global vars for the few tags that we really use often now Allow the wxLuaStackDialog to be able to show lua's registry lots of cleanup in bindings.wx.lua Index: bindings.wx.lua =================================================================== RCS file: /cvsroot/wxlua/wxLua/samples/bindings.wx.lua,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** bindings.wx.lua 14 Jun 2007 05:02:49 -0000 1.8 --- bindings.wx.lua 14 Jun 2007 23:59:49 -0000 1.9 *************** *** 121,128 **** ID_STACK_DIALOG = 1002 ! img_normal = 0 -- a "file" image in the listctrl ! img_folder = 1 -- a "folder" image in the listctrl ! img_sort_dn = 2 -- a down arrow ! img_sort_up = 3 -- an up arrow listColWidths = {} -- stored by "object_type" name --- 121,130 ---- ID_STACK_DIALOG = 1002 ! list_images = { ! ["normal"] = 0, -- file image ! ["folder"] = 1, -- folder ! ["sort_dn"] = 2, -- down arrow ! ["sort_up"] = 3, -- up arrow ! } listColWidths = {} -- stored by "object_type" name *************** *** 130,138 **** list_level = 1 -- where are we in the listData listData = {} -- store the table currently displayed by the listCtrl ! -- {{"col val 1", "val2", ... ["icon"] = img_normal, ["color"] = wx.wxBLUE }, ! -- {"col val 1", "val2", ... The icon and color are optional }, -- { ... these are numbered items for the rows }, -- ["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 --- 132,141 ---- list_level = 1 -- where are we in the listData listData = {} -- store the table currently displayed by the listCtrl ! -- {{"col val 1", "val2", ... ["icon"] = list_images.normal, ["color"] = wx.wxBLUE }, ! -- {"col val 1", "val2", ... ["col_icons"] = {["col#"] = true, ...}}, ! -- {"col val 1", "val2", ... ["data"] = {["col#"] = some data, ...}}, ! -- {"col val 1", "val2", ... icon, color, col_icons, data are optional }, -- { ... these are numbered items for the rows }, -- ["col_labels"] = { "col label 1", "col label 2", ...}, -- ["object_type"] = "wxLuaBindClass", -- or something else readable -- ["list_item"] = last selected list item or nil if not set *************** *** 141,144 **** --- 144,162 ---- -- ---------------------------------------------------------------------------- + -- Find the bindings installed into wxLua, tables that might have wxLuaBinding_ + -- ---------------------------------------------------------------------------- + wxlua_tables = { "wxlua", "wx", "wxstc" } + + for i = 1, #wxlua_tables do + if _G[wxlua_tables[i]] then + for k, v in pairs(_G[wxlua_tables[i]]) do + if string.find(k, "wxLuaBinding_", 1, 1) then + table.insert(bindingList, {wxlua_tables[i], k}) + end + end + end + end + + -- ---------------------------------------------------------------------------- -- Load all the wxWidgets wxClassInfo -- ---------------------------------------------------------------------------- *************** *** 157,168 **** --print(c:GetClassName(), "Has Base2", c:GetBaseClass2()) ! local t2 = GetBases(c:GetBaseClass2()) ! for i = 1, #t2 do -- insert back in the original info for j = 1, #t do ! table.insert(t2[i], j, t[1][j]) end ! t2[i][1] = t2[i][1].." "..tostring(i) ! table.insert(t, t2[i]) end end --- 175,186 ---- --print(c:GetClassName(), "Has Base2", c:GetBaseClass2()) ! local baseTable2 = GetBases(c:GetBaseClass2()) ! for i = 1, #baseTable2 do -- insert back in the original info for j = 1, #t do ! table.insert(baseTable2[i], j, t[1][j]) end ! baseTable2[i][1] = baseTable2[i][1].." "..tostring(i) -- count # of base2s ! table.insert(t, baseTable2[i]) end end *************** *** 175,179 **** local t = { ! {"..", ["icon"] = img_folder}, ["col_labels"] = {"wxClassInfo::GetClassName()"}, ["object_type"] = "All Classes" --- 193,197 ---- local t = { ! {"..", ["icon"] = list_images.folder}, ["col_labels"] = {"wxClassInfo::GetClassName()"}, ["object_type"] = "All Classes" *************** *** 181,191 **** local ci = wx.wxClassInfo.GetFirst() ! local max_cols = 0 while ci do ! local tc = GetBases(ci) ! for i = 1, #tc do ! if max_cols < #tc[i] then max_cols = #tc[i] end ! table.insert(t, tc[i]) end --- 199,209 ---- local ci = wx.wxClassInfo.GetFirst() ! local max_cols = 1 while ci do ! local baseTable = GetBases(ci) ! for i = 1, #baseTable do ! if max_cols < #baseTable[i] then max_cols = #baseTable[i] end ! table.insert(t, baseTable[i]) end *************** *** 193,196 **** --- 211,215 ---- end + -- Fill remainder of items with "" string for i = 1, #t do for j = #t[i], max_cols do *************** *** 199,202 **** --- 218,222 ---- end + -- Create col labels for i = 2, max_cols do table.insert(t.col_labels, "Base Class "..tostring(i-1)) *************** *** 209,227 **** -- ---------------------------------------------------------------------------- - -- Find the bindings installed into wxLua, tables that might have wxLuaBinding_ - -- ---------------------------------------------------------------------------- - wxlua_tables = { "wxlua", "wx", "wxstc" } - - for i = 1, #wxlua_tables do - if _G[wxlua_tables[i]] then - for k, v in pairs(_G[wxlua_tables[i]]) do - if string.find(k, "wxLuaBinding_", 1, 1) then - table.insert(bindingList, {wxlua_tables[i], k}) - end - end - end - end - - -- ---------------------------------------------------------------------------- -- Save the current listctrl settings into the listColWidths table -- ---------------------------------------------------------------------------- --- 229,232 ---- *************** *** 253,260 **** end ! -- Wipe items and all cols and recreate them with appropriate names listCtrl:DeleteAllItems() ! for col = 1, listCtrl:GetColumnCount() do listCtrl:DeleteColumn(0) end --- 258,274 ---- end ! local function AutoColWidth(col, txt) ! if auto_col_widths and txt then ! local w = listCtrl:GetTextExtent(txt) ! if w > (listColWidths[data.object_type][col] or 0) - 25 then ! listColWidths[data.object_type][col] = w + 25 ! end ! end ! end ! ! -- Wipe items and extra cols listCtrl:DeleteAllItems() ! while #data.col_labels < listCtrl:GetColumnCount() do listCtrl:DeleteColumn(0) end *************** *** 262,276 **** -- Add the cols for col = 1, #data.col_labels do ! listCtrl:InsertColumn(col-1, data.col_labels[col], wx.wxLIST_FORMAT_LEFT, -1) ! 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 --- 276,293 ---- -- Add the cols for col = 1, #data.col_labels do ! if col > listCtrl:GetColumnCount() then ! listCtrl:InsertColumn(col-1, data.col_labels[col], wx.wxLIST_FORMAT_LEFT, -1) ! else ! local li = wx.wxListItem() ! li:SetText(data.col_labels[col]) ! li:SetImage(-1) ! listCtrl:SetColumn(col-1, li) ! end ! if data.col_sorted and data.col_sorted[col] then ! listCtrl:SetColumnImage(col-1, data.col_sorted[col]) end + + AutoColWidth(col, data.col_labels[col]) end *************** *** 281,325 **** local d = data[i] ! local info = wx.wxListItem() ! info:SetId(lc_item+1) ! info:SetText(tostring(d[1])) ! info:SetData(i) -- key into the listData table for sorting 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 data.col_icons and data.col_icons[col] and ! (d[col] ~= "") and (type(d[col]) ~= "function") then ! listCtrl:SetItemColumnImage(lc_item, col-1, data.col_icons[col]) ! end ! 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 --- 298,325 ---- local d = data[i] ! local li = wx.wxListItem() ! li:SetId(lc_item+1) ! li:SetText(tostring(d[1] or "")) ! li:SetData(i) -- key into the listData table for sorting if (d.icon) then ! li:SetImage(d.icon) end if (d.color) then ! li:SetTextColour(d.color) end ! lc_item = listCtrl:InsertItem(li) ! AutoColWidth(1, tostring(d[1])) ! for col = 2, #listData[level].col_labels do ! listCtrl:SetItem(lc_item, col-1, tostring(d[col] or "")) ! if d.col_icons and d.col_icons[col] then ! listCtrl:SetItemColumnImage(lc_item, col-1, d.col_icons[col]) end + + AutoColWidth(col, tostring(d[col])) end end *************** *** 400,416 **** -- ---------------------------------------------------------------------------- function CreatewxLuaBindClass(tbl) ! local keys = { "name", "methods", "methods_n", "classInfo", "class_tag", "baseclassName", "baseclass", "enums", "enums_n" } ! local t = CreatewxLuaBindTable(tbl, keys, "wxLuaBindClass") ! for i = 2, #t do ! -- This class has methods and can be expanded ! if (type(t[i][2]) == "table") then ! t[i].icon = img_folder ! end - -- Convert the wxClassInfo userdata into something more readable - local classInfo = t[i][4] if type(classInfo) == "userdata" then ! local s = classInfo:GetClassName() local b1 = classInfo:GetBaseClassName1() local b2 = classInfo:GetBaseClassName2() --- 400,417 ---- -- ---------------------------------------------------------------------------- function CreatewxLuaBindClass(tbl) ! local t = { ! {"..", ["icon"] = list_images.folder}, ! ["col_labels"] = { "name", "# methods", "wxClassInfo", "class tag", "Base Class Name", "# enums" }, ! ["object_type"] = "wxLuaBindClass" ! } ! -- items in table from binding.GetClassArray are these ! -- { "name", "methods", "methods_n", "classInfo", "class_tag", "baseclassName", "baseclass", "enums", "enums_n" } ! ! local function GetClassInfoStr(classInfo) ! local s = "" if type(classInfo) == "userdata" then ! s = classInfo:GetClassName() local b1 = classInfo:GetBaseClassName1() local b2 = classInfo:GetBaseClassName2() *************** *** 422,435 **** s = s.."("..b2..")" end ! t[i][4] = s -- replace with the string 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 --- 423,482 ---- s = s.."("..b2..")" end + end ! return s ! end ! ! t.col_numbers = {} ! t.col_numbers[2] = true ! t.col_numbers[4] = true ! t.col_numbers[6] = true ! ! --{ "name"[data], "methods_n", "classInfo", "class_tag", "baseclassName"[data], "enums_n"[data] } ! for i = 1, #tbl do ! local item = { ! tbl[i].name, ! tbl[i].methods_n, ! GetClassInfoStr(tbl[i].classInfo), ! tbl[i].class_tag, ! tbl[i].baseclassName or "", ! tbl[i].enums_n, ! ["col_icons"] = {}, ! ["data"] = {} ! } ! ! -- This class has methods and can be expanded ! if (type(tbl[i].methods) == "table") then ! item.icon = list_images.folder ! item.data[1] = tbl[i].methods ! end ! ! -- This class has a baseclass and can be expanded ! if (type(tbl[i].baseclass) == "userdata") then ! item.col_icons[5] = list_images.folder ! item.data[5] = tbl[i].baseclass end + + -- This class has enums and can be expanded + if (type(tbl[i].enums) == "table") then + item.col_icons[6] = list_images.folder + item.data[6] = tbl[i].enums + end + + -- some sanity checks to make sure the bindings are working + if (tbl[i].methods_n > 0) and (type(tbl[i].methods) ~= "table") then + print(tbl[i].name, "is missing methods table") + end + if (tbl[i].baseclassName) and (type(tbl[i].baseclass) ~= "userdata") then + print(tbl[i].name, "is missing baseclass userdata") + end + if (tbl[i].enums_n > 0) and (type(tbl[i].enums) ~= "table") then + print(tbl[i].name, "is missing enums table") + end + + + table.insert(t, item) end return t end *************** *** 439,483 **** -- ---------------------------------------------------------------------------- function CreatewxLuaBindMethod(tbl, classname) ! local keys = { "name", "type", "funcs", "funcs_n", "basemethod" } ! 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 ! if classname then ! t[i][1] = classname.."::"..t[i][1] end ! t[i][2] = CreatewxLuaMethod_TypeString(t[i][2]) -- Add in the CFuncs ! if (type(t[i][3]) == "table") then ! 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" } ! local cfunc_t = CreatewxLuaBindCFunc(t[i][3]) ! for j = 2, #cfunc_t do ! local cft = {t[i][1].." "..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]} ! if string.find(cfunc_t[j][2], "Overload", 1, 1) then cft.color = wx.wxGREEN end ! table.insert(t, i+j-1, cft) ! 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 --- 486,546 ---- -- ---------------------------------------------------------------------------- function CreatewxLuaBindMethod(tbl, classname) ! local t = { ! {"..", ["icon"] = list_images.folder}, ! ["col_labels"] = { "name", "type", "funcs_n", "basemethod", "minargs", "maxargs", "argtag_names", "argtags" }, ! ["object_type"] = "wxLuaBindMethod" ! } ! -- items in table are ! -- { "name", "type", "funcs", "funcs_n", "basemethod" } ! t.col_numbers = {} ! t.col_numbers[3] = true ! t.col_numbers[5] = true ! t.col_numbers[6] = true ! for i = 1, #tbl do ! local class_name = "" ! if tbl[i].class_name then class_name = tbl[i].class_name.."::" end ! local item = { ! class_name..tbl[i].name, ! CreatewxLuaMethod_TypeString(tbl[i].type), ! tbl[i].funcs_n, ! "", ! "", ! "", ! "", ! "", ! ["icon"] = list_images.folder, ! ["col_icons"] = {}, ! ["data"] = {} ! } ! ! if tbl[i].classname then ! item[1] = tbl[i].classname.."::"..item[1] end ! -- This method has a basemethod and can be expanded ! if type(tbl[i].basemethod) == "userdata" then ! item[4] = tbl[i].basemethod.class_name ! item.data[4] = tbl[i].basemethod ! item.col_icons[4] = list_images.folder ! end -- Add in the CFuncs ! item.data[1] = tbl[i].funcs ! item.color = wx.wxBLUE ! table.insert(t, item) ! -- keys for CFunc = { "func", "type", "minargs", "maxargs", "argtag_names", "argtags" } ! local cfunc_t = CreatewxLuaBindCFunc(tbl[i].funcs) ! for j = 2, #cfunc_t do ! local cft = {item[1].." func "..j-1, cfunc_t[j][2], "", "", cfunc_t[j][3], cfunc_t[j][4], cfunc_t[j][5], cfunc_t[j][6]} ! if string.find(cfunc_t[j][2], "Overload", 1, 1) then cft.color = wx.wxGREEN end ! table.insert(t, cft) end end return t end *************** *** 552,555 **** --- 615,621 ---- t.col_labels[6] ="argtags" + t.col_numbers = {} + t.col_numbers[3] = true + t.col_numbers[4] = true -- we don't want to show the table, just show the values *************** *** 570,574 **** function CreatewxLuaBindTable(tbl, cols, object_type) local t = { ! {"..", ["icon"] = img_folder}, ["col_labels"] = cols, ["object_type"] = object_type --- 636,640 ---- function CreatewxLuaBindTable(tbl, cols, object_type) local t = { ! {"..", ["icon"] = list_images.folder}, ["col_labels"] = cols, ["object_type"] = object_type *************** *** 599,610 **** -- ---------------------------------------------------------------------------- - -- Handle the wxEVT_COMMAND_LIST_COL_CLICK event when the mouse is clicked - -- ---------------------------------------------------------------------------- - function OnListColClicked(event) - local col = event:GetColumn() - SortListItems(col) - end - - -- ---------------------------------------------------------------------------- -- Sort items in the listctrl based on the column (0 based) and also the data table -- ---------------------------------------------------------------------------- --- 665,668 ---- *************** *** 612,621 **** local data = listData[list_level] ! if not data.col_sorted then ! data.col_sorted = {} end - local sorted = data.col_sorted[col+1] or false - local function SortListItems(item1, item2, col) local data1 = data[item1] --- 670,678 ---- local data = listData[list_level] ! local sorted = false ! if data.col_sorted and data.col_sorted[col+1] then ! sorted = data.col_sorted[col+1] == list_images.sort_dn end local function SortListItems(item1, item2, col) local data1 = data[item1] *************** *** 632,638 **** i1 = data1[3] i2 = data2[3] ! elseif ((data.object_type == "wxLuaBindClass") and ((col == 3) or (col == 5) or (col == 9))) or ! ((data.object_type == "wxLuaBindMethod") and ((col == 4) or (col == 6) or (col == 7))) or ! ((data.object_type == "wxLuaBindCFunc") and ((col == 3) or (col == 4))) then -- sort on the real numbers, but treat "" as lower if (i1 == "") and (i2 == "") then --- 689,693 ---- i1 = data1[3] i2 = data2[3] ! elseif data.col_numbers[col] then -- sort on the real numbers, but treat "" as lower if (i1 == "") and (i2 == "") then *************** *** 663,667 **** listCtrl:SortItems(SortListItems, col+1) ! data.col_sorted[col+1] = (not sorted) -- now make the table of data match what's in the listctrl so when you --- 718,727 ---- listCtrl:SortItems(SortListItems, col+1) ! data.col_sorted = {} -- we only remember the last col sorted ! if not sorted then ! data.col_sorted[col+1] = list_images.sort_dn ! else ! data.col_sorted[col+1] = list_images.sort_up ! end -- now make the table of data match what's in the listctrl so when you *************** *** 685,691 **** listCtrl:SetColumnImage(c-1, -1) elseif not sorted then ! listCtrl:SetColumnImage(col, img_sort_dn) else ! listCtrl:SetColumnImage(col, img_sort_up) end end --- 745,751 ---- listCtrl:SetColumnImage(c-1, -1) elseif not sorted then ! listCtrl:SetColumnImage(col, list_images.sort_dn) else ! listCtrl:SetColumnImage(col, list_images.sort_up) end end *************** *** 701,704 **** --- 761,766 ---- local itemText = listCtrl:GetItemText(index) + local data = listData[list_level] + -- ----------------------------------------------------------------------- -- Find what column we're in *************** *** 768,781 **** 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"}, --- 830,843 ---- listData[2] = { ! {"..", ["icon"] = list_images.folder}, {"GetBindingName", tostring(binding.GetBindingName)}, {"GetLuaNamespace", tostring(binding.GetLuaNamespace)}, ! {"GetClassArray", "GetClassCount : "..tostring(binding.GetClassCount), ["icon"] = list_images.folder}, ! {"GetFunctionArray", "GetFunctionCount : "..tostring(binding.GetFunctionCount), ["icon"] = list_images.folder}, ! {"GetDefineArray", "GetDefineCount : "..tostring(binding.GetDefineCount), ["icon"] = list_images.folder}, ! {"GetStringArray", "GetStringCount : "..tostring(binding.GetStringCount), ["icon"] = list_images.folder}, ! {"GetEventArray", "GetEventCount : "..tostring(binding.GetEventCount), ["icon"] = list_images.folder}, ! {"GetObjectArray", "GetObjectCount : "..tostring(binding.GetObjectCount), ["icon"] = list_images.folder}, ["col_labels"] = {"Function Name", "Value"}, *************** *** 814,822 **** local t = nil ! if ((col == 0) or (col == 1)) and (type(listData[list_level][data_index][2]) == "table") then ! t = CreatewxLuaBindMethod(listData[list_level][data_index][2], listData[list_level][data_index][1]) if frame:GetMenuBar():IsChecked(ID_VIEW_BASECLASS_FUNCTIONS) then ! local c = listData[list_level][data_index][7] while type(c) == "userdata" do local tt = CreatewxLuaBindMethod(c.methods, c.name) --- 876,884 ---- local t = nil ! if (col == 0) and (type(data[data_index].data[1]) == "table") then ! t = CreatewxLuaBindMethod(data[data_index].data[1], data[data_index][1]) if frame:GetMenuBar():IsChecked(ID_VIEW_BASECLASS_FUNCTIONS) then ! local c = data[data_index][5] while type(c) == "userdata" do local tt = CreatewxLuaBindMethod(c.methods, c.name) *************** *** 831,838 **** end end ! elseif (col == 6) and (type(listData[list_level][data_index][col+1]) == "userdata") then ! t = CreatewxLuaBindClass({listData[list_level][data_index][col+1]}) ! elseif (col == 7) and (type(listData[list_level][data_index][col+1]) == "table") then ! t = CreatewxLuaBindDefine(listData[list_level][data_index][col+1]) end --- 893,900 ---- end end ! elseif (col == 4) and (type(data[data_index].data[col+1]) == "userdata") then ! t = CreatewxLuaBindClass({data[data_index].data[col+1]}) ! elseif (col == 5) and (type(data[data_index].data[col+1]) == "table") then ! t = CreatewxLuaBindDefine(data[data_index].data[col+1]) end *************** *** 847,856 **** local t = nil ! if ((col == 0) or (col == 2)) and (type(listData[list_level][data_index][3]) == "table") then ! t = CreatewxLuaBindCFunc(listData[list_level][data_index][3]) ! t.class_name = listData[list_level].class_name ! elseif (col == 4) and (type(listData[list_level][data_index][col+1]) == "userdata") then ! t = CreatewxLuaBindMethod({listData[list_level][data_index][col+1]}) ! t.class_name = listData[list_level][data_index][col+1].class_name end --- 909,918 ---- local t = nil ! if (col == 0) and (type(data[data_index].data[col+1]) == "table") then ! t = CreatewxLuaBindCFunc(data[data_index].data[col+1]) ! t.class_name = data.class_name ! elseif (col == 3) and (type(data[data_index].data[col+1]) == "userdata") then ! t = CreatewxLuaBindMethod({data[data_index].data[col+1]}) ! t.class_name = data[data_index][col+1].class_name end *************** *** 871,875 **** function CreatewxLuaTypeTable() local t = { ! {"..", ["icon"] = img_folder}, ["col_labels"] = {"wxLua Type"}, ["object_type"] = "wxLua Types" --- 933,937 ---- function CreatewxLuaTypeTable() local t = { ! {"..", ["icon"] = list_images.folder}, ["col_labels"] = {"wxLua Type"}, ["object_type"] = "wxLua Types" *************** *** 929,933 **** function CreateAllClassesTable() local t = { ! {"..", ["icon"] = img_folder}, ["col_labels"] = {"wxLua Class Name (1st line) / wxClassInfo Name (2nd line)"}, ["object_type"] = "All wxLua Classes" --- 991,995 ---- function CreateAllClassesTable() local t = { ! {"..", ["icon"] = list_images.folder}, ["col_labels"] = {"wxLua Class Name (1st line) / wxClassInfo Name (2nd line)"}, ["object_type"] = "All wxLua Classes" *************** *** 936,956 **** local max_cols = 1 ! local function GetClassInfoStr(ci) ! local s = "" ! if type(ci) == "userdata" then ! s = s.." - "..ci:GetClassName() ! local b1 = ci:GetBaseClassName1() ! local b2 = ci:GetBaseClassName2() ! ! if (string.len(b1) > 0) then ! s = s.." ("..b1..")" ! end ! if (string.len(b2) > 0) then ! s = s.."("..b2..")" ! end ! end ! return s ! end ! local unwrappedBaseClasses = { ["wxDCBase"] = 1, --- 998,1002 ---- local max_cols = 1 ! -- These are classes that wxLua doesn't wrap since they're not necessary local unwrappedBaseClasses = { ["wxDCBase"] = 1, *************** *** 964,967 **** --- 1010,1014 ---- } + -- These are classes that wxLua has, but don't have wxClassInfo local wxwidgetsNoClassInfo = { ["wxBookCtrlBaseEvent"] = "wxNotifyEvent", *************** *** 978,989 **** end ! local t1 = binding.GetClassArray ! for i = 1, #t1 do -- this string is to force the wxLua classname and the wxClassInfo names -- to be together and the first char is to keep bindings together local a = string.format("%s%03d. ", string.char(string.byte('a')+b-1), i) ! local c = t1[i] local c_table = {["color"] = wx.wxBLUE} --- 1025,1036 ---- end ! local classTable = binding.GetClassArray ! for i = 1, #classTable do -- this string is to force the wxLua classname and the wxClassInfo names -- to be together and the first char is to keep bindings together local a = string.format("%s%03d. ", string.char(string.byte('a')+b-1), i) ! local c = classTable[i] local c_table = {["color"] = wx.wxBLUE} *************** *** 1065,1069 **** function CreateOverloadedBasecassFunctionsTable() local t = { ! {"..", ["icon"] = img_folder}, ["col_labels"] = {"Class Name", "Function Name", "Args"}, ["object_type"] = "Overloaded Baseclass Functions" --- 1112,1116 ---- function CreateOverloadedBasecassFunctionsTable() local t = { ! {"..", ["icon"] = list_images.folder}, ["col_labels"] = {"Class Name", "Function Name", "Args"}, ["object_type"] = "Overloaded Baseclass Functions" *************** *** 1078,1088 **** end ! local t1 = binding.GetClassArray ! for i = 1, #t1 do ! local methods = t1[i].methods -- some classes don't have methods, wxBestHelpController for example ! for j = 1, t1[i].methods_n do local m = methods[j] local m_table = {m.class_name, m.name} --- 1125,1135 ---- end ! local classTable = binding.GetClassArray ! for i = 1, #classTable do ! local methods = classTable[i].methods -- some classes don't have methods, wxBestHelpController for example ! for j = 1, classTable[i].methods_n do local m = methods[j] local m_table = {m.class_name, m.name} *************** *** 1214,1225 **** listCtrl:Connect(wx.wxEVT_COMMAND_LIST_ITEM_ACTIVATED, OnListItemActivated) ! listCtrl:Connect(wx.wxEVT_COMMAND_LIST_COL_CLICK, OnListColClicked) list_level = 1 listData[1] = { ! {"wxLua Types", "Compare Lua's type to wxLua's type", ["icon"] = img_folder }, ! {"All wxLua Classes", "Classes and their base classes (red may not indicate error)", ["icon"] = img_folder }, ! {"All wxWidgets wxClassInfo", "All wxObjects having wxClassInfo and their base classes", ["icon"] = img_folder }, ! {"Overloaded Baseclass Functions", "See all functions that also have a baseclass function", ["icon"] = img_folder }, ["col_labels"] = { "Item to View", "Information"}, --- 1261,1276 ---- listCtrl:Connect(wx.wxEVT_COMMAND_LIST_ITEM_ACTIVATED, OnListItemActivated) ! listCtrl:Connect(wx.wxEVT_COMMAND_LIST_COL_CLICK, ! function (event) ! local col = event:GetColumn() ! SortListItems(col) ! end) list_level = 1 listData[1] = { ! {"wxLua Types", "Compare Lua's type to wxLua's type", ["icon"] = list_images.folder }, ! {"All wxLua Classes", "Classes and their base classes (red may not indicate error)", ["icon"] = list_images.folder }, ! {"All wxWidgets wxClassInfo", "All wxObjects having wxClassInfo and their base classes", ["icon"] = list_images.folder }, ! {"Overloaded Baseclass Functions", "See all functions that also have a baseclass function", ["icon"] = list_images.folder }, ["col_labels"] = { "Item to View", "Information"}, *************** *** 1228,1234 **** ! -- Add the binding that are installed {"wxLuaBinding_wx", "wx", ["icon"] = img_folder }, for i = 1, #bindingList do ! table.insert(listData[1], {bindingList[i][2], bindingList[i][1], ["icon"] = img_folder }) end --- 1279,1285 ---- ! -- Add the binding that are installed {"wxLuaBinding_wx", "wx", ["icon"] = list_images.folder }, for i = 1, #bindingList do ! table.insert(listData[1], {bindingList[i][2], bindingList[i][1], ["icon"] = list_images.folder }) end |