Element.cpp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652
  1. #include "Element.h"
  2. #include "ElementAttributesProxy.h"
  3. #include "ElementChildNodesProxy.h"
  4. #include "ElementStyleProxy.h"
  5. #include "LuaEventListener.h"
  6. #include <RmlUi/Lua/Utilities.h>
  7. namespace Rml {
  8. namespace Lua {
  9. typedef ElementDocument Document;
  10. template <>
  11. void ExtraInit<Element>(lua_State* L, int metatable_index)
  12. {
  13. int top = lua_gettop(L);
  14. // guarantee the "Element.As" table exists
  15. lua_getfield(L, metatable_index - 1, "As");
  16. if (lua_isnoneornil(L, -1)) // if it doesn't exist, create it
  17. {
  18. lua_newtable(L);
  19. lua_setfield(L, metatable_index - 1, "As");
  20. }
  21. lua_pop(L, 1); // pop the result of lua_getfield
  22. lua_pushcfunction(L, Elementnew);
  23. lua_setfield(L, metatable_index - 1, "new");
  24. lua_settop(L, top);
  25. }
  26. int Elementnew(lua_State* L)
  27. {
  28. const char* tag = luaL_checkstring(L, 1);
  29. Element* ele = new Element(tag);
  30. LuaType<Element>::push(L, ele, true);
  31. return 1;
  32. }
  33. // methods
  34. int ElementAddEventListener(lua_State* L, Element* obj)
  35. {
  36. int top = lua_gettop(L);
  37. bool capture = false;
  38. // default false if they didn't pass it in
  39. if (top > 2)
  40. capture = RMLUI_CHECK_BOOL(L, 3);
  41. const char* event = luaL_checkstring(L, 1);
  42. LuaEventListener* listener = nullptr;
  43. int type = lua_type(L, 2);
  44. if (type == LUA_TFUNCTION)
  45. {
  46. listener = new LuaEventListener(L, 2, obj);
  47. }
  48. else if (type == LUA_TSTRING)
  49. {
  50. const char* code = luaL_checkstring(L, 2);
  51. listener = new LuaEventListener(code, obj);
  52. }
  53. else
  54. {
  55. Log::Message(Log::LT_WARNING, "Lua Context:AddEventLisener's 2nd argument can only be a Lua function or a string, you passed in a %s",
  56. lua_typename(L, type));
  57. }
  58. if (listener != nullptr)
  59. {
  60. obj->AddEventListener(event, listener, capture);
  61. }
  62. return 0;
  63. }
  64. int ElementAppendChild(lua_State* L, Element* obj)
  65. {
  66. ElementPtr* element = LuaType<ElementPtr>::check(L, 1);
  67. if (*element)
  68. {
  69. Element* child = obj->AppendChild(std::move(*element));
  70. LuaType<Element>::push(L, child, false);
  71. }
  72. else
  73. {
  74. Log::Message(Log::LT_WARNING, "Could not append child to element '%s', as the child was null. Was it already moved from?",
  75. obj->GetAddress().c_str());
  76. lua_pushnil(L);
  77. }
  78. return 1;
  79. }
  80. int ElementBlur(lua_State* /*L*/, Element* obj)
  81. {
  82. obj->Blur();
  83. return 0;
  84. }
  85. int ElementClick(lua_State* /*L*/, Element* obj)
  86. {
  87. obj->Click();
  88. return 0;
  89. }
  90. int ElementDispatchEvent(lua_State* L, Element* obj)
  91. {
  92. const char* event = luaL_checkstring(L, 1);
  93. Dictionary params;
  94. lua_pushnil(L); // becauase lua_next pops a key from the stack first, we don't want to pop the table
  95. while (lua_next(L, 2) != 0)
  96. {
  97. //[-1] is value, [-2] is key
  98. int type = lua_type(L, -1);
  99. const char* key = luaL_checkstring(L, -2); // key HAS to be a string, or things will go bad
  100. switch (type)
  101. {
  102. case LUA_TNUMBER: params[key] = (float)lua_tonumber(L, -1); break;
  103. case LUA_TBOOLEAN: params[key] = RMLUI_CHECK_BOOL(L, -1); break;
  104. case LUA_TSTRING: params[key] = luaL_checkstring(L, -1); break;
  105. case LUA_TUSERDATA:
  106. case LUA_TLIGHTUSERDATA: params[key] = lua_touserdata(L, -1); break;
  107. default: break;
  108. }
  109. lua_pop(L, 1); // pops value, leaves key for next iteration
  110. }
  111. obj->DispatchEvent(event, params);
  112. return 0;
  113. }
  114. int ElementFocus(lua_State* /*L*/, Element* obj)
  115. {
  116. obj->Focus();
  117. return 0;
  118. }
  119. int ElementGetAttribute(lua_State* L, Element* obj)
  120. {
  121. const char* name = luaL_checkstring(L, 1);
  122. Variant* var = obj->GetAttribute(name);
  123. PushVariant(L, var);
  124. return 1;
  125. }
  126. int ElementGetElementById(lua_State* L, Element* obj)
  127. {
  128. const char* id = luaL_checkstring(L, 1);
  129. Element* ele = obj->GetElementById(id);
  130. LuaType<Element>::push(L, ele, false);
  131. return 1;
  132. }
  133. int ElementGetElementsByTagName(lua_State* L, Element* obj)
  134. {
  135. const char* tag = luaL_checkstring(L, 1);
  136. ElementList list;
  137. obj->GetElementsByTagName(list, tag);
  138. lua_newtable(L);
  139. for (unsigned int i = 0; i < list.size(); i++)
  140. {
  141. PushIndex(L, i);
  142. LuaType<Element>::push(L, list[i], false);
  143. lua_settable(L, -3); //-3 is the table
  144. }
  145. return 1;
  146. }
  147. int ElementQuerySelector(lua_State* L, Element* obj)
  148. {
  149. const char* sel = luaL_checkstring(L, 1);
  150. Element* ele = obj->QuerySelector(sel);
  151. LuaType<Element>::push(L, ele, false);
  152. return 1;
  153. }
  154. int ElementQuerySelectorAll(lua_State* L, Element* obj)
  155. {
  156. const char* tag = luaL_checkstring(L, 1);
  157. ElementList list;
  158. obj->QuerySelectorAll(list, tag);
  159. lua_newtable(L);
  160. for (unsigned int i = 0; i < list.size(); i++)
  161. {
  162. PushIndex(L, i);
  163. LuaType<Element>::push(L, list[i], false);
  164. lua_settable(L, -3); //-3 is the table
  165. }
  166. return 1;
  167. }
  168. int ElementMatches(lua_State* L, Element* obj)
  169. {
  170. const char* tag = luaL_checkstring(L, 1);
  171. lua_pushboolean(L, obj->Matches(tag));
  172. return 1;
  173. }
  174. int ElementHasAttribute(lua_State* L, Element* obj)
  175. {
  176. const char* name = luaL_checkstring(L, 1);
  177. lua_pushboolean(L, obj->HasAttribute(name));
  178. return 1;
  179. }
  180. int ElementHasChildNodes(lua_State* L, Element* obj)
  181. {
  182. lua_pushboolean(L, obj->HasChildNodes());
  183. return 1;
  184. }
  185. int ElementInsertBefore(lua_State* L, Element* obj)
  186. {
  187. ElementPtr* element = LuaType<ElementPtr>::check(L, 1);
  188. Element* adjacent = LuaType<Element>::check(L, 2);
  189. if (*element)
  190. {
  191. Element* inserted = obj->InsertBefore(std::move(*element), adjacent);
  192. LuaType<Element>::push(L, inserted, false);
  193. }
  194. else
  195. {
  196. Log::Message(Log::LT_WARNING, "Could not insert child to element '%s', as the child was null. Was it already moved from?",
  197. obj->GetAddress().c_str());
  198. lua_pushnil(L);
  199. }
  200. return 1;
  201. }
  202. int ElementIsClassSet(lua_State* L, Element* obj)
  203. {
  204. const char* name = luaL_checkstring(L, 1);
  205. lua_pushboolean(L, obj->IsClassSet(name));
  206. return 1;
  207. }
  208. int ElementRemoveAttribute(lua_State* L, Element* obj)
  209. {
  210. const char* name = luaL_checkstring(L, 1);
  211. obj->RemoveAttribute(name);
  212. return 0;
  213. }
  214. int ElementRemoveChild(lua_State* L, Element* obj)
  215. {
  216. Element* element = LuaType<Element>::check(L, 1);
  217. lua_pushboolean(L, static_cast<bool>(obj->RemoveChild(element)));
  218. return 1;
  219. }
  220. int ElementReplaceChild(lua_State* L, Element* obj)
  221. {
  222. ElementPtr* inserted = LuaType<ElementPtr>::check(L, 1);
  223. Element* replaced = LuaType<Element>::check(L, 2);
  224. if (*inserted)
  225. lua_pushboolean(L, static_cast<bool>(obj->ReplaceChild(std::move(*inserted), replaced)));
  226. else
  227. Log::Message(Log::LT_WARNING, "Could not replace child in element '%s', as the child was null. Was it already moved from?",
  228. obj->GetAddress().c_str());
  229. return 1;
  230. }
  231. int ElementScrollIntoView(lua_State* L, Element* obj)
  232. {
  233. bool align = RMLUI_CHECK_BOOL(L, 1);
  234. obj->ScrollIntoView(align);
  235. return 0;
  236. }
  237. int ElementSetAttribute(lua_State* L, Element* obj)
  238. {
  239. const char* name = luaL_checkstring(L, 1);
  240. const char* value = luaL_checkstring(L, 2);
  241. obj->SetAttribute(name, String(value));
  242. return 0;
  243. }
  244. int ElementSetClass(lua_State* L, Element* obj)
  245. {
  246. const char* name = luaL_checkstring(L, 1);
  247. bool value = RMLUI_CHECK_BOOL(L, 2);
  248. obj->SetClass(name, value);
  249. return 0;
  250. }
  251. // getters
  252. int ElementGetAttrattributes(lua_State* L)
  253. {
  254. Element* ele = LuaType<Element>::check(L, 1);
  255. RMLUI_CHECK_OBJ(ele);
  256. ElementAttributesProxy* proxy = new ElementAttributesProxy();
  257. proxy->owner = ele;
  258. LuaType<ElementAttributesProxy>::push(L, proxy, true);
  259. return 1;
  260. }
  261. int ElementGetAttrchild_nodes(lua_State* L)
  262. {
  263. Element* ele = LuaType<Element>::check(L, 1);
  264. RMLUI_CHECK_OBJ(ele);
  265. ElementChildNodesProxy* ecnp = new ElementChildNodesProxy();
  266. ecnp->owner = ele;
  267. LuaType<ElementChildNodesProxy>::push(L, ecnp, true);
  268. return 1;
  269. }
  270. int ElementGetAttrclass_name(lua_State* L)
  271. {
  272. Element* ele = LuaType<Element>::check(L, 1);
  273. RMLUI_CHECK_OBJ(ele);
  274. String classnames = ele->GetClassNames();
  275. lua_pushstring(L, classnames.c_str());
  276. return 1;
  277. }
  278. int ElementGetAttrclient_left(lua_State* L)
  279. {
  280. Element* ele = LuaType<Element>::check(L, 1);
  281. RMLUI_CHECK_OBJ(ele);
  282. lua_pushnumber(L, ele->GetClientLeft());
  283. return 1;
  284. }
  285. int ElementGetAttrclient_height(lua_State* L)
  286. {
  287. Element* ele = LuaType<Element>::check(L, 1);
  288. RMLUI_CHECK_OBJ(ele);
  289. lua_pushnumber(L, ele->GetClientHeight());
  290. return 1;
  291. }
  292. int ElementGetAttrclient_top(lua_State* L)
  293. {
  294. Element* ele = LuaType<Element>::check(L, 1);
  295. RMLUI_CHECK_OBJ(ele);
  296. lua_pushnumber(L, ele->GetClientTop());
  297. return 1;
  298. }
  299. int ElementGetAttrclient_width(lua_State* L)
  300. {
  301. Element* ele = LuaType<Element>::check(L, 1);
  302. RMLUI_CHECK_OBJ(ele);
  303. lua_pushnumber(L, ele->GetClientWidth());
  304. return 1;
  305. }
  306. int ElementGetAttrfirst_child(lua_State* L)
  307. {
  308. Element* ele = LuaType<Element>::check(L, 1);
  309. RMLUI_CHECK_OBJ(ele);
  310. Element* child = ele->GetFirstChild();
  311. if (child == nullptr)
  312. lua_pushnil(L);
  313. else
  314. LuaType<Element>::push(L, child, false);
  315. return 1;
  316. }
  317. int ElementGetAttrid(lua_State* L)
  318. {
  319. Element* ele = LuaType<Element>::check(L, 1);
  320. RMLUI_CHECK_OBJ(ele);
  321. lua_pushstring(L, ele->GetId().c_str());
  322. return 1;
  323. }
  324. int ElementGetAttrinner_rml(lua_State* L)
  325. {
  326. Element* ele = LuaType<Element>::check(L, 1);
  327. RMLUI_CHECK_OBJ(ele);
  328. lua_pushstring(L, ele->GetInnerRML().c_str());
  329. return 1;
  330. }
  331. int ElementGetAttrlast_child(lua_State* L)
  332. {
  333. Element* ele = LuaType<Element>::check(L, 1);
  334. RMLUI_CHECK_OBJ(ele);
  335. Element* child = ele->GetLastChild();
  336. if (child == nullptr)
  337. lua_pushnil(L);
  338. else
  339. LuaType<Element>::push(L, child, false);
  340. return 1;
  341. }
  342. int ElementGetAttrnext_sibling(lua_State* L)
  343. {
  344. Element* ele = LuaType<Element>::check(L, 1);
  345. RMLUI_CHECK_OBJ(ele);
  346. Element* sibling = ele->GetNextSibling();
  347. if (sibling == nullptr)
  348. lua_pushnil(L);
  349. else
  350. LuaType<Element>::push(L, sibling, false);
  351. return 1;
  352. }
  353. int ElementGetAttroffset_height(lua_State* L)
  354. {
  355. Element* ele = LuaType<Element>::check(L, 1);
  356. RMLUI_CHECK_OBJ(ele);
  357. lua_pushnumber(L, ele->GetOffsetHeight());
  358. return 1;
  359. }
  360. int ElementGetAttroffset_left(lua_State* L)
  361. {
  362. Element* ele = LuaType<Element>::check(L, 1);
  363. RMLUI_CHECK_OBJ(ele);
  364. lua_pushnumber(L, ele->GetOffsetLeft());
  365. return 1;
  366. }
  367. int ElementGetAttroffset_parent(lua_State* L)
  368. {
  369. Element* ele = LuaType<Element>::check(L, 1);
  370. RMLUI_CHECK_OBJ(ele);
  371. Element* parent = ele->GetOffsetParent();
  372. LuaType<Element>::push(L, parent, false);
  373. return 1;
  374. }
  375. int ElementGetAttroffset_top(lua_State* L)
  376. {
  377. Element* ele = LuaType<Element>::check(L, 1);
  378. RMLUI_CHECK_OBJ(ele);
  379. lua_pushnumber(L, ele->GetOffsetTop());
  380. return 1;
  381. }
  382. int ElementGetAttroffset_width(lua_State* L)
  383. {
  384. Element* ele = LuaType<Element>::check(L, 1);
  385. RMLUI_CHECK_OBJ(ele);
  386. lua_pushnumber(L, ele->GetOffsetWidth());
  387. return 1;
  388. }
  389. int ElementGetAttrowner_document(lua_State* L)
  390. {
  391. Element* ele = LuaType<Element>::check(L, 1);
  392. RMLUI_CHECK_OBJ(ele);
  393. Document* doc = ele->GetOwnerDocument();
  394. LuaType<Document>::push(L, doc, false);
  395. return 1;
  396. }
  397. int ElementGetAttrparent_node(lua_State* L)
  398. {
  399. Element* ele = LuaType<Element>::check(L, 1);
  400. RMLUI_CHECK_OBJ(ele);
  401. Element* parent = ele->GetParentNode();
  402. if (parent == nullptr)
  403. lua_pushnil(L);
  404. else
  405. LuaType<Element>::push(L, parent, false);
  406. return 1;
  407. }
  408. int ElementGetAttrprevious_sibling(lua_State* L)
  409. {
  410. Element* ele = LuaType<Element>::check(L, 1);
  411. RMLUI_CHECK_OBJ(ele);
  412. Element* sibling = ele->GetPreviousSibling();
  413. if (sibling == nullptr)
  414. lua_pushnil(L);
  415. else
  416. LuaType<Element>::push(L, sibling, false);
  417. return 1;
  418. }
  419. int ElementGetAttrscroll_height(lua_State* L)
  420. {
  421. Element* ele = LuaType<Element>::check(L, 1);
  422. RMLUI_CHECK_OBJ(ele);
  423. lua_pushnumber(L, ele->GetScrollHeight());
  424. return 1;
  425. }
  426. int ElementGetAttrscroll_left(lua_State* L)
  427. {
  428. Element* ele = LuaType<Element>::check(L, 1);
  429. RMLUI_CHECK_OBJ(ele);
  430. lua_pushnumber(L, ele->GetScrollLeft());
  431. return 1;
  432. }
  433. int ElementGetAttrscroll_top(lua_State* L)
  434. {
  435. Element* ele = LuaType<Element>::check(L, 1);
  436. RMLUI_CHECK_OBJ(ele);
  437. lua_pushnumber(L, ele->GetScrollTop());
  438. return 1;
  439. }
  440. int ElementGetAttrscroll_width(lua_State* L)
  441. {
  442. Element* ele = LuaType<Element>::check(L, 1);
  443. RMLUI_CHECK_OBJ(ele);
  444. lua_pushnumber(L, ele->GetScrollWidth());
  445. return 1;
  446. }
  447. int ElementGetAttrstyle(lua_State* L)
  448. {
  449. Element* ele = LuaType<Element>::check(L, 1);
  450. RMLUI_CHECK_OBJ(ele);
  451. ElementStyleProxy* prox = new ElementStyleProxy();
  452. prox->owner = ele;
  453. LuaType<ElementStyleProxy>::push(L, prox, true);
  454. return 1;
  455. }
  456. int ElementGetAttrtag_name(lua_State* L)
  457. {
  458. Element* ele = LuaType<Element>::check(L, 1);
  459. RMLUI_CHECK_OBJ(ele);
  460. lua_pushstring(L, ele->GetTagName().c_str());
  461. return 1;
  462. }
  463. // setters
  464. int ElementSetAttrclass_name(lua_State* L)
  465. {
  466. Element* ele = LuaType<Element>::check(L, 1);
  467. RMLUI_CHECK_OBJ(ele);
  468. const char* name = luaL_checkstring(L, 2);
  469. ele->SetClassNames(name);
  470. return 0;
  471. }
  472. int ElementSetAttrid(lua_State* L)
  473. {
  474. Element* ele = LuaType<Element>::check(L, 1);
  475. RMLUI_CHECK_OBJ(ele);
  476. const char* id = luaL_checkstring(L, 2);
  477. ele->SetId(id);
  478. return 0;
  479. }
  480. int ElementSetAttrinner_rml(lua_State* L)
  481. {
  482. Element* ele = LuaType<Element>::check(L, 1);
  483. RMLUI_CHECK_OBJ(ele);
  484. const char* rml = luaL_checkstring(L, 2);
  485. ele->SetInnerRML(rml);
  486. return 0;
  487. }
  488. int ElementSetAttrscroll_left(lua_State* L)
  489. {
  490. Element* ele = LuaType<Element>::check(L, 1);
  491. RMLUI_CHECK_OBJ(ele);
  492. float scroll = (float)luaL_checknumber(L, 2);
  493. ele->SetScrollLeft(scroll);
  494. return 0;
  495. }
  496. int ElementSetAttrscroll_top(lua_State* L)
  497. {
  498. Element* ele = LuaType<Element>::check(L, 1);
  499. RMLUI_CHECK_OBJ(ele);
  500. float scroll = (float)luaL_checknumber(L, 2);
  501. ele->SetScrollTop(scroll);
  502. return 0;
  503. }
  504. RegType<Element> ElementMethods[] = {
  505. RMLUI_LUAMETHOD(Element, AddEventListener),
  506. RMLUI_LUAMETHOD(Element, AppendChild),
  507. RMLUI_LUAMETHOD(Element, Blur),
  508. RMLUI_LUAMETHOD(Element, Click),
  509. RMLUI_LUAMETHOD(Element, DispatchEvent),
  510. RMLUI_LUAMETHOD(Element, Focus),
  511. RMLUI_LUAMETHOD(Element, GetAttribute),
  512. RMLUI_LUAMETHOD(Element, GetElementById),
  513. RMLUI_LUAMETHOD(Element, GetElementsByTagName),
  514. RMLUI_LUAMETHOD(Element, QuerySelector),
  515. RMLUI_LUAMETHOD(Element, QuerySelectorAll),
  516. RMLUI_LUAMETHOD(Element, Matches),
  517. RMLUI_LUAMETHOD(Element, HasAttribute),
  518. RMLUI_LUAMETHOD(Element, HasChildNodes),
  519. RMLUI_LUAMETHOD(Element, InsertBefore),
  520. RMLUI_LUAMETHOD(Element, IsClassSet),
  521. RMLUI_LUAMETHOD(Element, RemoveAttribute),
  522. RMLUI_LUAMETHOD(Element, RemoveChild),
  523. RMLUI_LUAMETHOD(Element, ReplaceChild),
  524. RMLUI_LUAMETHOD(Element, ScrollIntoView),
  525. RMLUI_LUAMETHOD(Element, SetAttribute),
  526. RMLUI_LUAMETHOD(Element, SetClass),
  527. {nullptr, nullptr},
  528. };
  529. luaL_Reg ElementGetters[] = {
  530. RMLUI_LUAGETTER(Element, attributes),
  531. RMLUI_LUAGETTER(Element, child_nodes),
  532. RMLUI_LUAGETTER(Element, class_name),
  533. RMLUI_LUAGETTER(Element, client_left),
  534. RMLUI_LUAGETTER(Element, client_height),
  535. RMLUI_LUAGETTER(Element, client_top),
  536. RMLUI_LUAGETTER(Element, client_width),
  537. RMLUI_LUAGETTER(Element, first_child),
  538. RMLUI_LUAGETTER(Element, id),
  539. RMLUI_LUAGETTER(Element, inner_rml),
  540. RMLUI_LUAGETTER(Element, last_child),
  541. RMLUI_LUAGETTER(Element, next_sibling),
  542. RMLUI_LUAGETTER(Element, offset_height),
  543. RMLUI_LUAGETTER(Element, offset_left),
  544. RMLUI_LUAGETTER(Element, offset_parent),
  545. RMLUI_LUAGETTER(Element, offset_top),
  546. RMLUI_LUAGETTER(Element, offset_width),
  547. RMLUI_LUAGETTER(Element, owner_document),
  548. RMLUI_LUAGETTER(Element, parent_node),
  549. RMLUI_LUAGETTER(Element, previous_sibling),
  550. RMLUI_LUAGETTER(Element, scroll_height),
  551. RMLUI_LUAGETTER(Element, scroll_left),
  552. RMLUI_LUAGETTER(Element, scroll_top),
  553. RMLUI_LUAGETTER(Element, scroll_width),
  554. RMLUI_LUAGETTER(Element, style),
  555. RMLUI_LUAGETTER(Element, tag_name),
  556. {nullptr, nullptr},
  557. };
  558. luaL_Reg ElementSetters[] = {
  559. RMLUI_LUASETTER(Element, class_name),
  560. RMLUI_LUASETTER(Element, id),
  561. RMLUI_LUASETTER(Element, inner_rml),
  562. RMLUI_LUASETTER(Element, scroll_left),
  563. RMLUI_LUASETTER(Element, scroll_top),
  564. {nullptr, nullptr},
  565. };
  566. RMLUI_LUATYPE_DEFINE(Element)
  567. template <>
  568. void ExtraInit<ElementPtr>(lua_State* /*L*/, int /*metatable_index*/)
  569. {
  570. return;
  571. }
  572. RegType<ElementPtr> ElementPtrMethods[] = {
  573. {nullptr, nullptr},
  574. };
  575. luaL_Reg ElementPtrGetters[] = {
  576. {nullptr, nullptr},
  577. };
  578. luaL_Reg ElementPtrSetters[] = {
  579. {nullptr, nullptr},
  580. };
  581. RMLUI_LUATYPE_DEFINE(ElementPtr)
  582. } // namespace Lua
  583. } // namespace Rml