1 /**
2  * @file lv_scale_private.h
3  *
4  */
5 
6 #ifndef LV_SCALE_PRIVATE_H
7 #define LV_SCALE_PRIVATE_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 
17 #include "lv_scale.h"
18 
19 #if LV_USE_SCALE != 0
20 #include "../../core/lv_obj_private.h"
21 
22 /*********************
23  *      DEFINES
24  *********************/
25 
26 /**********************
27  *      TYPEDEFS
28  **********************/
29 
30 struct _lv_scale_section_t {
31     lv_style_t * main_style;               /**< Style to use for MAIN part(s) of scale
32                                             *   when it falls within this section's range */
33     lv_style_t * indicator_style;          /**< Style to use for INDICATOR part(s) of scale
34                                             *   when it falls within this section's range */
35     lv_style_t * items_style;              /**< Style to use for ITEMS part(s) of scale
36                                             *   when it falls within this section's range */
37     int32_t range_min;                     /**< Scale parts with value >= this value will be drawn using applicable style. */
38     int32_t range_max;                     /**< Scale parts with value <= this value will be drawn using applicable style. */
39     uint32_t first_tick_idx_in_section;    /**< Internal (set during drawing): Tick index of first tick that falls within
40                                             *   this section; LV_SCALE_TICK_IDX_DEFAULT_ID if section contains no ticks. */
41     uint32_t last_tick_idx_in_section;     /**< Internal (set during drawing): Tick index of last tick that falls within
42                                             *   this section; LV_SCALE_TICK_IDX_DEFAULT_ID if section contains no ticks. */
43     int32_t first_tick_in_section_width;   /**< Internal (set during drawing) */
44     int32_t last_tick_in_section_width;    /**< Internal (set during drawing) */
45     lv_point_t first_tick_in_section;      /**< Internal (set during drawing) */
46     lv_point_t last_tick_in_section;       /**< Internal (set during drawing) */
47     uint32_t first_tick_idx_is_major : 1;  /**< Internal (set during drawing): true if
48                                             * `first_tick_idx_in_section` represents a major tick. */
49     uint32_t last_tick_idx_is_major  : 1;  /**< Internal (set during drawing): true if
50                                             * `last_tick_idx_in_section` represents a major tick. */
51 };
52 
53 struct _lv_scale_t {
54     lv_obj_t obj;                      /**< Base Widget part of Scale */
55     lv_ll_t section_ll;                /**< Linked list for the sections (stores lv_scale_section_t)*/
56     const char ** txt_src;             /**< Optional list of text strings for major ticks
57                                         *   when custom labels are provided. */
58     lv_scale_mode_t mode;              /**< Orientation and layout of scale. */
59     int32_t range_min;                 /**< Scale's minimum value */
60     int32_t range_max;                 /**< Scale's maximum value */
61     uint32_t total_tick_count   : 15;  /**< Total number of ticks (major and minor) */
62     uint32_t major_tick_every   : 15;  /**< Frequency of major ticks to minor ticks */
63     uint32_t label_enabled      : 1;   /**< Draw labels for major ticks? */
64     uint32_t post_draw          : 1;   /**< false: drawing occurs during LV_EVENT_DRAW_MAIN;
65                                         *   true : drawing occurs during LV_EVENT_DRAW_POST. */
66     uint32_t draw_ticks_on_top  : 1;   /**< Draw ticks on top of main line? */
67     /* Round scale */
68     uint32_t angle_range;              /**< Degrees between low end and high end of scale */
69     int32_t rotation;                  /**< Clockwise angular offset from 3-o'clock position of low end of scale */
70     /* Private properties */
71     int32_t custom_label_cnt;          /**< Number of custom labels provided in `txt_src` */
72     int32_t last_tick_width;           /**< Width of last tick in pixels */
73     int32_t first_tick_width;          /**< Width of first tick in pixels */
74 };
75 
76 
77 /**********************
78  * GLOBAL PROTOTYPES
79  **********************/
80 
81 /**********************
82  *      MACROS
83  **********************/
84 
85 #endif /* LV_USE_SCALE != 0 */
86 
87 #ifdef __cplusplus
88 } /*extern "C"*/
89 #endif
90 
91 #endif /*LV_SCALE_PRIVATE_H*/
92