2016-06-08 07:25:08 +02:00
|
|
|
/**
|
|
|
|
* @file lv_page.h
|
2018-06-19 09:49:58 +02:00
|
|
|
*
|
2016-06-08 07:25:08 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LV_PAGE_H
|
|
|
|
#define LV_PAGE_H
|
|
|
|
|
2017-07-09 15:32:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
2019-12-26 02:49:30 +01:00
|
|
|
#include "../lv_conf_internal.h"
|
2018-07-07 11:53:22 +02:00
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_PAGE != 0
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2017-01-02 10:48:21 +01:00
|
|
|
/*Testing of dependencies*/
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_CONT == 0
|
|
|
|
#error "lv_page: lv_cont is required. Enable it in lv_conf.h (LV_USE_CONT 1) "
|
2017-01-02 10:48:21 +01:00
|
|
|
#endif
|
|
|
|
|
2017-08-23 14:39:09 +02:00
|
|
|
#include "lv_cont.h"
|
2017-11-30 11:35:33 +01:00
|
|
|
#include "../lv_core/lv_indev.h"
|
2019-05-20 09:22:09 -07:00
|
|
|
#include "../lv_misc/lv_anim.h"
|
2016-06-08 07:25:08 +02:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
2017-01-14 23:54:16 +01:00
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
/** Scrollbar modes: shows when should the scrollbars be visible*/
|
2019-04-04 07:15:40 +02:00
|
|
|
enum {
|
2020-05-12 21:29:16 +02:00
|
|
|
LV_SCROLLBAR_MODE_OFF = 0x0, /**< Never show scroll bars*/
|
2020-05-12 21:37:01 +02:00
|
|
|
LV_SCROLLBAR_MODE_ON = 0x1, /**< Always show scroll bars*/
|
2020-05-12 21:29:16 +02:00
|
|
|
LV_SCROLLBAR_MODE_DRAG = 0x2, /**< Show scroll bars when page is being dragged*/
|
|
|
|
LV_SCROLLBAR_MODE_AUTO = 0x3, /**< Show scroll bars when the scrollable container is large enough to be scrolled*/
|
|
|
|
LV_SCROLLBAR_MODE_HIDE = 0x4, /**< Hide the scroll bar temporally*/
|
2020-08-23 08:49:27 +02:00
|
|
|
LV_SCROLLBAR_MODE_UNHIDE = 0x8, /**< Unhide the previously hidden scroll bar. Recover original mode too*/
|
2018-09-18 13:59:40 +02:00
|
|
|
};
|
2020-05-12 21:29:16 +02:00
|
|
|
typedef uint8_t lv_scrollbar_mode_t;
|
2017-04-13 10:20:35 +02:00
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
/** Edges: describes the four edges of the page*/
|
2019-06-27 07:16:15 +02:00
|
|
|
enum { LV_PAGE_EDGE_LEFT = 0x1, LV_PAGE_EDGE_TOP = 0x2, LV_PAGE_EDGE_RIGHT = 0x4, LV_PAGE_EDGE_BOTTOM = 0x8 };
|
2019-03-22 19:08:21 -04:00
|
|
|
typedef uint8_t lv_page_edge_t;
|
|
|
|
|
2017-01-14 23:54:16 +01:00
|
|
|
/*Data of page*/
|
2020-02-26 19:48:27 +01:00
|
|
|
typedef struct {
|
2017-04-21 09:15:39 +02:00
|
|
|
lv_cont_ext_t bg; /*Ext. of ancestor*/
|
2017-01-14 23:54:16 +01:00
|
|
|
/*New data for this type */
|
2019-04-04 07:15:40 +02:00
|
|
|
lv_obj_t * scrl; /*The scrollable object on the background*/
|
2020-02-26 19:48:27 +01:00
|
|
|
struct {
|
2020-01-16 14:26:36 +01:00
|
|
|
lv_style_list_t style; /*Style of scrollbars*/
|
2019-06-06 06:05:40 +02:00
|
|
|
lv_area_t hor_area; /*Horizontal scrollbar area relative to the page. (Handled by the library) */
|
|
|
|
lv_area_t ver_area; /*Vertical scrollbar area relative to the page (Handled by the library)*/
|
|
|
|
uint8_t hor_draw : 1; /*1: horizontal scrollbar is visible now (Handled by the library)*/
|
|
|
|
uint8_t ver_draw : 1; /*1: vertical scrollbar is visible now (Handled by the library)*/
|
2020-05-12 21:29:16 +02:00
|
|
|
lv_scrollbar_mode_t mode : 3; /*Scrollbar visibility from 'lv_scrollbar_mode_t'*/
|
2020-02-15 02:30:20 +01:00
|
|
|
} scrlbar;
|
2019-05-20 18:31:47 -07:00
|
|
|
#if LV_USE_ANIMATION
|
2020-02-26 19:48:27 +01:00
|
|
|
struct {
|
2019-06-06 06:05:40 +02:00
|
|
|
lv_anim_value_t state; /*Store the current size of the edge flash effect*/
|
2020-01-16 14:26:36 +01:00
|
|
|
lv_style_list_t style; /*Style of edge flash effect (usually homogeneous circle)*/
|
2019-06-06 06:05:40 +02:00
|
|
|
uint8_t enabled : 1; /*1: Show a flash animation on the edge*/
|
|
|
|
uint8_t top_ip : 1; /*Used internally to show that top most position is reached (flash is In
|
|
|
|
Progress)*/
|
|
|
|
uint8_t bottom_ip : 1; /*Used internally to show that bottom most position is reached (flash
|
|
|
|
is In Progress)*/
|
|
|
|
uint8_t right_ip : 1; /*Used internally to show that right most position is reached (flash
|
|
|
|
is In Progress)*/
|
|
|
|
uint8_t left_ip : 1; /*Used internally to show that left most position is reached (flash is
|
|
|
|
In Progress)*/
|
2019-04-04 07:15:40 +02:00
|
|
|
} edge_flash;
|
2019-06-19 00:35:35 +02:00
|
|
|
|
|
|
|
uint16_t anim_time; /*Scroll animation time*/
|
2019-05-20 18:31:47 -07:00
|
|
|
#endif
|
2019-09-17 14:38:55 +02:00
|
|
|
lv_obj_t * scroll_prop_obj; /*Pointer to child page from where the scroll is being propagated */
|
2020-02-26 19:48:27 +01:00
|
|
|
uint8_t scroll_prop : 1; /*The direction of the scroll propagation*/
|
2018-06-19 09:49:58 +02:00
|
|
|
} lv_page_ext_t;
|
2017-01-14 23:54:16 +01:00
|
|
|
|
2018-09-18 13:59:40 +02:00
|
|
|
enum {
|
2020-01-07 23:43:57 +01:00
|
|
|
LV_PAGE_PART_BG = LV_CONT_PART_MAIN,
|
2020-04-21 11:36:05 +02:00
|
|
|
LV_PAGE_PART_SCROLLBAR = _LV_OBJ_PART_VIRTUAL_LAST,
|
2019-12-31 06:10:50 +01:00
|
|
|
LV_PAGE_PART_EDGE_FLASH,
|
2020-01-07 23:43:57 +01:00
|
|
|
_LV_PAGE_PART_VIRTUAL_LAST,
|
2020-01-05 20:05:11 +01:00
|
|
|
|
2020-04-21 11:36:05 +02:00
|
|
|
LV_PAGE_PART_SCROLLABLE = _LV_OBJ_PART_REAL_LAST,
|
2020-01-07 23:43:57 +01:00
|
|
|
_LV_PAGE_PART_REAL_LAST,
|
2018-09-18 13:59:40 +02:00
|
|
|
};
|
2019-12-31 06:10:50 +01:00
|
|
|
typedef uint8_t lv_part_style_t;
|
2016-06-08 07:25:08 +02:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a page objects
|
|
|
|
* @param par pointer to an object, it will be the parent of the new page
|
|
|
|
* @param copy pointer to a page object, if not NULL then the new object will be copied from it
|
|
|
|
* @return pointer to the created page
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy);
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2018-03-16 11:53:27 -04:00
|
|
|
/**
|
|
|
|
* Delete all children of the scrl object, without deleting scrl child.
|
2019-09-26 12:54:40 +02:00
|
|
|
* @param page pointer to an object
|
2018-03-16 11:53:27 -04:00
|
|
|
*/
|
2019-09-26 12:54:40 +02:00
|
|
|
void lv_page_clean(lv_obj_t * page);
|
2018-03-16 11:53:27 -04:00
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
/**
|
|
|
|
* Get the scrollable object of a page
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return pointer to a container which is the scrollable part of the page
|
|
|
|
*/
|
2020-06-16 12:03:32 +02:00
|
|
|
lv_obj_t * lv_page_get_scrollable(const lv_obj_t * page);
|
2017-11-10 15:01:40 +01:00
|
|
|
|
2019-06-19 00:35:35 +02:00
|
|
|
/**
|
|
|
|
* Get the animation time
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return the animation time in milliseconds
|
|
|
|
*/
|
|
|
|
uint16_t lv_page_get_anim_time(const lv_obj_t * page);
|
|
|
|
|
2017-11-15 15:50:33 +01:00
|
|
|
/*=====================
|
|
|
|
* Setter functions
|
|
|
|
*====================*/
|
|
|
|
|
2017-04-21 09:15:39 +02:00
|
|
|
/**
|
|
|
|
* Set the scroll bar mode on a page
|
|
|
|
* @param page pointer to a page object
|
2018-07-12 23:38:27 +02:00
|
|
|
* @param sb_mode the new mode from 'lv_page_sb.mode_t' enum
|
2017-04-21 09:15:39 +02:00
|
|
|
*/
|
2020-05-12 21:29:16 +02:00
|
|
|
void lv_page_set_scrollbar_mode(lv_obj_t * page, lv_scrollbar_mode_t sb_mode);
|
2017-04-21 09:15:39 +02:00
|
|
|
|
2019-06-19 00:35:35 +02:00
|
|
|
/**
|
|
|
|
* Set the animation time for the page
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @param anim_time animation time in milliseconds
|
|
|
|
*/
|
|
|
|
void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time);
|
|
|
|
|
2018-11-07 20:41:52 +01:00
|
|
|
/**
|
2019-04-04 07:15:40 +02:00
|
|
|
* Enable the scroll propagation feature. If enabled then the page will move its parent if there is
|
|
|
|
* no more space to scroll.
|
2019-09-19 14:58:07 +02:00
|
|
|
* The page needs to have a page-like parent (e.g. `lv_page`, `lv_tabview` tab, `lv_win` content area etc)
|
|
|
|
* If enabled drag direction will be changed `LV_DRAG_DIR_ONE` automatically to allow scrolling only in one direction at one time.
|
2018-11-07 20:41:52 +01:00
|
|
|
* @param page pointer to a Page
|
|
|
|
* @param en true or false to enable/disable scroll propagation
|
|
|
|
*/
|
2019-09-17 16:07:30 +02:00
|
|
|
void lv_page_set_scroll_propagation(lv_obj_t * page, bool en);
|
2018-11-07 20:41:52 +01:00
|
|
|
|
2018-11-24 20:31:06 +01:00
|
|
|
/**
|
|
|
|
* Enable the edge flash effect. (Show an arc when the an edge is reached)
|
|
|
|
* @param page pointer to a Page
|
|
|
|
* @param en true or false to enable/disable end flash
|
|
|
|
*/
|
|
|
|
void lv_page_set_edge_flash(lv_obj_t * page, bool en);
|
|
|
|
|
2019-02-24 06:24:36 +01:00
|
|
|
/**
|
|
|
|
* Set the fit policy in all 4 directions separately.
|
|
|
|
* It tell how to change the page size automatically.
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @param left left fit policy from `lv_fit_t`
|
|
|
|
* @param right right fit policy from `lv_fit_t`
|
|
|
|
* @param top bottom fit policy from `lv_fit_t`
|
|
|
|
* @param bottom bottom fit policy from `lv_fit_t`
|
|
|
|
*/
|
2020-06-16 12:03:32 +02:00
|
|
|
static inline void lv_page_set_scrollable_fit4(lv_obj_t * page, lv_fit_t left, lv_fit_t right, lv_fit_t top,
|
2020-06-16 13:47:04 +02:00
|
|
|
lv_fit_t bottom)
|
2019-02-24 06:24:36 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
lv_cont_set_fit4(lv_page_get_scrollable(page), left, right, top, bottom);
|
2019-02-24 06:24:36 +01:00
|
|
|
}
|
|
|
|
|
2017-11-05 00:48:57 +01:00
|
|
|
/**
|
2019-02-24 06:24:36 +01:00
|
|
|
* Set the fit policy horizontally and vertically separately.
|
|
|
|
* It tell how to change the page size automatically.
|
2017-04-13 10:20:35 +02:00
|
|
|
* @param page pointer to a page object
|
2019-02-24 06:24:36 +01:00
|
|
|
* @param hot horizontal fit policy from `lv_fit_t`
|
|
|
|
* @param ver vertical fit policy from `lv_fit_t`
|
|
|
|
*/
|
2020-06-16 12:03:32 +02:00
|
|
|
static inline void lv_page_set_scrollable_fit2(lv_obj_t * page, lv_fit_t hor, lv_fit_t ver)
|
2019-02-24 06:24:36 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
lv_cont_set_fit2(lv_page_get_scrollable(page), hor, ver);
|
2019-02-24 06:24:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2020-06-15 17:12:48 +03:00
|
|
|
* Set the fit policy in all 4 direction at once.
|
2019-02-24 06:24:36 +01:00
|
|
|
* It tell how to change the page size automatically.
|
|
|
|
* @param page pointer to a button object
|
|
|
|
* @param fit fit policy from `lv_fit_t`
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2020-06-16 12:03:32 +02:00
|
|
|
static inline void lv_page_set_scrollable_fit(lv_obj_t * page, lv_fit_t fit)
|
2017-11-05 00:48:57 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
lv_cont_set_fit(lv_page_get_scrollable(page), fit);
|
2017-11-05 00:48:57 +01:00
|
|
|
}
|
2017-04-13 10:20:35 +02:00
|
|
|
|
2017-04-21 09:15:39 +02:00
|
|
|
/**
|
2017-11-05 00:48:57 +01:00
|
|
|
* Set width of the scrollable part of a page
|
2017-04-21 09:15:39 +02:00
|
|
|
* @param page pointer to a page object
|
2017-11-05 00:48:57 +01:00
|
|
|
* @param w the new width of the scrollable (it ha no effect is horizontal fit is enabled)
|
2017-04-21 09:15:39 +02:00
|
|
|
*/
|
2019-04-04 07:15:40 +02:00
|
|
|
static inline void lv_page_set_scrl_width(lv_obj_t * page, lv_coord_t w)
|
2017-11-05 00:48:57 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
lv_obj_set_width(lv_page_get_scrollable(page), w);
|
2017-11-05 00:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set height of the scrollable part of a page
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @param h the new height of the scrollable (it ha no effect is vertical fit is enabled)
|
|
|
|
*/
|
2019-04-04 07:15:40 +02:00
|
|
|
static inline void lv_page_set_scrl_height(lv_obj_t * page, lv_coord_t h)
|
2017-11-05 00:48:57 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
lv_obj_set_height(lv_page_get_scrollable(page), h);
|
2017-11-05 00:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-04-04 07:15:40 +02:00
|
|
|
* Set the layout of the scrollable part of the page
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @param layout a layout from 'lv_cont_layout_t'
|
|
|
|
*/
|
2017-11-17 15:43:08 +01:00
|
|
|
static inline void lv_page_set_scrl_layout(lv_obj_t * page, lv_layout_t layout)
|
2017-11-05 00:48:57 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
lv_cont_set_layout(lv_page_get_scrollable(page), layout);
|
2017-11-05 00:48:57 +01:00
|
|
|
}
|
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
/*=====================
|
|
|
|
* Getter functions
|
|
|
|
*====================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the scroll bar mode on a page
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return the mode from 'lv_page_sb.mode_t' enum
|
|
|
|
*/
|
2020-05-12 21:29:16 +02:00
|
|
|
lv_scrollbar_mode_t lv_page_get_scrollbar_mode(const lv_obj_t * page);
|
2017-11-10 15:01:40 +01:00
|
|
|
|
2018-11-07 20:41:52 +01:00
|
|
|
/**
|
|
|
|
* Get the scroll propagation property
|
|
|
|
* @param page pointer to a Page
|
|
|
|
* @return true or false
|
|
|
|
*/
|
2019-09-17 16:07:30 +02:00
|
|
|
bool lv_page_get_scroll_propagation(lv_obj_t * page);
|
2018-10-15 12:38:13 +02:00
|
|
|
|
2018-11-24 20:31:06 +01:00
|
|
|
/**
|
|
|
|
* Get the edge flash effect property.
|
|
|
|
* @param page pointer to a Page
|
|
|
|
* return true or false
|
|
|
|
*/
|
|
|
|
bool lv_page_get_edge_flash(lv_obj_t * page);
|
|
|
|
|
2018-10-15 12:38:13 +02:00
|
|
|
/**
|
|
|
|
* Get that width which can be set to the children to still not cause overflow (show scrollbars)
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return the width which still fits into the page
|
|
|
|
*/
|
2020-04-08 11:12:06 +02:00
|
|
|
lv_coord_t lv_page_get_width_fit(lv_obj_t * page);
|
2018-10-15 12:38:13 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get that height which can be set to the children to still not cause overflow (show scrollbars)
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return the height which still fits into the page
|
|
|
|
*/
|
2020-04-08 11:12:06 +02:00
|
|
|
lv_coord_t lv_page_get_height_fit(lv_obj_t * page);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Divide the width of the object and get the width of a given number of columns.
|
2020-06-15 17:12:48 +03:00
|
|
|
* Take into account the paddings of the background and scrollable too.
|
2020-04-08 11:12:06 +02:00
|
|
|
* @param page pointer to an object
|
|
|
|
* @param div indicates how many columns are assumed.
|
|
|
|
* If 1 the width will be set the the parent's width
|
|
|
|
* If 2 only half parent width - inner padding of the parent
|
|
|
|
* If 3 only third parent width - 2 * inner padding of the parent
|
|
|
|
* @param span how many columns are combined
|
|
|
|
* @return the width according to the given parameters
|
|
|
|
*/
|
|
|
|
lv_coord_t lv_page_get_width_grid(lv_obj_t * page, uint8_t div, uint8_t span);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Divide the height of the object and get the width of a given number of columns.
|
2020-06-15 17:12:48 +03:00
|
|
|
* Take into account the paddings of the background and scrollable too.
|
2020-04-08 11:12:06 +02:00
|
|
|
* @param page pointer to an object
|
|
|
|
* @param div indicates how many rows are assumed.
|
|
|
|
* If 1 the height will be set the the parent's height
|
|
|
|
* If 2 only half parent height - inner padding of the parent
|
|
|
|
* If 3 only third parent height - 2 * inner padding of the parent
|
|
|
|
* @param span how many rows are combined
|
|
|
|
* @return the height according to the given parameters
|
|
|
|
*/
|
|
|
|
lv_coord_t lv_page_get_height_grid(lv_obj_t * page, uint8_t div, uint8_t span);
|
2018-10-15 12:38:13 +02:00
|
|
|
|
2017-11-05 00:48:57 +01:00
|
|
|
/**
|
|
|
|
* Get width of the scrollable part of a page
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return the width of the scrollable
|
|
|
|
*/
|
2019-04-04 07:15:40 +02:00
|
|
|
static inline lv_coord_t lv_page_get_scrl_width(const lv_obj_t * page)
|
2017-11-05 00:48:57 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
return lv_obj_get_width(lv_page_get_scrollable(page));
|
2017-11-05 00:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get height of the scrollable part of a page
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return the height of the scrollable
|
|
|
|
*/
|
2019-04-04 07:15:40 +02:00
|
|
|
static inline lv_coord_t lv_page_get_scrl_height(const lv_obj_t * page)
|
2017-11-05 00:48:57 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
return lv_obj_get_height(lv_page_get_scrollable(page));
|
2017-11-05 00:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-04-04 07:15:40 +02:00
|
|
|
* Get the layout of the scrollable part of a page
|
|
|
|
* @param page pointer to page object
|
|
|
|
* @return the layout from 'lv_cont_layout_t'
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
static inline lv_layout_t lv_page_get_scrl_layout(const lv_obj_t * page)
|
2017-11-05 00:48:57 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
return lv_cont_get_layout(lv_page_get_scrollable(page));
|
2017-11-05 00:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-02-24 06:24:36 +01:00
|
|
|
* Get the left fit mode
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return an element of `lv_fit_t`
|
|
|
|
*/
|
|
|
|
static inline lv_fit_t lv_page_get_scrl_fit_left(const lv_obj_t * page)
|
2017-11-05 00:48:57 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
return lv_cont_get_fit_left(lv_page_get_scrollable(page));
|
2017-11-05 00:48:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2019-02-24 06:24:36 +01:00
|
|
|
* Get the right fit mode
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return an element of `lv_fit_t`
|
|
|
|
*/
|
|
|
|
static inline lv_fit_t lv_page_get_scrl_fit_right(const lv_obj_t * page)
|
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
return lv_cont_get_fit_right(lv_page_get_scrollable(page));
|
2019-02-24 06:24:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the top fit mode
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return an element of `lv_fit_t`
|
|
|
|
*/
|
2019-04-19 06:10:01 +02:00
|
|
|
static inline lv_fit_t lv_page_get_scrl_fit_top(const lv_obj_t * page)
|
2019-02-24 06:24:36 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
return lv_cont_get_fit_top(lv_page_get_scrollable(page));
|
2019-02-24 06:24:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the bottom fit mode
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @return an element of `lv_fit_t`
|
|
|
|
*/
|
|
|
|
static inline lv_fit_t lv_page_get_scrl_fit_bottom(const lv_obj_t * page)
|
2017-11-05 00:48:57 +01:00
|
|
|
{
|
2020-06-16 12:03:32 +02:00
|
|
|
return lv_cont_get_fit_bottom(lv_page_get_scrollable(page));
|
2017-11-05 00:48:57 +01:00
|
|
|
}
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-15 15:50:33 +01:00
|
|
|
/*=====================
|
|
|
|
* Other functions
|
|
|
|
*====================*/
|
2017-11-10 15:01:40 +01:00
|
|
|
|
2019-03-22 19:08:21 -04:00
|
|
|
/**
|
|
|
|
* Find whether the page has been scrolled to a certain edge.
|
|
|
|
* @param page Page object
|
|
|
|
* @param edge Edge to check
|
|
|
|
* @return true if the page is on the specified edge
|
|
|
|
*/
|
2019-04-04 07:15:40 +02:00
|
|
|
bool lv_page_on_edge(lv_obj_t * page, lv_page_edge_t edge);
|
2019-03-22 19:08:21 -04:00
|
|
|
|
2017-11-10 15:01:40 +01:00
|
|
|
/**
|
2017-11-15 15:50:33 +01:00
|
|
|
* Glue the object to the page. After it the page can be moved (dragged) with this object too.
|
|
|
|
* @param obj pointer to an object on a page
|
|
|
|
* @param glue true: enable glue, false: disable glue
|
|
|
|
*/
|
|
|
|
void lv_page_glue_obj(lv_obj_t * obj, bool glue);
|
2017-11-10 15:01:40 +01:00
|
|
|
|
|
|
|
/**
|
2017-11-15 15:50:33 +01:00
|
|
|
* Focus on an object. It ensures that the object will be visible on the page.
|
|
|
|
* @param page pointer to a page object
|
|
|
|
* @param obj pointer to an object to focus (must be on the page)
|
2019-06-19 00:35:35 +02:00
|
|
|
* @param anim_en LV_ANIM_ON to focus with animation; LV_ANIM_OFF to focus without animation
|
2017-11-15 15:50:33 +01:00
|
|
|
*/
|
2019-06-19 00:35:35 +02:00
|
|
|
void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_en);
|
2017-11-10 15:01:40 +01:00
|
|
|
|
2018-08-04 21:48:40 +02:00
|
|
|
/**
|
2018-08-10 01:04:20 +02:00
|
|
|
* Scroll the page horizontally
|
2018-08-04 21:48:40 +02:00
|
|
|
* @param page pointer to a page object
|
2018-08-10 01:04:20 +02:00
|
|
|
* @param dist the distance to scroll (< 0: scroll left; > 0 scroll right)
|
2018-08-04 21:48:40 +02:00
|
|
|
*/
|
2018-08-10 01:04:20 +02:00
|
|
|
void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist);
|
2018-08-04 21:48:40 +02:00
|
|
|
|
|
|
|
/**
|
2018-08-10 01:04:20 +02:00
|
|
|
* Scroll the page vertically
|
2018-08-04 21:48:40 +02:00
|
|
|
* @param page pointer to a page object
|
2018-08-10 01:04:20 +02:00
|
|
|
* @param dist the distance to scroll (< 0: scroll down; > 0 scroll up)
|
2018-08-04 21:48:40 +02:00
|
|
|
*/
|
2018-08-10 01:04:20 +02:00
|
|
|
void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist);
|
2018-08-04 21:48:40 +02:00
|
|
|
|
2018-11-25 09:54:13 +01:00
|
|
|
/**
|
|
|
|
* Not intended to use directly by the user but by other object types internally.
|
2019-09-17 16:07:30 +02:00
|
|
|
* Start an edge flash animation.
|
2018-11-25 09:54:13 +01:00
|
|
|
* @param page
|
2019-09-17 16:07:30 +02:00
|
|
|
* @param edge the edge to flash. Can be `LV_PAGE_EDGE_LEFT/RIGHT/TOP/BOTTOM`
|
2018-11-25 09:54:13 +01:00
|
|
|
*/
|
2019-09-17 16:07:30 +02:00
|
|
|
void lv_page_start_edge_flash(lv_obj_t * page, lv_page_edge_t edge);
|
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
2019-04-04 07:15:40 +02:00
|
|
|
#endif /*LV_USE_PAGE*/
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2017-07-09 15:32:49 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
2016-06-08 07:25:08 +02:00
|
|
|
#endif
|
2017-07-09 15:32:49 +02:00
|
|
|
|
2019-04-04 07:15:40 +02:00
|
|
|
#endif /*LV_PAGE_H*/
|