feat(event) rework the prototype of lv_event_cb

It encapsulates all event related parameters into a single lv_event_t obejct.
This commit is contained in:
Gabor Kiss-Vamosi
2021-04-14 15:31:54 +02:00
parent c090af0f26
commit 422c9e5bd6
67 changed files with 688 additions and 506 deletions

View File

@@ -1,10 +1,12 @@
#include "../../lv_examples.h"
#if LV_USE_TABLE && LV_BUILD_EXAMPLES
static void event_cb(lv_obj_t * obj, lv_event_t e)
static void event_cb(lv_event_t * e)
{
if(e == LV_EVENT_DRAW_PART_BEGIN) {
lv_obj_draw_dsc_t * dsc = lv_event_get_param();
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_target(e);
if(code == LV_EVENT_DRAW_PART_BEGIN) {
lv_obj_draw_dsc_t * dsc = lv_event_get_param(e);
/*If the cells are drawn...*/
if(dsc->part == LV_PART_ITEMS) {
uint32_t row = dsc->id / lv_table_get_col_cnt(obj);

View File

@@ -3,10 +3,12 @@
#define ITEM_CNT 200
static void event_cb(lv_obj_t * obj, lv_event_t e)
static void event_cb(lv_event_t * e)
{
if(e == LV_EVENT_DRAW_PART_END) {
lv_obj_draw_dsc_t * dsc = lv_event_get_param();
lv_event_code_t code = lv_event_get_code(e);
lv_obj_t * obj = lv_event_get_target(e);
if(code == LV_EVENT_DRAW_PART_END) {
lv_obj_draw_dsc_t * dsc = lv_event_get_param(e);
/*If the cells are drawn...*/
if(dsc->part == LV_PART_ITEMS) {
bool chk = lv_table_has_cell_ctrl(obj, dsc->id, 0, LV_TABLE_CELL_CTRL_CUSTOM_1);
@@ -36,7 +38,7 @@ static void event_cb(lv_obj_t * obj, lv_event_t e)
lv_draw_rect(&sw_area, dsc->clip_area, &rect_dsc);
}
}
else if(e == LV_EVENT_VALUE_CHANGED) {
else if(code == LV_EVENT_VALUE_CHANGED) {
uint16_t col;
uint16_t row;
lv_table_get_selected_cell(obj, &row, &col);