diff options
Diffstat (limited to 'examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c')
-rw-r--r-- | examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c b/examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c index 97a340e38..f355e37d5 100644 --- a/examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c +++ b/examples/widgets/buttonmatrix/lv_example_buttonmatrix_2.c @@ -15,33 +15,36 @@ static void event_cb(lv_event_t * e) /*Change the draw descriptor of the 2nd button*/ if(base_dsc->id1 == 1) { - if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) { - lv_draw_rect_dsc_t * rect_draw_dsc = draw_task->draw_dsc; - rect_draw_dsc->radius = 0; - if(pressed) rect_draw_dsc->bg_color = lv_palette_darken(LV_PALETTE_BLUE, 3); - else rect_draw_dsc->bg_color = lv_palette_main(LV_PALETTE_BLUE); - rect_draw_dsc->shadow_width = 6; - rect_draw_dsc->shadow_offset_x = 3; - rect_draw_dsc->shadow_offset_y = 3; + lv_draw_fill_dsc_t * fill_draw_dsc = lv_draw_task_get_fill_dsc(draw_task); + if(fill_draw_dsc) { + fill_draw_dsc->radius = 0; + if(pressed) fill_draw_dsc->color = lv_palette_darken(LV_PALETTE_BLUE, 3); + else fill_draw_dsc->color = lv_palette_main(LV_PALETTE_BLUE); + } + lv_draw_box_shadow_dsc_t * box_shadow_draw_dsc = lv_draw_task_get_box_shadow_dsc(draw_task); + if(box_shadow_draw_dsc) { + box_shadow_draw_dsc->width = 6; + box_shadow_draw_dsc->ofs_x = 3; + box_shadow_draw_dsc->ofs_y = 3; } - if(draw_task->type == LV_DRAW_TASK_TYPE_LABEL) { - lv_draw_label_dsc_t * label_draw_dsc = draw_task->draw_dsc; + lv_draw_label_dsc_t * label_draw_dsc = lv_draw_task_get_label_dsc(draw_task); + if(label_draw_dsc) { label_draw_dsc->color = lv_color_white(); } } /*Change the draw descriptor of the 3rd button*/ else if(base_dsc->id1 == 2) { - if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) { - lv_draw_rect_dsc_t * rect_draw_dsc = draw_task->draw_dsc; - rect_draw_dsc->radius = LV_RADIUS_CIRCLE; - if(pressed) rect_draw_dsc->bg_color = lv_palette_darken(LV_PALETTE_RED, 3); - else rect_draw_dsc->bg_color = lv_palette_main(LV_PALETTE_RED); + lv_draw_fill_dsc_t * fill_draw_dsc = lv_draw_task_get_fill_dsc(draw_task); + if(fill_draw_dsc) { + fill_draw_dsc->radius = LV_RADIUS_CIRCLE; + if(pressed) fill_draw_dsc->color = lv_palette_darken(LV_PALETTE_RED, 3); + else fill_draw_dsc->color = lv_palette_main(LV_PALETTE_RED); } } else if(base_dsc->id1 == 3) { - if(draw_task->type == LV_DRAW_TASK_TYPE_LABEL) { - lv_draw_label_dsc_t * label_draw_dsc = draw_task->draw_dsc; + lv_draw_label_dsc_t * label_draw_dsc = lv_draw_task_get_label_dsc(draw_task); + if(label_draw_dsc) { label_draw_dsc->opa = 0; } if(draw_task->type == LV_DRAW_TASK_TYPE_FILL) { |