diff options
| author | Alexander Pickering <alex@cogarr.net> | 2018-09-10 23:11:08 -0400 |
|---|---|---|
| committer | Alexander Pickering <alex@cogarr.net> | 2018-09-10 23:11:08 -0400 |
| commit | c38d5eca7091fc7f0206ed0c746622022b2ae508 (patch) | |
| tree | 8c01d4a941b4152675354b8b7a46c0906e9fb40c /src/client/lua_api/gui/iguifiledialog.cpp | |
| parent | b3c0d2ead1f384b35615be562c5f06804e8990cb (diff) | |
| download | brokengine-c38d5eca7091fc7f0206ed0c746622022b2ae508.tar.gz brokengine-c38d5eca7091fc7f0206ed0c746622022b2ae508.tar.bz2 brokengine-c38d5eca7091fc7f0206ed0c746622022b2ae508.zip | |
Added documentation
Also added treeview guielemnt
Also added ifilesystem guielement
Also added io library
Diffstat (limited to 'src/client/lua_api/gui/iguifiledialog.cpp')
| -rw-r--r-- | src/client/lua_api/gui/iguifiledialog.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/src/client/lua_api/gui/iguifiledialog.cpp b/src/client/lua_api/gui/iguifiledialog.cpp index ad95b13..6303230 100644 --- a/src/client/lua_api/gui/iguifiledialog.cpp +++ b/src/client/lua_api/gui/iguifiledialog.cpp @@ -29,11 +29,11 @@ extern IrrlichtDevice* device; /*** @function newfileopendialog() Creates a new dialog to open a file -@tparam title string The rectangle to place the button at. If the box has a parent, +@tparam ?string title The rectangle to place the button at. If the box has a parent, it is offset from the upper-left of the parent element. -@tparam path string The path to open the file dialog to -@tparam parent (iguielement | nil) parent The parent element of the button. -@tparam modal boolean If other gui elements can be interacted with before this element is closed +@tparam ?string path The path to open the file dialog to +@tparam ?iguielement parent The parent element of the button. +@tparam ?boolean modal If other gui elements can be interacted with before this element is closed @treturn iguifileopendialog The button element */ //gui.newfileopendialog(["title"][,"path"][,parent][,modal]) @@ -88,12 +88,38 @@ static int newfileopendialog(lua_State* L){ return 1; } +//{fileopendialog} -> "dir" +int getdir(lua_State *L){ + lua_getfield(L,-1,"guielement");//{fileopendialog},ud_fileopendialog + IGUIFileOpenDialog *f = (IGUIFileOpenDialog*)lua_touserdata(L,-1); + lua_pop(L,2); + const char *dname = f->getDirectoryName().c_str(); + lua_pushstring(L,dname); + return 1; +} + +//{fileopendialog} -> "name" +int getname(lua_State *L){ + lua_getfield(L, -1, "guielement");//{fileopendialog},ud_fileopendialog + IGUIFileOpenDialog *f = (IGUIFileOpenDialog*)lua_touserdata(L,-1); + lua_pop(L,2);// + const wchar_t *name_w = f->getFileName(); + size_t slen = wcslen(name_w); + char name_c[slen + 1]; // + 1 for null + wcstombs(name_c,name_w,slen); + name_c[slen] = '\0'; + lua_pushstring(L,name_c); + return 1; +} + static const luaL_reg iguifileopendialog_f[] = { {"new", newfileopendialog}, {0,0}, }; static const luaL_reg iguifileopendialog_m[] = { + {"getdir", getdir}, + {"getname", getname}, {0,0}, }; |
