1#!/usr/bin/env python3
2
3import os
4import re
5import sys
6
7props = [
8{'section': 'Size and position', 'dsc':'Properties related to size, position, alignment and layout of the objects.' },
9{'name': 'WIDTH',
10 'style_type': 'num',   'var_type': 'lv_coord_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
11 'dsc': "Sets the width of object. Pixel, percentage and `LV_SIZE_CONTENT` values can be used. Percentage values are relative to the width of the parent's content area."},
12
13{'name': 'MIN_WIDTH',
14 'style_type': 'num',   'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
15 'dsc': "Sets a minimal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
16
17{'name': 'MAX_WIDTH',
18 'style_type': 'num',   'var_type': 'lv_coord_t' , 'default':'LV_COORD_MAX', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
19 'dsc': "Sets a maximal width. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
20
21{'name': 'HEIGHT',
22 'style_type': 'num',   'var_type': 'lv_coord_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
23 'dsc': "Sets the height of object. Pixel, percentage and `LV_SIZE_CONTENT` can be used. Percentage values are relative to the height of the parent's content area."},
24
25{'name': 'MIN_HEIGHT',
26 'style_type': 'num',   'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
27 'dsc': "Sets a minimal height. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
28
29{'name': 'MAX_HEIGHT',
30 'style_type': 'num',   'var_type': 'lv_coord_t' , 'default':'LV_COORD_MAX', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
31 'dsc': "Sets a maximal height. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."},
32
33{'name': 'X',
34 'style_type': 'num',   'var_type': 'lv_coord_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
35 'dsc': "Set the X coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
36
37{'name': 'Y',
38 'style_type': 'num',   'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
39 'dsc': "Set the Y coordinate of the object considering the set `align`. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."},
40
41{'name': 'ALIGN',
42 'style_type': 'num',   'var_type': 'lv_align_t', 'default':'`LV_ALIGN_DEFAULT`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
43 'dsc': "Set the alignment which tells from which point of the parent the X and Y coordinates should be interpreted. The possible values are: `LV_ALIGN_DEFAULT`, `LV_ALIGN_TOP_LEFT/MID/RIGHT`, `LV_ALIGN_BOTTOM_LEFT/MID/RIGHT`, `LV_ALIGN_LEFT/RIGHT_MID`, `LV_ALIGN_CENTER`. `LV_ALIGN_DEFAULT` means `LV_ALIGN_TOP_LEFT` with LTR base direction and `LV_ALIGN_TOP_RIGHT` with RTL base direction."},
44
45{'name': 'TRANSFORM_WIDTH',
46 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
47 'dsc': "Make the object wider on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." },
48
49{'name': 'TRANSFORM_HEIGHT',
50  'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
51 'dsc': "Make the object higher on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." },
52
53{'name': 'TRANSLATE_X',
54 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
55 'dsc': "Move the object with this value in X direction. Applied after layouts, aligns and other positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's width." },
56
57{'name': 'TRANSLATE_Y',
58 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
59 'dsc': "Move the object with this value in Y direction. Applied after layouts, aligns and other positioning. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to the object's height." },
60
61{'name': 'TRANSFORM_ZOOM',
62 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
63 'dsc': "Zoom an objects. The value 256 (or `LV_IMG_ZOOM_NONE`) means normal size, 128 half size, 512 double size, and so on" },
64
65{'name': 'TRANSFORM_ANGLE',
66 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
67 'dsc': "Rotate an objects. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
68
69{'name': 'TRANSFORM_PIVOT_X',
70 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
71 'dsc': "Set the pivot point's X coordinate for transformations. Relative to the object's top left corner'"},
72
73{'name': 'TRANSFORM_PIVOT_Y',
74 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
75 'dsc': "Set the pivot point's Y coordinate for transformations. Relative to the object's top left corner'"},
76
77{'section': 'Padding', 'dsc' : "Properties to describe spacing between the parent's sides and the children and among the children. Very similar to the padding properties in HTML."},
78{'name': 'PAD_TOP',
79 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
80 'dsc': "Sets the padding on the top. It makes the content area smaller in this direction."},
81
82{'name': 'PAD_BOTTOM',
83 'style_type': 'num',   'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
84 'dsc': "Sets the padding on the bottom. It makes the content area smaller in this direction."},
85
86{'name': 'PAD_LEFT',
87 'style_type': 'num',   'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
88 'dsc': "Sets the padding on the left. It makes the content area smaller in this direction."},
89
90{'name': 'PAD_RIGHT',
91  'style_type': 'num',   'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
92 'dsc': "Sets the padding on the right. It makes the content area smaller in this direction."},
93
94{'name': 'PAD_ROW',
95 'style_type': 'num',   'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
96 'dsc': "Sets the padding between the rows. Used by the layouts."},
97
98{'name': 'PAD_COLUMN',
99 'style_type': 'num',   'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
100 'dsc': "Sets the padding between the columns. Used by the layouts."},
101
102{'section': 'Background', 'dsc':'Properties to describe the background color and image of the objects.' },
103{'name': 'BG_COLOR',
104 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0xffffff`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
105 'dsc': "Set the background color of the object."},
106
107{'name': 'BG_OPA',
108 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
109 'dsc': "Set the opacity of the background. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
110
111{'name': 'BG_GRAD_COLOR',
112 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
113 'dsc': "Set the gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`"},
114
115{'name': 'BG_GRAD_DIR',
116 'style_type': 'num',   'var_type': 'lv_grad_dir_t',  'default':'`LV_GRAD_DIR_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
117 'dsc': "Set the direction of the gradient of the background. The possible values are `LV_GRAD_DIR_NONE/HOR/VER`."},
118
119{'name': 'BG_MAIN_STOP',
120 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
121 'dsc': "Set the point from which the background color should start for gradients. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"},
122
123{'name': 'BG_GRAD_STOP',
124 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':255, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
125 'dsc': "Set the point from which the background's gradient color should start. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"},
126
127{'name': 'BG_GRAD',
128 'style_type': 'ptr',   'var_type': 'const lv_grad_dsc_t *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
129 'dsc': "Set the gradient definition. The pointed instance must exist while the object is alive. NULL to disable. It wraps `BG_GRAD_COLOR`, `BG_GRAD_DIR`, `BG_MAIN_STOP` and `BG_GRAD_STOP` into one descriptor and allows creating gradients with more colors too."},
130
131{'name': 'BG_DITHER_MODE',
132 'style_type': 'num',   'var_type': 'lv_dither_mode_t',  'default':'`LV_DITHER_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
133 'dsc': "Set the dithering mode of the gradient of the background. The possible values are `LV_DITHER_NONE/ORDERED/ERR_DIFF`."},
134
135{'name': 'BG_IMG_SRC',
136 'style_type': 'ptr',   'var_type': 'const void *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
137 'dsc': "Set a background image. Can be a pointer to `lv_img_dsc_t`, a path to a file or an `LV_SYMBOL_...`"},
138
139{'name': 'BG_IMG_OPA',
140 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
141 'dsc': "Set the opacity of the background image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
142
143{'name': 'BG_IMG_RECOLOR',
144 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
145 'dsc': "Set a color to mix to the background image."},
146
147{'name': 'BG_IMG_RECOLOR_OPA',
148 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
149 'dsc': "Set the intensity of background image recoloring. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means no mixing, 255, `LV_OPA_100` or `LV_OPA_COVER` means full recoloring, other values or LV_OPA_10, LV_OPA_20, etc are interpreted proportionally."},
150
151{'name': 'BG_IMG_TILED',
152 'style_type': 'num',   'var_type': 'bool',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
153 'dsc': "If enabled the background image will be tiled. The possible values are `true` or `false`."},
154
155{'section': 'Border', 'dsc':'Properties to describe the borders' },
156{'name': 'BORDER_COLOR',
157 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
158 'dsc': "Set the color of the border"},
159
160{'name': 'BORDER_OPA',
161 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
162 'dsc': "Set the opacity of the border. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
163
164{'name': 'BORDER_WIDTH',
165 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
166 'dsc': "Set hte width of the border. Only pixel values can be used."},
167
168{'name': 'BORDER_SIDE',
169 'style_type': 'num',   'var_type': 'lv_border_side_t',  'default':'`LV_BORDER_SIDE_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
170 'dsc': "Set only which side(s) the border should be drawn. The possible values are `LV_BORDER_SIDE_NONE/TOP/BOTTOM/LEFT/RIGHT/INTERNAL`. OR-ed values can be used as well, e.g. `LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_LEFT`."},
171
172{'name': 'BORDER_POST',
173'style_type': 'num',   'var_type': 'bool' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
174 'dsc': "Sets whether the border should be drawn before or after the children are drawn. `true`: after children, `false`: before children"},
175
176{'section': 'Outline', 'dsc':'Properties to describe the outline. It\'s like a border but drawn outside of the rectangles.' },
177{'name': 'OUTLINE_WIDTH',
178 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
179 'dsc': "Set the width of the outline in pixels. "},
180
181{'name': 'OUTLINE_COLOR',
182 'style_type': 'color', 'var_type': 'lv_color_t' ,  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
183 'dsc': "Set the color of the outline."},
184
185{'name': 'OUTLINE_OPA',
186'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
187 'dsc': "Set the opacity of the outline. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
188
189{'name': 'OUTLINE_PAD',
190 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
191 'dsc': "Set the padding of the outline, i.e. the gap between object and the outline."},
192
193{'section': 'Shadow', 'dsc':'Properties to describe the shadow drawn under the rectangles.' },
194{'name': 'SHADOW_WIDTH',
195 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
196 'dsc': "Set the width of the shadow in pixels. The value should be >= 0."},
197
198{'name': 'SHADOW_OFS_X',
199 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
200 'dsc': "Set an offset on the shadow in pixels in X direction. "},
201
202{'name': 'SHADOW_OFS_Y',
203 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
204 'dsc': "Set an offset on the shadow in pixels in Y direction. "},
205
206{'name': 'SHADOW_SPREAD',
207 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
208 'dsc': "Make the shadow calculation to use a larger or smaller rectangle as base. The value can be in pixel to make the area larger/smaller"},
209
210{'name': 'SHADOW_COLOR',
211  'style_type': 'color', 'var_type': 'lv_color_t' ,  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
212 'dsc': "Set the color of the shadow"},
213
214{'name': 'SHADOW_OPA',
215 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
216 'dsc': "Set the opacity of the shadow. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
217
218{'section': 'Image', 'dsc':'Properties to describe the images' },
219{'name': 'IMG_OPA',
220 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
221 'dsc': "Set the opacity of an image. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
222
223{'name': 'IMG_RECOLOR',
224 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
225 'dsc': "Set color to mixt to the image."},
226
227{'name': 'IMG_RECOLOR_OPA',
228 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
229 'dsc': "Set the intensity of the color mixing. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
230
231{'section': 'Line', 'dsc':'Properties to describe line-like objects' },
232{'name': 'LINE_WIDTH',
233 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
234 'dsc': "Set the width of the lines in pixel."},
235
236{'name': 'LINE_DASH_WIDTH',
237 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
238 'dsc': "Set the width of dashes in pixel. Note that dash works only on horizontal and vertical lines"},
239
240{'name': 'LINE_DASH_GAP',
241 'style_type': 'num',   'var_type': 'lv_coord_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
242 'dsc': "Set the gap between dashes in pixel. Note that dash works only on horizontal and vertical lines"},
243
244{'name': 'LINE_ROUNDED',
245 'style_type': 'num',   'var_type': 'bool' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
246 'dsc': "Make the end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending "},
247
248{'name': 'LINE_COLOR',
249 'style_type': 'color', 'var_type': 'lv_color_t' ,  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
250 'dsc': "Set the color fo the lines."},
251
252{'name': 'LINE_OPA',
253 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
254 'dsc': "Set the opacity of the lines."},
255
256{'section': 'Arc', 'dsc':'TODO' },
257{'name': 'ARC_WIDTH',
258 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
259 'dsc': "Set the width (thickness) of the arcs in pixel."},
260
261{'name': 'ARC_ROUNDED',
262 'style_type': 'num',   'var_type': 'bool' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
263 'dsc': "Make the end points of the arcs rounded. `true`: rounded, `false`: perpendicular line ending "},
264
265{'name': 'ARC_COLOR',
266 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
267 'dsc': "Set the color of the arc."},
268
269{'name': 'ARC_OPA',
270 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
271 'dsc': "Set the opacity of the arcs."},
272
273{'name': 'ARC_IMG_SRC',
274 'style_type': 'ptr',   'var_type': 'const void *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
275 'dsc': "Set an image from which the arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_img_dsc_t` or a path to a file"},
276
277{'section': 'Text', 'dsc':'Properties to describe the properties of text. All these properties are inherited.' },
278{'name': 'TEXT_COLOR',
279'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 1, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
280 'dsc': "Sets the color of the text."},
281
282{'name': 'TEXT_OPA',
283 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
284 'dsc': "Set the opacity of the text. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency."},
285
286{'name': 'TEXT_FONT',
287 'style_type': 'ptr',   'var_type': 'const lv_font_t *',  'default':'`LV_FONT_DEFAULT`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
288 'dsc': "Set the font of the text (a pointer `lv_font_t *`). "},
289
290{'name': 'TEXT_LETTER_SPACE',
291'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
292 'dsc': "Set the letter space in pixels"},
293
294{'name': 'TEXT_LINE_SPACE',
295 'style_type': 'num',   'var_type': 'lv_coord_t' ,  'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
296 'dsc': "Set the line space in pixels."},
297
298{'name': 'TEXT_DECOR',
299 'style_type': 'num',   'var_type': 'lv_text_decor_t' ,  'default':'`LV_TEXT_DECOR_NONE`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
300 'dsc': "Set decoration for the text. The possible values are `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well." },
301
302{'name': 'TEXT_ALIGN',
303'style_type': 'num',   'var_type': 'lv_text_align_t' ,  'default':'`LV_TEXT_ALIGN_AUTO`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
304 'dsc': "Set how to align the lines of the text. Note that it doesn't align the object itself, only the lines inside the object. The possible values are `LV_TEXT_ALIGN_LEFT/CENTER/RIGHT/AUTO`. `LV_TEXT_ALIGN_AUTO` detect the text base direction and uses left or right alignment accordingly"},
305
306{'section': 'Miscellaneous', 'dsc':'Mixed properties for various purposes.' },
307{'name': 'RADIUS',
308 'style_type': 'num', 'var_type': 'lv_coord_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
309 'dsc': "Set the radius on every corner. The value is interpreted in pixel (>= 0) or `LV_RADIUS_CIRCLE` for max. radius"},
310
311{'name': 'CLIP_CORNER',
312 'style_type': 'num',   'var_type': 'bool',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
313 'dsc': "Enable to clip the overflowed content on the rounded corner. Can be `true` or `false`." },
314
315{'name': 'OPA',
316 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
317 'dsc': "Scale down all opacity values of the object by this factor. Value 0, `LV_OPA_0` or `LV_OPA_TRANSP` means fully transparent, 255, `LV_OPA_100` or `LV_OPA_COVER` means fully covering, other values or LV_OPA_10, LV_OPA_20, etc means semi transparency." },
318
319{'name': 'COLOR_FILTER_DSC',
320 'style_type': 'ptr',   'var_type': 'const lv_color_filter_dsc_t *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
321 'dsc': "Mix a color to all colors of the object." },
322
323{'name': 'COLOR_FILTER_OPA',
324 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
325 'dsc': "The intensity of mixing of color filter."},
326
327 {'name': 'ANIM',
328 'style_type': 'ptr',   'var_type': 'const lv_anim_t *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
329 'dsc': "The animation template for the object's animation. Should be a pointer to `lv_anim_t`. The animation parameters are widget specific, e.g. animation time could be the E.g. blink time of the cursor on the text area or scroll time of a roller. See the widgets' documentation to learn more."},
330
331{'name': 'ANIM_TIME',
332 'style_type': 'num',   'var_type': 'uint32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
333 'dsc': "The animation time in milliseconds. Its meaning is widget specific. E.g. blink time of the cursor on the text area or scroll time of a roller. See the widgets' documentation to learn more."},
334
335{'name': 'ANIM_SPEED',
336 'style_type': 'num',   'var_type': 'uint32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
337 'dsc': "The animation speed in pixel/sec. Its meaning is widget specific. E.g. scroll speed of label. See the widgets' documentation to learn more."},
338
339{'name': 'TRANSITION',
340 'style_type': 'ptr',   'var_type': 'const lv_style_transition_dsc_t *' ,  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
341 'dsc': "An initialized `lv_style_transition_dsc_t` to describe a transition."},
342
343{'name': 'BLEND_MODE',
344 'style_type': 'num',   'var_type': 'lv_blend_mode_t' ,  'default':'`LV_BLEND_MODE_NORMAL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
345 'dsc': "Describes how to blend the colors to the background. The possible values are `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY`"},
346
347{'name': 'LAYOUT',
348 'style_type': 'num',   'var_type': 'uint16_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
349 'dsc': "Set the layout if the object. The children will be repositioned and resized according to the policies set for the layout. For the possible values see the documentation of the layouts."},
350
351{'name': 'BASE_DIR',
352 'style_type': 'num',   'var_type': 'lv_base_dir_t', 'default':'`LV_BASE_DIR_AUTO`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
353 'dsc': "Set the base direction of the object. The possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`."},
354]
355
356
357def style_get_cast(style_type, var_type):
358  cast = ""
359  if style_type != 'color':
360    cast = "(" + var_type + ")"
361  return cast
362
363
364def obj_style_get(p):
365  if 'section' in p: return
366
367  cast = style_get_cast(p['style_type'], p['var_type'])
368  print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"(const struct _lv_obj_t * obj, uint32_t part)")
369  print("{")
370  print("    lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_" + p['name'] + ");")
371  print("    return " + cast + "v." + p['style_type'] + ";")
372  print("}")
373  print("")
374
375  if 'filtered' in p and p['filtered']:
376    print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"_filtered(const struct _lv_obj_t * obj, uint32_t part)")
377    print("{")
378    print("    lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_" + p['name'] + "));")
379    print("    return " + cast + "v." + p['style_type'] + ";")
380    print("}")
381    print("")
382
383
384
385def style_set_cast(style_type):
386  cast = ""
387  if style_type == 'num':
388    cast = "(int32_t)"
389  return cast
390
391
392def style_set_c(p):
393  if 'section' in p: return
394
395  cast = style_set_cast(p['style_type'])
396  print("")
397  print("void lv_style_set_" + p['name'].lower() +"(lv_style_t * style, "+ p['var_type'] +" value)")
398  print("{")
399  print("    lv_style_value_t v = {")
400  print("        ." + p['style_type'] +" = " + cast + "value")
401  print("    };")
402  print("    lv_style_set_prop(style, LV_STYLE_" + p['name'] +", v);")
403  print("}")
404
405
406def style_set_h(p):
407  if 'section' in p: return
408
409  print("void lv_style_set_" + p['name'].lower() +"(lv_style_t * style, "+ p['var_type'] +" value);")
410
411
412def local_style_set_c(p):
413  if 'section' in p: return
414
415  cast = style_set_cast(p['style_type'])
416  print("")
417  print("void lv_obj_set_style_" + p['name'].lower() + "(struct _lv_obj_t * obj, " + p['var_type'] +" value, lv_style_selector_t selector)")
418  print("{")
419  print("    lv_style_value_t v = {")
420  print("        ." + p['style_type'] +" = " + cast + "value")
421  print("    };")
422  print("    lv_obj_set_local_style_prop(obj, LV_STYLE_" + p['name'] +", v, selector);")
423  print("}")
424
425
426def local_style_set_h(p):
427  if 'section' in p: return
428  print("void lv_obj_set_style_" + p['name'].lower() + "(struct _lv_obj_t * obj, " + p['var_type'] +" value, lv_style_selector_t selector);")
429
430
431def style_const_set(p):
432  if 'section' in p: return
433
434  cast = style_set_cast(p['style_type'])
435  print("")
436  print("#define LV_STYLE_CONST_" + p['name'] + "(val) \\")
437  print("    { \\")
438  print("        .prop = LV_STYLE_" + p['name'] + ", .value = { ." + p['style_type'] +" = " + cast + "val } \\")
439  print("    }")
440
441
442def docs(p):
443  if "section" in p:
444    print("")
445    print("## " + p['section'])
446    print(p['dsc'])
447    return
448
449  if "default" not in p: return
450
451  d = str(p["default"])
452
453  i = "No"
454  if p["inherited"]: i = "Yes"
455
456  l = "No"
457  if p["layout"]: l = "Yes"
458
459  e = "No"
460  if p["ext_draw"]: e = "Yes"
461
462  li_style = "style='display:inline; margin-right: 20px; margin-left: 0px"
463
464  dsc = p['dsc']
465
466  print("")
467  print("### " + p["name"].lower())
468  print(dsc)
469
470  print("<ul>")
471  print("<li " + li_style + "'><strong>Default</strong> " + d + "</li>")
472  print("<li " + li_style + "'><strong>Inherited</strong> " + i + "</li>")
473  print("<li " + li_style + "'><strong>Layout</strong> " + l + "</li>")
474  print("<li " + li_style + "'><strong>Ext. draw</strong> " + e + "</li>")
475  print("</ul>")
476
477
478base_dir = os.path.abspath(os.path.dirname(__file__))
479sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.h', 'w')
480
481for p in props:
482  obj_style_get(p)
483
484for p in props:
485  local_style_set_h(p)
486
487sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.c', 'w')
488
489print("#include \"lv_obj.h\"")
490for p in props:
491  local_style_set_c(p)
492
493sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.c', 'w')
494
495print("#include \"lv_style.h\"")
496for p in props:
497  style_set_c(p)
498
499sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.h', 'w')
500
501for p in props:
502  style_set_h(p)
503
504for p in props:
505  style_const_set(p)
506
507sys.stdout = open(base_dir + '/../docs/overview/style-props.md', 'w')
508
509print('# Style properties')
510for p in props:
511  docs(p)
512