diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2010-09-09 02:26:30 +0200 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2010-09-09 02:32:26 +0200 |
commit | 7505e88db66798b2b8fcdff2d92a7136cd826b5b (patch) | |
tree | b6ced565318f8e8112e35cb0ad53abe4212ef8de /iup/srclua5/iuplua_api.c | |
parent | e9a184546b18cf3b796bd560561f312934004c54 (diff) |
Upgrading to IUP 3.2 - and cleaning up.
Diffstat (limited to 'iup/srclua5/iuplua_api.c')
-rwxr-xr-x | iup/srclua5/iuplua_api.c | 71 |
1 files changed, 40 insertions, 31 deletions
diff --git a/iup/srclua5/iuplua_api.c b/iup/srclua5/iuplua_api.c index adf5383..27adffe 100755 --- a/iup/srclua5/iuplua_api.c +++ b/iup/srclua5/iuplua_api.c @@ -35,8 +35,8 @@ static int SaveImageAsText(lua_State *L) static int Reparent(lua_State *L) { - lua_pushnumber(L, IupReparent(iuplua_checkihandle(L,1), - iuplua_checkihandle(L,2))); + lua_pushinteger(L, IupReparent(iuplua_checkihandle(L,1), + iuplua_checkihandle(L,2))); return 1; } @@ -132,11 +132,11 @@ static int GetAllDialogs(lua_State *L) lua_newtable(L); for (i=0; i<n; i++) { - lua_pushnumber(L,i+1); + lua_pushinteger(L,i+1); lua_pushstring(L,names[i]); lua_settable(L,-3); } - lua_pushnumber(L,n); + lua_pushinteger(L,n); free(names); return 2; } @@ -149,11 +149,11 @@ static int GetAllNames(lua_State *L) lua_newtable(L); for (i=0; i<n; i++) { - lua_pushnumber(L,i+1); + lua_pushinteger(L,i+1); lua_pushstring(L,names[i]); lua_settable(L,-3); } - lua_pushnumber(L,n); + lua_pushinteger(L,n); free(names); return 2; } @@ -166,11 +166,11 @@ static int GetAllAttributes(lua_State *L) lua_newtable(L); for (i=0; i<n; i++) { - lua_pushnumber(L,i+1); + lua_pushinteger(L,i+1); lua_pushstring(L,names[i]); lua_settable(L,-3); } - lua_pushnumber(L,n); + lua_pushinteger(L,n); free(names); return 2; } @@ -190,11 +190,11 @@ static int GetClassAttributes(lua_State *L) lua_newtable(L); for (i=0; i<n; i++) { - lua_pushnumber(L,i+1); + lua_pushinteger(L,i+1); lua_pushstring(L,names[i]); lua_settable(L,-3); } - lua_pushnumber(L,n); + lua_pushinteger(L,n); free(names); return 2; } @@ -219,7 +219,7 @@ static int GetFile (lua_State *L) iupStrCopyN(returned_fname, 10240, fname); ret = IupGetFile(returned_fname); lua_pushstring(L, returned_fname); - lua_pushnumber(L, ret); + lua_pushinteger(L, ret); return 2; } @@ -287,7 +287,7 @@ static int Help(lua_State *L) static int Hide(lua_State *L) { Ihandle *ih = iuplua_checkihandle(L,1); - lua_pushnumber(L, IupHide(ih)); + lua_pushinteger(L, IupHide(ih)); return 1; } @@ -309,13 +309,13 @@ static int LoadBuffer(lua_State *L) static int LoopStep(lua_State *L) { - lua_pushnumber(L,IupLoopStep()); + lua_pushinteger(L,IupLoopStep()); return 1; } static int LoopStepWait(lua_State *L) { - lua_pushnumber(L,IupLoopStepWait()); + lua_pushinteger(L,IupLoopStepWait()); return 1; } @@ -328,20 +328,20 @@ static int ExitLoop(lua_State *L) static int MainLoop(lua_State *L) { - lua_pushnumber(L,IupMainLoop()); + lua_pushinteger(L,IupMainLoop()); return 1; } static int MainLoopLevel(lua_State *L) { - lua_pushnumber(L,IupMainLoopLevel()); + lua_pushinteger(L,IupMainLoopLevel()); return 1; } static int Map(lua_State *L) { Ihandle *ih = iuplua_checkihandle(L,1); - lua_pushnumber(L, IupMap(ih)); + lua_pushinteger(L, IupMap(ih)); return 1; } @@ -375,7 +375,7 @@ static int Alarm(lua_State *L) luaL_checkstring(L, 3), luaL_optstring(L, 4, NULL), luaL_optstring(L, 5, NULL)); - lua_pushnumber(L, n); + lua_pushinteger(L, n); return 1; } @@ -387,11 +387,11 @@ static int ListDialog(lua_State *L) int* marks = lua_isnoneornil(L, 8)? NULL: iuplua_checkint_array(L,8); int i, ret; - if (size != luaL_getn(L, 4)) + if (size != iuplua_getn(L, 4)) luaL_error(L, "invalid number of elements in the list."); if (!marks && type==2) luaL_error(L, "invalid marks, must not be nil."); - if (marks && type==2 && size != luaL_getn(L, 8)) + if (marks && type==2 && size != iuplua_getn(L, 8)) luaL_error(L, "invalid number of elements in the marks."); ret = IupListDialog(type, luaL_checkstring(L, 2), @@ -406,13 +406,13 @@ static int ListDialog(lua_State *L) { for (i=0; i<size; i++) { - lua_pushnumber(L, i+1); - lua_pushnumber(L, marks[i]); + lua_pushinteger(L, i+1); + lua_pushinteger(L, marks[i]); lua_settable(L, 8); } } - lua_pushnumber(L, ret); + lua_pushinteger(L, ret); if (marks) free(marks); free(list); @@ -455,21 +455,21 @@ static int Popup(lua_State *L) Ihandle *ih = iuplua_checkihandle(L,1); int x = luaL_optint(L,2, IUP_CURRENT); int y = luaL_optint(L,3, IUP_CURRENT); - lua_pushnumber(L,IupPopup(ih,x,y)); + lua_pushinteger(L,IupPopup(ih,x,y)); return 1; } static int cf_isprint(lua_State *L) { int value = luaL_checkint(L, 1); - lua_pushnumber(L, iup_isprint(value)); + lua_pushinteger(L, iup_isprint(value)); return 1; } static int cf_xCODE(lua_State *L) { int value = luaL_checkint(L, 1); - lua_pushnumber(L, IUPxCODE(value)); + lua_pushinteger(L, IUPxCODE(value)); return 1; } @@ -588,7 +588,7 @@ static int GetParent(lua_State *L) static int VersionNumber(lua_State *L) { - lua_pushnumber(L, IupVersionNumber()); + lua_pushinteger(L, IupVersionNumber()); return 1; } @@ -605,7 +605,7 @@ static int GetChildPos(lua_State *L) { Ihandle* ih = iuplua_checkihandle(L,1); Ihandle* child = iuplua_checkihandle(L,2); - lua_pushnumber(L, IupGetChildPos(ih, child)); + lua_pushinteger(L, IupGetChildPos(ih, child)); return 1; } @@ -691,13 +691,13 @@ static int SetLanguage(lua_State *L) static int GetChildCount (lua_State *L) { - lua_pushnumber(L, IupGetChildCount(iuplua_checkihandle(L,1))); + lua_pushinteger(L, IupGetChildCount(iuplua_checkihandle(L,1))); return 1; } static int Show (lua_State *L) { - lua_pushnumber(L, IupShow(iuplua_checkihandle(L,1))); + lua_pushinteger(L, IupShow(iuplua_checkihandle(L,1))); return 1; } @@ -730,10 +730,18 @@ static int ShowXY(lua_State *L) Ihandle *ih = iuplua_checkihandle(L,1); int x = luaL_optint(L,2, IUP_CURRENT); int y = luaL_optint(L,3, IUP_CURRENT); - lua_pushnumber(L,IupShowXY(ih,x,y)); + lua_pushinteger(L, IupShowXY(ih,x,y)); return 1; } +static int ResetAttribute(lua_State *L) +{ + Ihandle *ih = iuplua_checkihandle(L,1); + const char *a = luaL_checkstring(L,2); + IupResetAttribute(ih, a); + return 0; +} + static int StoreAttribute(lua_State *L) { Ihandle *ih = iuplua_checkihandle(L,1); @@ -826,6 +834,7 @@ void iupluaapi_open(lua_State * L) {"NextField", NextField}, {"Popup", Popup}, {"PreviousField", PreviousField}, + {"ResetAttribute", ResetAttribute}, {"SetAttribute", StoreAttribute}, {"SetAttributes", SetAttributes}, {"isbutton1", cf_isbutton1}, |