2016-06-08 07:25:08 +02:00
|
|
|
/**
|
|
|
|
* @file lv_rect.h
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef LV_LABEL_H
|
|
|
|
#define LV_LABEL_H
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* INCLUDES
|
|
|
|
*********************/
|
2016-06-10 15:00:56 +02:00
|
|
|
#include "lv_conf.h"
|
2016-06-08 07:25:08 +02:00
|
|
|
#if USE_LV_LABEL != 0
|
|
|
|
|
|
|
|
#include "../lv_obj/lv_obj.h"
|
|
|
|
#include "../lv_misc/font.h"
|
|
|
|
|
|
|
|
/*********************
|
|
|
|
* DEFINES
|
|
|
|
*********************/
|
2016-10-16 21:43:28 +02:00
|
|
|
#define LV_LABEL_DOT_NUM 3
|
2016-06-08 07:25:08 +02:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* TYPEDEFS
|
|
|
|
**********************/
|
|
|
|
|
2016-10-07 11:15:46 +02:00
|
|
|
/*Style of label*/
|
2016-06-08 07:25:08 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2016-10-07 11:15:46 +02:00
|
|
|
lv_objs_t objs; /*Style of ancestor*/
|
|
|
|
/*New style element for this type */
|
2016-06-08 07:25:08 +02:00
|
|
|
font_types_t font;
|
|
|
|
uint16_t letter_space;
|
|
|
|
uint16_t line_space;
|
|
|
|
uint8_t mid :1;
|
|
|
|
}lv_labels_t;
|
|
|
|
|
2016-10-07 11:15:46 +02:00
|
|
|
/*Built-in styles of label*/
|
2016-06-08 07:25:08 +02:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
LV_LABELS_DEF,
|
|
|
|
LV_LABELS_BTN,
|
|
|
|
LV_LABELS_TXT,
|
|
|
|
LV_LABELS_TITLE,
|
|
|
|
}lv_labels_builtin_t;
|
2016-10-07 11:15:46 +02:00
|
|
|
|
2016-10-16 21:43:28 +02:00
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
LV_LABEL_LONG_EXPAND, /*Expand the object size to the text size*/
|
|
|
|
LV_LABEL_LONG_BREAK, /*Keep the width and break the text and expand the object height*/
|
|
|
|
LV_LABEL_LONG_DOTS, /*Keep the size, break the text and write dots in the last line*/
|
|
|
|
LV_LABEL_LONG_SCROLL, /*Expand the object size and scroll the text (move the label object)*/
|
|
|
|
}lv_label_long_mode_t;
|
|
|
|
|
2016-10-07 11:15:46 +02:00
|
|
|
/*Data of label*/
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/
|
|
|
|
/*New data for this type */
|
|
|
|
char * txt;
|
2016-10-16 21:43:28 +02:00
|
|
|
lv_label_long_mode_t long_mode;
|
2016-10-20 16:35:03 +02:00
|
|
|
char dot_tmp[LV_LABEL_DOT_NUM + 10]; /*Store character which are replaced with dots*/
|
2016-10-16 21:43:28 +02:00
|
|
|
uint16_t dot_end; /*The text end in dot mode*/
|
2016-10-07 11:15:46 +02:00
|
|
|
}lv_label_ext_t;
|
2016-06-08 07:25:08 +02:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
|
|
|
/*Create function*/
|
2016-10-07 11:15:46 +02:00
|
|
|
lv_obj_t * lv_label_create(lv_obj_t * par, lv_obj_t * copy);
|
|
|
|
bool lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param);
|
|
|
|
lv_labels_t * lv_labels_get(lv_labels_builtin_t style, lv_labels_t * copy);
|
2016-06-15 10:23:10 +02:00
|
|
|
|
2016-10-07 11:15:46 +02:00
|
|
|
void lv_label_set_text(lv_obj_t * label, const char * text);
|
2016-10-16 21:43:28 +02:00
|
|
|
void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode);
|
2016-10-07 11:15:46 +02:00
|
|
|
const char * lv_label_get_text(lv_obj_t * label);
|
2016-10-16 21:43:28 +02:00
|
|
|
lv_label_long_mode_t lv_label_get_long_mode(lv_obj_t * label);
|
2016-10-07 11:15:46 +02:00
|
|
|
void lv_label_get_letter_pos(lv_obj_t * label, uint16_t index, point_t * pos);
|
|
|
|
uint16_t lv_label_get_letter_on(lv_obj_t * label, point_t * pos);
|
2016-06-08 07:25:08 +02:00
|
|
|
|
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|