refactor(style): rename lv_indev_get_act to lv_indev_active
This commit is contained in:
@@ -195,7 +195,7 @@ static void msgbox_event_cb(lv_event_t * e)
|
||||
|
||||
static void ta_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(indev == NULL) return;
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(indev);
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ class KeyboardEncoder:
|
||||
|
||||
def ta_event_cb(self,e) :
|
||||
|
||||
indev = lv.indev_get_act()
|
||||
indev = lv.indev_active()
|
||||
if indev == None :
|
||||
return
|
||||
indev_type = indev.get_type()
|
||||
|
||||
@@ -266,7 +266,7 @@ static void shrink_anim_cb(void * var, int32_t v)
|
||||
|
||||
static void scroll_event_cb(lv_event_t * e)
|
||||
{
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
lv_obj_t * cont = lv_event_get_target(e);
|
||||
if(lv_indev_get_scroll_obj(indev) != cont) return;
|
||||
|
||||
|
||||
@@ -973,7 +973,7 @@ static lv_obj_t * album_image_create(lv_obj_t * parent)
|
||||
static void album_gesture_event_cb(lv_event_t * e)
|
||||
{
|
||||
LV_UNUSED(e);
|
||||
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act());
|
||||
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_active());
|
||||
if(dir == LV_DIR_LEFT) _lv_demo_music_album_next(true);
|
||||
if(dir == LV_DIR_RIGHT) _lv_demo_music_album_next(false);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ static void obj_test_task_cb(lv_timer_t * tmr)
|
||||
t = lv_tabview_add_tab(obj, LV_SYMBOL_EDIT " Edit");
|
||||
t = lv_tabview_add_tab(obj, LV_SYMBOL_CLOSE);
|
||||
|
||||
lv_tabview_set_act(obj, 1, LV_ANIM_ON);
|
||||
lv_tabview_set_active(obj, 1, LV_ANIM_ON);
|
||||
auto_delete(obj, LV_DEMO_STRESS_TIME_STEP * 5 + 30);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -1282,7 +1282,7 @@ static void ta_event_cb(lv_event_t * e)
|
||||
lv_obj_t * ta = lv_event_get_target(e);
|
||||
lv_obj_t * kb = lv_event_get_user_data(e);
|
||||
if(code == LV_EVENT_FOCUSED) {
|
||||
if(lv_indev_get_type(lv_indev_get_act()) != LV_INDEV_TYPE_KEYPAD) {
|
||||
if(lv_indev_get_type(lv_indev_active()) != LV_INDEV_TYPE_KEYPAD) {
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
lv_obj_set_style_max_height(kb, LV_HOR_RES * 2 / 3, 0);
|
||||
lv_obj_update_layout(tv); /*Be sure the sizes are recalculated*/
|
||||
@@ -1312,7 +1312,7 @@ static void birthday_event_cb(lv_event_t * e)
|
||||
lv_obj_t * ta = lv_event_get_target(e);
|
||||
|
||||
if(code == LV_EVENT_FOCUSED) {
|
||||
if(lv_indev_get_type(lv_indev_get_act()) == LV_INDEV_TYPE_POINTER) {
|
||||
if(lv_indev_get_type(lv_indev_active()) == LV_INDEV_TYPE_POINTER) {
|
||||
if(calendar == NULL) {
|
||||
lv_obj_add_flag(lv_layer_top(), LV_OBJ_FLAG_CLICKABLE);
|
||||
calendar = lv_calendar_create(lv_layer_top());
|
||||
@@ -1648,10 +1648,10 @@ static void slideshow_anim_ready_cb(lv_anim_t * a_old)
|
||||
LV_UNUSED(a_old);
|
||||
|
||||
lv_obj_t * cont = lv_tabview_get_content(tv);
|
||||
uint32_t tab_id = lv_tabview_get_tab_act(tv);
|
||||
uint32_t tab_id = lv_tabview_get_tab_active(tv);
|
||||
tab_id += 1;
|
||||
if(tab_id > 2) tab_id = 0;
|
||||
lv_tabview_set_act(tv, tab_id, LV_ANIM_ON);
|
||||
lv_tabview_set_active(tv, tab_id, LV_ANIM_ON);
|
||||
|
||||
lv_obj_t * tab = lv_obj_get_child(cont, tab_id);
|
||||
lv_obj_scroll_to_y(tab, 0, LV_ANIM_OFF);
|
||||
|
||||
@@ -87,7 +87,7 @@ existing screen copied into the new screen.
|
||||
To load a screen, use :cpp:expr:`lv_screen_load(scr)`. To get the active screen,
|
||||
use :cpp:expr:`lv_screen_active()`. These functions work on the default display. If
|
||||
you want to specify which display to work on, use
|
||||
:cpp:expr:`lv_disp_get_screen_act(disp)` and :cpp:expr:`lv_disp_load_scr(disp, scr)`. A
|
||||
:cpp:expr:`lv_disp_get_screen_active(disp)` and :cpp:expr:`lv_disp_load_scr(disp, scr)`. A
|
||||
screen can be loaded with animations too. Read more
|
||||
`here <object.html#load-screens>`__.
|
||||
|
||||
|
||||
@@ -96,8 +96,8 @@ Input device events
|
||||
- :cpp:enumerator:`LV_EVENT_SCROLL_THROW_BEGIN`: Sent once when the object is released while scrolling but the "momentum" still keeps the content scrolling.
|
||||
- :cpp:enumerator:`LV_EVENT_SCROLL_END`: Scrolling ends.
|
||||
- :cpp:enumerator:`LV_EVENT_SCROLL`: An object was scrolled
|
||||
- :cpp:enumerator:`LV_EVENT_GESTURE`: A gesture is detected. Get the gesture with :cpp:expr:`lv_indev_get_gesture_dir(lv_indev_get_act())`
|
||||
- :cpp:enumerator:`LV_EVENT_KEY`: A key is sent to an object. Get the key with :cpp:expr:`lv_indev_get_key(lv_indev_get_act())`
|
||||
- :cpp:enumerator:`LV_EVENT_GESTURE`: A gesture is detected. Get the gesture with :cpp:expr:`lv_indev_get_gesture_dir(lv_indev_active())`
|
||||
- :cpp:enumerator:`LV_EVENT_KEY`: A key is sent to an object. Get the key with :cpp:expr:`lv_indev_get_key(lv_indev_active())`
|
||||
- :cpp:enumerator:`LV_EVENT_FOCUSED`: An object is focused
|
||||
- :cpp:enumerator:`LV_EVENT_DEFOCUSED`: An object is unfocused
|
||||
- :cpp:enumerator:`LV_EVENT_LEAVE`: An object is unfocused but still selected
|
||||
|
||||
@@ -46,7 +46,7 @@ event. For example:
|
||||
void my_event(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * screen = lv_event_get_current_target(e);
|
||||
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_act());
|
||||
lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_active());
|
||||
switch(dir) {
|
||||
case LV_DIR_LEFT:
|
||||
...
|
||||
@@ -73,7 +73,7 @@ To prevent passing the gesture event to the parent from an object use
|
||||
Note that, gestures are not triggered if an object is being scrolled.
|
||||
|
||||
If you did some action on a gesture you can call
|
||||
:cpp:expr:`lv_indev_wait_release(lv_indev_get_act())` in the event handler to
|
||||
:cpp:expr:`lv_indev_wait_release(lv_indev_active())` in the event handler to
|
||||
prevent LVGL sending further input device related events.
|
||||
|
||||
Keypad and encoder
|
||||
|
||||
@@ -56,7 +56,7 @@ To select a new tab you can:
|
||||
|
||||
- Click on its tab button
|
||||
- Slide horizontally
|
||||
- Use :cpp:expr:`lv_tabview_set_act(tabview, id, LV_ANIM_ON)` function
|
||||
- Use :cpp:expr:`lv_tabview_set_active(tabview, id, LV_ANIM_ON)` function
|
||||
|
||||
Get the parts
|
||||
-------------
|
||||
@@ -69,7 +69,7 @@ Events
|
||||
******
|
||||
|
||||
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent when a new tab is selected by sliding
|
||||
or clicking the tab button. :cpp:expr:`lv_tabview_get_tab_act(tabview)`
|
||||
or clicking the tab button. :cpp:expr:`lv_tabview_get_tab_active(tabview)`
|
||||
returns the zero based index of the current tab.
|
||||
|
||||
Learn more about :ref:`events`.
|
||||
|
||||
@@ -45,7 +45,7 @@ Events
|
||||
******
|
||||
|
||||
- :cpp:enumerator:`LV_EVENT_VALUE_CHANGED` Sent when a new tile loaded by scrolling.
|
||||
:cpp:expr:`lv_tileview_get_tile_act(tabview)` can be used to get current
|
||||
:cpp:expr:`lv_tileview_get_tile_active(tabview)` can be used to get current
|
||||
tile.
|
||||
|
||||
Keys
|
||||
|
||||
@@ -145,7 +145,7 @@ void pika_lvgl_PALETTE___init__(PikaObj* self) {
|
||||
obj_setInt(self, "NONE", LV_PALETTE_NONE);
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_screen_act(PikaObj* self) {
|
||||
PikaObj* pika_lvgl_screen_active(PikaObj* self) {
|
||||
PikaObj* new_obj = newNormalObj(New_TinyObj);
|
||||
lv_obj_t* lv_obj = lv_screen_active();
|
||||
obj_setPtr(new_obj, "lv_obj", lv_obj);
|
||||
@@ -183,9 +183,9 @@ PikaObj* pika_lvgl_palette_main(PikaObj* self, int p) {
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_indev_get_act(PikaObj *self){
|
||||
PikaObj* pika_lvgl_indev_get_active(PikaObj *self){
|
||||
PikaObj* new_obj = newNormalObj(New_pika_lvgl_indev_t);
|
||||
lv_indev_t *lv_indev = lv_indev_get_act();
|
||||
lv_indev_t *lv_indev = lv_indev_active();
|
||||
obj_setPtr(new_obj,"lv_indev", lv_indev);
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ static void ta_event_cb(lv_event_t * e)
|
||||
lv_obj_t * kb = lv_event_get_user_data(e);
|
||||
|
||||
if(code == LV_EVENT_FOCUSED) {
|
||||
if(lv_indev_get_type(lv_indev_get_act()) != LV_INDEV_TYPE_KEYPAD) {
|
||||
if(lv_indev_get_type(lv_indev_active()) != LV_INDEV_TYPE_KEYPAD) {
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ def ta_event_cb(e,kb):
|
||||
ta = e.get_target_obj()
|
||||
|
||||
if code == lv.EVENT.FOCUSED:
|
||||
if lv.indev_get_act() != None and lv.indev_get_act().get_type() != lv.INDEV_TYPE.KEYPAD :
|
||||
if lv.indev_active() != None and lv.indev_active().get_type() != lv.INDEV_TYPE.KEYPAD :
|
||||
kb.set_textarea(ta)
|
||||
kb.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
elif code == lv.EVENT.CANCEL:
|
||||
|
||||
@@ -8,7 +8,7 @@ static void ta_event_cb(lv_event_t * e)
|
||||
lv_obj_t * kb = lv_event_get_user_data(e);
|
||||
|
||||
if(code == LV_EVENT_FOCUSED) {
|
||||
if(lv_indev_get_type(lv_indev_get_act()) != LV_INDEV_TYPE_KEYPAD) {
|
||||
if(lv_indev_get_type(lv_indev_active()) != LV_INDEV_TYPE_KEYPAD) {
|
||||
lv_keyboard_set_textarea(kb, ta);
|
||||
lv_obj_remove_flag(kb, LV_OBJ_FLAG_HIDDEN);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ def ta_event_cb(e,kb):
|
||||
ta = e.get_target_obj()
|
||||
|
||||
if code == lv.EVENT.FOCUSED:
|
||||
if lv.indev_get_act() != None and lv.indev_get_act().get_type() != lv.INDEV_TYPE.KEYPAD :
|
||||
if lv.indev_active() != None and lv.indev_active().get_type() != lv.INDEV_TYPE.KEYPAD :
|
||||
kb.set_textarea(ta)
|
||||
kb.remove_flag(lv.obj.FLAG.HIDDEN)
|
||||
elif code == lv.EVENT.READY:
|
||||
|
||||
@@ -9,13 +9,13 @@ void lv_example_bar_7(void)
|
||||
lv_obj_t * label;
|
||||
|
||||
|
||||
lv_obj_t * bar_tob = lv_bar_create(lv_scr_act());
|
||||
lv_obj_t * bar_tob = lv_bar_create(lv_screen_active());
|
||||
lv_obj_set_size(bar_tob, 20, 200);
|
||||
lv_bar_set_range(bar_tob, 100, 0);
|
||||
lv_bar_set_value(bar_tob, 70, LV_ANIM_OFF);
|
||||
lv_obj_align(bar_tob, LV_ALIGN_CENTER, 0, -30);
|
||||
|
||||
label = lv_label_create(lv_scr_act());
|
||||
label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(label, "From top to bottom");
|
||||
lv_obj_align_to(label, bar_tob, LV_ALIGN_OUT_TOP_MID, 0, -5);
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ static void draw_event_cb(lv_event_t * e)
|
||||
void lv_example_chart_4(void)
|
||||
{
|
||||
/*Create a chart1*/
|
||||
lv_obj_t * chart = lv_chart_create(lv_scr_act());
|
||||
lv_obj_t * chart = lv_chart_create(lv_screen_active());
|
||||
lv_chart_set_type(chart, LV_CHART_TYPE_BAR);
|
||||
lv_chart_set_point_count(chart, 24);
|
||||
lv_obj_set_style_pad_column(chart, 2, 0);
|
||||
|
||||
@@ -5,7 +5,7 @@ static void drag_event_handler(lv_event_t * e)
|
||||
{
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(indev == NULL) return;
|
||||
|
||||
lv_point_t vect;
|
||||
|
||||
@@ -2,7 +2,7 @@ def drag_event_handler(e):
|
||||
|
||||
obj = e.get_target_obj()
|
||||
|
||||
indev = lv.indev_get_act()
|
||||
indev = lv.indev_active()
|
||||
|
||||
vect = lv.point_t()
|
||||
indev.get_vect(vect)
|
||||
|
||||
@@ -10,13 +10,13 @@ static lv_obj_t * slider_label;
|
||||
void lv_example_slider_4(void)
|
||||
{
|
||||
/*Create a slider in the center of the display*/
|
||||
lv_obj_t * slider = lv_slider_create(lv_scr_act());
|
||||
lv_obj_t * slider = lv_slider_create(lv_screen_active());
|
||||
lv_obj_center(slider);
|
||||
lv_obj_add_event(slider, slider_event_cb, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
/*Reverse the direction of the slider*/
|
||||
lv_slider_set_range(slider, 100, 0);
|
||||
/*Create a label below the slider*/
|
||||
slider_label = lv_label_create(lv_scr_act());
|
||||
slider_label = lv_label_create(lv_screen_active());
|
||||
lv_label_set_text(slider_label, "0%");
|
||||
|
||||
lv_obj_align_to(slider_label, slider, LV_ALIGN_OUT_BOTTOM_MID, 0, 10);
|
||||
|
||||
@@ -636,7 +636,7 @@ static void lv_obj_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
/* Use the indev for then indev handler.
|
||||
* But if the obj was focused manually it returns NULL so try to
|
||||
* use the indev from the event*/
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(indev == NULL) indev = lv_event_get_indev(e);
|
||||
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(indev);
|
||||
|
||||
@@ -307,7 +307,7 @@ static lv_result_t event_send_core(lv_event_t * e)
|
||||
LV_TRACE_EVENT("Sending event %d to %p with %p param", e->code, (void *)e->original_target, e->param);
|
||||
|
||||
/*Call the input device's feedback callback if set*/
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
lv_indev_t * indev_act = lv_indev_active();
|
||||
if(indev_act) {
|
||||
if(indev_act->feedback_cb) indev_act->feedback_cb(indev_act, e);
|
||||
if(e->stop_processing) return LV_RESULT_OK;
|
||||
|
||||
@@ -835,7 +835,7 @@ bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area)
|
||||
/*Invalidate the object only if it belongs to the current or previous or one of the layers'*/
|
||||
lv_obj_t * obj_scr = lv_obj_get_screen(obj);
|
||||
lv_display_t * disp = lv_obj_get_disp(obj_scr);
|
||||
if(obj_scr != lv_display_get_screen_act(disp) &&
|
||||
if(obj_scr != lv_display_get_screen_active(disp) &&
|
||||
obj_scr != lv_display_get_screen_prev(disp) &&
|
||||
obj_scr != lv_display_get_layer_bottom(disp) &&
|
||||
obj_scr != lv_display_get_layer_top(disp) &&
|
||||
|
||||
@@ -436,7 +436,7 @@ static void obj_delete_core(lv_obj_t * obj)
|
||||
}
|
||||
}
|
||||
|
||||
if(indev->group == group && obj == lv_indev_get_obj_act()) {
|
||||
if(indev->group == group && obj == lv_indev_get_active_obj()) {
|
||||
lv_indev_reset(indev, obj);
|
||||
}
|
||||
indev = lv_indev_get_next(indev);
|
||||
|
||||
@@ -667,7 +667,7 @@ static void refr_area_part(lv_layer_t * layer)
|
||||
lv_obj_t * top_prev_scr = NULL;
|
||||
|
||||
/*Get the most top object which is not covered by others*/
|
||||
top_act_scr = lv_refr_get_top_obj(&layer->clip_area, lv_display_get_screen_act(disp_refr));
|
||||
top_act_scr = lv_refr_get_top_obj(&layer->clip_area, lv_display_get_screen_active(disp_refr));
|
||||
if(disp_refr->prev_scr) {
|
||||
top_prev_scr = lv_refr_get_top_obj(&layer->clip_area, disp_refr->prev_scr);
|
||||
}
|
||||
@@ -756,7 +756,7 @@ static void refr_obj_and_children(lv_layer_t * layer, lv_obj_t * top_obj)
|
||||
/*Normally always will be a top_obj (at least the screen)
|
||||
*but in special cases (e.g. if the screen has alpha) it won't.
|
||||
*In this case use the screen directly*/
|
||||
if(top_obj == NULL) top_obj = lv_display_get_screen_act(disp_refr);
|
||||
if(top_obj == NULL) top_obj = lv_display_get_screen_active(disp_refr);
|
||||
if(top_obj == NULL) return; /*Shouldn't happen*/
|
||||
|
||||
/*Refresh the top object and its children*/
|
||||
|
||||
@@ -461,7 +461,7 @@ bool lv_display_is_double_buffered(lv_display_t * disp)
|
||||
* SCREENS
|
||||
*--------------------*/
|
||||
|
||||
lv_obj_t * lv_display_get_screen_act(lv_display_t * disp)
|
||||
lv_obj_t * lv_display_get_screen_active(lv_display_t * disp)
|
||||
{
|
||||
if(!disp) disp = lv_display_get_default();
|
||||
if(!disp) {
|
||||
|
||||
@@ -327,7 +327,7 @@ bool lv_display_is_double_buffered(lv_display_t * disp);
|
||||
* (NULL to use the default screen)
|
||||
* @return pointer to the active screen object (loaded by 'lv_screen_load()')
|
||||
*/
|
||||
struct _lv_obj_t * lv_display_get_screen_act(lv_display_t * disp);
|
||||
struct _lv_obj_t * lv_display_get_screen_active(lv_display_t * disp);
|
||||
|
||||
/**
|
||||
* Return with a pointer to the previous screen. Only used during screen transitions.
|
||||
@@ -384,7 +384,7 @@ void lv_screen_load_anim(struct _lv_obj_t * scr, lv_screen_load_anim_t anim_type
|
||||
*/
|
||||
static inline struct _lv_obj_t * lv_screen_active(void)
|
||||
{
|
||||
return lv_display_get_screen_act(lv_display_get_default());
|
||||
return lv_display_get_screen_active(lv_display_get_default());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -254,7 +254,7 @@ void lv_indev_enable(lv_indev_t * indev, bool en)
|
||||
}
|
||||
}
|
||||
|
||||
lv_indev_t * lv_indev_get_act(void)
|
||||
lv_indev_t * lv_indev_active(void)
|
||||
{
|
||||
return indev_act;
|
||||
}
|
||||
@@ -445,7 +445,7 @@ void lv_indev_wait_release(lv_indev_t * indev)
|
||||
indev->wait_until_release = 1;
|
||||
}
|
||||
|
||||
lv_obj_t * lv_indev_get_obj_act(void)
|
||||
lv_obj_t * lv_indev_get_active_obj(void)
|
||||
{
|
||||
return indev_obj_act;
|
||||
}
|
||||
@@ -1205,7 +1205,7 @@ static lv_obj_t * pointer_search_obj(lv_display_t * disp, lv_point_t * p)
|
||||
if(indev_obj_act) return indev_obj_act;
|
||||
|
||||
/* Search the object in the active screen */
|
||||
indev_obj_act = lv_indev_search_obj(lv_display_get_screen_act(disp), p);
|
||||
indev_obj_act = lv_indev_search_obj(lv_display_get_screen_active(disp), p);
|
||||
if(indev_obj_act) return indev_obj_act;
|
||||
|
||||
indev_obj_act = lv_indev_search_obj(lv_display_get_layer_bottom(disp), p);
|
||||
|
||||
@@ -103,7 +103,7 @@ void lv_indev_enable(lv_indev_t * indev, bool en);
|
||||
* @return pointer to the currently processed input device or NULL if no input device processing
|
||||
* right now
|
||||
*/
|
||||
lv_indev_t * lv_indev_get_act(void);
|
||||
lv_indev_t * lv_indev_active(void);
|
||||
|
||||
/**
|
||||
* Set the type of an input device
|
||||
@@ -228,7 +228,7 @@ void lv_indev_wait_release(lv_indev_t * indev);
|
||||
* Gets a pointer to the currently active object in the currently processed input device.
|
||||
* @return pointer to currently active object or NULL if no active object
|
||||
*/
|
||||
struct _lv_obj_t * lv_indev_get_obj_act(void);
|
||||
struct _lv_obj_t * lv_indev_get_active_obj(void);
|
||||
|
||||
/**
|
||||
* Get a pointer to the indev read timer to
|
||||
|
||||
@@ -120,7 +120,7 @@ void _lv_indev_scroll_throw_handler(lv_indev_t * indev)
|
||||
if(scroll_obj == NULL) return;
|
||||
if(indev->pointer.scroll_dir == LV_DIR_NONE) return;
|
||||
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
lv_indev_t * indev_act = lv_indev_active();
|
||||
lv_coord_t scroll_throw = indev_act->scroll_throw;
|
||||
|
||||
if(lv_obj_has_flag(scroll_obj, LV_OBJ_FLAG_SCROLL_MOMENTUM) == false) {
|
||||
@@ -272,7 +272,7 @@ static lv_obj_t * find_scroll_obj(lv_indev_t * indev)
|
||||
{
|
||||
lv_obj_t * obj_candidate = NULL;
|
||||
lv_dir_t dir_candidate = LV_DIR_NONE;
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
lv_indev_t * indev_act = lv_indev_active();
|
||||
lv_coord_t scroll_limit = indev_act->scroll_limit;
|
||||
|
||||
/*Go until find a scrollable object in the current direction
|
||||
@@ -599,7 +599,7 @@ static lv_coord_t scroll_throw_predict_y(lv_indev_t * indev)
|
||||
lv_coord_t y = indev->pointer.scroll_throw_vect.y;
|
||||
lv_coord_t move = 0;
|
||||
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
lv_indev_t * indev_act = lv_indev_active();
|
||||
lv_coord_t scroll_throw = indev_act->scroll_throw;
|
||||
|
||||
while(y) {
|
||||
@@ -615,7 +615,7 @@ static lv_coord_t scroll_throw_predict_x(lv_indev_t * indev)
|
||||
lv_coord_t x = indev->pointer.scroll_throw_vect.x;
|
||||
lv_coord_t move = 0;
|
||||
|
||||
lv_indev_t * indev_act = lv_indev_get_act();
|
||||
lv_indev_t * indev_act = lv_indev_active();
|
||||
lv_coord_t scroll_throw = indev_act->scroll_throw;
|
||||
|
||||
while(x) {
|
||||
@@ -634,7 +634,7 @@ static lv_coord_t elastic_diff(lv_obj_t * scroll_obj, lv_coord_t diff, lv_coord_
|
||||
lv_scroll_snap_t snap;
|
||||
snap = dir == LV_DIR_HOR ? lv_obj_get_scroll_snap_x(scroll_obj) : lv_obj_get_scroll_snap_y(scroll_obj);
|
||||
|
||||
lv_obj_t * act_obj = lv_indev_get_obj_act();
|
||||
lv_obj_t * act_obj = lv_indev_get_active_obj();
|
||||
lv_coord_t snap_point = 0;
|
||||
lv_coord_t act_obj_point = 0;
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ static inline void lv_obj_move_background(lv_obj_t * obj)
|
||||
#define lv_obj_clear_flag lv_obj_remove_flag
|
||||
#define lv_obj_clear_state lv_obj_remove_state
|
||||
|
||||
#define lv_indev_get_act lv_indev_active
|
||||
#define lv_scr_act lv_screen_active
|
||||
#define lv_disp_create lv_display_create
|
||||
#define lv_disp_remove lv_display_remove
|
||||
@@ -206,6 +207,10 @@ static inline void lv_obj_move_background(lv_obj_t * obj)
|
||||
#define lv_btnmatrix_get_one_checked lv_buttonmatrix_get_one_checked
|
||||
|
||||
#define lv_tabview_get_tab_btns lv_tabview_get_tab_buttons
|
||||
#define lv_tabview_get_act lv_tabview_get_active
|
||||
#define lv_tabview_set_act lv_tabview_set_active
|
||||
|
||||
#define lv_tileview_get_tile_act lv_tileview_get_tile_active
|
||||
|
||||
#define lv_msgbox_get_btns lv_msgbox_get_buttons
|
||||
|
||||
|
||||
@@ -56,8 +56,8 @@ typedef enum {
|
||||
LV_EVENT_SCROLL_THROW_BEGIN,
|
||||
LV_EVENT_SCROLL_END, /**< Scrolling ends*/
|
||||
LV_EVENT_SCROLL, /**< Scrolling*/
|
||||
LV_EVENT_GESTURE, /**< A gesture is detected. Get the gesture with `lv_indev_get_gesture_dir(lv_indev_get_act());` */
|
||||
LV_EVENT_KEY, /**< A key is sent to the object. Get the key with `lv_indev_get_key(lv_indev_get_act());`*/
|
||||
LV_EVENT_GESTURE, /**< A gesture is detected. Get the gesture with `lv_indev_get_gesture_dir(lv_indev_active());` */
|
||||
LV_EVENT_KEY, /**< A key is sent to the object. Get the key with `lv_indev_get_key(lv_indev_active());`*/
|
||||
LV_EVENT_FOCUSED, /**< The object is focused*/
|
||||
LV_EVENT_DEFOCUSED, /**< The object is defocused*/
|
||||
LV_EVENT_LEAVE, /**< The object is defocused but still selected*/
|
||||
|
||||
@@ -279,9 +279,9 @@ static void gridnav_event_cb(lv_event_t * e)
|
||||
code == LV_EVENT_CLICKED || code == LV_EVENT_RELEASED) {
|
||||
if(lv_group_get_focused(lv_obj_get_group(obj)) == obj) {
|
||||
/*Forward press/release related event too*/
|
||||
lv_indev_type_t t = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t t = lv_indev_get_type(lv_indev_active());
|
||||
if(t == LV_INDEV_TYPE_ENCODER || t == LV_INDEV_TYPE_KEYPAD) {
|
||||
lv_obj_send_event(dsc->focused_obj, code, lv_indev_get_act());
|
||||
lv_obj_send_event(dsc->focused_obj, code, lv_indev_active());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -450,7 +450,7 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
lv_arc_t * arc = (lv_arc_t *)lv_event_get_target(e);
|
||||
if(code == LV_EVENT_PRESSING) {
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(indev == NULL) return;
|
||||
|
||||
/*Handle only pointers here*/
|
||||
@@ -600,7 +600,7 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
/*Leave edit mode if released. (No need to wait for LONG_PRESS)*/
|
||||
lv_group_t * g = lv_obj_get_group(obj);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_active());
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||
if(editing) lv_group_set_editing(g, false);
|
||||
}
|
||||
|
||||
@@ -421,7 +421,7 @@ static void lv_buttonmatrix_event(const lv_obj_class_t * class_p, lv_event_t * e
|
||||
lv_indev_t * indev = lv_event_get_indev(e);
|
||||
invalidate_button_area(obj, btnm->btn_id_sel);
|
||||
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_active());
|
||||
if(indev_type == LV_INDEV_TYPE_POINTER || indev_type == LV_INDEV_TYPE_BUTTON) {
|
||||
uint32_t btn_pr;
|
||||
/*Search the pressed area*/
|
||||
|
||||
@@ -686,7 +686,7 @@ static void lv_chart_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
|
||||
lv_chart_t * chart = (lv_chart_t *)obj;
|
||||
if(code == LV_EVENT_PRESSED) {
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
lv_point_t p;
|
||||
lv_indev_get_point(indev, &p);
|
||||
|
||||
|
||||
@@ -672,7 +672,7 @@ static void lv_dropdown_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
if(code == LV_EVENT_FOCUSED) {
|
||||
lv_group_t * g = lv_obj_get_group(obj);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_active());
|
||||
|
||||
/*Encoders need special handling*/
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||
@@ -733,7 +733,7 @@ static void lv_dropdown_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
else if(c == LV_KEY_ENTER) {
|
||||
/* Handle the ENTER key only if it was send by an other object.
|
||||
* Do no process it if ENTER is sent by the dropdown because it's handled in LV_EVENT_RELEASED */
|
||||
lv_obj_t * indev_obj = lv_indev_get_obj_act();
|
||||
lv_obj_t * indev_obj = lv_indev_get_active_obj();
|
||||
if(indev_obj != obj) {
|
||||
res = btn_release_handler(obj);
|
||||
if(res != LV_RESULT_OK) return;
|
||||
@@ -762,7 +762,7 @@ static void lv_dropdown_list_event(const lv_obj_class_t * class_p, lv_event_t *
|
||||
lv_dropdown_t * dropdown = (lv_dropdown_t *)dropdown_obj;
|
||||
|
||||
if(code == LV_EVENT_RELEASED) {
|
||||
if(lv_indev_get_scroll_obj(lv_indev_get_act()) == NULL) {
|
||||
if(lv_indev_get_scroll_obj(lv_indev_active()) == NULL) {
|
||||
list_release_handler(list);
|
||||
}
|
||||
}
|
||||
@@ -1024,7 +1024,7 @@ static void draw_box_label(lv_obj_t * dropdown_obj, lv_layer_t * layer, uint32_t
|
||||
static lv_result_t btn_release_handler(lv_obj_t * obj)
|
||||
{
|
||||
lv_dropdown_t * dropdown = (lv_dropdown_t *)obj;
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(lv_indev_get_scroll_obj(indev) == NULL) {
|
||||
if(lv_dropdown_is_open(obj)) {
|
||||
lv_dropdown_close(obj);
|
||||
@@ -1063,7 +1063,7 @@ static lv_result_t list_release_handler(lv_obj_t * list_obj)
|
||||
lv_obj_t * dropdown_obj = list->dropdown;
|
||||
lv_dropdown_t * dropdown = (lv_dropdown_t *)dropdown_obj;
|
||||
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
/*Leave edit mode once a new item is selected*/
|
||||
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER) {
|
||||
dropdown->sel_opt_id_orig = dropdown->sel_opt_id;
|
||||
@@ -1099,7 +1099,7 @@ static void list_press_handler(lv_obj_t * list_obj)
|
||||
lv_obj_t * dropdown_obj = list->dropdown;
|
||||
lv_dropdown_t * dropdown = (lv_dropdown_t *)dropdown_obj;
|
||||
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(indev && (lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER || lv_indev_get_type(indev) == LV_INDEV_TYPE_BUTTON)) {
|
||||
lv_point_t p;
|
||||
lv_indev_get_point(indev, &p);
|
||||
|
||||
@@ -358,7 +358,7 @@ static void lv_roller_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
lv_anim_delete(get_label(obj), set_y_anim);
|
||||
}
|
||||
else if(code == LV_EVENT_PRESSING) {
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
lv_point_t p;
|
||||
lv_indev_get_vect(indev, &p);
|
||||
|
||||
@@ -374,7 +374,7 @@ static void lv_roller_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
}
|
||||
else if(code == LV_EVENT_FOCUSED) {
|
||||
lv_group_t * g = lv_obj_get_group(obj);
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_active());
|
||||
|
||||
/*Encoders need special handling*/
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||
@@ -678,7 +678,7 @@ static lv_result_t release_handler(lv_obj_t * obj)
|
||||
lv_obj_t * label = get_label(obj);
|
||||
if(label == NULL) return LV_RESULT_OK;
|
||||
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
lv_roller_t * roller = (lv_roller_t *)obj;
|
||||
|
||||
/*Leave edit mode once a new option is selected*/
|
||||
|
||||
@@ -134,7 +134,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
}
|
||||
else if(code == LV_EVENT_PRESSED) {
|
||||
/*Save the pressed coordinates*/
|
||||
lv_indev_get_point(lv_indev_get_act(), &slider->pressed_point);
|
||||
lv_indev_get_point(lv_indev_active(), &slider->pressed_point);
|
||||
lv_obj_transform_point(obj, &slider->pressed_point, true, true);
|
||||
}
|
||||
else if(code == LV_EVENT_PRESSING) {
|
||||
@@ -150,7 +150,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
/*Leave edit mode if released. (No need to wait for LONG_PRESS)*/
|
||||
lv_group_t * g = lv_obj_get_group(obj);
|
||||
bool editing = lv_group_get_editing(g);
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_active());
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER) {
|
||||
if(editing) {
|
||||
if(lv_slider_get_mode(obj) == LV_SLIDER_MODE_RANGE) {
|
||||
@@ -171,7 +171,7 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
}
|
||||
}
|
||||
else if(code == LV_EVENT_FOCUSED) {
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_active());
|
||||
if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) {
|
||||
slider->left_knob_focus = 0;
|
||||
}
|
||||
@@ -335,7 +335,7 @@ static void drag_start(lv_obj_t * obj)
|
||||
slider->value_to_set = &slider->bar.cur_value;
|
||||
}
|
||||
else if(mode == LV_SLIDER_MODE_RANGE) {
|
||||
lv_indev_get_point(lv_indev_get_act(), &p);
|
||||
lv_indev_get_point(lv_indev_active(), &p);
|
||||
lv_obj_transform_point(obj, &p, true, true);
|
||||
const bool is_rtl = LV_BASE_DIR_RTL == lv_obj_get_style_base_dir(obj, LV_PART_MAIN);
|
||||
const bool is_horizontal = is_slider_horizontal(obj);
|
||||
@@ -392,7 +392,7 @@ static void drag_start(lv_obj_t * obj)
|
||||
static void update_knob_pos(lv_obj_t * obj, bool check_drag)
|
||||
{
|
||||
lv_slider_t * slider = (lv_slider_t *)obj;
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(lv_indev_get_type(indev) != LV_INDEV_TYPE_POINTER)
|
||||
return;
|
||||
if(lv_indev_get_scroll_obj(indev) != NULL)
|
||||
|
||||
@@ -374,7 +374,7 @@ static void lv_spinbox_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
lv_spinbox_t * spinbox = (lv_spinbox_t *)obj;
|
||||
if(code == LV_EVENT_RELEASED) {
|
||||
/*If released with an ENCODER then move to the next digit*/
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(lv_obj_get_group(obj))) {
|
||||
if(spinbox->digit_count > 1) {
|
||||
if(spinbox->digit_step_dir == LV_DIR_RIGHT) {
|
||||
@@ -434,7 +434,7 @@ static void lv_spinbox_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
}
|
||||
}
|
||||
else if(code == LV_EVENT_KEY) {
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_active());
|
||||
|
||||
uint32_t c = *((uint32_t *)lv_event_get_param(e)); /*uint32_t because can be UTF-8*/
|
||||
if(c == LV_KEY_RIGHT) {
|
||||
|
||||
@@ -496,14 +496,14 @@ static void lv_table_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
}
|
||||
else if(code == LV_EVENT_RELEASED) {
|
||||
lv_obj_invalidate(obj);
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
lv_obj_t * scroll_obj = lv_indev_get_scroll_obj(indev);
|
||||
if(table->col_act != LV_TABLE_CELL_NONE && table->row_act != LV_TABLE_CELL_NONE && scroll_obj == NULL) {
|
||||
res = lv_obj_send_event(obj, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
if(res != LV_RESULT_OK) return;
|
||||
}
|
||||
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_active());
|
||||
if(indev_type == LV_INDEV_TYPE_POINTER || indev_type == LV_INDEV_TYPE_BUTTON) {
|
||||
table->col_act = LV_TABLE_CELL_NONE;
|
||||
table->row_act = LV_TABLE_CELL_NONE;
|
||||
@@ -896,7 +896,7 @@ static lv_result_t get_pressed_cell(lv_obj_t * obj, uint32_t * row, uint32_t * c
|
||||
{
|
||||
lv_table_t * table = (lv_table_t *)obj;
|
||||
|
||||
lv_indev_type_t type = lv_indev_get_type(lv_indev_get_act());
|
||||
lv_indev_type_t type = lv_indev_get_type(lv_indev_active());
|
||||
if(type != LV_INDEV_TYPE_POINTER && type != LV_INDEV_TYPE_BUTTON) {
|
||||
if(col) *col = LV_TABLE_CELL_NONE;
|
||||
if(row) *row = LV_TABLE_CELL_NONE;
|
||||
@@ -904,7 +904,7 @@ static lv_result_t get_pressed_cell(lv_obj_t * obj, uint32_t * row, uint32_t * c
|
||||
}
|
||||
|
||||
lv_point_t p;
|
||||
lv_indev_get_point(lv_indev_get_act(), &p);
|
||||
lv_indev_get_point(lv_indev_active(), &p);
|
||||
|
||||
lv_coord_t tmp;
|
||||
if(col) {
|
||||
|
||||
@@ -118,7 +118,7 @@ lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name)
|
||||
|
||||
tabview->tab_cnt++;
|
||||
if(tabview->tab_cnt == 1) {
|
||||
lv_tabview_set_act(obj, 0, LV_ANIM_OFF);
|
||||
lv_tabview_set_active(obj, 0, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
lv_buttonmatrix_set_button_ctrl(buttons, tabview->tab_cur, LV_BUTTONMATRIX_CTRL_CHECKED);
|
||||
@@ -140,7 +140,7 @@ void lv_tabview_rename_tab(lv_obj_t * obj, uint32_t id, const char * new_name)
|
||||
lv_obj_invalidate(obj);
|
||||
}
|
||||
|
||||
void lv_tabview_set_act(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en)
|
||||
void lv_tabview_set_active(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_tabview_t * tabview = (lv_tabview_t *)obj;
|
||||
@@ -177,7 +177,7 @@ void lv_tabview_set_act(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en)
|
||||
tabview->tab_cur = id;
|
||||
}
|
||||
|
||||
uint32_t lv_tabview_get_tab_act(lv_obj_t * obj)
|
||||
uint32_t lv_tabview_get_tab_active(lv_obj_t * obj)
|
||||
{
|
||||
LV_ASSERT_OBJ(obj, MY_CLASS);
|
||||
lv_tabview_t * tabview = (lv_tabview_t *)obj;
|
||||
@@ -302,7 +302,7 @@ static void lv_tabview_event(const lv_obj_class_t * class_p, lv_event_t * e)
|
||||
lv_obj_t * target = lv_event_get_target(e);
|
||||
|
||||
if(code == LV_EVENT_SIZE_CHANGED) {
|
||||
lv_tabview_set_act(target, lv_tabview_get_tab_act(target), LV_ANIM_OFF);
|
||||
lv_tabview_set_active(target, lv_tabview_get_tab_active(target), LV_ANIM_OFF);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ static void buttons_value_changed_event_cb(lv_event_t * e)
|
||||
|
||||
lv_obj_t * tv = lv_obj_get_parent(buttons);
|
||||
uint32_t id = lv_buttonmatrix_get_selected_button(buttons);
|
||||
lv_tabview_set_act(tv, id, LV_ANIM_OFF);
|
||||
lv_tabview_set_active(tv, id, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
static void cont_scroll_end_event_cb(lv_event_t * e)
|
||||
@@ -324,10 +324,10 @@ static void cont_scroll_end_event_cb(lv_event_t * e)
|
||||
lv_obj_t * tv = lv_obj_get_parent(cont);
|
||||
lv_tabview_t * tv_obj = (lv_tabview_t *)tv;
|
||||
if(code == LV_EVENT_LAYOUT_CHANGED) {
|
||||
lv_tabview_set_act(tv, lv_tabview_get_tab_act(tv), LV_ANIM_OFF);
|
||||
lv_tabview_set_active(tv, lv_tabview_get_tab_active(tv), LV_ANIM_OFF);
|
||||
}
|
||||
else if(code == LV_EVENT_SCROLL_END) {
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(indev && indev->state == LV_INDEV_STATE_PRESSED) {
|
||||
return;
|
||||
}
|
||||
@@ -348,15 +348,15 @@ static void cont_scroll_end_event_cb(lv_event_t * e)
|
||||
|
||||
if(t < 0) t = 0;
|
||||
bool new_tab = false;
|
||||
if(t != (int32_t)lv_tabview_get_tab_act(tv)) new_tab = true;
|
||||
if(t != (int32_t)lv_tabview_get_tab_active(tv)) new_tab = true;
|
||||
|
||||
|
||||
/*If not scrolled by an indev set the tab immediately*/
|
||||
if(lv_indev_get_act()) {
|
||||
lv_tabview_set_act(tv, t, LV_ANIM_ON);
|
||||
if(lv_indev_active()) {
|
||||
lv_tabview_set_active(tv, t, LV_ANIM_ON);
|
||||
}
|
||||
else {
|
||||
lv_tabview_set_act(tv, t, LV_ANIM_OFF);
|
||||
lv_tabview_set_active(tv, t, LV_ANIM_OFF);
|
||||
}
|
||||
|
||||
if(new_tab) lv_obj_send_event(tv, LV_EVENT_VALUE_CHANGED, NULL);
|
||||
|
||||
@@ -48,9 +48,9 @@ lv_obj_t * lv_tabview_get_content(lv_obj_t * tv);
|
||||
|
||||
lv_obj_t * lv_tabview_get_tab_buttons(lv_obj_t * tv);
|
||||
|
||||
void lv_tabview_set_act(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en);
|
||||
void lv_tabview_set_active(lv_obj_t * obj, uint32_t id, lv_anim_enable_t anim_en);
|
||||
|
||||
uint32_t lv_tabview_get_tab_act(lv_obj_t * tv);
|
||||
uint32_t lv_tabview_get_tab_active(lv_obj_t * tv);
|
||||
|
||||
/**********************
|
||||
* MACROS
|
||||
|
||||
@@ -1143,7 +1143,7 @@ static void refr_cursor_area(lv_obj_t * obj)
|
||||
|
||||
static void update_cursor_position_on_click(lv_event_t * e)
|
||||
{
|
||||
lv_indev_t * click_source = lv_indev_get_act();
|
||||
lv_indev_t * click_source = lv_indev_active();
|
||||
if(click_source == NULL) return;
|
||||
|
||||
lv_obj_t * obj = lv_event_get_target(e);
|
||||
|
||||
@@ -119,7 +119,7 @@ void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim
|
||||
LV_LOG_WARN("No tile found with at (%d,%d) index", (int)col_id, (int)row_id);
|
||||
}
|
||||
|
||||
lv_obj_t * lv_tileview_get_tile_act(lv_obj_t * obj)
|
||||
lv_obj_t * lv_tileview_get_tile_active(lv_obj_t * obj)
|
||||
{
|
||||
lv_tileview_t * tv = (lv_tileview_t *) obj;
|
||||
return tv->tile_act;
|
||||
@@ -155,7 +155,7 @@ static void tileview_event_cb(lv_event_t * e)
|
||||
lv_tileview_t * tv = (lv_tileview_t *) obj;
|
||||
|
||||
if(code == LV_EVENT_SCROLL_END) {
|
||||
lv_indev_t * indev = lv_indev_get_act();
|
||||
lv_indev_t * indev = lv_indev_active();
|
||||
if(indev && indev->state == LV_INDEV_STATE_PRESSED) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ lv_obj_t * lv_tileview_add_tile(lv_obj_t * tv, uint8_t col_id, uint8_t row_id, l
|
||||
void lv_obj_set_tile(lv_obj_t * tv, lv_obj_t * tile_obj, lv_anim_enable_t anim_en);
|
||||
void lv_obj_set_tile_id(lv_obj_t * tv, uint32_t col_id, uint32_t row_id, lv_anim_enable_t anim_en);
|
||||
|
||||
lv_obj_t * lv_tileview_get_tile_act(lv_obj_t * obj);
|
||||
lv_obj_t * lv_tileview_get_tile_active(lv_obj_t * obj);
|
||||
|
||||
/*=====================
|
||||
* Other functions
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
void test_obj_property_fail_on_invalid_id(void)
|
||||
{
|
||||
lv_obj_t * obj = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * obj = lv_obj_create(lv_screen_active());
|
||||
lv_property_t prop = { };
|
||||
|
||||
prop.id = LV_PROPERTY_ID_INVALID;
|
||||
@@ -21,14 +21,14 @@ void test_obj_property_fail_on_invalid_id(void)
|
||||
TEST_ASSERT_EQUAL_INT(LV_RESULT_INVALID, lv_obj_set_property(obj, &prop));
|
||||
|
||||
prop.id = LV_PROPERTY_OBJ_PARENT; /* Valid ID */
|
||||
prop.ptr = lv_scr_act();
|
||||
prop.ptr = lv_screen_active();
|
||||
TEST_ASSERT_EQUAL_INT(LV_RESULT_OK, lv_obj_set_property(obj, &prop));
|
||||
}
|
||||
|
||||
void test_obj_property_set_get_should_match(void)
|
||||
{
|
||||
lv_obj_t * obj = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * root = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * obj = lv_obj_create(lv_screen_active());
|
||||
lv_obj_t * root = lv_obj_create(lv_screen_active());
|
||||
lv_property_t prop = { };
|
||||
lv_color_t color = {.red = 0x11, .green = 0x22, .blue = 0x33};
|
||||
|
||||
@@ -128,7 +128,7 @@ void test_obj_property_flag(void)
|
||||
{ LV_OBJ_FLAG_USER_4, LV_PROPERTY_OBJ_FLAG_USER_4 },
|
||||
};
|
||||
|
||||
lv_obj_t * obj = lv_obj_create(lv_scr_act());
|
||||
lv_obj_t * obj = lv_obj_create(lv_screen_active());
|
||||
obj->flags = 0;
|
||||
for(unsigned long i = 0; i < sizeof(properties) / sizeof(properties[0]); i++) {
|
||||
|
||||
|
||||
@@ -166,7 +166,7 @@ void test_arc_click_area_with_adv_hittest(void)
|
||||
/* Check value doesn't go to max when clicking on the other side of the arc */
|
||||
void test_arc_click_sustained_from_start_to_end_does_not_set_value_to_max(void)
|
||||
{
|
||||
arc = lv_arc_create(lv_scr_act());
|
||||
arc = lv_arc_create(lv_screen_active());
|
||||
lv_arc_set_value(arc, 0);
|
||||
|
||||
lv_obj_set_size(arc, 100, 100);
|
||||
|
||||
@@ -206,7 +206,7 @@ void test_tabview_set_act_non_existent(void)
|
||||
{
|
||||
tabview = lv_tabview_create(active_screen, LV_DIR_TOP, 50);
|
||||
|
||||
lv_tabview_set_act(tabview, 1, LV_ANIM_ON);
|
||||
lv_tabview_set_active(tabview, 1, LV_ANIM_ON);
|
||||
|
||||
TEST_ASSERT_EQUAL_SCREENSHOT("tabview_10.png");
|
||||
}
|
||||
@@ -222,9 +222,9 @@ void test_tabview_tab2_selected_event(void)
|
||||
LV_UNUSED(tab1);
|
||||
LV_UNUSED(tab2);
|
||||
|
||||
lv_tabview_set_act(tabview, 1, LV_ANIM_OFF);
|
||||
lv_tabview_set_active(tabview, 1, LV_ANIM_OFF);
|
||||
|
||||
TEST_ASSERT_EQUAL_UINT16(1, lv_tabview_get_tab_act(tabview));
|
||||
TEST_ASSERT_EQUAL_UINT16(1, lv_tabview_get_tab_active(tabview));
|
||||
}
|
||||
|
||||
void test_tabview_update_on_external_scroll(void)
|
||||
@@ -257,7 +257,7 @@ void test_tabview_update_on_external_scroll(void)
|
||||
|
||||
TEST_ASSERT_TRUE(lv_obj_is_visible(label1));
|
||||
TEST_ASSERT_FALSE(lv_obj_is_visible(label2));
|
||||
TEST_ASSERT_EQUAL_UINT16(2, lv_tabview_get_tab_act(tabview));
|
||||
TEST_ASSERT_EQUAL_UINT16(2, lv_tabview_get_tab_active(tabview));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user