diff options
| author | jacqueline <me@jacqueline.id.au> | 2024-06-12 17:54:10 +1000 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2024-06-12 17:54:10 +1000 |
| commit | 611176ed667c4ed7ee9f609e958f9404f4aee91d (patch) | |
| tree | 34fbbb5e6efbe0e300e0fc47ebc6b421e8a25e1f /lib/luavgl/src/obj.c | |
| parent | bd01bf3845fd67dc4e03f56d044b3bc53245eeed (diff) | |
| download | tangara-fw-611176ed667c4ed7ee9f609e958f9404f4aee91d.tar.gz | |
Port and fix our luavgl additions
Diffstat (limited to 'lib/luavgl/src/obj.c')
| -rw-r--r-- | lib/luavgl/src/obj.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/luavgl/src/obj.c b/lib/luavgl/src/obj.c index 496b7855..49c84a13 100644 --- a/lib/luavgl/src/obj.c +++ b/lib/luavgl/src/obj.c @@ -686,6 +686,29 @@ static int luavgl_obj_get_pos(lua_State *L) } /** + * set this object as the current selection + */ +static int luavgl_obj_focus(lua_State *L) { + lv_obj_t *obj = luavgl_to_obj(L, 1); + + lv_group_t *group = lv_obj_get_group(obj); + if (group == NULL) { + return 0; + } + lv_group_focus_obj(obj); + + return 0; +} + +static int luavgl_obj_move_to_index(lua_State *L) { + lv_obj_t *obj = luavgl_to_obj(L, 1); + int idx = luavgl_tointeger(L, 2); + + lv_obj_move_to_index(obj, idx); + return 0; +} + +/** * Remove all animations associates to this object */ static int luavgl_obj_remove_anim_all(lua_State *L) @@ -763,6 +786,8 @@ static const luaL_Reg luavgl_obj_methods[] = { {"indev_search", luavgl_obj_indev_search }, {"get_coords", luavgl_obj_get_coords }, {"get_pos", luavgl_obj_get_pos }, + {"focus", luavgl_obj_focus }, + {"move_to_index", luavgl_obj_move_to_index }, {"onevent", luavgl_obj_on_event }, {"onPressed", luavgl_obj_on_pressed }, |
