summaryrefslogtreecommitdiff
path: root/iup/srclua5/olecontrol.lua
blob: ab7afd5f9c18dfdeb0c8971a8415cad7954243b4 (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
------------------------------------------------------------------------------
-- OleControl class 
------------------------------------------------------------------------------
local ctrl = {
  nick = "olecontrol",
  parent = iup.WIDGET,
  creation = "s",
  funcname = "OleControl",
  callback = {},
  include = "iupole.h",
  extracode = [[ 
int iupolelua_open(lua_State* L)
{
  if (iuplua_opencall_internal(L))
    IupOleControlOpen();
    
  iuplua_get_env(L);
  iupolecontrollua_open(L);
  return 0;
}

/* obligatory to use require"iupluaole" */
int luaopen_iupluaole(lua_State* L)
{
  return iupolelua_open(L);
}

/* obligatory to use require"iupluaole51" */
int luaopen_iupluaole51(lua_State* L)
{
  return iupolelua_open(L);
}

]]
}

function ctrl.createElement(class, param)
  return iup.OleControl(param[1])
end

function ctrl.CreateLuaCOM(handle)
  -- if luacom is loaded, use it to access methods and properties
  -- of the control
  if luacom then
    local punk = handle.iunknown
    if punk then
      handle.com = luacom.CreateLuaCOM(luacom.ImportIUnknown(punk))
    end     
  end
end

iup.RegisterWidget(ctrl)
iup.SetClass(ctrl, "iup widget")