From eed0eb6a476d54ce19aeff137984aa981d9e3976 Mon Sep 17 00:00:00 2001 From: Pixel Date: Tue, 15 Jun 2010 00:59:57 -0700 Subject: Upgrading to iup 3.1 --- iup/srclua5/menu.lua | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'iup/srclua5/menu.lua') diff --git a/iup/srclua5/menu.lua b/iup/srclua5/menu.lua index 89cd241..70be236 100755 --- a/iup/srclua5/menu.lua +++ b/iup/srclua5/menu.lua @@ -3,7 +3,7 @@ ------------------------------------------------------------------------------ local ctrl = { nick = "menu", - parent = BOX, + parent = iup.BOX, creation = "-", callback = { open_cb = "", @@ -12,44 +12,44 @@ local ctrl = { } function ctrl.popup(handle, x, y) - Popup(handle, x, y) + iup.Popup(handle, x, y) end function ctrl.append(handle, elem) - Append(handle, elem) + iup.Append(handle, elem) end -function ctrl.createElement(class, arg) - local n = #arg +function ctrl.createElement(class, param) + local n = #param for i=1,n do - if type(arg[i]) == "table" then - itemarg = {} - for u,v in pairs(arg[i]) do + if type(param[i]) == "table" then + local itemarg = {} + for u,v in pairs(param[i]) do if type(u) ~= "number" then itemarg[u] = v end end - if type(arg[i][1]) == "string" and (type(arg[i][2]) == "function" or type(arg[i][2]) == "string") then - itemarg.title = arg[i][1] - itemarg.action = arg[i][2] - arg[i] = item(itemarg) - elseif type(arg[i][1]) == "string" and type(arg[i][2]) == "userdata" then - itemarg[1] = arg[i][2] - itemarg.title = arg[i][1] - arg[i] = submenu(itemarg) + if type(param[i][1]) == "string" and (type(param[i][2]) == "function" or type(param[i][2]) == "string") then + itemarg.title = param[i][1] + itemarg.action = param[i][2] + param[i] = iup.item(itemarg) + elseif type(param[i][1]) == "string" and type(param[i][2]) == "userdata" then + itemarg[1] = param[i][2] + itemarg.title = param[i][1] + param[i] = iup.submenu(itemarg) end end end - return Menu() + return iup.Menu() end function ctrl.showxy(handle, x, y) - return ShowXY(handle, x, y) + return iup.ShowXY(handle, x, y) end function ctrl.destroy(handle) - return Destroy(handle) + return iup.Destroy(handle) end -iupRegisterWidget(ctrl) -iupSetClass(ctrl, "iup widget") +iup.RegisterWidget(ctrl) +iup.SetClass(ctrl, "iup widget") -- cgit v1.2.3