2016-06-22 17:24:02 +02:00
|
|
|
/**
|
|
|
|
* @file lv_list.h
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LV_LIST_H
|
|
|
|
#define LV_LIST_H
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
|
|
|
#include "lv_conf.h"
|
|
|
|
#if USE_LV_LIST != 0
|
|
|
|
|
2017-01-02 10:48:21 +01:00
|
|
|
/*Testing of dependencies*/
|
|
|
|
#if USE_LV_BTN == 0
|
|
|
|
#error "lv_list: lv_btn is required. Enable it in lv_conf.h (USE_LV_BTN 1) "
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if USE_LV_LABEL == 0
|
|
|
|
#error "lv_list: lv_label is required. Enable it in lv_conf.h (USE_LV_LABEL 1) "
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if USE_LV_IMG == 0
|
|
|
|
#error "lv_list: lv_img is required. Enable it in lv_conf.h (USE_LV_IMG 1) "
|
|
|
|
#endif
|
|
|
|
|
2016-06-22 17:24:02 +02:00
|
|
|
#include "../lv_obj/lv_obj.h"
|
|
|
|
#include "lv_page.h"
|
|
|
|
#include "lv_btn.h"
|
2016-07-12 01:16:27 +02:00
|
|
|
#include "lv_label.h"
|
|
|
|
#include "lv_img.h"
|
2016-06-22 17:24:02 +02:00
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
2017-01-14 23:54:16 +01:00
|
|
|
/*Data of list*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
lv_page_ext_t page_ext; /*Ext. of ancestor*/
|
|
|
|
/*New data for this type */
|
|
|
|
/*No new data*/
|
|
|
|
}lv_list_ext_t;
|
2016-06-22 17:24:02 +02:00
|
|
|
|
2016-10-07 11:15:46 +02:00
|
|
|
/*Style of list*/
|
2016-06-22 17:24:02 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2016-10-27 14:20:22 +02:00
|
|
|
lv_pages_t bg_pages; /*Style of ancestor*/
|
2016-10-07 11:15:46 +02:00
|
|
|
/*New style element for this type */
|
2017-01-14 23:54:16 +01:00
|
|
|
lv_btns_t liste_btns; /*List element button style*/
|
|
|
|
lv_labels_t liste_labels; /*List element label style*/
|
|
|
|
lv_imgs_t liste_imgs; /*List element image style*/
|
|
|
|
lv_rect_layout_t liste_layout; /*List element layout (will be removed)*/
|
|
|
|
uint8_t widthe_sb :1; /*1: Keep space for the scrollbar*/
|
2016-06-22 17:24:02 +02:00
|
|
|
}lv_lists_t;
|
|
|
|
|
2016-10-07 11:15:46 +02:00
|
|
|
/*Built-in styles of list*/
|
2016-06-22 17:24:02 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
LV_LISTS_DEF,
|
2017-01-01 22:56:09 +01:00
|
|
|
LV_LISTS_SCRL,
|
|
|
|
LV_LISTS_TRANSP,
|
2016-06-22 17:24:02 +02:00
|
|
|
}lv_lists_builtin_t;
|
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Create a list objects
|
|
|
|
* @param par pointer to an object, it will be the parent of the new list
|
|
|
|
* @param copy pointer to a list object, if not NULL then the new object will be copied from it
|
|
|
|
* @return pointer to the created list
|
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
lv_obj_t * lv_list_create(lv_obj_t * par, lv_obj_t * copy);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Signal function of the list
|
|
|
|
* @param list pointer to a list object
|
|
|
|
* @param sign a signal type from lv_signal_t enum
|
|
|
|
* @param param pointer to a signal specific variable
|
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
bool lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add a list element to the list
|
|
|
|
* @param list pointer to list object
|
|
|
|
* @param img_fn file name of an image before the text (NULL if unused)
|
|
|
|
* @param txt text of the list element (NULL if unused)
|
|
|
|
* @param rel_action pointer to release action function (like with lv_btn)
|
|
|
|
* @return pointer to the new list element which can be customized (a button)
|
|
|
|
*/
|
2016-12-18 22:07:03 +01:00
|
|
|
lv_obj_t * lv_list_add(lv_obj_t * list, const char * img_fn, const char * txt, lv_action_t rel_action);
|
2016-10-07 11:15:46 +02:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Move the list elements up by one
|
|
|
|
* @param list pointer a to list object
|
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
void lv_list_up(lv_obj_t * list);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Move the list elements down by one
|
|
|
|
* @param list pointer to a list object
|
|
|
|
*/
|
|
|
|
void lv_list_down(lv_obj_t * list);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the text of a list element
|
|
|
|
* @param liste pointer to list element
|
|
|
|
* @return pointer to the text
|
|
|
|
*/
|
2016-12-29 23:48:01 +01:00
|
|
|
const char * lv_list_element_get_txt(lv_obj_t * liste);
|
2016-07-12 01:16:27 +02:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Return with a pointer to a built-in style and/or copy it to a variable
|
|
|
|
* @param style a style name from lv_lists_builtin_t enum
|
|
|
|
* @param copy_p copy the style to this variable. (NULL if unused)
|
|
|
|
* @return pointer to an lv_lists_t style
|
|
|
|
*/
|
|
|
|
lv_lists_t * lv_lists_get(lv_lists_builtin_t style, lv_lists_t * list);
|
|
|
|
|
2016-06-22 17:24:02 +02:00
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|