1 #ifndef _WIDGET_STYLE_H 2 #define _WIDGET_STYLE_H 3 4 #include "render_public.h" 5 6 #ifdef __cplusplus 7 extern "C" { 8 #endif 9 #define STYLE_MAX_CLASS_SELECTOR_ONCE 32 10 11 typedef enum { 12 //css_parse_start, 13 css_parse_selector_start, 14 css_parse_selector_id, 15 16 css_parse_selector_class_flag, 17 css_parse_selector_class, 18 19 css_parse_property, 20 css_parse_value, 21 css_parse_finish, 22 css_parse_invalid, 23 }css_parse_state_e; 24 25 typedef enum { 26 style_width, 27 style_height, 28 style_top, 29 style_left, 30 style_align, 31 32 style_main_color, 33 style_grad_color, 34 style_radius, 35 style_opacity, 36 style_border_color, 37 style_border_width, 38 style_border_part, 39 style_border_opacity, 40 41 style_shadow_color, 42 style_shadow_width, 43 style_shadow_type, 44 45 46 style_padding_ver, 47 style_padding_hor, 48 // style_padding_left, 49 // style_padding_right, 50 style_padding_inner, 51 52 style_text_size, 53 style_text_color, 54 style_text_sel_color, 55 style_text_font, 56 style_text_letter_space, 57 style_text_line_space, 58 style_text_opacity, 59 style_text_align, 60 61 style_image_color, 62 style_image_intense, 63 style_image_opacity, 64 65 66 style_line_color, 67 style_line_width, 68 style_line_opacity, 69 style_line_type, 70 71 style_position, 72 style_z_index, 73 74 style_max, 75 }widget_style_type_e; 76 77 78 typedef enum { 79 style_data_none = 0, 80 style_data_uint, 81 style_data_int, 82 style_data_float, 83 style_data_bool, 84 style_data_str, 85 style_data_color, 86 87 style_data_type_max, 88 }widget_data_type_e; 89 90 91 typedef enum { 92 selector_none = 0, 93 selector_id, 94 selector_class, 95 selector_max, 96 }widget_style_selector_e; 97 98 99 typedef enum { 100 position_static, 101 position_fix, 102 position_absolute, 103 position_invalid, 104 }widget_position_e; 105 106 typedef struct _widget_style_t { 107 widget_style_selector_e selector; 108 widget_data_type_e type; 109 union { 110 int val_none; 111 uint32_t val_uint; 112 int32_t val_int; 113 float val_float; 114 bool val_bool; 115 char *str; 116 widget_color val_color; 117 }; 118 } widget_style_t; 119 120 121 typedef struct _widget_user_style_t { 122 widget_style_t *sheet; 123 uint32_t length; 124 } widget_user_style_t; 125 126 typedef struct _widget_basic_style_t { 127 uint16_t width; 128 uint16_t height; 129 uint16_t top; 130 uint16_t left; 131 uint16_t align; 132 uint16_t text_align; 133 134 int z_index; 135 widget_position_e position; 136 }widget_basic_style_t; 137 138 typedef struct _widget_common_style_t { 139 widget_basic_style_t basic_style; 140 lv_style_t style; 141 }widget_common_style_t; 142 143 typedef struct _amp_widget_style_t { 144 widget_style_t *style; 145 bool flag; 146 uint32_t style_len; 147 int cur_style; 148 int cur_val; 149 char *class; 150 }amp_widget_style_t; 151 152 typedef struct _widget_style_class_t { 153 amp_widget_style_t widget_style; 154 list_node_t node; 155 }widget_style_class_t; 156 157 typedef struct _widget_style_handle_t { 158 amp_widget_style_t *handle[STYLE_MAX_CLASS_SELECTOR_ONCE]; 159 uint32_t num; 160 }widget_style_handle_t; 161 162 163 #ifdef __cplusplus 164 } /* extern "C" */ 165 #endif 166 167 #endif /*_WIDGET_STYLE_H*/ 168 169