From 8089f85c89a75f3ac5d216e00bb9bf3fc5c025ab Mon Sep 17 00:00:00 2001 From: Jeremy Tuloup Date: Sat, 22 Apr 2023 11:53:21 +0200 Subject: [PATCH] Fix typo xwidgtes_type -> xwidgets_type --- src/xwidgets.cpp | 242 +++++++++++++++++++++++------------------------ 1 file changed, 121 insertions(+), 121 deletions(-) diff --git a/src/xwidgets.cpp b/src/xwidgets.cpp index b8af9e7..77c90ec 100644 --- a/src/xwidgets.cpp +++ b/src/xwidgets.cpp @@ -73,20 +73,20 @@ namespace xlua #define XLUA_ADD_PROPERTY(CLS_OBJ,PROPERTY_TYPE,PROPERTY_NAME)\ CLS_OBJ.set(#PROPERTY_NAME, sol::property(\ - [](xwidgtes_type & widget){\ + [](xwidgets_type & widget){\ return PROPERTY_TYPE(widget.PROPERTY_NAME);\ }, \ - [](xwidgtes_type & widget, const PROPERTY_TYPE & val){\ + [](xwidgets_type & widget, const PROPERTY_TYPE & val){\ widget.PROPERTY_NAME = val;\ })\ ) #define XLUA_ADD_DATA_PROPERTY(CLS_OBJ,PROPERTY_TYPE,PROPERTY_NAME)\ CLS_OBJ.set(#PROPERTY_NAME, sol::property(\ - [](xwidgtes_type & widget){\ + [](xwidgets_type & widget){\ return PROPERTY_TYPE(widget.PROPERTY_NAME);\ }, \ - [](xwidgtes_type & widget, const std::string & val){\ + [](xwidgets_type & widget, const std::string & val){\ std::vector data(val.begin(), val.end());\ widget.PROPERTY_NAME = data;\ })\ @@ -94,10 +94,10 @@ namespace xlua #define XLUA_ADD_INDEX_PROPERTY(CLS_OBJ,PROPERTY_TYPE,PROPERTY_NAME)\ CLS_OBJ.set(#PROPERTY_NAME, sol::property(\ - [](xwidgtes_type & widget){\ + [](xwidgets_type & widget){\ return PROPERTY_TYPE(widget.PROPERTY_NAME) + 1;\ }, \ - [](xwidgtes_type & widget, const PROPERTY_TYPE & val){\ + [](xwidgets_type & widget, const PROPERTY_TYPE & val){\ widget.PROPERTY_NAME = val -1;\ })\ ) @@ -105,10 +105,10 @@ namespace xlua #define XLUA_ADD_CONTAINER_PROPERTY(CLS_OBJ,PROPERTY_TYPE,PROPERTY_NAME)\ CLS_OBJ.set(#PROPERTY_NAME, sol::property(\ - [](xwidgtes_type & widget){\ + [](xwidgets_type & widget){\ return PROPERTY_TYPE(widget.PROPERTY_NAME);\ }, \ - [](xwidgtes_type & widget, sol::as_table_t val){\ + [](xwidgets_type & widget, sol::as_table_t val){\ widget.PROPERTY_NAME = val;\ })\ ) @@ -117,7 +117,7 @@ namespace xlua #define XLUA_REGISTER_OBSERVER(CLS_OBJ, PROPERTY_TYPE, PROPERTY_NAME) \ - CLS_OBJ["register_observer"] = [](xwidgtes_type & widget, sol::protected_function function){ \ + CLS_OBJ["register_observer"] = [](xwidgets_type & widget, sol::protected_function function){ \ auto callback = [function](const auto& s) { \ auto res = function.call(PROPERTY_TYPE(s.PROPERTY_NAME)); \ if (!res.valid()) \ @@ -129,10 +129,10 @@ namespace xlua } \ }; \ XOBSERVE(widget, value, callback); \ - }; + }; #define XLUA_REGISTER_INDEX_OBSERVER(CLS_OBJ, PROPERTY_TYPE, PROPERTY_NAME) \ - CLS_OBJ["register_observer"] = [](xwidgtes_type & widget, sol::protected_function function){ \ + CLS_OBJ["register_observer"] = [](xwidgets_type & widget, sol::protected_function function){ \ auto callback = [function](const auto& s) { \ auto res = function.call(PROPERTY_TYPE(s.PROPERTY_NAME)+1); \ if (!res.valid()) \ @@ -144,10 +144,10 @@ namespace xlua } \ }; \ XOBSERVE(widget, PROPERTY_NAME, callback); \ - }; + }; #define XLUA_REGISTER_OPTIONAL_INDEX_OBSERVER(CLS_OBJ, PROPERTY_TYPE, PROPERTY_NAME) \ - CLS_OBJ["register_observer"] = [](xwidgtes_type & widget, sol::protected_function function){ \ + CLS_OBJ["register_observer"] = [](xwidgets_type & widget, sol::protected_function function){ \ auto callback = [function](const auto& s) { \ auto res = function.call(xtl::xoptional(s.PROPERTY_NAME).value()+1); \ if (!res.valid()) \ @@ -159,11 +159,11 @@ namespace xlua } \ }; \ XOBSERVE(widget, PROPERTY_NAME, callback); \ - }; + }; -template +template void register_widget_impl(sol::state_view & lua, const std::string widget_name, extend_f && extend) { // get widgets table @@ -173,16 +173,16 @@ void register_widget_impl(sol::state_view & lua, const std::string widget_name, // make usertype metatable - sol::usertype xwidgtes_lua_type = detail_table.new_usertype( + sol::usertype xwidgtes_lua_type = detail_table.new_usertype( widget_name, // 1 constructors - sol::constructors() + sol::constructors() ); // typical member function that returns a variable - xwidgtes_lua_type["display"] = &xwidgtes_type::display; - xwidgtes_lua_type["id"] = &xwidgtes_type::id; + xwidgtes_lua_type["display"] = &xwidgets_type::display; + xwidgtes_lua_type["id"] = &xwidgets_type::id; - xwidgtes_lua_type[sol::meta_function::to_string] = [widget_name](xwidgtes_type & ){ + xwidgtes_lua_type[sol::meta_function::to_string] = [widget_name](xwidgets_type & ){ return widget_name; }; @@ -244,8 +244,8 @@ void register_xwidgets_impl(sol::state_view & lua) sol::table detail_table = widgets_table["detail"]; { - using xwidgtes_type = xw::button; - register_widget_impl(lua, "xbutton",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::button; + register_widget_impl(lua, "xbutton",[](auto && xwidgtes_lua_type){ XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, description); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, tooltip); @@ -254,7 +254,7 @@ void register_xwidgets_impl(sol::state_view & lua) XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, button_style); //XLUA_ADD_PROPERTY(xwidgtes_lua_type, button_style, std::string); - xwidgtes_lua_type["on_click"] = [](xwidgtes_type & widget, sol::protected_function function){ + xwidgtes_lua_type["on_click"] = [](xwidgets_type & widget, sol::protected_function function){ auto callback = [function]() { auto res = function.call(); if (!res.valid()) @@ -265,15 +265,15 @@ void register_xwidgets_impl(sol::state_view & lua) interpreter.publish_execution_error(error_str,error_str,std::vector(1,error_str)); } }; - widget.on_click(typename xwidgtes_type::click_callback_type(callback)); + widget.on_click(typename xwidgets_type::click_callback_type(callback)); }; }); } - + { - using xwidgtes_type = xw::slider; - register_widget_impl(lua, "xslider",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::slider; + register_widget_impl(lua, "xslider",[](auto && xwidgtes_lua_type){ XLUA_ADD_PROPERTY(xwidgtes_lua_type, double, min); XLUA_ADD_PROPERTY(xwidgtes_lua_type, double, max); @@ -291,21 +291,21 @@ void register_xwidgets_impl(sol::state_view & lua) } { - using xwidgtes_type = xw::output; + using xwidgets_type = xw::output; const std::string widget_name = "xoutput"; // make usertype metatable - sol::usertype xwidgtes_lua_type = detail_table.new_usertype( + sol::usertype xwidgtes_lua_type = detail_table.new_usertype( widget_name.c_str(), // 1 constructors - sol::constructors() + sol::constructors() ); // typical member function that returns a variable - xwidgtes_lua_type["display"] = &xwidgtes_type::display; - xwidgtes_lua_type["capture"] = &xwidgtes_type::capture; - xwidgtes_lua_type["release"] = &xwidgtes_type::release; - xwidgtes_lua_type["captured"] = [](xwidgtes_type & widget, sol::protected_function function){ + xwidgtes_lua_type["display"] = &xwidgets_type::display; + xwidgtes_lua_type["capture"] = &xwidgets_type::capture; + xwidgtes_lua_type["release"] = &xwidgets_type::release; + xwidgtes_lua_type["captured"] = [](xwidgets_type & widget, sol::protected_function function){ widget.capture(); auto res = function.call(); if (!res.valid()) @@ -323,18 +323,18 @@ void register_xwidgets_impl(sol::state_view & lua) { - using xwidgtes_type = xw::hbox; - register_widget_impl(lua, "xhbox",[](auto && xwidgtes_lua_type){ - xwidgtes_lua_type["_add"] = [](xwidgtes_type & widget, xeus::xguid id){ + using xwidgets_type = xw::hbox; + register_widget_impl(lua, "xhbox",[](auto && xwidgtes_lua_type){ + xwidgtes_lua_type["_add"] = [](xwidgets_type & widget, xeus::xguid id){ widget.add(id); }; }); } { - using xwidgtes_type = xw::vbox; - register_widget_impl(lua, "xvbox",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::vbox; + register_widget_impl(lua, "xvbox",[](auto && xwidgtes_lua_type){ - xwidgtes_lua_type["_add"] = [](xwidgtes_type & widget, xeus::xguid id){ + xwidgtes_lua_type["_add"] = [](xwidgets_type & widget, xeus::xguid id){ widget.add(id); }; @@ -342,22 +342,22 @@ void register_xwidgets_impl(sol::state_view & lua) } { - using xwidgtes_type = xw::accordion; - register_widget_impl(lua, "xaccordion",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::accordion; + register_widget_impl(lua, "xaccordion",[](auto && xwidgtes_lua_type){ - xwidgtes_lua_type["_add"] = [](xwidgtes_type & widget, xeus::xguid id){ + xwidgtes_lua_type["_add"] = [](xwidgets_type & widget, xeus::xguid id){ widget.add(id); }; - xwidgtes_lua_type["set_title"] = [](xwidgtes_type & widget, std::size_t i, std::string title){ + xwidgtes_lua_type["set_title"] = [](xwidgets_type & widget, std::size_t i, std::string title){ widget.set_title(i-1, title); }; }); } { - using xwidgtes_type = xw::audio; - register_widget_impl(lua, "xaudio",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::audio; + register_widget_impl(lua, "xaudio",[](auto && xwidgtes_lua_type){ XLUA_ADD_DATA_PROPERTY(xwidgtes_lua_type, std::vector, value); XLUA_ADD_PROPERTY(xwidgtes_lua_type, bool, autoplay); @@ -367,8 +367,8 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::checkbox; - register_widget_impl(lua, "xcheckbox",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::checkbox; + register_widget_impl(lua, "xcheckbox",[](auto && xwidgtes_lua_type){ XLUA_ADD_PROPERTY(xwidgtes_lua_type, bool, value); XLUA_ADD_PROPERTY(xwidgtes_lua_type, bool, disabled); @@ -379,9 +379,9 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::color_picker; - register_widget_impl(lua, "xcolor_picker",[](auto && xwidgtes_lua_type){ - + using xwidgets_type = xw::color_picker; + register_widget_impl(lua, "xcolor_picker",[](auto && xwidgtes_lua_type){ + XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, value); XLUA_ADD_PROPERTY(xwidgtes_lua_type, bool, disabled); @@ -392,9 +392,9 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::controller; - register_widget_impl(lua, "xcontroller",[](auto && xwidgtes_lua_type){ - + using xwidgets_type = xw::controller; + register_widget_impl(lua, "xcontroller",[](auto && xwidgtes_lua_type){ + XLUA_ADD_PROPERTY(xwidgtes_lua_type, int, index); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, name); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, mapping); @@ -406,12 +406,12 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::dropdown; - register_widget_impl(lua, "xdropdown",[](auto && xwidgtes_lua_type){ - - using options_type = typename xwidgtes_type::options_type; - using value_type = typename xwidgtes_type::value_type; - using index_type = typename xwidgtes_type::index_type; + using xwidgets_type = xw::dropdown; + register_widget_impl(lua, "xdropdown",[](auto && xwidgtes_lua_type){ + + using options_type = typename xwidgets_type::options_type; + using value_type = typename xwidgets_type::value_type; + using index_type = typename xwidgets_type::index_type; XLUA_ADD_INDEX_PROPERTY(xwidgtes_lua_type, index_type, index); XLUA_ADD_CONTAINER_PROPERTY(xwidgtes_lua_type, options_type, _options_labels); @@ -423,9 +423,9 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::html; - register_widget_impl(lua, "xhtml",[](auto && xwidgtes_lua_type){ - + using xwidgets_type = xw::html; + register_widget_impl(lua, "xhtml",[](auto && xwidgtes_lua_type){ + XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, description); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, value); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, placeholder); @@ -434,8 +434,8 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::image; - register_widget_impl(lua, "ximage",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::image; + register_widget_impl(lua, "ximage",[](auto && xwidgtes_lua_type){ XLUA_ADD_DATA_PROPERTY(xwidgtes_lua_type, std::vector, value); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, format); @@ -445,9 +445,9 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::label; - register_widget_impl(lua, "xlabel",[](auto && xwidgtes_lua_type){ - + using xwidgets_type = xw::label; + register_widget_impl(lua, "xlabel",[](auto && xwidgtes_lua_type){ + XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, description); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, value); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, placeholder); @@ -456,8 +456,8 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::numeral; - register_widget_impl(lua, "xnumeral",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::numeral; + register_widget_impl(lua, "xnumeral",[](auto && xwidgtes_lua_type){ XLUA_ADD_PROPERTY(xwidgtes_lua_type, double, min); XLUA_ADD_PROPERTY(xwidgtes_lua_type, double, max); @@ -471,20 +471,20 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::password; - register_widget_impl(lua, "xpassword",[](auto && xwidgtes_lua_type){ - + using xwidgets_type = xw::password; + register_widget_impl(lua, "xpassword",[](auto && xwidgtes_lua_type){ + XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, description); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, value); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, placeholder); XLUA_ADD_PROPERTY(xwidgtes_lua_type, bool, disabled); - + XLUA_REGISTER_OBSERVER(xwidgtes_lua_type, std::string, value); }); } { - using xwidgtes_type = xw::play; - register_widget_impl(lua, "xplay",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::play; + register_widget_impl(lua, "xplay",[](auto && xwidgtes_lua_type){ XLUA_ADD_PROPERTY(xwidgtes_lua_type, double, min); XLUA_ADD_PROPERTY(xwidgtes_lua_type, double, max); @@ -504,8 +504,8 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::progress; - register_widget_impl(lua, "xprogress",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::progress; + register_widget_impl(lua, "xprogress",[](auto && xwidgtes_lua_type){ XLUA_ADD_PROPERTY(xwidgtes_lua_type, double, min); XLUA_ADD_PROPERTY(xwidgtes_lua_type, double, max); @@ -518,12 +518,12 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::selectionslider; - register_widget_impl(lua, "xselectionslider",[](auto && xwidgtes_lua_type){ - - using options_type = typename xwidgtes_type::options_type; - using value_type = typename xwidgtes_type::value_type; - using index_type = typename xwidgtes_type::index_type; + using xwidgets_type = xw::selectionslider; + register_widget_impl(lua, "xselectionslider",[](auto && xwidgtes_lua_type){ + + using options_type = typename xwidgets_type::options_type; + using value_type = typename xwidgets_type::value_type; + using index_type = typename xwidgets_type::index_type; XLUA_ADD_INDEX_PROPERTY(xwidgtes_lua_type, index_type, index); XLUA_ADD_CONTAINER_PROPERTY(xwidgtes_lua_type, options_type, _options_labels); @@ -539,13 +539,13 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::tab; - register_widget_impl(lua, "xtab",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::tab; + register_widget_impl(lua, "xtab",[](auto && xwidgtes_lua_type){ - using titles_type = typename xwidgtes_type::titles_type; + using titles_type = typename xwidgets_type::titles_type; XLUA_ADD_CONTAINER_PROPERTY(xwidgtes_lua_type, titles_type, _titles); - xwidgtes_lua_type["_add"] = [](xwidgtes_type & widget, xeus::xguid id){ + xwidgtes_lua_type["_add"] = [](xwidgets_type & widget, xeus::xguid id){ widget.add(id); }; @@ -553,10 +553,10 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::text; - register_widget_impl(lua, "xtext",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::text; + register_widget_impl(lua, "xtext",[](auto && xwidgtes_lua_type){ - using submit_callback_type = typename xwidgtes_type::submit_callback_type; + using submit_callback_type = typename xwidgets_type::submit_callback_type; XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, description); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, value); @@ -566,7 +566,7 @@ void register_xwidgets_impl(sol::state_view & lua) XLUA_REGISTER_OBSERVER(xwidgtes_lua_type, std::string, value); - xwidgtes_lua_type["on_submit"] = [](xwidgtes_type & widget, sol::protected_function function){ + xwidgtes_lua_type["on_submit"] = [](xwidgets_type & widget, sol::protected_function function){ auto callback = [function]() { auto res = function.call(); if (!res.valid()) @@ -583,8 +583,8 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::textarea; - register_widget_impl(lua, "xtextarea",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::textarea; + register_widget_impl(lua, "xtextarea",[](auto && xwidgtes_lua_type){ XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, description); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, value); @@ -598,8 +598,8 @@ void register_xwidgets_impl(sol::state_view & lua) } { - using xwidgtes_type = xw::togglebutton; - register_widget_impl(lua, "xtogglebutton",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::togglebutton; + register_widget_impl(lua, "xtogglebutton",[](auto && xwidgtes_lua_type){ XLUA_ADD_PROPERTY(xwidgtes_lua_type, bool, value); XLUA_ADD_PROPERTY(xwidgtes_lua_type, bool, disabled); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, tooltip); @@ -612,13 +612,13 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::togglebuttons; - register_widget_impl(lua, "xtogglebuttons",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::togglebuttons; + register_widget_impl(lua, "xtogglebuttons",[](auto && xwidgtes_lua_type){ + - - using options_type = typename xwidgtes_type::options_type; - using value_type = typename xwidgtes_type::value_type; - using index_type = typename xwidgtes_type::index_type; + using options_type = typename xwidgets_type::options_type; + using value_type = typename xwidgets_type::value_type; + using index_type = typename xwidgets_type::index_type; XLUA_ADD_INDEX_PROPERTY(xwidgtes_lua_type, index_type, index); XLUA_ADD_CONTAINER_PROPERTY(xwidgtes_lua_type, options_type, _options_labels); @@ -635,8 +635,8 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::video; - register_widget_impl(lua, "xvideo",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::video; + register_widget_impl(lua, "xvideo",[](auto && xwidgtes_lua_type){ XLUA_ADD_DATA_PROPERTY(xwidgtes_lua_type, std::vector, value); XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, format); @@ -649,16 +649,16 @@ void register_xwidgets_impl(sol::state_view & lua) }); } { - using xwidgtes_type = xw::valid; - register_widget_impl(lua, "xvalid",[](auto && xwidgtes_lua_type){ + using xwidgets_type = xw::valid; + register_widget_impl(lua, "xvalid",[](auto && xwidgtes_lua_type){ XLUA_ADD_PROPERTY(xwidgtes_lua_type, std::string, readout); XLUA_ADD_PROPERTY(xwidgtes_lua_type, bool, value); XLUA_REGISTER_OBSERVER(xwidgtes_lua_type, bool, value); }); } { - using xwidgtes_type = xw::link; - sol::usertype xwidgtes_lua_type = detail_table.new_usertype( + using xwidgets_type = xw::link; + sol::usertype xwidgtes_lua_type = detail_table.new_usertype( "xlink", sol::factories([]( const xeus::xguid id_source, @@ -666,7 +666,7 @@ void register_xwidgets_impl(sol::state_view & lua) const xeus::xguid id_target, std::string n_target ){ - return xwidgtes_type( + return xwidgets_type( xw::make_id_holder(id_source), n_source, xw::make_id_holder(id_target), @@ -675,13 +675,13 @@ void register_xwidgets_impl(sol::state_view & lua) }) ); // typical member function that returns a variable - xwidgtes_lua_type["display"] = &xwidgtes_type::display; - xwidgtes_lua_type["id"] = &xwidgtes_type::id; + xwidgtes_lua_type["display"] = &xwidgets_type::display; + xwidgtes_lua_type["id"] = &xwidgets_type::id; detail_table["xlink"] = xwidgtes_lua_type; } { - using xwidgtes_type = xw::directional_link; - sol::usertype xwidgtes_lua_type = detail_table.new_usertype( + using xwidgets_type = xw::directional_link; + sol::usertype xwidgtes_lua_type = detail_table.new_usertype( "xdirectional_link", sol::factories([]( const xeus::xguid id_source, @@ -689,7 +689,7 @@ void register_xwidgets_impl(sol::state_view & lua) const xeus::xguid id_target, std::string n_target ){ - return xwidgtes_type( + return xwidgets_type( xw::make_id_holder(id_source), n_source, xw::make_id_holder(id_target), @@ -698,9 +698,9 @@ void register_xwidgets_impl(sol::state_view & lua) }) ); // typical member function that returns a variable - xwidgtes_lua_type["display"] = &xwidgtes_type::display; - xwidgtes_lua_type["id"] = &xwidgtes_type::id; - detail_table["xdirectional_link"] = xwidgtes_lua_type; + xwidgtes_lua_type["display"] = &xwidgets_type::display; + xwidgtes_lua_type["id"] = &xwidgets_type::id; + detail_table["xdirectional_link"] = xwidgtes_lua_type; } } @@ -756,13 +756,13 @@ local concat_tables = function(...) ret[kw] = val end end - + return ret end --- add +-- add for k,widget_cls in pairs(layout_widgets) do function widget_cls:add(...) args = {n = select('#', ...), ...} @@ -775,7 +775,7 @@ end -- add factory function for k,widget_cls in pairs( concat_tables( layout_widgets, atomic_widgets)) do - ilua.widgets[k:sub(2)] = function(options) + ilua.widgets[k:sub(2)] = function(options) options = options or {} w = widget_cls.new() for kw,val in pairs(options) do @@ -791,7 +791,7 @@ end -- add factory function for k,widget_cls in pairs( link_widgets) do - ilua.widgets[k:sub(2)] = function(widget_a, property_a, widget_b, property_b) + ilua.widgets[k:sub(2)] = function(widget_a, property_a, widget_b, property_b) w = widget_cls.new(widget_a:id(), property_a, widget_b:id(), property_b) return w end