aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/textarea/lv_textarea_private.h
blob: e2d3aaab93ea70b7e92d84c347927b5753fce4ef (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/**
 * @file lv_textarea_private.h
 *
 */

#ifndef LV_TEXTAREA_PRIVATE_H
#define LV_TEXTAREA_PRIVATE_H

#ifdef __cplusplus
extern "C" {
#endif

/*********************
 *      INCLUDES
 *********************/

#include "../../core/lv_obj_private.h"
#include "lv_textarea.h"

#if LV_USE_TEXTAREA != 0

/*********************
 *      DEFINES
 *********************/

/**********************
 *      TYPEDEFS
 **********************/

/** Data of text area */
struct lv_textarea_t {
    lv_obj_t obj;
    lv_obj_t * label;            /**< Label of the text area */
    char * placeholder_txt;      /**< Place holder label. only visible if text is an empty string */
    char * pwd_tmp;              /**< Used to store the original text in password mode */
    char * pwd_bullet;           /**< Replacement characters displayed in password mode */
    const char * accepted_chars; /**< Only these characters will be accepted. NULL: accept all */
    uint32_t max_length;         /**< The max. number of characters. 0: no limit */
    uint32_t pwd_show_time;      /**< Time to show characters in password mode before change them to '*' */
    struct {
        int32_t valid_x;         /**< Used when stepping up/down to a shorter line.
                                  *(Used by the library) */
        uint32_t pos;            /**< The current cursor position
                                  *(0: before 1st letter; 1: before 2nd letter ...) */
        lv_area_t area;          /**< Cursor area relative to the Text Area */
        uint32_t txt_byte_pos;   /**< Byte index of the letter after (on) the cursor */
        uint8_t show : 1;        /**< Cursor is visible now or not (Handled by the library) */
        uint8_t click_pos : 1;   /**< 1: Enable positioning the cursor by clicking the text area */
    } cursor;
#if LV_LABEL_TEXT_SELECTION
    uint32_t sel_start;           /**< Temporary values for text selection */
    uint32_t sel_end;
    uint8_t text_sel_in_prog : 1; /**< User is in process of selecting */
    uint8_t text_sel_en : 1;      /**< Text can be selected on this text area */
#endif
    uint8_t pwd_mode : 1;         /**< Replace characters with '*' */
    uint8_t one_line : 1;         /**< One line mode (ignore line breaks) */
};


/**********************
 * GLOBAL PROTOTYPES
 **********************/

/**********************
 *      MACROS
 **********************/

#endif /* LV_USE_TEXTAREA != 0 */

#ifdef __cplusplus
} /*extern "C"*/
#endif

#endif /*LV_TEXTAREA_PRIVATE_H*/