summaryrefslogtreecommitdiff
path: root/iup/srclua5/radio.lua
blob: 0431e91ac41dea6718b010219fcd36844bbd10cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
------------------------------------------------------------------------------
-- Radio class 
------------------------------------------------------------------------------
local ctrl = {
  nick = "radio",
  parent = iup.WIDGET,
  creation = "I",
  callback = {}
} 

-- TODO: remove this code in the future, it seems to be useless an incorrect
function ctrl.SetChildrenNames(obj)
  if obj then
    if obj.parent.parent == iup.BOX then
      local i = 1
      while obj[i] do
        ctrl.SetChildrenNames (obj[i])
        i = i+1
      end
    elseif obj.parent == iup.FRAME then
      ctrl.SetChildrenNames (obj[1])
    else
      iup.SetHandleName(obj)
    end
  end
end

function ctrl.createElement(class, param)
   ctrl.SetChildrenNames(param[1])
   return iup.Radio(param[1])
end
   
iup.RegisterWidget(ctrl)
iup.SetClass(ctrl, "iup widget")