From eb1fe43595c29a46e305be128de9c6d356eec606 Mon Sep 17 00:00:00 2001 From: Liam <30486941+liamHowatt@users.noreply.github.com> Date: Tue, 30 Apr 2024 05:00:05 -0400 Subject: [PATCH] chore(style): use lv_part_t type where suitable (#6075) --- docs/overview/draw.rst | 377 ----------------------------------- docs/overview/index.rst | 1 - scripts/style_api_gen.py | 4 +- src/core/lv_obj_draw.c | 12 +- src/core/lv_obj_draw.h | 12 +- src/core/lv_obj_style.c | 4 +- src/core/lv_obj_style.h | 14 +- src/core/lv_obj_style_gen.c | 3 +- src/core/lv_obj_style_gen.h | 261 ++++++++++++------------ src/draw/lv_draw.h | 2 +- src/widgets/scale/lv_scale.c | 6 +- src/widgets/scale/lv_scale.h | 2 +- 12 files changed, 156 insertions(+), 542 deletions(-) delete mode 100644 docs/overview/draw.rst diff --git a/docs/overview/draw.rst b/docs/overview/draw.rst deleted file mode 100644 index df14d2aa2..000000000 --- a/docs/overview/draw.rst +++ /dev/null @@ -1,377 +0,0 @@ -.. _drawing: - -======= -Drawing -======= - -With LVGL, you don't need to draw anything manually. Just create objects -(like buttons, labels, arc, etc.), move and change them, and LVGL will -refresh and redraw what is required. - -However, it can be useful to have a basic understanding of how drawing -happens in LVGL to add customization, make it easier to find bugs or -just out of curiosity. - -The basic concept is to not draw directly onto the display but rather to -first draw on an internal draw buffer. When a drawing (rendering) is -ready that buffer is copied to the display. - -The draw buffer can be smaller than a display's size. LVGL will simply -render in "tiles" that fit into the given draw buffer. - -This approach has two main advantages compared to directly drawing to -the display: - -1. It avoids flickering while the layers of the UI are - drawn. For example, if LVGL drew directly onto the display, when drawing - a *background + button + text*, each "stage" would be visible for a short time. -2. It's faster to modify a buffer in internal RAM and - finally write one pixel only once than reading/writing the display - directly on each pixel access. (e.g. via a display controller with SPI interface). - -Note that this concept is different from "traditional" double buffering -where there are two display sized frame buffers: one holds the current -image to show on the display, and rendering happens to the other -(inactive) frame buffer, and they are swapped when the rendering is -finished. The main difference is that with LVGL you don't have to store -two frame buffers (which usually requires external RAM) but only smaller -draw buffer(s) that can easily fit into internal RAM. - -.. _drawing_screen_refresh: - -Mechanism of screen refreshing -****************************** - -Be sure to get familiar with the `Buffering modes of LVGL `__ first. - -LVGL refreshes the screen in the following steps: - -1. Something happens -in the UI which requires redrawing. For example, a button is pressed, a -chart is changed, an animation happened, etc. - -2. LVGL saves the changed object's old and new area into a buffer, called an *Invalid area - buffer*. For optimization, in some cases, objects are not added to the buffer: - - - Hidden objects are not added. - - Objects completely out of their parent are not added. - - Areas partially out of the parent are cropped to the parent's area. - - Objects on other screens are not added. - -3. In every :c:macro:`LV_DEF_REFR_PERIOD` (set in ``lv_conf.h``) the - following happens: - - - LVGL checks the invalid areas and joins those that are adjacent or intersecting. - - Takes the first joined area, if it's smaller than the *draw buffer*, then simply renders the area's content - into the *draw buffer*. If the area doesn't fit into the buffer, draw as many lines as possible to the *draw buffer*. - - When the area is rendered, call ``flush_cb`` from the display driver to refresh the display. - - If the area was larger than the buffer, render the remaining parts too. - - Repeat the same with remaining joined areas. - -When an area is redrawn the library searches the top-most object which -covers that area and starts drawing from that object. For example, if a -button's label has changed, the library will see that it's enough to -draw the button under the text and it's not necessary to redraw the -display under the rest of the button too. - -The difference between buffering modes regarding the drawing mechanism -is the following: - -1. **One buffer** - LVGL needs to wait for :cpp:func:`lv_display_flush_ready` (called from ``flush_cb``) before starting to redraw the next part. -2. **Two buffers** - LVGL can immediately draw to the second buffer when the first is sent to ``flush_cb`` because the - flushing should be done by DMA (or similar hardware) in the background. -3. **Double buffering** - ``flush_cb`` should only swap the addresses of the frame buffers. - -.. _drawing_masking: - -Masking -******* - -*Masking* is the basic concept of LVGL's draw engine. To use LVGL it's -not required to know about the mechanisms described here but you might -find interesting to know how drawing works under hood. Knowing about -masking comes in handy if you want to customize drawing. - -To learn about masking let's see the steps of drawing first. LVGL -performs the following steps to render any shape, image or text. It can -be considered as a drawing pipeline. - -1. **Prepare the draw descriptors** Create a draw descriptor from an - object's styles (e.g. :cpp:struct:`lv_draw_rect_dsc_t`). This gives us the - parameters for drawing, for example colors, widths, opacity, fonts, - radius, etc. -2. **Call the draw function** Call the draw function with the draw - descriptor and some other parameters (e.g. :cpp:func:`lv_draw_rect`). It - will render the primitive shape to the current draw buffer. -3. **Create masks** If the shape is very simple and doesn't require - masks, go to #5. Otherwise, create the required masks in the draw - function. (e.g. a rounded rectangle mask) -4. **Calculate all the added mask** It composites opacity values into a - *mask buffer* with the "shape" of the created masks. E.g. in case of - a "line mask" according to the parameters of the mask, keep one side - of the buffer as it is (255 by default) and set the rest to 0 to - indicate that this side should be removed. -5. **Blend a color or image** During blending, masking (make some pixels - transparent or opaque), blending modes (additive, subtractive, etc.) - and color/image opacity are handled. - -LVGL has the following built-in mask types which can be calculated and -applied real-time: - -- :cpp:enumerator:`LV_DRAW_MASK_TYPE_LINE`: Removes a side from a - line (top, bottom, left or right). :cpp:func:`lv_draw_line` uses four instances - of it. Essentially, every (skew) line is bounded with four line masks - forming a rectangle. -- :cpp:enumerator:`LV_DRAW_MASK_TYPE_RADIUS`: Removes the inner or - outer corners of a rectangle with a radiused transition. It's also used - to create circles by setting the radius to large value - (:c:macro:`LV_RADIUS_CIRCLE`) -- :cpp:enumerator:`LV_DRAW_MASK_TYPE_ANGLE`: Removes a circular - sector. It is used by :cpp:func:`lv_draw_arc` to remove the "empty" sector. -- :cpp:enumerator:`LV_DRAW_MASK_TYPE_FADE`: Create a vertical fade (change opacity) -- :cpp:enumerator:`LV_DRAW_MASK_TYPE_MAP`: The mask is stored in a bitmap array and the - necessary parts are applied - -Masks are used to create almost every basic primitive: - -- **letters**: Create a mask from the letter and draw a rectangle with the letter's color using the mask. -- **line**: Created from four "line masks" to mask out the left, right, top and bottom part of the line to get a perfectly perpendicular perimeter. -- **rounded rectangle**: A mask is created real-time to add a radius to the corners. -- **clip corner**: To clip overflowing content (usually children) on rounded corners, a rounded rectangle mask is also applied. -- **rectangle border**: Same as a rounded rectangle but the inner part is masked out too. -- **arc drawing**: A circular border is drawn but an arc mask is applied too. -- **ARGB images**: The alpha channel is separated into a mask and the image is drawn as a normal RGB image. - -Using masks ------------ - -Every mask type has a related parameter structure to describe the mask's -data. The following parameter types exist: - -- :cpp:type:`lv_draw_mask_line_param_t` -- :cpp:type:`lv_draw_mask_radius_param_t` -- :cpp:type:`lv_draw_mask_angle_param_t` -- :cpp:type:`lv_draw_mask_fade_param_t` -- :cpp:type:`lv_draw_mask_map_param_t` - -1. Initialize a mask parameter with ``lv_draw_mask__init``. See - ``lv_draw_mask.h`` for the whole API. -2. Add the mask parameter to the draw engine with - ``int16_t mask_id =`` :cpp:expr:`lv_draw_mask_add(¶m, ptr)`. ``ptr`` can be - any pointer to identify the mask, (``NULL`` if unused). -3. Call the draw functions -4. Remove the mask from the draw engine with - :cpp:expr:`lv_draw_mask_remove_id(mask_id)` or - :cpp:expr:`lv_draw_mask_remove_custom(ptr)`. -5. Free the parameter with :cpp:expr:`lv_draw_mask_free_param(¶m)`. - -A parameter can be added and removed any number of times, but it needs -to be freed when not required anymore. - -:cpp:func:`lv_draw_mask_add` saves only the pointer of the mask so the parameter -needs to be valid while in use. - -.. _drawing_hooks: - -Hook drawing -************ - -Although widgets can be easily customized by styles there might be cases -when something more custom is required. To ensure a great level of -flexibility LVGL sends a lot of events during drawing with parameters -that tell what LVGL is about to draw. Some fields of these parameters -can be modified to draw something else or any custom drawing operations -can be added manually. - -A good use case for this is the :ref:`Button matrix ` -widget. By default, its buttons can be styled in different states, but -you can't style the buttons one by one. However, an event is sent for -every button and you can, for example, tell LVGL to use different colors -on a specific button or to manually draw an image on some buttons. - -Each of these events is described in detail below. - -.. _drawing_hooks_main: - -Main drawing ------------- - -These events are related to the actual drawing of an object. E.g. the -drawing of buttons, texts, etc. happens here. - -:cpp:expr:`lv_event_get_draw_ctx(event)` can be used to get the current draw ctx -and in that structure is the clip area. The clip area is required in draw functions to make them draw only -on a limited area. - -LV_EVENT_DRAW_MAIN_BEGIN -^^^^^^^^^^^^^^^^^^^^^^^^ - -Sent before starting to draw an object. This is a good place to add -masks manually. E.g. add a line mask that "removes" the right side of an -object. - -LV_EVENT_DRAW_MAIN -^^^^^^^^^^^^^^^^^^ - -The actual drawing of an object happens in this event. E.g. a rectangle -for a button is drawn here. First, the widgets' internal events are -called to perform drawing and after that you can draw anything on top of -them. For example you can add a custom text or an image. - -LV_EVENT_DRAW_MAIN_END -^^^^^^^^^^^^^^^^^^^^^^ - -Called when the main drawing is finished. You can draw anything here as -well and it's also a good place to remove any masks created in -:cpp:enumerator:`LV_EVENT_DRAW_MAIN_BEGIN`. - -.. _drawing_hooks_post: - -Post drawing ------------- - -Post drawing events are called when all the children of an object are -drawn. For example LVGL use the post drawing phase to draw scrollbars -because they should be above all of the children. - -:cpp:expr:`lv_event_get_draw_ctx(event)` can be used to get the current draw ctx -and in that structure is the clip area. The clip area is required in draw functions to make them draw only -on a limited area. - -LV_EVENT_DRAW_POST_BEGIN -^^^^^^^^^^^^^^^^^^^^^^^^ - -Sent before starting the post draw phase. Masks can be added here too to -mask out the post drawn content. - -LV_EVENT_DRAW_POST -^^^^^^^^^^^^^^^^^^ - -The actual drawing should happen here. - -LV_EVENT_DRAW_POST_END -^^^^^^^^^^^^^^^^^^^^^^ - -Called when post drawing has finished. If masks were not removed in -:cpp:enumerator:`LV_EVENT_DRAW_MAIN_END` they should be removed here. - -.. _drawing_hooks_parts: - -Part drawing ------------- - -When LVGL draws a part of an object (e.g. a slider's indicator, a -table's cell or a button matrix's button) it sends events before and -after drawing that part with some context of the drawing. This allows -changing the parts on a very low level with masks, extra drawing, or -changing the parameters that LVGL is planning to use for drawing. - -In these events an :cpp:struct:`lv_obj_draw_part_dsc_t` structure is used to describe -the context of the drawing. Not all fields are set for every part and -widget. To see which fields are set for a widget refer to the widget's -documentation. - -:cpp:struct:`lv_obj_draw_part_dsc_t` has the following fields: - -.. code:: c - - typedef struct { - lv_draw_ctx_t * draw_ctx; /**< Draw context*/ - const lv_obj_class_t * class_p; /**< The class that sent the event */ - uint32_t type; /**< The type if part being draw. Element of `lv__draw_part_type_t` */ - lv_area_t * draw_area; /**< The area of the part being drawn*/ - lv_draw_rect_dsc_t * - rect_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for rectangle-like parts*/ - lv_draw_label_dsc_t * - label_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for text-like parts*/ - lv_draw_line_dsc_t * - line_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for line-like parts*/ - lv_draw_img_dsc_t * - img_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for image-like parts*/ - lv_draw_arc_dsc_t * - arc_dsc; /**< A draw descriptor that can be modified to changed what LVGL will draw. Set only for arc-like parts*/ - const lv_point_t * - p1; /**< A point calculated during drawing. E.g. a point of chart or the center of an arc.*/ - const lv_point_t * p2; /**< A point calculated during drawing. E.g. a point of chart.*/ - char * text; /**< A text calculated during drawing. Can be modified. E.g. tick labels on a chart axis.*/ - uint32_t text_length; /**< Size of the text buffer containing null-terminated text string calculated during drawing.*/ - uint32_t part; /**< The current part for which the event is sent*/ - uint32_t id; /**< The index of the part. E.g. a button's index on button matrix or table cell index.*/ - int32_t radius; /**< E.g. the radius of an arc (not the corner radius).*/ - int32_t value; /**< A value calculated during drawing. E.g. Chart's tick line value.*/ - const void * sub_part_ptr; /**< A pointer the identifies something in the part. E.g. chart series. */ - } lv_obj_draw_part_dsc_t; - -:cpp:expr:`lv_event_get_draw_part_dsc(event)` can be used to get a pointer to -:cpp:struct:`lv_obj_draw_part_dsc_t`. - -LV_EVENT_DRAW_PART_BEGIN -^^^^^^^^^^^^^^^^^^^^^^^^ - -Start the drawing of a part. This is a good place to modify the draw -descriptors (e.g. ``rect_dsc``), or add masks. - -LV_EVENT_DRAW_PART_END -^^^^^^^^^^^^^^^^^^^^^^ - -Finish the drawing of a part. This is a good place to draw extra content -on the part or remove masks added in :cpp:enumerator:`LV_EVENT_DRAW_PART_BEGIN`. - -.. _drawing_hooks_others: - -Others ------- - -LV_EVENT_COVER_CHECK -^^^^^^^^^^^^^^^^^^^^ - -This event is used to check whether an object fully covers an area or -not. - -:cpp:expr:`lv_event_get_cover_area(event)` returns a pointer to an area to check -and :cpp:expr:`lv_event_set_cover_res(event, res)` can be used to set one of -these results: - -- :cpp:enumerator:`LV_COVER_RES_COVER`: the area is fully covered by the object -- :cpp:enumerator:`LV_COVER_RES_NOT_COVER`: the area is not covered by the object -- :cpp:enumerator:`LV_COVER_RES_MASKED`: there is a mask on the object, so it does not fully cover the area - -Here are some reasons why an object would be unable to fully cover an -area: - -- It's simply not fully in area -- It has a radius -- It doesn't have 100% background opacity -- It's an ARGB or chroma keyed image -- It does not have normal blending mode. In this case LVGL needs to know the - colors under the object to apply blending properly -- It's a text, etc - -In short if for any reason the area below an object is visible than the -object doesn't cover that area. - -Before sending this event LVGL checks if at least the widget's -coordinates fully cover the area or not. If not the event is not called. - -You need to check only the drawing you have added. The existing -properties known by a widget are handled in its internal events. E.g. if -a widget has > 0 radius it might not cover an area, but you need to -handle ``radius`` only if you will modify it and the widget won't know -about it. - -LV_EVENT_REFR_EXT_DRAW_SIZE -^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -If you need to draw outside a widget, LVGL needs to know about it to -provide extra space for drawing. Let's say you create an event which -writes the current value of a slider above its knob. In this case LVGL -needs to know that the slider's draw area should be larger with the size -required for the text. - -You can simply set the required draw area with -:cpp:expr:`lv_event_set_ext_draw_size(e, size)`. - -.. _drawing_api: - -API -*** diff --git a/docs/overview/index.rst b/docs/overview/index.rst index 4ae76adee..94f0abe45 100644 --- a/docs/overview/index.rst +++ b/docs/overview/index.rst @@ -23,7 +23,6 @@ Overview fs animations timer - draw profiler renderers/index new_widget diff --git a/scripts/style_api_gen.py b/scripts/style_api_gen.py index 91688a88f..622907243 100755 --- a/scripts/style_api_gen.py +++ b/scripts/style_api_gen.py @@ -482,7 +482,7 @@ def obj_style_get(p): if 'section' in p: return cast = style_get_cast(p['style_type'], p['var_type']) - print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"(const lv_obj_t * obj, uint32_t part)") + print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"(const lv_obj_t * obj, lv_part_t part)") print("{") print(" lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_" + p['name'] + ");") print(" return " + cast + "v." + p['style_type'] + ";") @@ -490,7 +490,7 @@ def obj_style_get(p): print("") if 'filtered' in p and p['filtered']: - print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"_filtered(const lv_obj_t * obj, uint32_t part)") + print("static inline " + p['var_type'] + " lv_obj_get_style_" + p['name'].lower() +"_filtered(const lv_obj_t * obj, lv_part_t part)") print("{") 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'] + "));") print(" return " + cast + "v." + p['style_type'] + ";") diff --git a/src/core/lv_obj_draw.c b/src/core/lv_obj_draw.c index 7587e7164..91be29380 100644 --- a/src/core/lv_obj_draw.c +++ b/src/core/lv_obj_draw.c @@ -37,7 +37,7 @@ * GLOBAL FUNCTIONS **********************/ -void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc) +void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc) { draw_dsc->base.obj = obj; draw_dsc->base.part = part; @@ -142,7 +142,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t } } -void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc_t * draw_dsc) +void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc) { draw_dsc->base.obj = obj; draw_dsc->base.part = part; @@ -171,7 +171,7 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc draw_dsc->align = lv_obj_get_style_text_align(obj, part); } -void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc_t * draw_dsc) +void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc) { draw_dsc->base.obj = obj; draw_dsc->base.part = part; @@ -197,7 +197,7 @@ void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part); } -void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc) +void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc) { draw_dsc->base.obj = obj; draw_dsc->base.part = part; @@ -227,7 +227,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t if(part != LV_PART_MAIN) draw_dsc->blend_mode = lv_obj_get_style_blend_mode(obj, part); } -void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc) +void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc) { draw_dsc->base.obj = obj; draw_dsc->base.part = part; @@ -250,7 +250,7 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc->rounded = lv_obj_get_style_arc_rounded(obj, part); } -int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part) +int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part) { int32_t s = 0; diff --git a/src/core/lv_obj_draw.h b/src/core/lv_obj_draw.h index ad4f08721..73b76c18a 100644 --- a/src/core/lv_obj_draw.h +++ b/src/core/lv_obj_draw.h @@ -44,7 +44,7 @@ typedef enum { * @note Only the relevant fields will be set. * E.g. if `border width == 0` the other border properties won't be evaluated. */ -void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * draw_dsc); +void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_rect_dsc_t * draw_dsc); /** * Initialize a label draw descriptor from an object's styles in its current state @@ -54,7 +54,7 @@ void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint32_t part, lv_draw_rect_dsc_t * If the `opa` field is set to or the property is equal to `LV_OPA_TRANSP` the rest won't be initialized. * Should be initialized with `lv_draw_label_dsc_init(draw_dsc)`. */ -void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc_t * draw_dsc); +void lv_obj_init_draw_label_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_label_dsc_t * draw_dsc); /** * Initialize an image draw descriptor from an object's styles in its current state @@ -63,7 +63,7 @@ void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint32_t part, lv_draw_label_dsc * @param draw_dsc the descriptor to initialize. * Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`. */ -void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc_t * draw_dsc); +void lv_obj_init_draw_image_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_image_dsc_t * draw_dsc); /** * Initialize a line draw descriptor from an object's styles in its current state @@ -72,7 +72,7 @@ void lv_obj_init_draw_image_dsc(lv_obj_t * obj, uint32_t part, lv_draw_image_dsc * @param draw_dsc the descriptor to initialize. * Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`. */ -void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * draw_dsc); +void lv_obj_init_draw_line_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_line_dsc_t * draw_dsc); /** * Initialize an arc draw descriptor from an object's styles in its current state @@ -81,7 +81,7 @@ void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint32_t part, lv_draw_line_dsc_t * @param draw_dsc the descriptor to initialize. * Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`. */ -void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * draw_dsc); +void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, lv_part_t part, lv_draw_arc_dsc_t * draw_dsc); /** * Get the required extra size (around the object's part) to draw shadow, outline, value etc. @@ -89,7 +89,7 @@ void lv_obj_init_draw_arc_dsc(lv_obj_t * obj, uint32_t part, lv_draw_arc_dsc_t * * @param part part of the object * @return the extra size required around the object */ -int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part); +int32_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, lv_part_t part); /** * Send a 'LV_EVENT_REFR_EXT_DRAW_SIZE' Call the ancestor's event handler to the object to refresh the value of the extended draw size. diff --git a/src/core/lv_obj_style.c b/src/core/lv_obj_style.c index bc5045301..8c944cec0 100644 --- a/src/core/lv_obj_style.c +++ b/src/core/lv_obj_style.c @@ -49,7 +49,7 @@ typedef enum { * STATIC PROTOTYPES **********************/ static lv_style_t * get_local_style(lv_obj_t * obj, lv_style_selector_t selector); -static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, uint32_t part); +static _lv_obj_style_t * get_trans_style(lv_obj_t * obj, lv_part_t part); static lv_style_res_t get_prop_core(const lv_obj_t * obj, lv_style_selector_t selector, lv_style_prop_t prop, lv_style_value_t * v); static void report_style_change_core(void * style, lv_obj_t * obj); @@ -464,7 +464,7 @@ void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t lv_anim_start(&a); } -lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v) +lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v) { if(obj == NULL) return v; const lv_color_filter_dsc_t * f = lv_obj_get_style_color_filter_dsc(obj, part); diff --git a/src/core/lv_obj_style.h b/src/core/lv_obj_style.h index 2de047217..c4ac4b141 100644 --- a/src/core/lv_obj_style.h +++ b/src/core/lv_obj_style.h @@ -187,7 +187,7 @@ bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_sty /** * Used internally for color filtering */ -lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, uint32_t part, lv_style_value_t v); +lv_style_value_t _lv_obj_style_apply_color_filter(const lv_obj_t * obj, lv_part_t part, lv_style_value_t v); /** * Used internally to create a style transition @@ -297,7 +297,7 @@ static inline void lv_obj_set_style_transform_scale(lv_obj_t * obj, int32_t valu lv_obj_set_style_transform_scale_y(obj, value, selector); } -static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, lv_part_t part) { int32_t padding = lv_obj_get_style_pad_left(obj, part); int32_t border_width = lv_obj_get_style_border_width(obj, part); @@ -305,7 +305,7 @@ static inline int32_t lv_obj_get_style_space_left(const lv_obj_t * obj, uint32_t return (border_side & LV_BORDER_SIDE_LEFT) ? padding + border_width : padding; } -static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, lv_part_t part) { int32_t padding = lv_obj_get_style_pad_right(obj, part); int32_t border_width = lv_obj_get_style_border_width(obj, part); @@ -313,7 +313,7 @@ static inline int32_t lv_obj_get_style_space_right(const lv_obj_t * obj, uint32_ return (border_side & LV_BORDER_SIDE_RIGHT) ? padding + border_width : padding; } -static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, lv_part_t part) { int32_t padding = lv_obj_get_style_pad_top(obj, part); int32_t border_width = lv_obj_get_style_border_width(obj, part); @@ -321,7 +321,7 @@ static inline int32_t lv_obj_get_style_space_top(const lv_obj_t * obj, uint32_t return (border_side & LV_BORDER_SIDE_TOP) ? padding + border_width : padding; } -static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, lv_part_t part) { int32_t padding = lv_obj_get_style_pad_bottom(obj, part); int32_t border_width = lv_obj_get_style_border_width(obj, part); @@ -331,13 +331,13 @@ static inline int32_t lv_obj_get_style_space_bottom(const lv_obj_t * obj, uint32 lv_text_align_t lv_obj_calculate_style_text_align(const lv_obj_t * obj, lv_part_t part, const char * txt); -static inline int32_t lv_obj_get_style_transform_scale_x_safe(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_scale_x_safe(const lv_obj_t * obj, lv_part_t part) { int16_t zoom = lv_obj_get_style_transform_scale_x(obj, part); return zoom != 0 ? zoom : 1; } -static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_scale_y_safe(const lv_obj_t * obj, lv_part_t part) { int16_t zoom = lv_obj_get_style_transform_scale_y(obj, part); return zoom != 0 ? zoom : 1; diff --git a/src/core/lv_obj_style_gen.c b/src/core/lv_obj_style_gen.c index 22862ae01..ad97db594 100644 --- a/src/core/lv_obj_style_gen.c +++ b/src/core/lv_obj_style_gen.c @@ -690,8 +690,7 @@ void lv_obj_set_style_opa_layered(lv_obj_t * obj, lv_opa_t value, lv_style_selec lv_obj_set_local_style_prop(obj, LV_STYLE_OPA_LAYERED, v, selector); } -void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value, - lv_style_selector_t selector) +void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector) { lv_style_value_t v = { .ptr = value diff --git a/src/core/lv_obj_style_gen.h b/src/core/lv_obj_style_gen.h index 663e4046b..aa9615fc4 100644 --- a/src/core/lv_obj_style_gen.h +++ b/src/core/lv_obj_style_gen.h @@ -18,668 +18,662 @@ extern "C" { #include "../misc/lv_style.h" #include "../core/lv_obj_style.h" -static inline int32_t lv_obj_get_style_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_WIDTH); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_min_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_min_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_WIDTH); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_max_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_max_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_WIDTH); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_height(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_height(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_HEIGHT); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_min_height(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_min_height(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MIN_HEIGHT); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_max_height(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_max_height(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MAX_HEIGHT); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_length(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_length(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LENGTH); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_x(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_x(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_X); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_y(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_y(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_Y); return (int32_t)v.num; } -static inline lv_align_t lv_obj_get_style_align(const lv_obj_t * obj, uint32_t part) +static inline lv_align_t lv_obj_get_style_align(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ALIGN); return (lv_align_t)v.num; } -static inline int32_t lv_obj_get_style_transform_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_WIDTH); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_transform_height(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_height(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_HEIGHT); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_translate_x(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_translate_x(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_X); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_translate_y(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_translate_y(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSLATE_Y); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_transform_scale_x(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_scale_x(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_X); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_transform_scale_y(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_scale_y(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SCALE_Y); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_transform_rotation(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_rotation(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_ROTATION); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_transform_pivot_x(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_pivot_x(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_X); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_transform_pivot_y(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_pivot_y(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_PIVOT_Y); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_transform_skew_x(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_skew_x(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_X); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_transform_skew_y(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_transform_skew_y(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSFORM_SKEW_Y); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_pad_top(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_top(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_TOP); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_pad_bottom(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_bottom(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_BOTTOM); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_pad_left(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_left(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_LEFT); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_pad_right(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_right(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_RIGHT); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_pad_row(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_row(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_ROW); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_pad_column(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_pad_column(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_PAD_COLUMN); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_margin_top(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_margin_top(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_TOP); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_margin_bottom(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_margin_bottom(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_BOTTOM); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_margin_left(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_margin_left(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_LEFT); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_margin_right(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_margin_right(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_MARGIN_RIGHT); return (int32_t)v.num; } -static inline lv_color_t lv_obj_get_style_bg_color(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_bg_color(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_bg_color_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_bg_color_filtered(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_COLOR)); return v.color; } -static inline lv_opa_t lv_obj_get_style_bg_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_bg_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_OPA); return (lv_opa_t)v.num; } -static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_bg_grad_color(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_bg_grad_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_BG_GRAD_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_COLOR)); return v.color; } -static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const lv_obj_t * obj, uint32_t part) +static inline lv_grad_dir_t lv_obj_get_style_bg_grad_dir(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_DIR); return (lv_grad_dir_t)v.num; } -static inline int32_t lv_obj_get_style_bg_main_stop(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_bg_main_stop(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_STOP); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_bg_grad_stop(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_bg_grad_stop(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_STOP); return (int32_t)v.num; } -static inline lv_opa_t lv_obj_get_style_bg_main_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_bg_main_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_MAIN_OPA); return (lv_opa_t)v.num; } -static inline lv_opa_t lv_obj_get_style_bg_grad_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_bg_grad_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD_OPA); return (lv_opa_t)v.num; } -static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const lv_obj_t * obj, uint32_t part) +static inline const lv_grad_dsc_t * lv_obj_get_style_bg_grad(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_GRAD); return (const lv_grad_dsc_t *)v.ptr; } -static inline const void * lv_obj_get_style_bg_image_src(const lv_obj_t * obj, uint32_t part) +static inline const void * lv_obj_get_style_bg_image_src(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_SRC); return (const void *)v.ptr; } -static inline lv_opa_t lv_obj_get_style_bg_image_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_bg_image_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_OPA); return (lv_opa_t)v.num; } -static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_bg_image_recolor(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_bg_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_BG_IMAGE_RECOLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR)); return v.color; } -static inline lv_opa_t lv_obj_get_style_bg_image_recolor_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_bg_image_recolor_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_RECOLOR_OPA); return (lv_opa_t)v.num; } -static inline bool lv_obj_get_style_bg_image_tiled(const lv_obj_t * obj, uint32_t part) +static inline bool lv_obj_get_style_bg_image_tiled(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BG_IMAGE_TILED); return (bool)v.num; } -static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_border_color(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_border_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_BORDER_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_COLOR)); return v.color; } -static inline lv_opa_t lv_obj_get_style_border_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_border_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_OPA); return (lv_opa_t)v.num; } -static inline int32_t lv_obj_get_style_border_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_border_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_WIDTH); return (int32_t)v.num; } -static inline lv_border_side_t lv_obj_get_style_border_side(const lv_obj_t * obj, uint32_t part) +static inline lv_border_side_t lv_obj_get_style_border_side(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_SIDE); return (lv_border_side_t)v.num; } -static inline bool lv_obj_get_style_border_post(const lv_obj_t * obj, uint32_t part) +static inline bool lv_obj_get_style_border_post(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BORDER_POST); return (bool)v.num; } -static inline int32_t lv_obj_get_style_outline_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_outline_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_WIDTH); return (int32_t)v.num; } -static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_outline_color(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_outline_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_OUTLINE_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_COLOR)); return v.color; } -static inline lv_opa_t lv_obj_get_style_outline_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_outline_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_OPA); return (lv_opa_t)v.num; } -static inline int32_t lv_obj_get_style_outline_pad(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_outline_pad(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OUTLINE_PAD); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_shadow_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_shadow_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_WIDTH); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_shadow_offset_x(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_shadow_offset_x(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_X); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_shadow_offset_y(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_shadow_offset_y(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OFFSET_Y); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_shadow_spread(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_shadow_spread(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_SPREAD); return (int32_t)v.num; } -static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_shadow_color(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_shadow_color_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_SHADOW_COLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_COLOR)); return v.color; } -static inline lv_opa_t lv_obj_get_style_shadow_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_shadow_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_SHADOW_OPA); return (lv_opa_t)v.num; } -static inline lv_opa_t lv_obj_get_style_image_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_image_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_OPA); return (lv_opa_t)v.num; } -static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_image_recolor(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_image_recolor_filtered(const lv_obj_t * obj, lv_part_t part) { - lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, - LV_STYLE_IMAGE_RECOLOR)); + lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR)); return v.color; } -static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_image_recolor_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_IMAGE_RECOLOR_OPA); return (lv_opa_t)v.num; } -static inline int32_t lv_obj_get_style_line_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_line_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_WIDTH); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_line_dash_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_line_dash_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_WIDTH); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_line_dash_gap(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_line_dash_gap(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_DASH_GAP); return (int32_t)v.num; } -static inline bool lv_obj_get_style_line_rounded(const lv_obj_t * obj, uint32_t part) +static inline bool lv_obj_get_style_line_rounded(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_ROUNDED); return (bool)v.num; } -static inline lv_color_t lv_obj_get_style_line_color(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_line_color(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_line_color_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_line_color_filtered(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_COLOR)); return v.color; } -static inline lv_opa_t lv_obj_get_style_line_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_line_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LINE_OPA); return (lv_opa_t)v.num; } -static inline int32_t lv_obj_get_style_arc_width(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_arc_width(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_WIDTH); return (int32_t)v.num; } -static inline bool lv_obj_get_style_arc_rounded(const lv_obj_t * obj, uint32_t part) +static inline bool lv_obj_get_style_arc_rounded(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_ROUNDED); return (bool)v.num; } -static inline lv_color_t lv_obj_get_style_arc_color(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_arc_color(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_arc_color_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_arc_color_filtered(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_COLOR)); return v.color; } -static inline lv_opa_t lv_obj_get_style_arc_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_arc_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_OPA); return (lv_opa_t)v.num; } -static inline const void * lv_obj_get_style_arc_image_src(const lv_obj_t * obj, uint32_t part) +static inline const void * lv_obj_get_style_arc_image_src(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ARC_IMAGE_SRC); return (const void *)v.ptr; } -static inline lv_color_t lv_obj_get_style_text_color(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_text_color(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR); return v.color; } -static inline lv_color_t lv_obj_get_style_text_color_filtered(const lv_obj_t * obj, uint32_t part) +static inline lv_color_t lv_obj_get_style_text_color_filtered(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = _lv_obj_style_apply_color_filter(obj, part, lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_COLOR)); return v.color; } -static inline lv_opa_t lv_obj_get_style_text_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_text_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_OPA); return (lv_opa_t)v.num; } -static inline const lv_font_t * lv_obj_get_style_text_font(const lv_obj_t * obj, uint32_t part) +static inline const lv_font_t * lv_obj_get_style_text_font(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_FONT); return (const lv_font_t *)v.ptr; } -static inline int32_t lv_obj_get_style_text_letter_space(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_text_letter_space(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LETTER_SPACE); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_text_line_space(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_text_line_space(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_LINE_SPACE); return (int32_t)v.num; } -static inline lv_text_decor_t lv_obj_get_style_text_decor(const lv_obj_t * obj, uint32_t part) +static inline lv_text_decor_t lv_obj_get_style_text_decor(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_DECOR); return (lv_text_decor_t)v.num; } -static inline lv_text_align_t lv_obj_get_style_text_align(const lv_obj_t * obj, uint32_t part) +static inline lv_text_align_t lv_obj_get_style_text_align(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TEXT_ALIGN); return (lv_text_align_t)v.num; } -static inline int32_t lv_obj_get_style_radius(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_radius(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_RADIUS); return (int32_t)v.num; } -static inline bool lv_obj_get_style_clip_corner(const lv_obj_t * obj, uint32_t part) +static inline bool lv_obj_get_style_clip_corner(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_CLIP_CORNER); return (bool)v.num; } -static inline lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA); return (lv_opa_t)v.num; } -static inline lv_opa_t lv_obj_get_style_opa_layered(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_opa_layered(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_OPA_LAYERED); return (lv_opa_t)v.num; } -static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, uint32_t part) +static inline const lv_color_filter_dsc_t * lv_obj_get_style_color_filter_dsc(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_DSC); return (const lv_color_filter_dsc_t *)v.ptr; } -static inline lv_opa_t lv_obj_get_style_color_filter_opa(const lv_obj_t * obj, uint32_t part) +static inline lv_opa_t lv_obj_get_style_color_filter_opa(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_COLOR_FILTER_OPA); return (lv_opa_t)v.num; } -static inline const lv_anim_t * lv_obj_get_style_anim(const lv_obj_t * obj, uint32_t part) +static inline const lv_anim_t * lv_obj_get_style_anim(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM); return (const lv_anim_t *)v.ptr; } -static inline uint32_t lv_obj_get_style_anim_duration(const lv_obj_t * obj, uint32_t part) +static inline uint32_t lv_obj_get_style_anim_duration(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ANIM_DURATION); return (uint32_t)v.num; } -static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const lv_obj_t * obj, uint32_t part) +static inline const lv_style_transition_dsc_t * lv_obj_get_style_transition(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_TRANSITION); return (const lv_style_transition_dsc_t *)v.ptr; } -static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const lv_obj_t * obj, uint32_t part) +static inline lv_blend_mode_t lv_obj_get_style_blend_mode(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BLEND_MODE); return (lv_blend_mode_t)v.num; } -static inline uint16_t lv_obj_get_style_layout(const lv_obj_t * obj, uint32_t part) +static inline uint16_t lv_obj_get_style_layout(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_LAYOUT); return (uint16_t)v.num; } -static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, uint32_t part) +static inline lv_base_dir_t lv_obj_get_style_base_dir(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BASE_DIR); return (lv_base_dir_t)v.num; } -static inline const void * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, uint32_t part) +static inline const void * lv_obj_get_style_bitmap_mask_src(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_BITMAP_MASK_SRC); return (const void *)v.ptr; } -static inline uint32_t lv_obj_get_style_rotary_sensitivity(const lv_obj_t * obj, uint32_t part) +static inline uint32_t lv_obj_get_style_rotary_sensitivity(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_ROTARY_SENSITIVITY); return (uint32_t)v.num; } #if LV_USE_FLEX -static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_flow_t lv_obj_get_style_flex_flow(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_FLOW); return (lv_flex_flow_t)v.num; } -static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_align_t lv_obj_get_style_flex_main_place(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_MAIN_PLACE); return (lv_flex_align_t)v.num; } -static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_align_t lv_obj_get_style_flex_cross_place(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_CROSS_PLACE); return (lv_flex_align_t)v.num; } -static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, uint32_t part) +static inline lv_flex_align_t lv_obj_get_style_flex_track_place(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_TRACK_PLACE); return (lv_flex_align_t)v.num; } -static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t part) +static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_FLEX_GROW); return (uint8_t)v.num; @@ -688,61 +682,61 @@ static inline uint8_t lv_obj_get_style_flex_grow(const lv_obj_t * obj, uint32_t #endif /*LV_USE_FLEX*/ #if LV_USE_GRID -static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, uint32_t part) +static inline const int32_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY); return (const int32_t *)v.ptr; } -static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, uint32_t part) +static inline lv_grid_align_t lv_obj_get_style_grid_column_align(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_ALIGN); return (lv_grid_align_t)v.num; } -static inline const int32_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, uint32_t part) +static inline const int32_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_DSC_ARRAY); return (const int32_t *)v.ptr; } -static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, uint32_t part) +static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_ALIGN); return (lv_grid_align_t)v.num; } -static inline int32_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_POS); return (int32_t)v.num; } -static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, uint32_t part) +static inline lv_grid_align_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_X_ALIGN); return (lv_grid_align_t)v.num; } -static inline int32_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_SPAN); return (int32_t)v.num; } -static inline int32_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS); return (int32_t)v.num; } -static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, uint32_t part) +static inline lv_grid_align_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_Y_ALIGN); return (lv_grid_align_t)v.num; } -static inline int32_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, uint32_t part) +static inline int32_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, lv_part_t part) { lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_SPAN); return (int32_t)v.num; @@ -835,8 +829,7 @@ void lv_obj_set_style_radius(lv_obj_t * obj, int32_t value, lv_style_selector_t void lv_obj_set_style_clip_corner(lv_obj_t * obj, bool value, lv_style_selector_t selector); void lv_obj_set_style_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_opa_layered(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); -void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value, - lv_style_selector_t selector); +void lv_obj_set_style_color_filter_dsc(lv_obj_t * obj, const lv_color_filter_dsc_t * value, lv_style_selector_t selector); void lv_obj_set_style_color_filter_opa(lv_obj_t * obj, lv_opa_t value, lv_style_selector_t selector); void lv_obj_set_style_anim(lv_obj_t * obj, const lv_anim_t * value, lv_style_selector_t selector); void lv_obj_set_style_anim_duration(lv_obj_t * obj, uint32_t value, lv_style_selector_t selector); diff --git a/src/draw/lv_draw.h b/src/draw/lv_draw.h index 0672bc55d..828e13f41 100644 --- a/src/draw/lv_draw.h +++ b/src/draw/lv_draw.h @@ -176,7 +176,7 @@ struct _lv_layer_t { typedef struct { lv_obj_t * obj; - uint32_t part; + lv_part_t part; uint32_t id1; uint32_t id2; lv_layer_t * layer; diff --git a/src/widgets/scale/lv_scale.c b/src/widgets/scale/lv_scale.c index 68de22b6d..9e28a8af9 100644 --- a/src/widgets/scale/lv_scale.c +++ b/src/widgets/scale/lv_scale.c @@ -48,7 +48,7 @@ static void scale_get_label_coords(lv_obj_t * obj, lv_draw_label_dsc_t * label_d static void scale_set_indicator_label_properties(lv_obj_t * obj, lv_draw_label_dsc_t * label_dsc, lv_style_t * indicator_section_style); static void scale_set_line_properties(lv_obj_t * obj, lv_draw_line_dsc_t * line_dsc, lv_style_t * section_style, - uint32_t part); + lv_part_t part); static void scale_set_arc_properties(lv_obj_t * obj, lv_draw_arc_dsc_t * arc_dsc, lv_style_t * section_style); /* Helpers */ static void scale_find_section_tick_idx(lv_obj_t * obj); @@ -340,7 +340,7 @@ void lv_scale_section_set_range(lv_scale_section_t * section, int32_t minor_rang section->major_range = major_range; } -void lv_scale_section_set_style(lv_scale_section_t * section, uint32_t part, lv_style_t * section_part_style) +void lv_scale_section_set_style(lv_scale_section_t * section, lv_part_t part, lv_style_t * section_part_style) { if(NULL == section) return; @@ -1128,7 +1128,7 @@ static void scale_get_label_coords(lv_obj_t * obj, lv_draw_label_dsc_t * label_d * @param part line part, example: LV_PART_INDICATOR, LV_PART_ITEMS, LV_PART_MAIN */ static void scale_set_line_properties(lv_obj_t * obj, lv_draw_line_dsc_t * line_dsc, lv_style_t * section_style, - uint32_t part) + lv_part_t part) { if(section_style) { lv_style_value_t value; diff --git a/src/widgets/scale/lv_scale.h b/src/widgets/scale/lv_scale.h index a71478f8f..38c800e25 100644 --- a/src/widgets/scale/lv_scale.h +++ b/src/widgets/scale/lv_scale.h @@ -220,7 +220,7 @@ void lv_scale_section_set_range(lv_scale_section_t * section, int32_t minor_rang * @param part the part for the section, e.g. LV_PART_INDICATOR * @param section_part_style Pointer to the section part style */ -void lv_scale_section_set_style(lv_scale_section_t * section, uint32_t part, lv_style_t * section_part_style); +void lv_scale_section_set_style(lv_scale_section_t * section, lv_part_t part, lv_style_t * section_part_style); /*===================== * Getter functions