Skip to content

Commit

Permalink
obj: allow chain set of obj style API
Browse files Browse the repository at this point in the history
Return the obj so we can do obj:add_style():remove_style() etc.

Signed-off-by: Neo Xu <[email protected]>
  • Loading branch information
XuNeo committed Oct 21, 2024
1 parent d097625 commit bca28b3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/style.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,8 @@ static int luavgl_obj_set_style(lua_State *L)
lua_pop(L, 1); /* remove value, keep the key to continue. */
}

return 0;
lua_settop(L, 1);
return 1;
}

/**
Expand All @@ -697,7 +698,8 @@ static int luavgl_obj_add_style(lua_State *L)

lv_obj_add_style(obj, &s->style, selector);

return 0;
lua_settop(L, 1);
return 1;
}

/**
Expand All @@ -714,7 +716,9 @@ static int luavgl_obj_remove_style(lua_State *L)
}

lv_obj_remove_style(obj, &s->style, selector);
return 0;

lua_settop(L, 1);
return 1;
}

/**
Expand All @@ -725,7 +729,8 @@ static int luavgl_obj_remove_style_all(lua_State *L)
lv_obj_t *obj = luavgl_to_obj(L, 1);

lv_obj_remove_style_all(obj);
return 0;
lua_settop(L, 1);
return 1;
}

static const rotable_Reg luavgl_style_methods[] = {
Expand Down

0 comments on commit bca28b3

Please sign in to comment.