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