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:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user