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 Widgets.' },
9{'name': 'WIDTH',
10 'style_type': 'num',   'var_type': 'int32_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
11 'dsc': "Sets width of Widget. 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': 'int32_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': 'int32_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': 'int32_t' , 'default':'Widget dependent', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
23 'dsc': "Sets height of Widget. 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': 'int32_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': 'int32_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': 'LENGTH',
34 'style_type': 'num',   'var_type': 'int32_t' , 'default':'0', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
35 'dsc': "Its meaning depends on the type of Widget. For example in case of lv_scale it means the length of the ticks."},
36
37{'name': 'X',
38 'style_type': 'num',   'var_type': 'int32_t' , 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
39 'dsc': "Set X coordinate of Widget considering the ``align`` setting. Pixel and percentage values can be used. Percentage values are relative to the width of the parent's content area."},
40
41{'name': 'Y',
42 'style_type': 'num',   'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
43 'dsc': "Set Y coordinate of Widget considering the ``align`` setting. Pixel and percentage values can be used. Percentage values are relative to the height of the parent's content area."},
44
45{'name': 'ALIGN',
46 'style_type': 'num',   'var_type': 'lv_align_t', 'default':'`LV_ALIGN_DEFAULT`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
47 'dsc': "Set the alignment which tells from which point of the parent the X and Y coordinates should be interpreted. 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."},
48
49{'name': 'TRANSFORM_WIDTH',
50 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
51 'dsc': "Make Widget wider on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to Widget's width." },
52
53{'name': 'TRANSFORM_HEIGHT',
54  'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
55 'dsc': "Make Widget higher on both sides with this value. Pixel and percentage (with `lv_pct(x)`) values can be used. Percentage values are relative to Widget's height." },
56
57{'name': 'TRANSLATE_X',
58 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
59 'dsc': "Move Widget 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 Widget's width." },
60
61{'name': 'TRANSLATE_Y',
62 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
63 'dsc': "Move Widget 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 Widget's height." },
64
65{'name': 'TRANSLATE_RADIAL',
66'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
67 'dsc': "Move object around the centre of the parent object (e.g. around the circumference of a scale)"},
68
69{'name': 'TRANSFORM_SCALE_X',
70 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
71 'dsc': "Zoom Widget horizontally. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on" },
72
73{'name': 'TRANSFORM_SCALE_Y',
74 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
75 'dsc': "Zoom Widget vertically. The value 256 (or `LV_SCALE_NONE`) means normal size, 128 half size, 512 double size, and so on" },
76
77{'name': 'TRANSFORM_ROTATION',
78 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
79 'dsc': "Rotate Widget. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
80
81{'name': 'TRANSFORM_PIVOT_X',
82 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
83 'dsc': "Set pivot point's X coordinate for transformations. Relative to Widget's top left corner'"},
84
85{'name': 'TRANSFORM_PIVOT_Y',
86 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
87 'dsc': "Set pivot point's Y coordinate for transformations. Relative to Widget's top left corner'"},
88
89{'name': 'TRANSFORM_SKEW_X',
90 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
91 'dsc': "Skew Widget horizontally. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
92
93{'name': 'TRANSFORM_SKEW_Y',
94  'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 1,
95  'dsc': "Skew Widget vertically. The value is interpreted in 0.1 degree units. E.g. 450 means 45 deg."},
96
97{'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."},
98{'name': 'PAD_TOP',
99 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
100 'dsc': "Sets the padding on the top. It makes the content area smaller in this direction."},
101
102{'name': 'PAD_BOTTOM',
103 'style_type': 'num',   'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
104 'dsc': "Sets the padding on the bottom. It makes the content area smaller in this direction."},
105
106{'name': 'PAD_LEFT',
107 'style_type': 'num',   'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
108 'dsc': "Sets the padding on the left. It makes the content area smaller in this direction."},
109
110{'name': 'PAD_RIGHT',
111  'style_type': 'num',   'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
112 'dsc': "Sets the padding on the right. It makes the content area smaller in this direction."},
113
114{'name': 'PAD_ROW',
115 'style_type': 'num',   'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
116 'dsc': "Sets the padding between the rows. Used by the layouts."},
117
118{'name': 'PAD_COLUMN',
119 'style_type': 'num',   'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
120 'dsc': "Sets the padding between the columns. Used by the layouts."},
121
122{'name': 'PAD_RADIAL',
123'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
124 'dsc': "Pad text labels away from the scale ticks/remainder of the ``LV_PART_``"},
125
126{'section': 'Margin', 'dsc' : "Properties to describe spacing around a Widget. Very similar to the margin properties in HTML."},
127{'name': 'MARGIN_TOP',
128 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
129 'dsc': "Sets margin on the top. Widget will keep this space from its siblings in layouts."},
130
131{'name': 'MARGIN_BOTTOM',
132 'style_type': 'num',   'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
133 'dsc': "Sets margin on the bottom. Widget will keep this space from its siblings in layouts."},
134
135{'name': 'MARGIN_LEFT',
136 'style_type': 'num',   'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
137 'dsc': "Sets margin on the left. Widget will keep this space from its siblings in layouts."},
138
139{'name': 'MARGIN_RIGHT',
140  'style_type': 'num',   'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
141 'dsc': "Sets margin on the right. Widget will keep this space from its siblings in layouts."},
142
143{'section': 'Background', 'dsc':'Properties to describe the background color and image of Widget.' },
144{'name': 'BG_COLOR',
145 'style_type': 'color', 'var_type': 'lv_color_t', 'default':'`0xffffff`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
146 'dsc': "Set background color of Widget."},
147
148{'name': 'BG_OPA',
149 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
150 'dsc': "Set 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."},
151
152{'name': 'BG_GRAD_COLOR',
153 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
154 'dsc': "Set gradient color of the background. Used only if `grad_dir` is not `LV_GRAD_DIR_NONE`"},
155
156{'name': 'BG_GRAD_DIR',
157 'style_type': 'num',   'var_type': 'lv_grad_dir_t',  'default':'`LV_GRAD_DIR_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
158 'dsc': "Set direction of the gradient of the background. Possible values are `LV_GRAD_DIR_NONE/HOR/VER`."},
159
160{'name': 'BG_MAIN_STOP',
161 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
162 'dsc': "Set point from which background color should start for gradients. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"},
163
164{'name': 'BG_GRAD_STOP',
165 'style_type': 'num',   'var_type': 'int32_t',  'default':255, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
166 'dsc': "Set point from which background's gradient color should start. 0 means to top/left side, 255 the bottom/right side, 128 the center, and so on"},
167
168{'name': 'BG_MAIN_OPA',
169 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':255, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
170 'dsc': "Set opacity of the first gradient color"},
171
172{'name': 'BG_GRAD_OPA',
173 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':255, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
174 'dsc': "Set opacity of the second gradient color"},
175
176{'name': 'BG_GRAD',
177 'style_type': 'ptr',   'var_type': 'const lv_grad_dsc_t *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
178 'dsc': "Set gradient definition. The pointed instance must exist while Widget 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 as well. If it's set other gradient related properties will be ignored'"},
179
180{'name': 'BG_IMAGE_SRC',
181 'style_type': 'ptr',   'var_type': 'const void *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
182 'dsc': "Set a background image. Can be a pointer to `lv_image_dsc_t`, a path to a file or an `LV_SYMBOL_...`"},
183
184{'name': 'BG_IMAGE_OPA',
185 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
186 'dsc': "Set 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."},
187
188{'name': 'BG_IMAGE_RECOLOR',
189 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
190 'dsc': "Set a color to mix to the background image."},
191
192{'name': 'BG_IMAGE_RECOLOR_OPA',
193 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
194 'dsc': "Set 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."},
195
196{'name': 'BG_IMAGE_TILED',
197 'style_type': 'num',   'var_type': 'bool',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
198 'dsc': "If enabled the background image will be tiled. Possible values are `true` or `false`."},
199
200{'section': 'Border', 'dsc':'Properties to describe the borders' },
201{'name': 'BORDER_COLOR',
202 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
203 'dsc': "Set color of the border"},
204
205{'name': 'BORDER_OPA',
206 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
207 'dsc': "Set 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."},
208
209{'name': 'BORDER_WIDTH',
210 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
211 'dsc': "Set width of the border. Only pixel values can be used."},
212
213{'name': 'BORDER_SIDE',
214 'style_type': 'num',   'var_type': 'lv_border_side_t',  'default':'`LV_BORDER_SIDE_NONE`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
215 'dsc': "Set only which side(s) the border should be drawn. 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`."},
216
217{'name': 'BORDER_POST',
218'style_type': 'num',   'var_type': 'bool' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
219 'dsc': "Sets whether the border should be drawn before or after the children are drawn. `true`: after children, `false`: before children"},
220
221{'section': 'Outline', 'dsc':'Properties to describe the outline. It\'s like a border but drawn outside of the rectangles.' },
222{'name': 'OUTLINE_WIDTH',
223 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
224 'dsc': "Set width of outline in pixels."},
225
226{'name': 'OUTLINE_COLOR',
227 'style_type': 'color', 'var_type': 'lv_color_t' ,  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
228 'dsc': "Set color of outline."},
229
230{'name': 'OUTLINE_OPA',
231'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
232 'dsc': "Set opacity of 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."},
233
234{'name': 'OUTLINE_PAD',
235 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
236 'dsc': "Set padding of outline, i.e. the gap between Widget and the outline."},
237
238{'section': 'Shadow', 'dsc':'Properties to describe the shadow drawn under the rectangles.' },
239{'name': 'SHADOW_WIDTH',
240 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
241 'dsc': "Set width of the shadow in pixels. The value should be >= 0."},
242
243{'name': 'SHADOW_OFFSET_X',
244 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
245 'dsc': "Set an offset on the shadow in pixels in X direction."},
246
247{'name': 'SHADOW_OFFSET_Y',
248 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
249 'dsc': "Set an offset on the shadow in pixels in Y direction."},
250
251{'name': 'SHADOW_SPREAD',
252 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
253 'dsc': "Make shadow calculation to use a larger or smaller rectangle as base. The value can be in pixels to make the area larger/smaller"},
254
255{'name': 'SHADOW_COLOR',
256  'style_type': 'color', 'var_type': 'lv_color_t' ,  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
257 'dsc': "Set color of shadow"},
258
259{'name': 'SHADOW_OPA',
260 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 1,
261 'dsc': "Set opacity of 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."},
262
263{'section': 'Image', 'dsc':'Properties to describe the images' },
264{'name': 'IMAGE_OPA',
265 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
266 'dsc': "Set 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."},
267
268{'name': 'IMAGE_RECOLOR',
269 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
270 'dsc': "Set color to mix with the image."},
271
272{'name': 'IMAGE_RECOLOR_OPA',
273 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
274 'dsc': "Set intensity of 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."},
275
276{'section': 'Line', 'dsc':'Properties to describe line-like Widgets' },
277{'name': 'LINE_WIDTH',
278 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
279 'dsc': "Set width of lines in pixels."},
280
281{'name': 'LINE_DASH_WIDTH',
282 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
283 'dsc': "Set width of dashes in pixels. Note that dash works only on horizontal and vertical lines"},
284
285{'name': 'LINE_DASH_GAP',
286 'style_type': 'num',   'var_type': 'int32_t',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
287 'dsc': "Set gap between dashes in pixels. Note that dash works only on horizontal and vertical lines"},
288
289{'name': 'LINE_ROUNDED',
290 'style_type': 'num',   'var_type': 'bool' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
291 'dsc': "Make end points of the lines rounded. `true`: rounded, `false`: perpendicular line ending"},
292
293{'name': 'LINE_COLOR',
294 'style_type': 'color', 'var_type': 'lv_color_t' ,  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
295 'dsc': "Set color of lines."},
296
297{'name': 'LINE_OPA',
298 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
299 'dsc': "Set opacity of lines."},
300
301{'section': 'Arc', 'dsc':'TODO' },
302{'name': 'ARC_WIDTH',
303 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 1,
304 'dsc': "Set width (thickness) of arcs in pixels."},
305
306{'name': 'ARC_ROUNDED',
307 'style_type': 'num',   'var_type': 'bool' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
308 'dsc': "Make end points of arcs rounded. `true`: rounded, `false`: perpendicular line ending"},
309
310{'name': 'ARC_COLOR',
311 'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 0, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
312 'dsc': "Set color of arc."},
313
314{'name': 'ARC_OPA',
315 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_COVER`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
316 'dsc': "Set opacity of arcs."},
317
318{'name': 'ARC_IMAGE_SRC',
319 'style_type': 'ptr',   'var_type': 'const void *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
320 'dsc': "Set an image from which arc will be masked out. It's useful to display complex effects on the arcs. Can be a pointer to `lv_image_dsc_t` or a path to a file"},
321
322{'section': 'Text', 'dsc':'Properties to describe the properties of text. All these properties are inherited.' },
323{'name': 'TEXT_COLOR',
324'style_type': 'color', 'var_type': 'lv_color_t',  'default':'`0x000000`', 'inherited': 1, 'layout': 0, 'ext_draw': 0, 'filtered': 1,
325 'dsc': "Sets color of text."},
326
327{'name': 'TEXT_OPA',
328 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
329 'dsc': "Set opacity of 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."},
330
331{'name': 'TEXT_FONT',
332 'style_type': 'ptr',   'var_type': 'const lv_font_t *',  'default':'`LV_FONT_DEFAULT`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
333 'dsc': "Set font of text (a pointer `lv_font_t *`)."},
334
335{'name': 'TEXT_LETTER_SPACE',
336'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
337 'dsc': "Set letter space in pixels"},
338
339{'name': 'TEXT_LINE_SPACE',
340 'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 1, 'layout': 1, 'ext_draw': 0,
341 'dsc': "Set line space in pixels."},
342
343{'name': 'TEXT_DECOR',
344 'style_type': 'num',   'var_type': 'lv_text_decor_t' ,  'default':'`LV_TEXT_DECOR_NONE`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
345 'dsc': "Set decoration for the text. Possible values are `LV_TEXT_DECOR_NONE/UNDERLINE/STRIKETHROUGH`. OR-ed values can be used as well." },
346
347{'name': 'TEXT_ALIGN',
348'style_type': 'num',   'var_type': 'lv_text_align_t' ,  'default':'`LV_TEXT_ALIGN_AUTO`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
349 'dsc': "Set how to align the lines of the text. Note that it doesn't align the Widget itself, only the lines inside the Widget. 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"},
350
351{'section': 'Miscellaneous', 'dsc':'Mixed properties for various purposes.' },
352{'name': 'RADIUS',
353 'style_type': 'num', 'var_type': 'int32_t', 'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
354 'dsc': "Set radius on every corner. The value is interpreted in pixels (>= 0) or `LV_RADIUS_CIRCLE` for max. radius"},
355
356{'name': 'RADIAL_OFFSET',
357'style_type': 'num',   'var_type': 'int32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
358 'dsc': "Move start point of object (e.g. scale tick) radially"},
359
360{'name': 'CLIP_CORNER',
361 'style_type': 'num',   'var_type': 'bool',  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
362 'dsc': "Enable to clip the overflowed content on the rounded corner. Can be `true` or `false`." },
363
364{'name': 'OPA',
365 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
366 'dsc': "Scale down all opacity values of the Widget 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." },
367
368{'name': 'OPA_LAYERED',
369 'style_type': 'num',   'var_type': 'lv_opa_t',  'default':'`LV_OPA_COVER`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
370 'dsc': "First draw Widget on the layer, then scale down layer opacity 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." },
371
372{'name': 'COLOR_FILTER_DSC',
373 'style_type': 'ptr',   'var_type': 'const lv_color_filter_dsc_t *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
374 'dsc': "Mix a color with all colors of the Widget." },
375
376{'name': 'COLOR_FILTER_OPA',
377 'style_type': 'num',   'var_type': 'lv_opa_t' ,  'default':'`LV_OPA_TRANSP`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
378 'dsc': "The intensity of mixing of color filter."},
379
380 {'name': 'ANIM',
381 'style_type': 'ptr',   'var_type': 'const lv_anim_t *',  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
382 'dsc': "Animation template for Widget'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 Widgets' documentation to learn more."},
383
384{'name': 'ANIM_DURATION',
385 'style_type': 'num',   'var_type': 'uint32_t' ,  'default':0, 'inherited': 0, 'layout': 0, 'ext_draw': 0,
386 'dsc': "Animation duration 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 Widgets' documentation to learn more."},
387
388{'name': 'TRANSITION',
389 'style_type': 'ptr',   'var_type': 'const lv_style_transition_dsc_t *' ,  'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
390 'dsc': "An initialized ``lv_style_transition_dsc_t`` to describe a transition."},
391
392{'name': 'BLEND_MODE',
393 'style_type': 'num',   'var_type': 'lv_blend_mode_t' ,  'default':'`LV_BLEND_MODE_NORMAL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
394 'dsc': "Describes how to blend the colors to the background. Possible values are `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE/MULTIPLY`"},
395
396{'name': 'LAYOUT',
397 'style_type': 'num',   'var_type': 'uint16_t', 'default':0, 'inherited': 0, 'layout': 1, 'ext_draw': 0,
398 'dsc': "Set layout of Widget. Children will be repositioned and resized according to policies set for the layout. For possible values see documentation of the layouts."},
399
400{'name': 'BASE_DIR',
401 'style_type': 'num',   'var_type': 'lv_base_dir_t', 'default':'`LV_BASE_DIR_AUTO`', 'inherited': 1, 'layout': 1, 'ext_draw': 0,
402 'dsc': "Set base direction of Widget. Possible values are `LV_BIDI_DIR_LTR/RTL/AUTO`."},
403
404{'name': 'BITMAP_MASK_SRC',
405 'style_type': 'ptr',   'var_type': 'const void *', 'default':'`NULL`', 'inherited': 0, 'layout': 0, 'ext_draw': 0,
406 'dsc': "If set, a layer will be created for the widget and the layer will be masked with this A8 bitmap mask."},
407
408{'name': 'ROTARY_SENSITIVITY',
409 'style_type': 'num',   'var_type': 'uint32_t', 'default':'`256`', 'inherited': 1, 'layout': 0, 'ext_draw': 0,
410 'dsc': "Adjust sensitivity for rotary encoders in 1/256 unit. It means, 128: slow down the rotary to half, 512: speeds up to double, 256: no change"},
411
412{'section': 'Flex', 'dsc':'Flex layout properties.',  'guard':'LV_USE_FLEX'},
413
414
415{'name': 'FLEX_FLOW',
416 'style_type': 'num',   'var_type': 'lv_flex_flow_t', 'default':'`LV_FLEX_FLOW_NONE`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
417 'dsc': "Defines in which direct the flex layout should arrange the children"},
418
419
420{'name': 'FLEX_MAIN_PLACE',
421 'style_type': 'num',   'var_type': 'lv_flex_align_t', 'default':'`LV_FLEX_ALIGN_NONE`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
422 'dsc': "Defines how to align the children in the direction of flex flow"},
423
424
425{'name': 'FLEX_CROSS_PLACE',
426 'style_type': 'num',   'var_type': 'lv_flex_align_t', 'default':'`LV_FLEX_ALIGN_NONE`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
427 'dsc': "Defines how to align the children perpendicular to the direction of flex flow"},
428
429
430{'name': 'FLEX_TRACK_PLACE',
431 'style_type': 'num',   'var_type': 'lv_flex_align_t', 'default':'`LV_FLEX_ALIGN_NONE`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
432 'dsc': "Defines how to align the tracks of the flow"},
433
434{'name': 'FLEX_GROW',
435 'style_type': 'num',   'var_type': 'uint8_t', 'default':'`LV_FLEX_ALIGN_ROW`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
436 'dsc': "Defines how much space to take proportionally from the free space of the Widget's track"},
437
438
439
440{'section': 'Grid', 'dsc':'Grid layout properties.', 'guard':'LV_USE_GRID'},
441
442
443{'name': 'GRID_COLUMN_DSC_ARRAY',
444 'style_type': 'ptr',   'var_type': 'const int32_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
445 'dsc': "An array to describe the columns of the grid. Should be LV_GRID_TEMPLATE_LAST terminated"},
446
447{'name': 'GRID_COLUMN_ALIGN',
448 'style_type': 'num',   'var_type': 'lv_grid_align_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
449 'dsc': "Defines how to distribute the columns"},
450
451
452{'name': 'GRID_ROW_DSC_ARRAY',
453 'style_type': 'ptr',   'var_type': 'const int32_t *', 'default':'`NULL`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
454 'dsc': "An array to describe the rows of the grid. Should be LV_GRID_TEMPLATE_LAST terminated"},
455
456{'name': 'GRID_ROW_ALIGN',
457 'style_type': 'num',   'var_type': 'lv_grid_align_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
458 'dsc': "Defines how to distribute the rows."},
459
460{'name': 'GRID_CELL_COLUMN_POS',
461 'style_type': 'num',   'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
462 'dsc': "Set column in which Widget should be placed."},
463
464{'name': 'GRID_CELL_X_ALIGN',
465 'style_type': 'num',   'var_type': 'lv_grid_align_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
466 'dsc': "Set how to align Widget horizontally."},
467
468{'name': 'GRID_CELL_COLUMN_SPAN',
469 'style_type': 'num',   'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
470 'dsc': "Set how many columns Widget should span. Needs to be >= 1."},
471
472{'name': 'GRID_CELL_ROW_POS',
473 'style_type': 'num',   'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
474 'dsc': "Set row in which Widget should be placed."},
475
476{'name': 'GRID_CELL_Y_ALIGN',
477 'style_type': 'num',   'var_type': 'lv_grid_align_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
478 'dsc': "Set how to align Widget vertically."},
479
480{'name': 'GRID_CELL_ROW_SPAN',
481 'style_type': 'num',   'var_type': 'int32_t', 'default':'`LV_GRID_ALIGN_START`', 'inherited': 0, 'layout': 1, 'ext_draw': 0,
482 'dsc': "Set how many rows Widget should span. Needs to be >= 1."},
483]
484
485
486def style_get_cast(style_type, var_type):
487  cast = ""
488  if style_type != 'color':
489    cast = "(" + var_type + ")"
490  return cast
491
492
493def obj_style_get(p):
494  if 'section' in p: return
495
496  cast = style_get_cast(p['style_type'], p['var_type'])
497  print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"(const lv_obj_t * obj, lv_part_t part)")
498  print("{")
499  print("    lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_" + p['name'] + ");")
500  print("    return " + cast + "v." + p['style_type'] + ";")
501  print("}")
502  print("")
503
504  if 'filtered' in p and p['filtered']:
505    print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"_filtered(const lv_obj_t * obj, lv_part_t part)")
506    print("{")
507    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'] + "));")
508    print("    return " + cast + "v." + p['style_type'] + ";")
509    print("}")
510    print("")
511
512
513
514def style_set_cast(style_type):
515  cast = ""
516  if style_type == 'num':
517    cast = "(int32_t)"
518  return cast
519
520
521def style_set_c(p):
522  if 'section' in p: return
523
524  cast = style_set_cast(p['style_type'])
525  print("")
526  print("void lv_style_set_" + p['name'].lower() +"(lv_style_t * style, "+ p['var_type'] +" value)")
527  print("{")
528  print("    lv_style_value_t v = {")
529  print("        ." + p['style_type'] +" = " + cast + "value")
530  print("    };")
531  print("    lv_style_set_prop(style, LV_STYLE_" + p['name'] +", v);")
532  print("}")
533
534
535def style_set_h(p):
536  if 'section' in p: return
537
538  print("void lv_style_set_" + p['name'].lower() +"(lv_style_t * style, "+ p['var_type'] +" value);")
539
540
541def local_style_set_c(p):
542  if 'section' in p: return
543
544  cast = style_set_cast(p['style_type'])
545  print("")
546  print("void lv_obj_set_style_" + p['name'].lower() + "(lv_obj_t * obj, " + p['var_type'] +" value, lv_style_selector_t selector)")
547  print("{")
548  print("    lv_style_value_t v = {")
549  print("        ." + p['style_type'] +" = " + cast + "value")
550  print("    };")
551  print("    lv_obj_set_local_style_prop(obj, LV_STYLE_" + p['name'] +", v, selector);")
552  print("}")
553
554
555def local_style_set_h(p):
556  if 'section' in p: return
557  print("void lv_obj_set_style_" + p['name'].lower() + "(lv_obj_t * obj, " + p['var_type'] +" value, lv_style_selector_t selector);")
558
559
560def style_const_set(p):
561  if 'section' in p: return
562
563  cast = style_set_cast(p['style_type'])
564  print("")
565  print("#define LV_STYLE_CONST_" + p['name'] + "(val) \\")
566  print("    { \\")
567  print("        .prop = LV_STYLE_" + p['name'] + ", .value = { ." + p['style_type'] +" = " + cast + "val } \\")
568  print("    }")
569
570
571def docs(p):
572  if "section" in p:
573    print("")
574    print(p['section'])
575    print("-" * len(p['section']))
576    print("")
577    print(p['dsc'])
578    return
579
580  if "default" not in p: return
581
582  d = str(p["default"])
583
584  i = "No"
585  if p["inherited"]: i = "Yes"
586
587  l = "No"
588  if p["layout"]: l = "Yes"
589
590  e = "No"
591  if p["ext_draw"]: e = "Yes"
592
593  li_style = "style='display:inline-block; margin-right: 20px; margin-left: 0px"
594
595  dsc = p['dsc']
596
597  print("")
598  print(p["name"].lower())
599  print("~" * len(p["name"].lower()))
600  print("")
601  print(dsc)
602
603
604  print("")
605  print(".. raw:: html")
606  print("")
607  print("  <ul>")
608  print("  <li " + li_style + "'><strong>Default</strong> " + d + "</li>")
609  print("  <li " + li_style + "'><strong>Inherited</strong> " + i + "</li>")
610  print("  <li " + li_style + "'><strong>Layout</strong> " + l + "</li>")
611  print("  <li " + li_style + "'><strong>Ext. draw</strong> " + e + "</li>")
612  print("  </ul>")
613
614def guard_proc(p):
615  global guard
616  if 'section' in p:
617    if guard:
618      guard_close()
619    if 'guard' in p:
620      guard = p['guard']
621      print(f"#if {guard}")
622
623def guard_close():
624  global guard
625  if guard:
626    print(f"#endif /*{guard}*/\n")
627  guard = ""
628
629base_dir = os.path.abspath(os.path.dirname(__file__))
630sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.h', 'w')
631
632
633HEADING = f'''
634/*
635 **********************************************************************
636 *                            DO NOT EDIT
637 * This file is automatically generated by "{os.path.split(__file__)[-1]}"
638 **********************************************************************
639 */
640
641'''
642
643print(HEADING)
644print('#ifndef LV_OBJ_STYLE_GEN_H')
645print('#define LV_OBJ_STYLE_GEN_H')
646print()
647print('''\
648#ifdef __cplusplus
649extern "C" {
650#endif
651''')
652print("#include \"../misc/lv_area.h\"")
653print("#include \"../misc/lv_style.h\"")
654print("#include \"../core/lv_obj_style.h\"")
655print("#include \"../misc/lv_types.h\"")
656print()
657
658guard = ""
659for p in props:
660  guard_proc(p)
661  obj_style_get(p)
662guard_close()
663
664for p in props:
665  guard_proc(p)
666  local_style_set_h(p)
667guard_close()
668
669print()
670print('''\
671#ifdef __cplusplus
672} /* extern "C" */
673#endif
674''')
675
676print('#endif /* LV_OBJ_STYLE_GEN_H */')
677
678sys.stdout = open(base_dir + '/../src/core/lv_obj_style_gen.c', 'w')
679
680print(HEADING)
681print("#include \"lv_obj.h\"")
682print()
683
684for p in props:
685  guard_proc(p)
686  local_style_set_c(p)
687guard_close()
688
689sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.c', 'w')
690
691print(HEADING)
692print("#include \"lv_style.h\"")
693print()
694
695for p in props:
696  guard_proc(p)
697  style_set_c(p)
698guard_close()
699
700sys.stdout = open(base_dir + '/../src/misc/lv_style_gen.h', 'w')
701
702print(HEADING)
703print('#ifndef LV_STYLE_GEN_H')
704print('#define LV_STYLE_GEN_H')
705print()
706print('''\
707#ifdef __cplusplus
708extern "C" {
709#endif
710''')
711
712for p in props:
713  guard_proc(p)
714  style_set_h(p)
715guard_close()
716
717for p in props:
718  guard_proc(p)
719  style_const_set(p)
720guard_close()
721
722print()
723print('''\
724#ifdef __cplusplus
725} /* extern "C" */
726#endif
727''')
728print('#endif /* LV_STYLE_GEN_H */')
729
730sys.stdout = open(base_dir + '/../docs/details/base-widget/styles/style-properties.rst', 'w')
731
732print('.. _style_properties:')
733print()
734print('================')
735print('Style Properties')
736print('================')
737
738for p in props:
739  docs(p)
740