/
LuaFindDialog.pas
executable file
·90 lines (70 loc) · 2.46 KB
/
LuaFindDialog.pas
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
unit LuaFindDialog;
{$mode delphi}
interface
uses
Classes, SysUtils, dialogs, luaclass, lua, lauxlib, luahandler, betterControls;
procedure initializeLuaFindDialog;
implementation
uses LuaCommonDialog;
function finddialog_getLeft(L: Plua_State): integer; cdecl;
begin
lua_pushinteger(L, tfinddialog(luaclass_getClassObject(L)).Left);
result:=1;
end;
function finddialog_setLeft(L: Plua_State): integer; cdecl;
begin
tfinddialog(luaclass_getClassObject(L)).Left:=lua_tointeger(L,1);
result:=0;
end;
function finddialog_getTop(L: Plua_State): integer; cdecl;
begin
lua_pushinteger(L, tfinddialog(luaclass_getClassObject(L)).Top);
result:=1;
end;
function finddialog_setTop(L: Plua_State): integer; cdecl;
begin
tfinddialog(luaclass_getClassObject(L)).Top:=lua_tointeger(L,1);
result:=0;
end;
function finddialog_getWidth(L: Plua_State): integer; cdecl;
begin
lua_pushinteger(L, tfinddialog(luaclass_getClassObject(L)).Width);
result:=1;
end;
function finddialog_setWidth(L: Plua_State): integer; cdecl;
begin
tfinddialog(luaclass_getClassObject(L)).Width:=lua_tointeger(L,1);
result:=0;
end;
function finddialog_getHeight(L: Plua_State): integer; cdecl;
begin
lua_pushinteger(L, tfinddialog(luaclass_getClassObject(L)).Height);
result:=1;
end;
function finddialog_setHeight(L: Plua_State): integer; cdecl;
begin
tfinddialog(luaclass_getClassObject(L)).Height:=lua_tointeger(L,1);
result:=0;
end;
function createFindDialog(L: Plua_State): integer; cdecl;
var fd: TFindDialog;
begin
luaclass_newClass(L, TFindDialog.Create(lua_ToCEUserData(L, -1)));
result:=1;
end;
procedure finddialog_addMetaData(L: PLua_state; metatable: integer; userdata: integer );
begin
//only export "execute" the rest is already published
commondialog_addMetaData(L, metatable, userdata);
luaclass_addPropertyToTable(L, metatable, userdata, 'Left', finddialog_getLeft, finddialog_setLeft);
luaclass_addPropertyToTable(L, metatable, userdata, 'Top', finddialog_getTop, finddialog_setTop);
luaclass_addPropertyToTable(L, metatable, userdata, 'Width', finddialog_getWidth, finddialog_setWidth);
luaclass_addPropertyToTable(L, metatable, userdata, 'Height', finddialog_getHeight, finddialog_setHeight);
end;
procedure initializeLuaFindDialog;
begin
lua_register(LuaVM, 'createFindDialog', createFindDialog);
end;
initialization
luaclass_register(TFindDialog, finddialog_addMetaData);
end.