1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00

fix try a different approach to make structs private

This commit is contained in:
Gabor Kiss-Vamosi 2021-05-29 09:32:19 +02:00
parent d527ca019a
commit 4554f5d9c3
26 changed files with 446 additions and 394 deletions

View File

@ -82,8 +82,8 @@ typedef enum {
}lv_event_code_t;
typedef struct _lv_event_t {
struct _lv_obj_t * target;
struct _lv_obj_t * current_target;
lv_obj_t * target;
lv_obj_t * current_target;
lv_event_code_t code;
void * user_data;
void * param;
@ -135,7 +135,7 @@ typedef struct {
* @param param arbitrary data depending on the widget type and the event. (Usually `NULL`)
* @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event_code
*/
lv_res_t lv_event_send(struct _lv_obj_t * obj, lv_event_code_t event_code, void * param);
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_code_t event_code, void * param);
/**
* Used by the widgets internally to call the ancestor widget types's event handler
@ -150,7 +150,7 @@ lv_res_t lv_obj_event_base(const lv_obj_class_t * class_p, lv_event_t * e);
* @param e pointer to the event descriptor
* @return the target of the event_code
*/
struct _lv_obj_t * lv_event_get_target(lv_event_t * e);
lv_obj_t * lv_event_get_target(lv_event_t * e);
/**
* Get the current target of the event. It's the object which event handler being called.
@ -158,7 +158,7 @@ struct _lv_obj_t * lv_event_get_target(lv_event_t * e);
* @param e pointer to the event descriptor
* @return pointer to the current target of the event_code
*/
struct _lv_obj_t * lv_event_get_current_target(lv_event_t * e);
lv_obj_t * lv_event_get_current_target(lv_event_t * e);
/**
* Get the event code of an event
@ -200,7 +200,7 @@ uint32_t lv_event_register_id(void);
* Mark this object's `event_temp_data` deleted to know that it's `lv_event_send` should return `LV_RES_INV`
* @param obj pointer to an obejct to mark as deleted
*/
void _lv_event_mark_deleted(struct _lv_obj_t * obj);
void _lv_event_mark_deleted(lv_obj_t * obj);
/**
@ -213,7 +213,7 @@ void _lv_event_mark_deleted(struct _lv_obj_t * obj);
* @param user_data custom data data will be available in `event_cb`
* @return a pointer the event descriptor. Can be used in ::lv_obj_remove_event_dsc
*/
struct _lv_event_dsc_t * lv_obj_add_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data);
struct _lv_event_dsc_t * lv_obj_add_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb, lv_event_code_t filter, void * user_data);
/**
* Remove an event handler function for an object.
@ -221,7 +221,7 @@ struct _lv_event_dsc_t * lv_obj_add_event_cb(struct _lv_obj_t * obj, lv_event_cb
* @param event_cb the event function to remove
* @return true if any event handlers were removed
*/
bool lv_obj_remove_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb);
bool lv_obj_remove_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb);
/**
* Remove an event handler function for an object.
@ -229,7 +229,7 @@ bool lv_obj_remove_event_cb(struct _lv_obj_t * obj, lv_event_cb_t event_cb);
* @param event_dsc pointer to an event descriptor to remove (returned by ::lv_obj_add_event_cb)
* @return true if any event handlers were removed
*/
bool lv_obj_remove_event_dsc(struct _lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc);
bool lv_obj_remove_event_dsc(lv_obj_t * obj, struct _lv_event_dsc_t * event_dsc);
/**
* Get the input device passed as parameter to indev related events.

View File

@ -49,8 +49,11 @@ typedef uint8_t lv_key_t;
struct _lv_obj_t;
struct _lv_group_t;
typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_group_t lv_group_t;
typedef struct _lv_obj_t lv_obj_t;
typedef void (*lv_group_focus_cb_t)(lv_group_t *);
/**
* Groups can be used to logically hold objects so that they can be individually focused.
@ -58,7 +61,7 @@ typedef void (*lv_group_focus_cb_t)(struct _lv_group_t *);
*/
typedef struct _lv_group_t {
lv_ll_t obj_ll; /**< Linked list to store the objects in the group*/
struct _lv_obj_t ** obj_focus; /**< The object in focus*/
lv_obj_t ** obj_focus; /**< The object in focus*/
lv_group_focus_cb_t focus_cb; /**< A function to call when a new object is focused (optional)*/
#if LV_USE_USER_DATA
@ -73,8 +76,6 @@ typedef struct _lv_group_t {
of list.*/
} _lv_group_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef _lv_group_t lv_group_t;
typedef enum {
LV_GROUP_REFOCUS_POLICY_NEXT = 0,
@ -120,13 +121,13 @@ lv_group_t * lv_group_get_default(void);
* @param group pointer to a group
* @param obj pointer to an object to add
*/
void lv_group_add_obj(lv_group_t * group, struct _lv_obj_t * obj);
void lv_group_add_obj(lv_group_t * group, lv_obj_t * obj);
/**
* Remove an object from its group
* @param obj pointer to an object to remove
*/
void lv_group_remove_obj(struct _lv_obj_t * obj);
void lv_group_remove_obj(lv_obj_t * obj);
/**
* Remove all objects from a group
@ -138,7 +139,7 @@ void lv_group_remove_all_objs(lv_group_t * group);
* Focus on an object (defocus the current)
* @param obj pointer to an object to focus on
*/
void lv_group_focus_obj(struct _lv_obj_t * obj);
void lv_group_focus_obj(lv_obj_t * obj);
/**
* Focus the next object in a group (defocus the current)
@ -201,7 +202,7 @@ void lv_group_set_wrap(lv_group_t * group, bool en);
* @param group pointer to a group
* @return pointer to the focused object
*/
struct _lv_obj_t * lv_group_get_focused(const lv_group_t * group);
lv_obj_t * lv_group_get_focused(const lv_group_t * group);
/**
* Get the focus callback function of a group

View File

@ -33,6 +33,8 @@ extern "C" {
**********************/
struct _lv_obj_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_obj_t lv_obj_t;
/**
* Possible states of a widget.
@ -137,7 +139,7 @@ extern const lv_obj_class_t lv_obj_class;
* They are allocated automatically if any elements is set.
*/
typedef struct {
struct _lv_obj_t ** children; /**< Store the pointer of the children in an array.*/
lv_obj_t ** children; /**< Store the pointer of the children in an array.*/
uint32_t child_cnt; /**< Number of children*/
lv_group_t * group_p;
@ -156,7 +158,7 @@ typedef struct {
typedef struct _lv_obj_t {
const lv_obj_class_t * class_p;
struct _lv_obj_t * parent;
lv_obj_t * parent;
_lv_obj_spec_attr_t * spec_attr;
_lv_obj_style_t * styles;
#if LV_USE_USER_DATA
@ -173,8 +175,7 @@ typedef struct _lv_obj_t {
uint16_t w_layout :1;
}_lv_obj_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef _lv_obj_t lv_obj_t;
/**********************
* GLOBAL PROTOTYPES
**********************/

View File

@ -140,7 +140,7 @@ void _lv_obj_destructor(lv_obj_t * obj)
}
}
bool lv_obj_is_editable(struct _lv_obj_t * obj)
bool lv_obj_is_editable(lv_obj_t * obj)
{
const lv_obj_class_t * class_p = obj->class_p;
@ -152,7 +152,7 @@ bool lv_obj_is_editable(struct _lv_obj_t * obj)
return class_p->editable == LV_OBJ_CLASS_EDITABLE_TRUE ? true : false;
}
bool lv_obj_is_group_def(struct _lv_obj_t * obj)
bool lv_obj_is_group_def(lv_obj_t * obj)
{
const lv_obj_class_t * class_p = obj->class_p;

View File

@ -29,6 +29,11 @@ struct _lv_obj_t;
struct _lv_obj_class_t;
struct _lv_event_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_obj_class_t lv_obj_class_t;
typedef struct _lv_event_t lv_event_t;
typedef struct _lv_obj_t lv_obj_t;
typedef enum {
LV_OBJ_CLASS_EDITABLE_INHERIT, /**< Check the base class. Must have 0 value to let zero initialized class inherit*/
LV_OBJ_CLASS_EDITABLE_TRUE,
@ -42,19 +47,20 @@ typedef enum {
}lv_obj_class_group_def_t;
typedef void (*lv_obj_class_event_cb_t)(struct _lv_obj_class_t * class_p, struct _lv_event_t * e);
typedef void (*lv_obj_class_event_cb_t)(lv_obj_class_t * class_p, lv_event_t * e);
/**
* Describe the common methods of every object.
* Similar to a C++ class.
*/
typedef struct _lv_obj_class_t {
const struct _lv_obj_class_t * base_class;
void (*constructor_cb)(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * obj);
void (*destructor_cb)(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * obj);
void (*constructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj);
void (*destructor_cb)(const lv_obj_class_t * class_p, lv_obj_t * obj);
#if LV_USE_USER_DATA
void * user_data;
#endif
void (*event_cb)(const struct _lv_obj_class_t * class_p, struct _lv_event_t * e); /**< Widget type specific event function*/
void (*event_cb)(const lv_obj_class_t * class_p, lv_event_t * e); /**< Widget type specific event function*/
lv_coord_t width_def;
lv_coord_t height_def;
uint32_t editable : 2; /**< Value from ::lv_obj_class_editable_t*/
@ -72,15 +78,15 @@ typedef struct _lv_obj_class_t {
* @param parent pointer to an object where the new object should be created
* @return pointer to the created object
*/
struct _lv_obj_t * lv_obj_class_create_obj(const struct _lv_obj_class_t * class_p, struct _lv_obj_t * parent);
lv_obj_t * lv_obj_class_create_obj(const lv_obj_class_t * class_p, lv_obj_t * parent);
void lv_obj_class_init_obj(struct _lv_obj_t * obj);
void lv_obj_class_init_obj(lv_obj_t * obj);
void _lv_obj_destructor(struct _lv_obj_t * obj);
void _lv_obj_destructor(lv_obj_t * obj);
bool lv_obj_is_editable(struct _lv_obj_t * obj);
bool lv_obj_is_editable(lv_obj_t * obj);
bool lv_obj_is_group_def(struct _lv_obj_t * obj);
bool lv_obj_is_group_def(lv_obj_t * obj);
/**********************
* MACROS

View File

@ -24,6 +24,8 @@ extern "C" {
**********************/
struct _lv_obj_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_obj_t lv_obj_t;
/** Cover check results.*/
typedef enum {
@ -65,7 +67,7 @@ typedef struct
* @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(struct _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, uint32_t part, lv_draw_rect_dsc_t * draw_dsc);
/**
* Initialize a label draw descriptor from an object's styles in its current state
@ -75,7 +77,7 @@ void lv_obj_init_draw_rect_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_re
* If the `opa` filed 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(struct _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, uint32_t part, lv_draw_label_dsc_t * draw_dsc);
/**
* Initialize an image draw descriptor from an object's styles in its current state
@ -84,7 +86,7 @@ void lv_obj_init_draw_label_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_l
* @param draw_dsc the descriptor the initialize.
* Should be initialized with `lv_draw_image_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_img_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t * draw_dsc);
void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint32_t part, lv_draw_img_dsc_t * draw_dsc);
/**
@ -94,7 +96,7 @@ void lv_obj_init_draw_img_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_img
* @param draw_dsc the descriptor the initialize.
* Should be initialized with `lv_draw_line_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_line_dsc(struct _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, uint32_t part, lv_draw_line_dsc_t * draw_dsc);
/**
* Initialize an arc draw descriptor from an object's styles in its current state
@ -103,7 +105,7 @@ void lv_obj_init_draw_line_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_li
* @param draw_dsc the descriptor the initialize.
* Should be initialized with `lv_draw_arc_dsc_init(draw_dsc)`.
*/
void lv_obj_init_draw_arc_dsc(struct _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, uint32_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.
@ -111,7 +113,7 @@ void lv_obj_init_draw_arc_dsc(struct _lv_obj_t * obj, uint32_t part, lv_draw_arc
* @param part part of the object
* @return the extra size required around the object
*/
lv_coord_t lv_obj_calculate_ext_draw_size(struct _lv_obj_t * obj, uint32_t part);
lv_coord_t lv_obj_calculate_ext_draw_size(lv_obj_t * obj, uint32_t part);
/**
* Initialize a draw descriptor used in events.
@ -125,14 +127,14 @@ void lv_obj_draw_dsc_init(lv_obj_draw_part_dsc_t * dsc, const lv_area_t * clip_a
* The result will be saved in `obj`.
* @param obj pointer to an object
*/
void lv_obj_refresh_ext_draw_size(struct _lv_obj_t * obj);
void lv_obj_refresh_ext_draw_size(lv_obj_t * obj);
/**
* Get the extended draw area of an object.
* @param obj pointer to an object
* @return the size extended draw area around the real coordinates
*/
lv_coord_t _lv_obj_get_ext_draw_size(const struct _lv_obj_t * obj);
lv_coord_t _lv_obj_get_ext_draw_size(const lv_obj_t * obj);
/**********************
* MACROS

View File

@ -347,7 +347,7 @@ uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data)
return layout_cnt; /*No -1 to skip 0th index*/
}
void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align)
void lv_obj_set_align(lv_obj_t * obj, lv_align_t align)
{
lv_obj_set_style_align(obj, align, 0);
}

View File

@ -23,7 +23,10 @@ extern "C" {
* TYPEDEFS
**********************/
struct _lv_obj_t;
typedef void (*lv_layout_update_cb_t)(struct _lv_obj_t *, void * user_data);
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_obj_t lv_obj_t;
typedef void (*lv_layout_update_cb_t)(lv_obj_t *, void * user_data);
typedef struct {
lv_layout_update_cb_t cb;
void * user_data;
@ -39,21 +42,21 @@ typedef struct {
* @param x new distance from the left side of the parent plus the parent's left padding
* @param y new distance from the top side of the parent plus the parent's right padding
*/
void lv_obj_set_pos(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
/**
* Set the x coordinate of a object
* @param obj pointer to an object
* @param x new distance from the left side from the parent plus the parent's left padding
*/
void lv_obj_set_x(struct _lv_obj_t * obj, lv_coord_t x);
void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x);
/**
* Set the y coordinate of a object
* @param obj pointer to an object
* @param y new distance from the top of the parent plus the parent's top padding
*/
void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y);
void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y);
/**
* Set the size of an object.
@ -66,14 +69,14 @@ void lv_obj_set_y(struct _lv_obj_t * obj, lv_coord_t y);
* LV_SIZE_PCT(x) to set size in percentage of the parent's content area size (the size without paddings).
* x should be in [0..1000]% range
*/
void lv_obj_set_size(struct _lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
/**
* Recalculate the size of the object
* @param obj pointer to an object
* @return true: the size has been changed
*/
bool lv_obj_refr_size(struct _lv_obj_t * obj);
bool lv_obj_refr_size(lv_obj_t * obj);
/**
* Set the width of an object
@ -85,7 +88,7 @@ bool lv_obj_refr_size(struct _lv_obj_t * obj);
* lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings).
* x should be in [0..1000]% range
*/
void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w);
void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w);
/**
* Set the height of an object
@ -97,47 +100,47 @@ void lv_obj_set_width(struct _lv_obj_t * obj, lv_coord_t w);
* lv_pct(x) to set size in percentage of the parent's content area size (the size without paddings).
* x should be in [0..1000]% range
*/
void lv_obj_set_height(struct _lv_obj_t * obj, lv_coord_t h);
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h);
/**
* Set the width reduced by the left and right padding and the border width.
* @param obj pointer to an object
* @param w the width without paddings in pixels
*/
void lv_obj_set_content_width(struct _lv_obj_t * obj, lv_coord_t w);
void lv_obj_set_content_width(lv_obj_t * obj, lv_coord_t w);
/**
* Set the height reduced by the top and bottom padding and the border width.
* @param obj pointer to an object
* @param h the height without paddings in pixels
*/
void lv_obj_set_content_height(struct _lv_obj_t * obj, lv_coord_t h);
void lv_obj_set_content_height(lv_obj_t * obj, lv_coord_t h);
/**
* Set a layout for an object
* @param obj pointer to an object
* @param layout pointer to a layout descriptor to set
*/
void lv_obj_set_layout(struct _lv_obj_t * obj, uint32_t layout);
void lv_obj_set_layout(lv_obj_t * obj, uint32_t layout);
/**
* Test whether the and object is positioned by a layout or not
* @param obj pointer to an object to test
* @return true: positioned by a layout; false: not positioned by a layout
*/
bool lv_obj_is_layout_positioned(const struct _lv_obj_t * obj);
bool lv_obj_is_layout_positioned(const lv_obj_t * obj);
/**
* Mark the object for layout update.
* @param obj pointer to an object whose children needs to be updated
*/
void lv_obj_mark_layout_as_dirty(struct _lv_obj_t * obj);
void lv_obj_mark_layout_as_dirty(lv_obj_t * obj);
/**
* Update the layout of an object.
* @param obj pointer to an object whose children needs to be updated
*/
void lv_obj_update_layout(const struct _lv_obj_t * obj);
void lv_obj_update_layout(const lv_obj_t * obj);
/**
* Regsiter a new layout
@ -152,7 +155,7 @@ uint32_t lv_layout_register(lv_layout_update_cb_t cb, void * user_data);
* @param obj pointer to an object to align
* @param align type of alignment (see 'lv_align_t' enum) `LV_ALIGN_OUT_...` can't be used.
*/
void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align);
void lv_obj_set_align(lv_obj_t * obj, lv_align_t align);
/**
* Change the alignment of an object and set new coordinates.
@ -164,7 +167,7 @@ void lv_obj_set_align(struct _lv_obj_t * obj, lv_align_t align);
* @param x_ofs x coordinate offset after alignment
* @param y_ofs y coordinate offset after alignment
*/
void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
void lv_obj_align(lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
/**
* Align an object to an other object.
@ -175,14 +178,14 @@ void lv_obj_align(struct _lv_obj_t * obj, lv_align_t align, lv_coord_t x_ofs, lv
* @param y_ofs y coordinate offset after alignment
* @note if the position or size of `base` changes `obj` needs to be aligned manually again
*/
void lv_obj_align_to(struct _lv_obj_t * obj, const struct _lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
void lv_obj_align_to(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs, lv_coord_t y_ofs);
/**
* Align an object to the center on its parent.
* @param obj pointer to an object to align
* @note if the parent size changes `obj` needs to be aligned manually again
*/
static inline void lv_obj_center(struct _lv_obj_t * obj)
static inline void lv_obj_center(lv_obj_t * obj)
{
lv_obj_align(obj, LV_ALIGN_CENTER, 0, 0);
}
@ -193,7 +196,7 @@ static inline void lv_obj_center(struct _lv_obj_t * obj)
* @param obj pointer to an object
* @param coords pointer to an area to store the coordinates
*/
void lv_obj_get_coords(const struct _lv_obj_t * obj, lv_area_t * coords);
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * coords);
/**
* Get the x coordinate of object.
@ -203,7 +206,7 @@ void lv_obj_get_coords(const struct _lv_obj_t * obj, lv_area_t * coords);
* @note Scrolling of the parent doesn't change the returned value.
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
*/
lv_coord_t lv_obj_get_x(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_x(const lv_obj_t * obj);
/**
* Get the x2 coordinate of object.
@ -213,7 +216,7 @@ lv_coord_t lv_obj_get_x(const struct _lv_obj_t * obj);
* @note Scrolling of the parent doesn't change the returned value.
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
*/
lv_coord_t lv_obj_get_x2(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_x2(const lv_obj_t * obj);
/**
* Get the y coordinate of object.
@ -223,7 +226,7 @@ lv_coord_t lv_obj_get_x2(const struct _lv_obj_t * obj);
* @note Scrolling of the parent doesn't change the returned value.
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
*/
lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_y(const lv_obj_t * obj);
/**
* Get the y2 coordinate of object.
@ -233,42 +236,42 @@ lv_coord_t lv_obj_get_y(const struct _lv_obj_t * obj);
* @note Scrolling of the parent doesn't change the returned value.
* @note The returned value is always the distance from the parent even if `obj` is positioned by a layout.
*/
lv_coord_t lv_obj_get_y2(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_y2(const lv_obj_t * obj);
/**
* Get the width of an object
* @param obj pointer to an object
* @return the width in pixels
*/
lv_coord_t lv_obj_get_width(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_width(const lv_obj_t * obj);
/**
* Get the height of an object
* @param obj pointer to an object
* @return the height in pixels
*/
lv_coord_t lv_obj_get_height(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_height(const lv_obj_t * obj);
/**
* Get the width reduced by the left and right padding and the border width.
* @param obj pointer to an object
* @return the width which still fits into its parent without causing overflow (making the parent scrollable)
*/
lv_coord_t lv_obj_get_content_width(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_content_width(const lv_obj_t * obj);
/**
* Get the height reduced by the top an bottom padding and the border width.
* @param obj pointer to an object
* @return the height which still fits into the parent without causing overflow (making the parent scrollable)
*/
lv_coord_t lv_obj_get_content_height(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_content_height(const lv_obj_t * obj);
/**
* Get the area reduced by the paddings and the border width.
* @param obj pointer to an object
* @param area the area which still fits into the parent without causing overflow (making the parent scrollable)
*/
void lv_obj_get_content_coords(const struct _lv_obj_t * obj, lv_area_t * area);
void lv_obj_get_content_coords(const lv_obj_t * obj, lv_area_t * area);
/**
* Get the width occupied by the "parts" of the widget. E.g. the width of all columns of a table.
@ -277,7 +280,7 @@ void lv_obj_get_content_coords(const struct _lv_obj_t * obj, lv_area_t * area);
* @note This size independent from the real size of the widget.
* It just tells how large the internal ("virtual") content is.
*/
lv_coord_t lv_obj_get_self_width(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_self_width(const lv_obj_t * obj);
/**
* Get the height occupied by the "parts" of the widget. E.g. the height of all rows of a table.
@ -286,21 +289,21 @@ lv_coord_t lv_obj_get_self_width(const struct _lv_obj_t * obj);
* @note This size independent from the real size of the widget.
* It just tells how large the internal ("virtual") content is.
*/
lv_coord_t lv_obj_get_self_height(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_self_height(const lv_obj_t * obj);
/**
* Handle if the size of the internal ("virtual") content of an object has changed.
* @param obj pointer to an object
* @return false: nothing happened; true: refresh happened
*/
bool lv_obj_refresh_self_size(struct _lv_obj_t * obj);
bool lv_obj_refresh_self_size(lv_obj_t * obj);
void lv_obj_refr_pos(struct _lv_obj_t * obj);
void lv_obj_refr_pos(lv_obj_t * obj);
void lv_obj_move_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
void lv_obj_move_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
void lv_obj_move_children_by(struct _lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating);
void lv_obj_move_children_by(lv_obj_t * obj, lv_coord_t x_diff, lv_coord_t y_diff, bool ignore_floating);
/**
* Mark an area of an object as invalid.
@ -308,13 +311,13 @@ void lv_obj_move_children_by(struct _lv_obj_t * obj, lv_coord_t x_diff, lv_coord
* @param obj pointer to an object
* @param area the area to redraw
*/
void lv_obj_invalidate_area(const struct _lv_obj_t * obj, const lv_area_t * area);
void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area);
/**
* Mark the object as invalid to redrawn its area
* @param obj pointer to an object
*/
void lv_obj_invalidate(const struct _lv_obj_t * obj);
void lv_obj_invalidate(const lv_obj_t * obj);
/**
* Tell whether an area of an object is visible (even partially) now or not
@ -322,21 +325,21 @@ void lv_obj_invalidate(const struct _lv_obj_t * obj);
* @param area the are to check. The visible part of the area will be written back here.
* @return true visible; false not visible (hidden, out of parent, on other screen, etc)
*/
bool lv_obj_area_is_visible(const struct _lv_obj_t * obj, lv_area_t * area);
bool lv_obj_area_is_visible(const lv_obj_t * obj, lv_area_t * area);
/**
* Tell whether an object is visible (even partially) now or not
* @param obj pointer to an object
* @return true: visible; false not visible (hidden, out of parent, on other screen, etc)
*/
bool lv_obj_is_visible(const struct _lv_obj_t * obj);
bool lv_obj_is_visible(const lv_obj_t * obj);
/**
* Set the size of an extended clickable area
* @param obj pointer to an object
* @param size extended clickable area in all 4 directions [px]
*/
void lv_obj_set_ext_click_area(struct _lv_obj_t * obj, lv_coord_t size);
void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t size);
/**
* Get the an area where to object can be clicked.
@ -344,7 +347,7 @@ void lv_obj_set_ext_click_area(struct _lv_obj_t * obj, lv_coord_t size);
* @param obj pointer to an object
* @param area store the result area here
*/
void lv_obj_get_click_area(const struct _lv_obj_t * obj, lv_area_t * area);
void lv_obj_get_click_area(const lv_obj_t * obj, lv_area_t * area);
/**
* Hit-test an object given a particular point in screen space.
@ -352,7 +355,7 @@ void lv_obj_get_click_area(const struct _lv_obj_t * obj, lv_area_t * area);
* @param point screen-space point (absolute coordinate)
* @return true: if the object is considered under the point
*/
bool lv_obj_hit_test(struct _lv_obj_t * obj, const lv_point_t * point);
bool lv_obj_hit_test(lv_obj_t * obj, const lv_point_t * point);
/**
* Clamp a width between min and max width. If the min/max width is in percentage value use the ref_width

View File

@ -64,7 +64,7 @@ void lv_obj_set_scrollbar_mode(lv_obj_t * obj, lv_scrollbar_mode_t mode)
lv_obj_invalidate(obj);
}
void lv_obj_set_scroll_dir(struct _lv_obj_t * obj, lv_dir_t dir)
void lv_obj_set_scroll_dir(lv_obj_t * obj, lv_dir_t dir)
{
lv_obj_allocate_spec_attr(obj);
@ -73,13 +73,13 @@ void lv_obj_set_scroll_dir(struct _lv_obj_t * obj, lv_dir_t dir)
}
}
void lv_obj_set_scroll_snap_x(struct _lv_obj_t * obj, lv_scroll_snap_t align)
void lv_obj_set_scroll_snap_x(lv_obj_t * obj, lv_scroll_snap_t align)
{
lv_obj_allocate_spec_attr(obj);
obj->spec_attr->scroll_snap_x = align;
}
void lv_obj_set_scroll_snap_y(struct _lv_obj_t * obj, lv_scroll_snap_t align)
void lv_obj_set_scroll_snap_y(lv_obj_t * obj, lv_scroll_snap_t align)
{
lv_obj_allocate_spec_attr(obj);
obj->spec_attr->scroll_snap_y = align;
@ -89,25 +89,25 @@ void lv_obj_set_scroll_snap_y(struct _lv_obj_t * obj, lv_scroll_snap_t align)
* Getter functions
*====================*/
lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const struct _lv_obj_t * obj)
lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const lv_obj_t * obj)
{
if(obj->spec_attr) return obj->spec_attr->scrollbar_mode;
else return LV_SCROLLBAR_MODE_AUTO;
}
lv_dir_t lv_obj_get_scroll_dir(const struct _lv_obj_t * obj)
lv_dir_t lv_obj_get_scroll_dir(const lv_obj_t * obj)
{
if(obj->spec_attr) return obj->spec_attr->scroll_dir;
else return LV_DIR_ALL;
}
lv_scroll_snap_t lv_obj_get_scroll_snap_x(const struct _lv_obj_t * obj)
lv_scroll_snap_t lv_obj_get_scroll_snap_x(const lv_obj_t * obj)
{
if(obj->spec_attr) return obj->spec_attr->scroll_snap_x;
else return LV_SCROLL_SNAP_NONE;
}
lv_scroll_snap_t lv_obj_get_scroll_snap_y(const struct _lv_obj_t * obj)
lv_scroll_snap_t lv_obj_get_scroll_snap_y(const lv_obj_t * obj)
{
if(obj->spec_attr) return obj->spec_attr->scroll_snap_y;
else return LV_SCROLL_SNAP_NONE;

View File

@ -27,6 +27,9 @@ extern "C" {
/*Can't include lv_obj.h because it includes this header file*/
struct _lv_obj_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_obj_t lv_obj_t;
/** Scrollbar modes: shows when should the scrollbars be visible*/
enum {
LV_SCROLLBAR_MODE_OFF, /**< Never show scrollbars*/
@ -59,28 +62,28 @@ typedef uint8_t lv_scroll_snap_t;
* @param obj pointer to an object
* @param mode LV_SCROLL_MODE_ON/OFF/AUTO/ACTIVE
*/
void lv_obj_set_scrollbar_mode(struct _lv_obj_t * obj, lv_scrollbar_mode_t mode);
void lv_obj_set_scrollbar_mode(lv_obj_t * obj, lv_scrollbar_mode_t mode);
/**
* Set the object in which directions can be scrolled
* @param obj pointer to an object
* @param dir the allow scroll directions. An element or OR-ed values of `lv_dir_t`
*/
void lv_obj_set_scroll_dir(struct _lv_obj_t * obj, lv_dir_t dir);
void lv_obj_set_scroll_dir(lv_obj_t * obj, lv_dir_t dir);
/**
* Set where to snap the children when scrolling ends horizontally
* @param obj pointer to an object
* @param align the snap align to set from `lv_snap_align_t`
*/
void lv_obj_set_scroll_snap_x(struct _lv_obj_t * obj, lv_scroll_snap_t align);
void lv_obj_set_scroll_snap_x(lv_obj_t * obj, lv_scroll_snap_t align);
/**
* Set where to snap the children when scrolling ends vertically
* @param obj pointer to an object
* @param align the snap align to set from `lv_snap_align_t`
*/
void lv_obj_set_scroll_snap_y(struct _lv_obj_t * obj, lv_scroll_snap_t align);
void lv_obj_set_scroll_snap_y(lv_obj_t * obj, lv_scroll_snap_t align);
/*=====================
* Getter functions
@ -91,28 +94,28 @@ void lv_obj_set_scroll_snap_y(struct _lv_obj_t * obj, lv_scroll_snap_t align);
* @param obj pointer to an object
* @return the current scroll mode from `lv_scroll_mode_t`
*/
lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const struct _lv_obj_t * obj);
lv_scrollbar_mode_t lv_obj_get_scrollbar_mode(const lv_obj_t * obj);
/**
* Get the object in which directions can be scrolled
* @param obj pointer to an object
* @param dir the allow scroll directions. An element or OR-ed values of `lv_dir_t`
*/
lv_dir_t lv_obj_get_scroll_dir(const struct _lv_obj_t * obj);
lv_dir_t lv_obj_get_scroll_dir(const lv_obj_t * obj);
/**
* Get where to snap the children when scrolling ends horizontally
* @param obj pointer to an object
* @return the current snap align from `lv_snap_align_t`
*/
lv_scroll_snap_t lv_obj_get_scroll_snap_x(const struct _lv_obj_t * obj);
lv_scroll_snap_t lv_obj_get_scroll_snap_x(const lv_obj_t * obj);
/**
* Get where to snap the children when scrolling ends vertically
* @param obj pointer to an object
* @return the current snap align from `lv_snap_align_t`
*/
lv_scroll_snap_t lv_obj_get_scroll_snap_y(const struct _lv_obj_t * obj);
lv_scroll_snap_t lv_obj_get_scroll_snap_y(const lv_obj_t * obj);
/**
* Get current X scroll position.
@ -122,7 +125,7 @@ lv_scroll_snap_t lv_obj_get_scroll_snap_y(const struct _lv_obj_t * obj);
* If scrolled return > 0
* If scrolled in (elastic scroll) return < 0
*/
lv_coord_t lv_obj_get_scroll_x(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_scroll_x(const lv_obj_t * obj);
/**
* Get current Y scroll position.
@ -132,7 +135,7 @@ lv_coord_t lv_obj_get_scroll_x(const struct _lv_obj_t * obj);
* If scrolled return > 0
* If scrolled inside return < 0
*/
lv_coord_t lv_obj_get_scroll_y(const struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_scroll_y(const lv_obj_t * obj);
/**
* Return the height of the area above the object.
@ -141,7 +144,7 @@ lv_coord_t lv_obj_get_scroll_y(const struct _lv_obj_t * obj);
* @param obj pointer to an object
* @return the scrollable area above the object in pixels
*/
lv_coord_t lv_obj_get_scroll_top(struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_scroll_top(lv_obj_t * obj);
/**
* Return the height of the area below the object.
@ -150,7 +153,7 @@ lv_coord_t lv_obj_get_scroll_top(struct _lv_obj_t * obj);
* @param obj pointer to an object
* @return the scrollable area below the object in pixels
*/
lv_coord_t lv_obj_get_scroll_bottom(struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_scroll_bottom(lv_obj_t * obj);
/**
* Return the width of the area on the left the object.
@ -159,7 +162,7 @@ lv_coord_t lv_obj_get_scroll_bottom(struct _lv_obj_t * obj);
* @param obj pointer to an object
* @return the scrollable area on the left the object in pixels
*/
lv_coord_t lv_obj_get_scroll_left(struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_scroll_left(lv_obj_t * obj);
/**
* Return the width of the area on the right the object.
@ -168,7 +171,7 @@ lv_coord_t lv_obj_get_scroll_left(struct _lv_obj_t * obj);
* @param obj pointer to an object
* @return the scrollable area on the right the object in pixels
*/
lv_coord_t lv_obj_get_scroll_right(struct _lv_obj_t * obj);
lv_coord_t lv_obj_get_scroll_right(lv_obj_t * obj);
/**
* Get the X and Y coordinates where the scrolling will end for this object if a scrolling animation is in progress.
@ -192,7 +195,7 @@ void lv_obj_get_scroll_end(struct _lv_obj_t * obj, lv_point_t * end);
* @note > 0 value means scroll right/bottom (show the more content on the right/bottom)
* @note
*/
void lv_obj_scroll_by(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
void lv_obj_scroll_by(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
/**
* Scroll to a given coordinate on an object.
@ -202,7 +205,7 @@ void lv_obj_scroll_by(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_ani
* @param y pixels to scroll vertically
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
void lv_obj_scroll_to(lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim_en);
/**
* Scroll to a given X coordinate on an object.
@ -211,7 +214,7 @@ void lv_obj_scroll_to(struct _lv_obj_t * obj, lv_coord_t x, lv_coord_t y, lv_ani
* @param x pixels to scroll horizontally
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_x(struct _lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en);
void lv_obj_scroll_to_x(lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t anim_en);
/**
* Scroll to a given Y coordinate on an object
@ -220,14 +223,14 @@ void lv_obj_scroll_to_x(struct _lv_obj_t * obj, lv_coord_t x, lv_anim_enable_t a
* @param y pixels to scroll vertically
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_y(struct _lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en);
void lv_obj_scroll_to_y(lv_obj_t * obj, lv_coord_t y, lv_anim_enable_t anim_en);
/**
* Scroll to an object until it becomes visible on its parent
* @param obj pointer to an object to scroll into view
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_view(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
void lv_obj_scroll_to_view(lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Scroll to an object until it becomes visible on its parent.
@ -236,21 +239,21 @@ void lv_obj_scroll_to_view(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
* @param obj pointer to an object to scroll into view
* @param anim_en LV_ANIM_ON: scroll with animation; LV_ANIM_OFF: scroll immediately
*/
void lv_obj_scroll_to_view_recursive(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
void lv_obj_scroll_to_view_recursive(lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Tell whether an object is being scrolled or not at this moment
* @param obj pointer to an object
* @return true: `obj` is being scrolled
*/
bool lv_obj_is_scrolling(const struct _lv_obj_t * obj);
bool lv_obj_is_scrolling(const lv_obj_t * obj);
/**
* Check the children of `obj` and scroll `obj` to fulfill the scroll_snap settings
* @param obj an object whose children needs to checked and snapped
* @param anim_en LV_ANIM_ON/OFF
*/
void lv_obj_update_snap(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
void lv_obj_update_snap(lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Get the area of the scrollbars
@ -258,13 +261,13 @@ void lv_obj_update_snap(struct _lv_obj_t * obj, lv_anim_enable_t anim_en);
* @param hor_area pointer to store the area of the horizontal scrollbar
* @param ver_area pointer to store the area of the vertical scrollbar
*/
void lv_obj_get_scrollbar_area(struct _lv_obj_t * obj, lv_area_t * hor, lv_area_t * ver);
void lv_obj_get_scrollbar_area(lv_obj_t * obj, lv_area_t * hor, lv_area_t * ver);
/**
* Invalidate the area of the scrollbars
* @param obj pointer to an object
*/
void lv_obj_scrollbar_invalidate(struct _lv_obj_t * obj);
void lv_obj_scrollbar_invalidate(lv_obj_t * obj);
/**********************
* MACROS

View File

@ -73,7 +73,7 @@ void _lv_obj_style_init(void)
_lv_ll_init(&LV_GC_ROOT(_lv_obj_style_trans_ll), sizeof(trans_t));
}
void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector)
void lv_obj_add_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector)
{
trans_del(obj, selector, LV_STYLE_PROP_ANY, NULL);

View File

@ -27,6 +27,9 @@ extern "C" {
/*Can't include lv_obj.h because it includes this header file*/
struct _lv_obj_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_obj_t lv_obj_t;
typedef enum {
_LV_STYLE_STATE_CMP_SAME, /*The style properties in the 2 states are identical*/
_LV_STYLE_STATE_CMP_DIFF_REDRAW, /*The differences can be shown with a simple redraw*/
@ -72,7 +75,7 @@ void _lv_obj_style_init(void);
* @param style pointer to a style to add
* @example lv_obj_add_style_no_refresh(slider, LV_PART_KNOB, LV_STATE_PRESSED, &style1);
*/
void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
void lv_obj_add_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
/**
* Add a style to an object.
@ -83,13 +86,13 @@ void lv_obj_add_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selec
* @example lv_obj_remove_style(obj, LV_PART_MAIN, LV_STATE_ANY, &style); //Remove all styles from the main part
* @example lv_obj_remove_style(obj, LV_PART_ANY, LV_STATE_ANY, NULL); //Remove all styles
*/
void lv_obj_remove_style(struct _lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
void lv_obj_remove_style(lv_obj_t * obj, lv_style_t * style, lv_style_selector_t selector);
/**
* Remove all styles from an object
* @param obj pointer to an object
*/
static inline void lv_obj_remove_style_all(struct _lv_obj_t * obj)
static inline void lv_obj_remove_style_all(lv_obj_t * obj)
{
lv_obj_remove_style(obj, NULL, LV_PART_ANY | LV_STATE_ANY);
}
@ -109,7 +112,7 @@ void lv_obj_report_style_change(lv_style_t * style);
* It is used to optimize what needs to be refreshed.
* `LV_STYLE_PROP_INV` to perform only a style cache update
*/
void lv_obj_refresh_style(struct _lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
void lv_obj_refresh_style(lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
/**
* Enable or disable automatic style refreshing when a new style is added/removed to/from an object
@ -128,7 +131,7 @@ void lv_obj_enable_style_refresh(bool en);
* @return the value of the property.
* Should be read from the correct field of the `lv_style_value_t` according to the type of the property.
*/
lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
lv_style_value_t lv_obj_get_style_prop(const lv_obj_t * obj, lv_part_t part, lv_style_prop_t prop);
/**
* Set local style property on an object's part and state.
@ -138,9 +141,9 @@ lv_style_value_t lv_obj_get_style_prop(const struct _lv_obj_t * obj, lv_part_t p
* @param prop the property
* @param value value of the property. The correct element should be set according to the type of the property
*/
void lv_obj_set_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value, lv_style_selector_t selector);
void lv_obj_set_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t value, lv_style_selector_t selector);
lv_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value, lv_style_selector_t selector);
lv_res_t lv_obj_get_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_value_t * value, lv_style_selector_t selector);
/**
* Remove a local style property from a part of an object with a given state.
@ -150,7 +153,7 @@ lv_res_t lv_obj_get_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t pro
* @param prop a style property to remove.
* @return true the property was found and removed; false: the property was not found
*/
bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector);
bool lv_obj_remove_local_style_prop(lv_obj_t * obj, lv_style_prop_t prop, lv_style_selector_t selector);
/**
* Used internally to create a style tarnsition
@ -160,7 +163,7 @@ bool lv_obj_remove_local_style_prop(struct _lv_obj_t * obj, lv_style_prop_t prop
* @param new_state
* @param tr
*/
void _lv_obj_style_create_transition(struct _lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr);
void _lv_obj_style_create_transition(lv_obj_t * obj, lv_part_t part, lv_state_t prev_state, lv_state_t new_state, const _lv_obj_style_transition_dsc_t * tr);
/**
* Used internally to compare the appearance of an object in 2 states
@ -169,7 +172,7 @@ void _lv_obj_style_create_transition(struct _lv_obj_t * obj, lv_part_t part, lv_
* @param state2
* @return
*/
_lv_style_state_cmp_t _lv_obj_style_state_compare(struct _lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
_lv_style_state_cmp_t _lv_obj_style_state_compare(lv_obj_t * obj, lv_state_t state1, lv_state_t state2);
/**
* Fade in an an object and all its children.
@ -177,7 +180,7 @@ _lv_style_state_cmp_t _lv_obj_style_state_compare(struct _lv_obj_t * obj, lv_sta
* @param time time of fade
* @param delay delay to start the animation
*/
void lv_obj_fade_in(struct _lv_obj_t * obj, uint32_t time, uint32_t delay);
void lv_obj_fade_in(lv_obj_t * obj, uint32_t time, uint32_t delay);
/**
* Fade out an an object and all its children.
@ -185,7 +188,7 @@ void lv_obj_fade_in(struct _lv_obj_t * obj, uint32_t time, uint32_t delay);
* @param time time of fade
* @param delay delay to start the animation
*/
void lv_obj_fade_out(struct _lv_obj_t * obj, uint32_t time, uint32_t delay);
void lv_obj_fade_out(lv_obj_t * obj, uint32_t time, uint32_t delay);
lv_state_t lv_obj_style_get_selector_state(lv_style_selector_t selector);
@ -193,29 +196,29 @@ lv_part_t lv_obj_style_get_selector_part(lv_style_selector_t selector);
#include "lv_obj_style_gen.h"
static inline void lv_obj_set_style_pad_all(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
static inline void lv_obj_set_style_pad_all(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
lv_obj_set_style_pad_left(obj, value, selector);
lv_obj_set_style_pad_right(obj, value, selector);
lv_obj_set_style_pad_top(obj, value, selector);
lv_obj_set_style_pad_bottom(obj, value, selector);
}
static inline void lv_obj_set_style_pad_hor(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
static inline void lv_obj_set_style_pad_hor(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
lv_obj_set_style_pad_left(obj, value, selector);
lv_obj_set_style_pad_right(obj, value, selector);
}
static inline void lv_obj_set_style_pad_ver(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
static inline void lv_obj_set_style_pad_ver(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
lv_obj_set_style_pad_top(obj, value, selector);
lv_obj_set_style_pad_bottom(obj, value, selector);
}
static inline void lv_obj_set_style_pad_gap(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
static inline void lv_obj_set_style_pad_gap(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
lv_obj_set_style_pad_row(obj, value, selector);
lv_obj_set_style_pad_column(obj, value, selector);
}
static inline void lv_obj_set_style_size(struct _lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
static inline void lv_obj_set_style_size(lv_obj_t * obj, lv_coord_t value, lv_style_selector_t selector) {
lv_obj_set_style_width(obj, value, selector);
lv_obj_set_style_height(obj, value, selector);
}

File diff suppressed because it is too large Load Diff

View File

@ -28,13 +28,17 @@ extern "C" {
struct _lv_obj_t;
struct _lv_obj_class_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_obj_t lv_obj_t;
typedef struct _lv_obj_class_t lv_obj_class_t;
typedef enum {
LV_OBJ_TREE_WALK_NEXT,
LV_OBJ_TREE_WALK_SKIP_CHILDREN,
LV_OBJ_TREE_WALK_END,
} lv_obj_tree_walk_res_t;
typedef lv_obj_tree_walk_res_t (*lv_obj_tree_walk_cb_t)(struct _lv_obj_t *, void *);
typedef lv_obj_tree_walk_res_t (*lv_obj_tree_walk_cb_t)(lv_obj_t *, void *);
/**********************
* GLOBAL PROTOTYPES
@ -46,7 +50,7 @@ typedef lv_obj_tree_walk_res_t (*lv_obj_tree_walk_cb_t)(struct _lv_obj_t *, void
* Send `LV_EVENT_DELETED` to deleted objects.
* @param obj pointer to an object
*/
void lv_obj_del(struct _lv_obj_t * obj);
void lv_obj_del(lv_obj_t * obj);
/**
* Delete all children of an object.
@ -54,7 +58,7 @@ void lv_obj_del(struct _lv_obj_t * obj);
* Send `LV_EVENT_DELETED` to deleted objects.
* @param obj pointer to an object
*/
void lv_obj_clean(struct _lv_obj_t * obj);
void lv_obj_clean(lv_obj_t * obj);
/**
* A function to be easily used in animation ready callback to delete an object when the animation is ready
@ -68,7 +72,7 @@ void lv_obj_del_anim_ready_cb(lv_anim_t * a);
* @param obj object to delete
* @see lv_async_call
*/
void lv_obj_del_async(struct _lv_obj_t * obj);
void lv_obj_del_async(lv_obj_t * obj);
/**
* Move the parent of an object. The relative coordinates will be kept.
@ -76,7 +80,7 @@ void lv_obj_del_async(struct _lv_obj_t * obj);
* @param obj pointer to an object whose parent needs to be changed
* @param parent pointer to the new parent
*/
void lv_obj_set_parent(struct _lv_obj_t * obj, struct _lv_obj_t * parent);
void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent);
/**
* Move the object to the foreground.
@ -84,7 +88,7 @@ void lv_obj_set_parent(struct _lv_obj_t * obj, struct _lv_obj_t * parent);
* It also means it can cover any of the siblings.
* @param obj pointer to an object
*/
void lv_obj_move_foreground(struct _lv_obj_t * obj);
void lv_obj_move_foreground(lv_obj_t * obj);
/**
* Move the object to the background.
@ -92,28 +96,28 @@ void lv_obj_move_foreground(struct _lv_obj_t * obj);
* It also means any of the siblings can cover the object.
* @param obj pointer to an object
*/
void lv_obj_move_background(struct _lv_obj_t * obj);
void lv_obj_move_background(lv_obj_t * obj);
/**
* Get the screen of an object
* @param obj pointer to an object
* @return pointer to the obejct's screen
*/
struct _lv_obj_t * lv_obj_get_screen(const struct _lv_obj_t * obj);
lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj);
/**
* Get the display of the object
* @param obj pointer to an object
* @return pointer to the obejct's display
*/
lv_disp_t * lv_obj_get_disp(const struct _lv_obj_t * obj);
lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj);
/**
* Get the parent of an object
* @param obj pointer to an object
* @return the parent of the object. (NULL if `obj` was a screen)
*/
struct _lv_obj_t * lv_obj_get_parent(const struct _lv_obj_t * obj);
lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj);
/**
* Get the child of an object by the child's index.
@ -126,14 +130,14 @@ struct _lv_obj_t * lv_obj_get_parent(const struct _lv_obj_t * obj);
* -2: the second youngest
* @return pointer to the child or NULL if the index was invalid
*/
struct _lv_obj_t * lv_obj_get_child(const struct _lv_obj_t * obj, int32_t id);
lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, int32_t id);
/**
* Get the number of children
* @param obj pointer to an object
* @return the number of children
*/
uint32_t lv_obj_get_child_cnt(const struct _lv_obj_t * obj);
uint32_t lv_obj_get_child_cnt(const lv_obj_t * obj);
/**
* Get the index of a child.
@ -141,7 +145,7 @@ uint32_t lv_obj_get_child_cnt(const struct _lv_obj_t * obj);
* @return the child index of the object.
* E.g. 0: the oldest (firstly created child)
*/
uint32_t lv_obj_get_child_id(const struct _lv_obj_t * obj);
uint32_t lv_obj_get_child_id(const lv_obj_t * obj);
/**
* Iterate through all children of any object.
@ -149,7 +153,7 @@ uint32_t lv_obj_get_child_id(const struct _lv_obj_t * obj);
* @param cb call this callback on the objects
* @param user_data pointer to any user related data (will be passed to `cb`)
*/
void lv_obj_tree_walk(struct _lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void * user_data);
void lv_obj_tree_walk(lv_obj_t * start_obj, lv_obj_tree_walk_cb_t cb, void * user_data);
/**********************
* MACROS

View File

@ -26,7 +26,10 @@ extern "C" {
struct _lv_theme_t;
struct _lv_disp_t;
typedef void (*lv_theme_apply_cb_t)(struct _lv_theme_t *, lv_obj_t *);
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_theme_t lv_theme_t;
typedef void (*lv_theme_apply_cb_t)(lv_theme_t *, lv_obj_t *);
typedef struct _lv_theme_t {
lv_theme_apply_cb_t apply_cb;

View File

@ -41,9 +41,12 @@ enum {
typedef uint8_t lv_img_src_t;
/*Decoder function definitions*/
struct _lv_img_decoder_dsc_t;
struct _lv_img_decoder_t;
struct _lv_img_decoder_dsc;
struct _lv_img_decoder;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_img_decoder_dsc_t lv_img_decoder_dsc_t;
typedef struct _lv_img_decoder_t lv_img_decoder_t;
/**
* Get info from an image and store in the `header`
@ -52,7 +55,7 @@ struct _lv_img_decoder;
* @param header store the info here
* @return LV_RES_OK: info written correctly; LV_RES_INV: failed
*/
typedef lv_res_t (*lv_img_decoder_info_f_t)(struct _lv_img_decoder * decoder, const void * src,
typedef lv_res_t (*lv_img_decoder_info_f_t)(lv_img_decoder_t * decoder, const void * src,
lv_img_header_t * header);
/**
@ -60,7 +63,7 @@ typedef lv_res_t (*lv_img_decoder_info_f_t)(struct _lv_img_decoder * decoder, co
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor. `src`, `color` are already initialized in it.
*/
typedef lv_res_t (*lv_img_decoder_open_f_t)(struct _lv_img_decoder * decoder, struct _lv_img_decoder_dsc * dsc);
typedef lv_res_t (*lv_img_decoder_open_f_t)(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc);
/**
* Decode `len` pixels starting from the given `x`, `y` coordinates and store them in `buf`.
@ -73,7 +76,7 @@ typedef lv_res_t (*lv_img_decoder_open_f_t)(struct _lv_img_decoder * decoder, st
* @param buf a buffer to store the decoded pixels
* @return LV_RES_OK: ok; LV_RES_INV: failed
*/
typedef lv_res_t (*lv_img_decoder_read_line_f_t)(struct _lv_img_decoder * decoder, struct _lv_img_decoder_dsc * dsc,
typedef lv_res_t (*lv_img_decoder_read_line_f_t)(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc,
lv_coord_t x, lv_coord_t y, lv_coord_t len, uint8_t * buf);
/**
@ -81,10 +84,10 @@ typedef lv_res_t (*lv_img_decoder_read_line_f_t)(struct _lv_img_decoder * decode
* @param decoder pointer to the decoder the function associated with
* @param dsc pointer to decoder descriptor
*/
typedef void (*lv_img_decoder_close_f_t)(struct _lv_img_decoder * decoder, struct _lv_img_decoder_dsc * dsc);
typedef void (*lv_img_decoder_close_f_t)(lv_img_decoder_t * decoder, lv_img_decoder_dsc_t * dsc);
typedef struct _lv_img_decoder {
typedef struct _lv_img_decoder_t {
lv_img_decoder_info_f_t info_cb;
lv_img_decoder_open_f_t open_cb;
lv_img_decoder_read_line_f_t read_line_cb;
@ -97,7 +100,7 @@ typedef struct _lv_img_decoder {
/**Describe an image decoding session. Stores data about the decoding*/
typedef struct _lv_img_decoder_dsc {
typedef struct _lv_img_decoder_dsc_t {
/**The decoder which was able to open the image source*/
lv_img_decoder_t * decoder;

View File

@ -110,7 +110,7 @@ void lv_obj_set_flex_align(lv_obj_t * obj, lv_flex_align_t main_place, lv_flex_a
lv_obj_set_style_layout(obj, LV_LAYOUT_FLEX, 0);
}
void lv_obj_set_flex_grow(struct _lv_obj_t * obj, uint8_t grow)
void lv_obj_set_flex_grow(lv_obj_t * obj, uint8_t grow)
{
lv_obj_set_style_flex_grow(obj, grow, 0);
}

View File

@ -49,7 +49,7 @@ typedef struct {
* STATIC PROTOTYPES
**********************/
static void grid_update(lv_obj_t * cont, void * user_data);
static void calc(struct _lv_obj_t * obj, _lv_grid_calc_t * calc);
static void calc(lv_obj_t * obj, _lv_grid_calc_t * calc);
static void calc_free(_lv_grid_calc_t * calc);
static void calc_cols(lv_obj_t * cont, _lv_grid_calc_t * c);
static void calc_rows(lv_obj_t * cont, _lv_grid_calc_t * c);
@ -193,7 +193,7 @@ static void grid_update(lv_obj_t * cont, void * user_data)
* @param calc store the calculated cells sizes here
* @note `_lv_grid_calc_free(calc_out)` needs to be called when `calc_out` is not needed anymore
*/
static void calc(struct _lv_obj_t * cont, _lv_grid_calc_t * calc_out)
static void calc(lv_obj_t * cont, _lv_grid_calc_t * calc_out)
{
if(lv_obj_get_child(cont, 0) == NULL) {
lv_memset_00(calc_out, sizeof(_lv_grid_calc_t));

View File

@ -85,7 +85,7 @@ void lv_obj_set_grid_align(lv_obj_t * obj, lv_grid_align_t column_align, lv_grid
* @param row_pos row ID
* @param row_span number of rows to take (>= 1)
*/
void lv_obj_set_grid_cell(struct _lv_obj_t * obj, lv_grid_align_t column_align, uint8_t col_pos, uint8_t col_span,
void lv_obj_set_grid_cell(lv_obj_t * obj, lv_grid_align_t column_align, uint8_t col_pos, uint8_t col_span,
lv_grid_align_t row_align, uint8_t row_pos, uint8_t row_span);
/**
@ -259,61 +259,61 @@ static inline void lv_obj_set_style_grid_cell_y_align(lv_obj_t * obj, lv_coord_t
lv_obj_set_local_style_prop(obj, LV_STYLE_GRID_CELL_Y_ALIGN, v, selector);
}
static inline const lv_coord_t * lv_obj_get_style_grid_row_dsc_array(const struct _lv_obj_t * obj, uint32_t part)
static inline const lv_coord_t * lv_obj_get_style_grid_row_dsc_array(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_ROW_DSC_ARRAY);
return (const lv_coord_t *)v.ptr;
}
static inline const lv_coord_t * lv_obj_get_style_grid_column_dsc_array(const struct _lv_obj_t * obj, uint32_t part)
static inline const lv_coord_t * lv_obj_get_style_grid_column_dsc_array(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_COLUMN_DSC_ARRAY);
return (const lv_coord_t *)v.ptr;
}
static inline lv_grid_align_t lv_obj_get_style_grid_row_align(const struct _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, uint32_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 lv_grid_align_t lv_obj_get_style_grid_column_align(const struct _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, uint32_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 lv_coord_t lv_obj_get_style_grid_cell_column_pos(const struct _lv_obj_t * obj, uint32_t part)
static inline lv_coord_t lv_obj_get_style_grid_cell_column_pos(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_POS);
return (lv_coord_t)v.num;
}
static inline lv_coord_t lv_obj_get_style_grid_cell_column_span(const struct _lv_obj_t * obj, uint32_t part)
static inline lv_coord_t lv_obj_get_style_grid_cell_column_span(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_COLUMN_SPAN);
return (lv_coord_t)v.num;
}
static inline lv_coord_t lv_obj_get_style_grid_cell_row_pos(const struct _lv_obj_t * obj, uint32_t part)
static inline lv_coord_t lv_obj_get_style_grid_cell_row_pos(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_POS);
return (lv_coord_t)v.num;
}
static inline lv_coord_t lv_obj_get_style_grid_cell_row_span(const struct _lv_obj_t * obj, uint32_t part)
static inline lv_coord_t lv_obj_get_style_grid_cell_row_span(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_ROW_SPAN);
return (lv_coord_t)v.num;
}
static inline lv_coord_t lv_obj_get_style_grid_cell_x_align(const struct _lv_obj_t * obj, uint32_t part)
static inline lv_coord_t lv_obj_get_style_grid_cell_x_align(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_X_ALIGN);
return (lv_coord_t)v.num;
}
static inline lv_coord_t lv_obj_get_style_grid_cell_y_align(const struct _lv_obj_t * obj, uint32_t part)
static inline lv_coord_t lv_obj_get_style_grid_cell_y_align(const lv_obj_t * obj, uint32_t part)
{
lv_style_value_t v = lv_obj_get_style_prop(obj, part, LV_STYLE_GRID_CELL_Y_ALIGN);
return (lv_coord_t)v.num;

View File

@ -53,13 +53,18 @@ enum {
typedef uint8_t lv_font_subpx_t;
struct _lv_font_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_font_t lv_font_t;
/** Describe the properties of a font*/
typedef struct _lv_font_struct {
typedef struct _lv_font_t {
/** Get a glyph's descriptor from a font*/
bool (*get_glyph_dsc)(const struct _lv_font_struct *, lv_font_glyph_dsc_t *, uint32_t letter, uint32_t letter_next);
bool (*get_glyph_dsc)(const lv_font_t *, lv_font_glyph_dsc_t *, uint32_t letter, uint32_t letter_next);
/** Get a glyph's bitmap from a font*/
const uint8_t * (*get_glyph_bitmap)(const struct _lv_font_struct *, uint32_t);
const uint8_t * (*get_glyph_bitmap)(const lv_font_t *, uint32_t);
/*Pointer to the font in a font pack (must have the same line height)*/
lv_coord_t line_height; /**< The real line height where any text fits*/

View File

@ -43,6 +43,10 @@ struct _lv_disp_t;
struct _lv_disp_drv_t;
struct _lv_theme_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_disp_drv_t lv_disp_drv_t;
typedef struct _lv_obj_t lv_obj_t;
/**
* Structure for holding display buffer information.
*/
@ -97,38 +101,38 @@ typedef struct _lv_disp_drv_t {
/** MANDATORY: Write the internal buffer (draw_buf) to the display. 'lv_disp_flush_ready()' has to be
* called when finished*/
void (*flush_cb)(struct _lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
void (*flush_cb)(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
/** OPTIONAL: Extend the invalidated areas to match with the display drivers requirements
* E.g. round `y` to, 8, 16 ..) on a monochrome display*/
void (*rounder_cb)(struct _lv_disp_drv_t * disp_drv, lv_area_t * area);
void (*rounder_cb)(lv_disp_drv_t * disp_drv, lv_area_t * area);
/** OPTIONAL: Set a pixel in a buffer according to the special requirements of the display
* Can be used for color format not supported in LittelvGL. E.g. 2 bit -> 4 gray scales
* @note Much slower then drawing with supported color formats.*/
void (*set_px_cb)(struct _lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
void (*set_px_cb)(lv_disp_drv_t * disp_drv, uint8_t * buf, lv_coord_t buf_w, lv_coord_t x, lv_coord_t y,
lv_color_t color, lv_opa_t opa);
/** OPTIONAL: Called after every refresh cycle to tell the rendering and flushing time + the
* number of flushed pixels*/
void (*monitor_cb)(struct _lv_disp_drv_t * disp_drv, uint32_t time, uint32_t px);
void (*monitor_cb)(lv_disp_drv_t * disp_drv, uint32_t time, uint32_t px);
/** OPTIONAL: Called periodically while lvgl waits for operation to be completed.
* For example flushing or GPU
* User can execute very simple tasks here or yield the task*/
void (*wait_cb)(struct _lv_disp_drv_t * disp_drv);
void (*wait_cb)(lv_disp_drv_t * disp_drv);
/** OPTIONAL: Called when lvgl needs any CPU cache that affects rendering to be cleaned*/
void (*clean_dcache_cb)(struct _lv_disp_drv_t * disp_drv);
void (*clean_dcache_cb)(lv_disp_drv_t * disp_drv);
/** OPTIONAL: called to wait while the gpu is working*/
void (*gpu_wait_cb)(struct _lv_disp_drv_t * disp_drv);
void (*gpu_wait_cb)(lv_disp_drv_t * disp_drv);
/** OPTIONAL: called when driver parameters are updated */
void (*drv_update_cb)(struct _lv_disp_drv_t * disp_drv);
void (*drv_update_cb)(lv_disp_drv_t * disp_drv);
/** OPTIONAL: Fill a memory with a color (GPU only)*/
void (*gpu_fill_cb)(struct _lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
void (*gpu_fill_cb)(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color);
/** On CHROMA_KEYED images this color will be transparent.
@ -156,12 +160,12 @@ typedef struct _lv_disp_t {
struct _lv_theme_t * theme;
/** Screens of the display*/
struct _lv_obj_t ** screens; /**< Array of screen objects.*/
struct _lv_obj_t * act_scr; /**< Currently active screen on this display*/
struct _lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations*/
struct _lv_obj_t * scr_to_load; /**< The screen prepared to load in lv_scr_load_anim*/
struct _lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top*/
struct _lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys*/
lv_obj_t ** screens; /**< Array of screen objects.*/
lv_obj_t * act_scr; /**< Currently active screen on this display*/
lv_obj_t * prev_scr; /**< Previous screen. Used during screen animations*/
lv_obj_t * scr_to_load; /**< The screen prepared to load in lv_scr_load_anim*/
lv_obj_t * top_layer; /**< @see lv_disp_get_layer_top*/
lv_obj_t * sys_layer; /**< @see lv_disp_get_layer_sys*/
uint32_t screen_cnt;
uint8_t del_prev : 1; /**< 1: Automatically delete the previous screen when the screen load animation is ready*/

View File

@ -58,6 +58,12 @@ struct _lv_group_t;
struct _lv_indev_t;
struct _lv_indev_drv_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_indev_drv_t lv_indev_drv_t;
typedef struct _lv_indev_t lv_indev_t;
typedef struct _lv_group_t lv_group_t;
typedef struct _lv_obj_t lv_obj_t;
/** Possible input device types*/
typedef enum {
LV_INDEV_TYPE_NONE, /**< Uninitialized state*/
@ -91,11 +97,11 @@ typedef struct _lv_indev_drv_t {
lv_indev_type_t type;
/**< Function pointer to read input device data.*/
void (*read_cb)(struct _lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
void (*read_cb)(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
/** Called when an action happened on the input device.
* The second parameter is the event from `lv_event_t`*/
void (*feedback_cb)(struct _lv_indev_drv_t *, uint8_t);
void (*feedback_cb)(lv_indev_drv_t *, uint8_t);
#if LV_USE_USER_DATA
void * user_data;
@ -124,7 +130,7 @@ typedef struct _lv_indev_drv_t {
/**< Repeated trigger period in long press [ms]*/
uint16_t long_press_repeat_time;
} lv_indev_drv_t;
} _lv_indev_drv_t;
/** Run time data of input devices
* Internally used by the library, you should not need to touch it.
@ -147,10 +153,10 @@ typedef struct _lv_indev_proc_t {
lv_point_t scroll_sum; /*Count the dragged pixels to check LV_INDEV_DEF_SCROLL_LIMIT*/
lv_point_t scroll_throw_vect;
lv_point_t scroll_throw_vect_ori;
struct _lv_obj_t * act_obj; /*The object being pressed*/
struct _lv_obj_t * last_obj; /*The last object which was pressed*/
struct _lv_obj_t * scroll_obj; /*The object being scrolled*/
struct _lv_obj_t * last_pressed; /*The lastly pressed object*/
lv_obj_t * act_obj; /*The object being pressed*/
lv_obj_t * last_obj; /*The last object which was pressed*/
lv_obj_t * scroll_obj; /*The object being scrolled*/
lv_obj_t * last_pressed; /*The lastly pressed object*/
lv_area_t scroll_area;
lv_point_t gesture_sum; /*Count the gesture pixels to check LV_INDEV_DEF_GESTURE_LIMIT*/
@ -175,8 +181,8 @@ typedef struct _lv_indev_proc_t {
typedef struct _lv_indev_t {
lv_indev_drv_t * driver;
_lv_indev_proc_t proc;
struct _lv_obj_t * cursor; /**< Cursor for LV_INPUT_TYPE_POINTER*/
struct lv_group_t_struct * group; /**< Keypad destination group*/
lv_obj_t * cursor; /**< Cursor for LV_INPUT_TYPE_POINTER*/
lv_group_t * group; /**< Keypad destination group*/
const lv_point_t * btn_points; /**< Array points assigned to the button ()screen will be pressed
here by the buttons*/
} _lv_indev_t;

View File

@ -37,9 +37,11 @@ typedef enum {
LV_EXPORT_CONST_INT(LV_ANIM_REPEAT_INFINITE);
struct _lv_anim_t;
struct _lv_anim_path_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_anim_t lv_anim_t;
/** Get the current value during an animation*/
typedef int32_t (*lv_anim_path_cb_t)(const struct _lv_anim_t *);
typedef int32_t (*lv_anim_path_cb_t)(const lv_anim_t *);
/** Generic prototype of "animator" functions.
* First parameter is the variable to animate.
@ -51,16 +53,16 @@ typedef void (*lv_anim_exec_xcb_t)(void *, int32_t);
/** Same as `lv_anim_exec_xcb_t` but receives `lv_anim_t *` as the first parameter.
* It's more consistent but less convenient. Might be used by binding generator functions.*/
typedef void (*lv_anim_custom_exec_cb_t)(struct _lv_anim_t *, int32_t);
typedef void (*lv_anim_custom_exec_cb_t)(lv_anim_t *, int32_t);
/** Callback to call when the animation is ready*/
typedef void (*lv_anim_ready_cb_t)(struct _lv_anim_t *);
typedef void (*lv_anim_ready_cb_t)(lv_anim_t *);
/** Callback to call when the animation really stars (considering `delay`)*/
typedef void (*lv_anim_start_cb_t)(struct _lv_anim_t *);
typedef void (*lv_anim_start_cb_t)(lv_anim_t *);
/** Callback used when the animation values are relative to get the current value*/
typedef int32_t (*lv_anim_get_value_cb_t)(struct _lv_anim_t *);
typedef int32_t (*lv_anim_get_value_cb_t)(lv_anim_t *);
/** Describes an animation*/
typedef struct _lv_anim_t {
@ -91,9 +93,6 @@ typedef struct _lv_anim_t {
uint32_t time_orig;
} _lv_anim_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef _lv_anim_t lv_anim_t;
/**********************
* GLOBAL PROTOTYPES
**********************/

View File

@ -266,8 +266,10 @@ typedef uint8_t lv_opa_t;
//! @endcond
struct _lv_color_filter_dsc_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_color_filter_dsc_t lv_color_filter_dsc_t;
typedef lv_color_t (*lv_color_filter_cb_t)(const struct _lv_color_filter_dsc_t *, lv_color_t, lv_opa_t);
typedef lv_color_t (*lv_color_filter_cb_t)(const lv_color_filter_dsc_t *, lv_color_t, lv_opa_t);
typedef struct _lv_color_filter_dsc_t {
lv_color_filter_cb_t filter_cb;

View File

@ -68,20 +68,25 @@ enum {
};
typedef uint8_t lv_fs_whence_t;
struct _lv_fs_drv_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_fs_drv_t lv_fs_drv_t;
typedef struct _lv_fs_drv_t {
char letter;
bool (*ready_cb)(struct _lv_fs_drv_t * drv);
bool (*ready_cb)(lv_fs_drv_t * drv);
void * (*open_cb)(struct _lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode);
lv_fs_res_t (*close_cb)(struct _lv_fs_drv_t * drv, void * file_p);
lv_fs_res_t (*read_cb)(struct _lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br);
lv_fs_res_t (*write_cb)(struct _lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw);
lv_fs_res_t (*seek_cb)(struct _lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence);
lv_fs_res_t (*tell_cb)(struct _lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
void * (*open_cb)(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode);
lv_fs_res_t (*close_cb)(lv_fs_drv_t * drv, void * file_p);
lv_fs_res_t (*read_cb)(lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br);
lv_fs_res_t (*write_cb)(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw);
lv_fs_res_t (*seek_cb)(lv_fs_drv_t * drv, void * file_p, uint32_t pos, lv_fs_whence_t whence);
lv_fs_res_t (*tell_cb)(lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
void * (*dir_open_cb)(struct _lv_fs_drv_t * drv, const char * path);
lv_fs_res_t (*dir_read_cb)(struct _lv_fs_drv_t * drv, void * rddir_p, char * fn);
lv_fs_res_t (*dir_close_cb)(struct _lv_fs_drv_t * drv, void * rddir_p);
void * (*dir_open_cb)(lv_fs_drv_t * drv, const char * path);
lv_fs_res_t (*dir_read_cb)(lv_fs_drv_t * drv, void * rddir_p, char * fn);
lv_fs_res_t (*dir_close_cb)(lv_fs_drv_t * drv, void * rddir_p);
#if LV_USE_USER_DATA
void * user_data; /**< Custom file user data*/

View File

@ -33,11 +33,13 @@ extern "C" {
**********************/
struct _lv_timer_t;
/*Trick to no expose the fields of the struct in the MicroPython binding*/
typedef struct _lv_timer_t lv_timer_t;
/**
* Timers execute this type of functions.
*/
typedef void (*lv_timer_cb_t)(struct _lv_timer_t *);
typedef void (*lv_timer_cb_t)(lv_timer_t *);
/**
* Descriptor of a lv_timer