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