1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00

scroll: add basic api

This commit is contained in:
Gabor Kiss-Vamosi 2020-06-28 13:19:28 +02:00
parent 2d7423100a
commit e55500af5d
2 changed files with 60 additions and 0 deletions

View File

@ -1061,6 +1061,65 @@ void lv_obj_set_auto_realign(lv_obj_t * obj, bool en)
#endif
}
/**
* Moves all children with horizontally or vertically.
* It doesn't take into account any limits so any values are possible
* @param obj pointer to an object whose children should be moved
* @param x pixel to move horizontally
* @param y pixels to move vertically
*/
void lv_obj_scroll_by_raw(lv_obj_t * obj, lv_coord_t x, lv_coord_t y)
{
obj->scroll.x += x;
obj->scroll.y += y;
refresh_children_position(obj, x, y);
}
/**
* Moves all children with horizontally or vertically.
* Limits the scroll to the bounding box of the children.
* @param obj pointer to an object whose children should be moved
* @param x pixel to move horizontally
* @param y pixels to move vertically
*/
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
{
obj->scroll.x += x;
obj->scroll.y += y;
refresh_children_position(obj, x, y);
}
/**
* Scroll the a given x coordinate to the left side of obj.
* @param obj pointer to an object which should be scrolled
* @param x the x coordinate to scroll to
* @param y the y coordinate to scroll to
*/
void lv_obj_scroll_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en)
{
}
/**
* Scroll the a given x coordinate to the left side of obj.
* @param obj pointer to an object which should be scrolled
* @param x the x coordinate to scroll to
*/
void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en)
{
// refresh_children_position(obj, x, y);
}
/**
* Scroll the a given y coordinate to the top side of obj.
* @param obj pointer to an object which should be scrolled
* @param y the y coordinate to scroll to
*/
void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en)
{
// refresh_children_position(obj, x, y);
}
/**
* Set the size of an extended clickable area

View File

@ -198,6 +198,7 @@ typedef struct _lv_obj_t {
lv_ll_t child_ll; /**< Linked list to store the children objects*/
lv_area_t coords; /**< Coordinates of the object (x1, y1, x2, y2)*/
lv_point_t scroll; /**< The current X/Y scroll offset*/
lv_event_cb_t event_cb; /**< Event callback function */
lv_signal_cb_t signal_cb; /**< Object type specific signal function*/