diff --git a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js index 1177adb557..279cce4d64 100644 --- a/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js +++ b/cocos/scripting/js-bindings/auto/api/jsb_cocos2dx_ui_auto_api.js @@ -3599,6 +3599,16 @@ widget { }, +/** + * @method setCurSelectedIndex + * @param {int} arg0 + */ +setCurSelectedIndex : function ( +int +) +{ +}, + /** * @method insertDefaultItem * @param {long} arg0 diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp index 3299e0e7f4..28829d26f9 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp @@ -8819,6 +8819,26 @@ bool js_cocos2dx_ui_ListView_pushBackCustomItem(JSContext *cx, uint32_t argc, js JS_ReportError(cx, "js_cocos2dx_ui_ListView_pushBackCustomItem : wrong number of arguments: %d, was expecting %d", argc, 1); return false; } +bool js_cocos2dx_ui_ListView_setCurSelectedIndex(JSContext *cx, uint32_t argc, jsval *vp) +{ + JS::CallArgs args = JS::CallArgsFromVp(argc, vp); + bool ok = true; + JS::RootedObject obj(cx, args.thisv().toObjectOrNull()); + js_proxy_t *proxy = jsb_get_js_proxy(obj); + cocos2d::ui::ListView* cobj = (cocos2d::ui::ListView *)(proxy ? proxy->ptr : NULL); + JSB_PRECONDITION2( cobj, cx, false, "js_cocos2dx_ui_ListView_setCurSelectedIndex : Invalid Native Object"); + if (argc == 1) { + int arg0 = 0; + ok &= jsval_to_int32(cx, args.get(0), (int32_t *)&arg0); + JSB_PRECONDITION2(ok, cx, false, "js_cocos2dx_ui_ListView_setCurSelectedIndex : Error processing arguments"); + cobj->setCurSelectedIndex(arg0); + args.rval().setUndefined(); + return true; + } + + JS_ReportError(cx, "js_cocos2dx_ui_ListView_setCurSelectedIndex : wrong number of arguments: %d, was expecting %d", argc, 1); + return false; +} bool js_cocos2dx_ui_ListView_insertDefaultItem(JSContext *cx, uint32_t argc, jsval *vp) { JS::CallArgs args = JS::CallArgsFromVp(argc, vp); @@ -9401,6 +9421,7 @@ void js_register_cocos2dx_ui_ListView(JSContext *cx, JS::HandleObject global) { JS_FN("setMagneticType", js_cocos2dx_ui_ListView_setMagneticType, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("getIndex", js_cocos2dx_ui_ListView_getIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("pushBackCustomItem", js_cocos2dx_ui_ListView_pushBackCustomItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), + JS_FN("setCurSelectedIndex", js_cocos2dx_ui_ListView_setCurSelectedIndex, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("insertDefaultItem", js_cocos2dx_ui_ListView_insertDefaultItem, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("setMagneticAllowedOutOfBoundary", js_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), JS_FN("addEventListener", js_cocos2dx_ui_ListView_addEventListener, 1, JSPROP_PERMANENT | JSPROP_ENUMERATE), diff --git a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp index 2acbcd8feb..52ee698405 100644 --- a/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.hpp @@ -466,6 +466,7 @@ bool js_cocos2dx_ui_ListView_jumpToItem(JSContext *cx, uint32_t argc, jsval *vp) bool js_cocos2dx_ui_ListView_setMagneticType(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_getIndex(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_pushBackCustomItem(JSContext *cx, uint32_t argc, jsval *vp); +bool js_cocos2dx_ui_ListView_setCurSelectedIndex(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_insertDefaultItem(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary(JSContext *cx, uint32_t argc, jsval *vp); bool js_cocos2dx_ui_ListView_addEventListener(JSContext *cx, uint32_t argc, jsval *vp); diff --git a/cocos/scripting/lua-bindings/auto/api/ListView.lua b/cocos/scripting/lua-bindings/auto/api/ListView.lua index e0e16fd013..e462384539 100644 --- a/cocos/scripting/lua-bindings/auto/api/ListView.lua +++ b/cocos/scripting/lua-bindings/auto/api/ListView.lua @@ -76,6 +76,15 @@ -- @param #ccui.Widget item -- @return ListView#ListView self (return value: ccui.ListView) +-------------------------------- +-- + * @brief Set current selected widget's index and call TouchEventType::ENDED event.
+-- + * @param A index of a selected item.
+-- + +-- @function [parent=#ListView] setCurSelectedIndex +-- @param self +-- @param #int itemIndex +-- @return ListView#ListView self (return value: ccui.ListView) + -------------------------------- -- Insert a default item(create by cloning model) into listview at a give index.
-- param index An index in ssize_t. diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp index fc3c6acbf0..5eb6b991ed 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.cpp @@ -17485,6 +17485,56 @@ int lua_cocos2dx_ui_ListView_pushBackCustomItem(lua_State* tolua_S) return 0; } +int lua_cocos2dx_ui_ListView_setCurSelectedIndex(lua_State* tolua_S) +{ + int argc = 0; + cocos2d::ui::ListView* cobj = nullptr; + bool ok = true; + +#if COCOS2D_DEBUG >= 1 + tolua_Error tolua_err; +#endif + + +#if COCOS2D_DEBUG >= 1 + if (!tolua_isusertype(tolua_S,1,"ccui.ListView",0,&tolua_err)) goto tolua_lerror; +#endif + + cobj = (cocos2d::ui::ListView*)tolua_tousertype(tolua_S,1,0); + +#if COCOS2D_DEBUG >= 1 + if (!cobj) + { + tolua_error(tolua_S,"invalid 'cobj' in function 'lua_cocos2dx_ui_ListView_setCurSelectedIndex'", nullptr); + return 0; + } +#endif + + argc = lua_gettop(tolua_S)-1; + if (argc == 1) + { + int arg0; + + ok &= luaval_to_int32(tolua_S, 2,(int *)&arg0, "ccui.ListView:setCurSelectedIndex"); + if(!ok) + { + tolua_error(tolua_S,"invalid arguments in function 'lua_cocos2dx_ui_ListView_setCurSelectedIndex'", nullptr); + return 0; + } + cobj->setCurSelectedIndex(arg0); + lua_settop(tolua_S, 1); + return 1; + } + luaL_error(tolua_S, "%s has wrong number of arguments: %d, was expecting %d \n", "ccui.ListView:setCurSelectedIndex",argc, 1); + return 0; + +#if COCOS2D_DEBUG >= 1 + tolua_lerror: + tolua_error(tolua_S,"#ferror in function 'lua_cocos2dx_ui_ListView_setCurSelectedIndex'.",&tolua_err); +#endif + + return 0; +} int lua_cocos2dx_ui_ListView_insertDefaultItem(lua_State* tolua_S) { int argc = 0; @@ -18670,6 +18720,7 @@ int lua_register_cocos2dx_ui_ListView(lua_State* tolua_S) tolua_function(tolua_S,"setMagneticType",lua_cocos2dx_ui_ListView_setMagneticType); tolua_function(tolua_S,"getIndex",lua_cocos2dx_ui_ListView_getIndex); tolua_function(tolua_S,"pushBackCustomItem",lua_cocos2dx_ui_ListView_pushBackCustomItem); + tolua_function(tolua_S,"setCurSelectedIndex",lua_cocos2dx_ui_ListView_setCurSelectedIndex); tolua_function(tolua_S,"insertDefaultItem",lua_cocos2dx_ui_ListView_insertDefaultItem); tolua_function(tolua_S,"setMagneticAllowedOutOfBoundary",lua_cocos2dx_ui_ListView_setMagneticAllowedOutOfBoundary); tolua_function(tolua_S,"addEventListener",lua_cocos2dx_ui_ListView_addEventListener); diff --git a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp index 9e0b93ee14..c120314acc 100644 --- a/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp +++ b/cocos/scripting/lua-bindings/auto/lua_cocos2dx_ui_auto.hpp @@ -755,6 +755,7 @@ int register_all_cocos2dx_ui(lua_State* tolua_S); + #endif // __cocos2dx_ui_h__