2018-11-25 12:02:16 +01:00
|
|
|
/**
|
|
|
|
* @file lv_tileview.h
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LV_TILEVIEW_H
|
|
|
|
#define LV_TILEVIEW_H
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
2019-12-26 02:49:30 +01:00
|
|
|
#include "../lv_conf_internal.h"
|
2018-11-25 12:02:16 +01:00
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_TILEVIEW != 0
|
2018-11-25 12:02:16 +01:00
|
|
|
|
2020-02-14 22:04:00 +01:00
|
|
|
#include "../lv_widgets/lv_page.h"
|
2018-11-25 12:02:16 +01:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/*Data of tileview*/
|
2019-04-04 07:15:40 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2018-11-25 12:02:16 +01:00
|
|
|
lv_page_ext_t page;
|
|
|
|
/*New data for this type */
|
|
|
|
const lv_point_t * valid_pos;
|
2019-06-20 14:28:25 +02:00
|
|
|
uint16_t valid_pos_cnt;
|
2019-05-20 09:22:09 -07:00
|
|
|
#if LV_USE_ANIMATION
|
2018-11-25 12:02:16 +01:00
|
|
|
uint16_t anim_time;
|
2019-05-20 09:22:09 -07:00
|
|
|
#endif
|
2018-11-25 12:02:16 +01:00
|
|
|
lv_point_t act_id;
|
2019-04-04 07:15:40 +02:00
|
|
|
uint8_t drag_top_en : 1;
|
|
|
|
uint8_t drag_bottom_en : 1;
|
|
|
|
uint8_t drag_left_en : 1;
|
|
|
|
uint8_t drag_right_en : 1;
|
2018-11-25 12:02:16 +01:00
|
|
|
} lv_tileview_ext_t;
|
|
|
|
|
2020-02-03 16:18:53 +01:00
|
|
|
/*Parts of the Tileview*/
|
2018-11-25 12:02:16 +01:00
|
|
|
enum {
|
2020-02-03 16:18:53 +01:00
|
|
|
LV_TILEVIEW_PART_BG = LV_PAGE_PART_BG,
|
2020-02-03 20:49:34 +01:00
|
|
|
LV_TILEVIEW_PART_SCRLBAR = LV_PAGE_PART_SCRLBAR,
|
|
|
|
LV_TILEVIEW_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH,
|
2020-02-03 16:18:53 +01:00
|
|
|
_LV_TILEVIEW_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
|
|
|
|
_LV_TILEVIEW_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST
|
2018-11-25 12:02:16 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a tileview objects
|
|
|
|
* @param par pointer to an object, it will be the parent of the new tileview
|
|
|
|
* @param copy pointer to a tileview object, if not NULL then the new object will be copied from it
|
|
|
|
* @return pointer to the created tileview
|
|
|
|
*/
|
|
|
|
lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy);
|
|
|
|
|
|
|
|
/*======================
|
|
|
|
* Add/remove functions
|
|
|
|
*=====================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Register an object on the tileview. The register object will able to slide the tileview
|
2019-03-15 05:45:27 +01:00
|
|
|
* @param tileview pointer to a Tileview object
|
2018-11-25 12:02:16 +01:00
|
|
|
* @param element pointer to an object
|
|
|
|
*/
|
2019-03-15 05:45:27 +01:00
|
|
|
void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element);
|
2018-11-25 12:02:16 +01:00
|
|
|
|
|
|
|
/*=====================
|
|
|
|
* Setter functions
|
|
|
|
*====================*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the valid position's indices. The scrolling will be possible only to these positions.
|
|
|
|
* @param tileview pointer to a Tileview object
|
2019-11-21 06:08:01 +01:00
|
|
|
* @param valid_pos array width the indices. E.g. `lv_point_t p[] = {{0,0}, {1,0}, {1,1}`.
|
|
|
|
* Only the pointer is saved so can't be a local variable.
|
2019-06-20 14:28:25 +02:00
|
|
|
* @param valid_pos_cnt numner of elements in `valid_pos` array
|
2018-11-25 12:02:16 +01:00
|
|
|
*/
|
2019-11-21 06:08:01 +01:00
|
|
|
void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t valid_pos[], uint16_t valid_pos_cnt);
|
2018-11-25 12:02:16 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the tile to be shown
|
|
|
|
* @param tileview pointer to a tileview object
|
|
|
|
* @param x column id (0, 1, 2...)
|
|
|
|
* @param y line id (0, 1, 2...)
|
2019-06-11 13:51:14 +02:00
|
|
|
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
|
2018-11-25 12:02:16 +01:00
|
|
|
*/
|
2019-06-11 13:51:14 +02:00
|
|
|
void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim);
|
2018-11-25 12:02:16 +01:00
|
|
|
|
2018-11-25 19:40:19 +01:00
|
|
|
/**
|
|
|
|
* Enable the edge flash effect. (Show an arc when the an edge is reached)
|
|
|
|
* @param tileview pointer to a Tileview
|
|
|
|
* @param en true or false to enable/disable end flash
|
|
|
|
*/
|
|
|
|
static inline void lv_tileview_set_edge_flash(lv_obj_t * tileview, bool en)
|
|
|
|
{
|
|
|
|
lv_page_set_edge_flash(tileview, en);
|
|
|
|
}
|
|
|
|
|
2019-06-20 14:28:25 +02:00
|
|
|
/**
|
|
|
|
* Set the animation time for the Tile view
|
|
|
|
* @param tileview pointer to a page object
|
|
|
|
* @param anim_time animation time in milliseconds
|
|
|
|
*/
|
|
|
|
static inline void lv_tileview_set_anim_time(lv_obj_t * tileview, uint16_t anim_time)
|
|
|
|
{
|
|
|
|
lv_page_set_anim_time(tileview, anim_time);
|
|
|
|
}
|
|
|
|
|
2018-11-25 12:02:16 +01:00
|
|
|
/*=====================
|
|
|
|
* Getter functions
|
|
|
|
*====================*/
|
2019-11-29 11:32:22 +08:00
|
|
|
/**
|
|
|
|
* Get the tile to be shown
|
|
|
|
* @param tileview pointer to a tileview object
|
|
|
|
* @param x column id (0, 1, 2...)
|
|
|
|
* @param y line id (0, 1, 2...)
|
|
|
|
*/
|
|
|
|
void lv_tileview_get_tile_act(lv_obj_t * tileview, lv_coord_t *x, lv_coord_t *y);
|
2018-11-25 19:40:19 +01:00
|
|
|
/**
|
|
|
|
* Get the scroll propagation property
|
|
|
|
* @param tileview pointer to a Tileview
|
|
|
|
* @return true or false
|
|
|
|
*/
|
|
|
|
static inline bool lv_tileview_get_edge_flash(lv_obj_t * tileview)
|
|
|
|
{
|
|
|
|
return lv_page_get_edge_flash(tileview);
|
|
|
|
}
|
|
|
|
|
2019-06-20 14:28:25 +02:00
|
|
|
/**
|
|
|
|
* Get the animation time for the Tile view
|
|
|
|
* @param tileview pointer to a page object
|
|
|
|
* @return animation time in milliseconds
|
|
|
|
*/
|
|
|
|
static inline uint16_t lv_tileview_get_anim_time(lv_obj_t * tileview)
|
|
|
|
{
|
|
|
|
return lv_page_get_anim_time(tileview);
|
|
|
|
}
|
|
|
|
|
2018-11-25 12:02:16 +01:00
|
|
|
/*=====================
|
|
|
|
* Other functions
|
|
|
|
*====================*/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
2019-04-04 07:15:40 +02:00
|
|
|
#endif /*LV_USE_TILEVIEW*/
|
2018-11-25 12:02:16 +01:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
} /* extern "C" */
|
|
|
|
#endif
|
|
|
|
|
2019-04-04 07:15:40 +02:00
|
|
|
#endif /*LV_TILEVIEW_H*/
|