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

796 lines
21 KiB
C
Raw Normal View History

2016-06-08 07:25:08 +02:00
/**
* @file lv_obj.h
2016-06-08 07:25:08 +02:00
*
*/
#ifndef LV_OBJ_H
#define LV_OBJ_H
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
extern "C" {
#endif
2016-06-08 07:25:08 +02:00
/*********************
* INCLUDES
*********************/
2017-04-21 09:15:39 +02:00
#include "lv_conf.h"
2016-06-08 07:25:08 +02:00
#include <stddef.h>
#include <stdbool.h>
2017-11-23 20:42:14 +01:00
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_mem.h"
#include "../lv_misc/lv_ll.h"
#include "../lv_misc/lv_color.h"
#include "lv_style.h"
2016-06-08 07:25:08 +02:00
/*********************
* DEFINES
*********************/
2017-04-21 09:15:39 +02:00
2016-06-08 07:25:08 +02:00
/*Error check of lv_conf.h*/
#if LV_HOR_RES == 0 || LV_VER_RES == 0
#error "LV: LV_HOR_RES and LV_VER_RES must be greater then 0"
#endif
#if LV_ANTIALIAS != 0 && LV_ANTIALIAS != 1
#error "LV: LV_ATIALIAS can be only 0 or 1"
2016-06-08 07:25:08 +02:00
#endif
#if LV_VDB_SIZE == 0 && LV_ANTIALIAS != 0
2017-01-09 18:09:28 +01:00
#error "LV: If LV_VDB_SIZE == 0 the antialaissing must be disabled"
2016-06-08 07:25:08 +02:00
#endif
2017-06-17 09:08:12 +02:00
#if LV_VDB_SIZE != 0 && LV_VDB_SIZE < LV_HOR_RES && LV_ANTIALIAS == 0
#error "LV: Small Virtual Display Buffer (lv_conf.h: LV_VDB_SIZE >= LV_HOR_RES)"
#endif
#if LV_VDB_SIZE != 0 && LV_VDB_SIZE < 2 *LV_HOR_RES && LV_ANTIALIAS != 0
#error "LV: Small Virtual Display Buffer (lv_conf.h: LV_VDB_SIZE >= (2 * LV_HOR_RES))"
#endif
2016-07-12 15:05:17 +02:00
#define ANIM_IN 0x00 /*Animation to show an object. 'OR' it with lv_anim_builtin_t*/
#define ANIM_OUT 0x80 /*Animation to hide an object. 'OR' it with lv_anim_builtin_t*/
#define ANIM_DIR_MASK 0x80 /*ANIM_IN/ANIM_OUT mask*/
2016-06-08 07:25:08 +02:00
/**********************
* TYPEDEFS
**********************/
2017-11-19 19:28:45 +01:00
struct _lv_obj_t;
2016-06-08 07:25:08 +02:00
typedef enum
{
LV_DESIGN_DRAW_MAIN,
LV_DESIGN_DRAW_POST,
2016-06-08 07:25:08 +02:00
LV_DESIGN_COVER_CHK,
}lv_design_mode_t;
2017-11-19 19:28:45 +01:00
typedef bool (* lv_design_func_t) (struct _lv_obj_t * obj, const area_t * mask_p, lv_design_mode_t mode);
2016-06-08 07:25:08 +02:00
2017-11-15 21:06:44 +01:00
typedef enum
{
LV_RES_INV = 0, /*Typically indicates that the object is deleted (become invalid) in the action function*/
LV_RES_OK, /*The object is valid (no deleted) after the action*/
}lv_res_t;
2016-06-08 07:25:08 +02:00
typedef enum
{
/*General signals*/
2016-06-08 07:25:08 +02:00
LV_SIGNAL_CLEANUP,
LV_SIGNAL_CHILD_CHG,
LV_SIGNAL_CORD_CHG,
LV_SIGNAL_STYLE_CHG,
LV_SIGNAL_REFR_EXT_SIZE,
2017-10-09 15:21:26 +02:00
/*Input device related*/
2016-06-08 07:25:08 +02:00
LV_SIGNAL_PRESSED,
LV_SIGNAL_PRESSING,
2016-06-08 07:25:08 +02:00
LV_SIGNAL_PRESS_LOST,
LV_SIGNAL_RELEASED,
LV_SIGNAL_LONG_PRESS,
LV_SIGNAL_LONG_PRESS_REP,
2016-06-08 07:25:08 +02:00
LV_SIGNAL_DRAG_BEGIN,
LV_SIGNAL_DRAG_END,
/*Group related*/
LV_SIGNAL_FOCUS,
LV_SIGNAL_DEFOCUS,
LV_SIGNAL_CONTROLL,
2016-06-08 07:25:08 +02:00
}lv_signal_t;
2017-11-19 19:28:45 +01:00
typedef lv_res_t (* lv_signal_func_t) (struct _lv_obj_t * obj, lv_signal_t sign, void * param);
2016-06-08 07:25:08 +02:00
2017-11-19 19:28:45 +01:00
typedef struct _lv_obj_t
2016-06-08 07:25:08 +02:00
{
2017-11-19 19:28:45 +01:00
struct _lv_obj_t * par; /*Pointer to the parent object*/
2017-05-01 16:47:27 +02:00
ll_dsc_t child_ll; /*Linked list to store the children objects*/
2016-06-08 07:25:08 +02:00
area_t coords; /*Coordinates of the object (x1, y1, x2, y2)*/
lv_signal_func_t signal_func; /*Object type specific signal function*/
lv_design_func_t design_func; /*Object type specific design function*/
2016-06-08 07:25:08 +02:00
void * ext_attr; /*Object type specific extended data*/
2017-05-01 16:47:27 +02:00
lv_style_t * style_p; /*Pointer to the object's style*/
#if LV_OBJ_FREE_PTR != 0
void * free_ptr; /*Application specific pointer (set it freely)*/
#endif
2017-07-19 15:19:10 +02:00
void * group_p; /*Pointer to the group of the object*/
2016-06-08 07:25:08 +02:00
/*Attributes and states*/
uint8_t click :1; /*1: Can be pressed by an input device*/
uint8_t drag :1; /*1: Enable the dragging*/
uint8_t drag_throw:1; /*1: Enable throwing with drag*/
2017-05-01 16:47:27 +02:00
uint8_t drag_parent :1; /*1: Parent will be dragged instead*/
uint8_t hidden :1; /*1: Object is hidden*/
uint8_t top :1; /*1: If the object or its children is clicked it goes to the foreground*/
uint8_t reserved :1;
uint8_t protect; /*Automatically happening actions can be prevented. 'OR'ed values from lv_obj_prot_t*/
2017-05-01 16:47:27 +02:00
cord_t ext_size; /*EXTtend the size of the object in every direction. E.g. for shadow drawing*/
2017-11-19 19:28:45 +01:00
#ifdef LV_OBJ_FREE_NUM_TYPE
LV_OBJ_FREE_NUM_TYPE free_num; /*Application specific identifier (set it freely)*/
2017-04-11 10:50:57 +02:00
#endif
2016-06-08 07:25:08 +02:00
}lv_obj_t;
2017-11-19 19:28:45 +01:00
typedef lv_res_t (*lv_action_t) (struct _lv_obj_t * obj);
/*Protect some attributes (max. 8 bit)*/
typedef enum
{
LV_PROTECT_NONE = 0x00,
LV_PROTECT_CHILD_CHG = 0x01, /*Disable the child change signal. Used by the library*/
2017-04-11 10:50:57 +02:00
LV_PROTECT_PARENT = 0x02, /*Prevent automatic parent change (e.g. in lv_page)*/
LV_PROTECT_POS = 0x04, /*Prevent automatic positioning (e.g. in lv_cont layout)*/
2017-07-09 15:32:49 +02:00
LV_PROTECT_FOLLOW = 0x08, /*Prevent the object be followed in automatic ordering (e.g. in lv_cont PRETTY layout)*/
}lv_protect_t;
2016-06-08 07:25:08 +02:00
typedef enum
{
LV_ALIGN_CENTER = 0,
2017-05-01 16:47:27 +02:00
LV_ALIGN_IN_TOP_LEFT,
LV_ALIGN_IN_TOP_MID,
LV_ALIGN_IN_TOP_RIGHT,
LV_ALIGN_IN_BOTTOM_LEFT,
LV_ALIGN_IN_BOTTOM_MID,
LV_ALIGN_IN_BOTTOM_RIGHT,
LV_ALIGN_IN_LEFT_MID,
LV_ALIGN_IN_RIGHT_MID,
LV_ALIGN_OUT_TOP_LEFT,
LV_ALIGN_OUT_TOP_MID,
LV_ALIGN_OUT_TOP_RIGHT,
LV_ALIGN_OUT_BOTTOM_LEFT,
LV_ALIGN_OUT_BOTTOM_MID,
LV_ALIGN_OUT_BOTTOM_RIGHT,
LV_ALIGN_OUT_LEFT_TOP,
LV_ALIGN_OUT_LEFT_MID,
LV_ALIGN_OUT_LEFT_BOTTOM,
LV_ALIGN_OUT_RIGHT_TOP,
LV_ALIGN_OUT_RIGHT_MID,
LV_ALIGN_OUT_RIGHT_BOTTOM,
2016-06-08 07:25:08 +02:00
}lv_align_t;
2016-07-12 15:05:17 +02:00
typedef enum
{
LV_ANIM_NONE = 0,
2016-09-27 13:43:01 +02:00
LV_ANIM_FLOAT_TOP, /*Float from/to the top*/
LV_ANIM_FLOAT_LEFT, /*Float from/to the left*/
LV_ANIM_FLOAT_BOTTOM, /*Float from/to the bottom*/
LV_ANIM_FLOAT_RIGHT, /*Float from/to the right*/
LV_ANIM_GROW_H, /*Grow/shrink horizontally*/
LV_ANIM_GROW_V, /*Grow/shrink vertically*/
2016-07-12 15:05:17 +02:00
}lv_anim_builtin_t;
2016-06-08 07:25:08 +02:00
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Init. the 'lv' library.
*/
2016-06-08 07:25:08 +02:00
void lv_init(void);
2017-11-19 20:45:40 +01:00
/*--------------------
* Create and delete
*-------------------*/
/**
* Create a basic object
* @param parent pointer to a parent object.
* If NULL then a screen will be created
* @param copy pointer to a base object, if not NULL then the new object will be copied from it
* @return pointer to the new object
*/
2016-10-07 11:15:46 +02:00
lv_obj_t * lv_obj_create(lv_obj_t * parent, lv_obj_t * copy);
/**
* Delete 'obj' and all of its children
2017-05-01 16:47:27 +02:00
* @param obj pointer to an object to delete
2017-11-19 20:45:40 +01:00
* @preturn LV_RES_INV beacuse the object is deleted
*/
2017-11-15 21:06:44 +01:00
lv_res_t lv_obj_del(lv_obj_t * obj);
2016-06-08 07:25:08 +02:00
/**
* Delete all children of an object
* @param obj pointer to an object
*/
void lv_obj_clear(lv_obj_t *obj);
2017-05-12 16:09:37 +02:00
/**
* Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'
* @param obj pointer to an object
*/
void lv_obj_invalidate(lv_obj_t * obj);
2017-05-12 16:09:37 +02:00
2017-11-19 20:45:40 +01:00
/*=====================
* Setter functions
*====================*/
/*--------------
* Screen set
*--------------*/
/**
* Load a new screen
* @param scr pointer to a screen
*/
2017-10-20 15:37:50 +02:00
void lv_scr_load(lv_obj_t * scr);
2017-11-19 20:45:40 +01:00
/*--------------------
* Parent/children set
*--------------------*/
/**
* Set a new parent for an object. Its relative position will be the same.
* @param obj pointer to an object
* @param parent pointer to the new parent object
*/
2016-10-07 11:15:46 +02:00
void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent);
2017-11-19 20:45:40 +01:00
/*--------------------
* Coordinate set
* ------------------*/
/**
* Set relative the position of an object (relative to the parent)
* @param obj pointer to an object
* @param x new distance from the left side of the parent
* @param y new distance from the top of the parent
*/
2016-10-07 11:15:46 +02:00
void lv_obj_set_pos(lv_obj_t * obj, cord_t x, cord_t y);
/**
* Set relative the position of an object (relative to the parent).
2017-11-19 20:45:40 +01:00
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
2017-11-19 20:45:40 +01:00
* @param x new distance from the left side of the parent.
* @param y new distance from the top of the parent.
*/
2017-11-19 20:45:40 +01:00
static inline void lv_obj_set_pos_scale(lv_obj_t * obj, cord_t x, cord_t y)
{
lv_obj_set_pos(obj, x << LV_ANTIALIAS, y << LV_ANTIALIAS);
}
/**
* Set the x coordinate of a object
* @param obj pointer to an object
* @param x new distance from the left side from the parent
*/
2016-10-07 11:15:46 +02:00
void lv_obj_set_x(lv_obj_t * obj, cord_t x);
/**
* Set the x coordinate of a object.
2017-11-19 20:45:40 +01:00
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
2017-11-19 20:45:40 +01:00
* @param x new distance from the left side from the parent.
*/
2017-11-19 20:45:40 +01:00
static inline void lv_obj_set_x_scale(lv_obj_t * obj, cord_t x)
{
lv_obj_set_x(obj, x << LV_ANTIALIAS);
}
/**
* Set the y coordinate of a object
* @param obj pointer to an object
* @param y new distance from the top of the parent
*/
2016-10-07 11:15:46 +02:00
void lv_obj_set_y(lv_obj_t * obj, cord_t y);
/**
* Set the y coordinate of a object.
2017-11-19 20:45:40 +01:00
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
2017-11-19 20:45:40 +01:00
* @param y new distance from the top of the parent.
*/
2017-11-19 20:45:40 +01:00
static inline void lv_obj_set_y_scale(lv_obj_t * obj, cord_t y)
{
lv_obj_set_y(obj, y << LV_ANTIALIAS);
}
/**
* Set the size of an object
* @param obj pointer to an object
* @param w new width
* @param h new height
*/
2016-10-07 11:15:46 +02:00
void lv_obj_set_size(lv_obj_t * obj, cord_t w, cord_t h);
/**
2017-11-19 20:45:40 +01:00
* Set the size of an object.
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
2017-11-19 20:45:40 +01:00
* @param w new width
* @param h new height
*/
2017-11-19 20:45:40 +01:00
static inline void lv_obj_set_size_scale(lv_obj_t * obj, cord_t w, cord_t h)
{
lv_obj_set_size(obj, w << LV_ANTIALIAS, h << LV_ANTIALIAS);
}
/**
* Set the width of an object
* @param obj pointer to an object
* @param w new width
*/
2016-10-07 11:15:46 +02:00
void lv_obj_set_width(lv_obj_t * obj, cord_t w);
/**
2017-11-19 20:45:40 +01:00
* Set the width of an object.
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
2017-11-19 20:45:40 +01:00
* @param w new width
*/
2017-11-19 20:45:40 +01:00
static inline void lv_obj_set_width_scale(lv_obj_t * obj, cord_t w)
{
lv_obj_set_width(obj, w << LV_ANTIALIAS);
}
/**
* Set the height of an object
* @param obj pointer to an object
* @param h new height
*/
2016-10-07 11:15:46 +02:00
void lv_obj_set_height(lv_obj_t * obj, cord_t h);
/**
2017-11-19 20:45:40 +01:00
* Set the height of an object.
* The coordinate will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object
2017-11-19 20:45:40 +01:00
* @param h new height
*/
2017-11-19 20:45:40 +01:00
static inline void lv_obj_set_height_scale(lv_obj_t * obj, cord_t h)
{
lv_obj_set_height(obj, h << LV_ANTIALIAS);
}
/**
* Align an object to an other object.
* @param obj pointer to an object to align
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
* @param align type of alignment (see 'lv_align_t' enum)
* @param x_mod x coordinate shift after alignment
* @param y_mod y coordinate shift after alignment
*/
2016-10-07 11:15:46 +02:00
void lv_obj_align(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod, cord_t y_mod);
/**
2017-11-19 20:45:40 +01:00
* Align an object to an other object.
* The coordinates will be up scaled LV_ANTIALIAS is enabled.
* @param obj pointer to an object to align
* @param base pointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
* @param align type of alignment (see 'lv_align_t' enum)
2017-11-19 20:45:40 +01:00
* @param x_mod x coordinate shift after alignment
* @param y_mod y coordinate shift after alignment
*/
2017-11-19 20:45:40 +01:00
static inline void lv_obj_align_scale(lv_obj_t * obj,lv_obj_t * base, lv_align_t align, cord_t x_mod, cord_t y_mod)
{
lv_obj_align(obj, base, align, x_mod << LV_ANTIALIAS, y_mod << LV_ANTIALIAS);
}
2017-11-19 20:45:40 +01:00
/*---------------------
* Appearance set
*--------------------*/
/**
* Set a new style for an object
* @param obj pointer to an object
* @param style_p pointer to the new style
*/
void lv_obj_set_style(lv_obj_t * obj, lv_style_t * style);
2017-05-12 16:09:37 +02:00
/**
* Notify an object about its style is modified
* @param obj pointer to an object
*/
void lv_obj_refresh_style(lv_obj_t * obj);
2017-05-12 16:09:37 +02:00
/**
* Notify all object if a style is modified
* @param style pointer to a style. Only the objects with this style will be notified
* (NULL to notify all objects)
*/
2017-11-19 20:45:40 +01:00
void lv_obj_report_style_mod(void * style);
/*-----------------
* Attribute set
*----------------*/
2017-05-12 16:09:37 +02:00
/**
* Hide an object. It won't be visible and clickable.
* @param obj pointer to an object
* @param en true: hide the object
*/
2016-12-15 10:31:30 +01:00
void lv_obj_set_hidden(lv_obj_t * obj, bool en);
/**
* Enable or disable the clicking of an object
* @param obj pointer to an object
* @param en true: make the object clickable
*/
2016-12-15 10:31:30 +01:00
void lv_obj_set_click(lv_obj_t * obj, bool en);
/**
* Enable to bring this object to the foreground if it
* or any of its children is clicked
* @param obj pointer to an object
* @param en true: enable the auto top feature
*/
2016-12-15 10:31:30 +01:00
void lv_obj_set_top(lv_obj_t * obj, bool en);
/**
* Enable the dragging of an object
* @param obj pointer to an object
* @param en true: make the object dragable
*/
2016-12-15 10:31:30 +01:00
void lv_obj_set_drag(lv_obj_t * obj, bool en);
/**
* Enable the throwing of an object after is is dragged
* @param obj pointer to an object
* @param en true: enable the drag throw
*/
2016-12-15 10:31:30 +01:00
void lv_obj_set_drag_throw(lv_obj_t * obj, bool en);
/**
* Enable to use parent for drag related operations.
* If trying to drag the object the parent will be moved instead
* @param obj pointer to an object
* @param en true: enable the 'drag parent' for the object
*/
2016-12-15 10:31:30 +01:00
void lv_obj_set_drag_parent(lv_obj_t * obj, bool en);
/**
* Set a bit or bits in the protect filed
* @param obj pointer to an object
* @param prot 'OR'-ed values from lv_obj_prot_t
*/
void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot);
/**
* Clear a bit or bits in the protect filed
* @param obj pointer to an object
* @param prot 'OR'-ed values from lv_obj_prot_t
*/
void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot);
/**
* Set the signal function of an object.
* Always call the previous signal function in the new.
* @param obj pointer to an object
* @param fp the new signal function
*/
void lv_obj_set_signal_func(lv_obj_t * obj, lv_signal_func_t fp);
/**
* Set a new design function for an object
* @param obj pointer to an object
* @param fp the new design function
*/
void lv_obj_set_design_func(lv_obj_t * obj, lv_design_func_t fp);
2017-11-19 20:45:40 +01:00
/*----------------
* Other set
*--------------*/
/**
* Allocate a new ext. data for an object
* @param obj pointer to an object
* @param ext_size the size of the new ext. data
* @return Normal pointer to the allocated ext
*/
void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);
/**
* Send a 'LV_SIGNAL_REFR_EXT_SIZE' signal to the object
* @param obj pointer to an object
*/
void lv_obj_refresh_ext_size(lv_obj_t * obj);
2017-11-19 19:28:45 +01:00
#ifdef LV_OBJ_FREE_NUM_TYPE
/**
* Set an application specific number for an object.
* It can help to identify objects in the application.
* @param obj pointer to an object
* @param free_num the new free number
*/
2017-11-19 20:45:40 +01:00
void lv_obj_set_free_num(lv_obj_t * obj, LV_OBJ_FREE_NUM_TYPE free_num);
2017-05-01 16:47:27 +02:00
#endif
2017-10-20 15:37:50 +02:00
#if LV_OBJ_FREE_PTR != 0
/**
* Set an application specific pointer for an object.
* It can help to identify objects in the application.
* @param obj pointer to an object
* @param free_p the new free pinter
*/
2017-11-19 20:45:40 +01:00
void lv_obj_set_free_ptr(lv_obj_t * obj, void * free_p);
2017-05-01 16:47:27 +02:00
#endif
2017-07-19 15:19:10 +02:00
/**
* Animate an object
* @param obj pointer to an object to animate
* @param type type of animation from 'lv_anim_builtin_t'. 'OR' it with ANIM_IN or ANIM_OUT
* @param time time of animation in milliseconds
* @param delay delay before the animation in milliseconds
* @param cb a function to call when the animation is ready
*/
void lv_obj_animate(lv_obj_t * obj, lv_anim_builtin_t type, uint16_t time, uint16_t delay, void (*cb) (lv_obj_t *));
2017-11-19 20:45:40 +01:00
/*=======================
* Getter functions
*======================*/
/*------------------
* Screen get
*-----------------*/
/**
2017-11-19 20:45:40 +01:00
* Return with a pointer to the active screen
* @return pointer to the active screen object (loaded by 'lv_scr_load()')
*/
2017-11-19 20:45:40 +01:00
lv_obj_t * lv_scr_act(void);
/**
* Return with the top layer. (Same on every screen and it is above the normal screen layer)
* @return pointer to the top layer object (transparent screen sized lv_obj)
*/
lv_obj_t * lv_layer_top(void);
2017-10-10 16:17:23 +02:00
/**
* Return with the system layer. (Same on every screen and it is above the all other layers)
* It is used for example by the cursor
* @return pointer to the system layer object (transparent screen sized lv_obj)
*/
lv_obj_t * lv_layer_sys(void);
/**
* Return with the screen of an object
* @param obj pointer to an object
* @return pointer to a screen
*/
lv_obj_t * lv_obj_get_screen(lv_obj_t * obj);
2017-11-19 20:45:40 +01:00
/*---------------------
* Parent/children get
*--------------------*/
/**
* Returns with the parent of an object
* @param obj pointer to an object
* @return pointer to the parent of 'obj'
*/
2016-10-07 11:15:46 +02:00
lv_obj_t * lv_obj_get_parent(lv_obj_t * obj);
/**
2017-11-19 20:45:40 +01:00
* Iterate through the children of an object (start from the "youngest, lastly created")
* @param obj pointer to an object
* @param child NULL at first call to get the next children
* and the previous return value later
* @return the child after 'act_child' or NULL if no more child
*/
2016-10-07 11:15:46 +02:00
lv_obj_t * lv_obj_get_child(lv_obj_t * obj, lv_obj_t * child);
/**
2017-11-19 20:45:40 +01:00
* Iterate through the children of an object (start from the "oldest", firstly created)
* @param obj pointer to an object
* @param child NULL at first call to get the next children
* and the previous return value later
* @return the child after 'act_child' or NULL if no more child
*/
lv_obj_t * lv_obj_get_child_back(lv_obj_t * obj, lv_obj_t * child);
/**
* Count the children of an object (only children directly on 'obj')
* @param obj pointer to an object
* @return children number of 'obj'
*/
uint16_t lv_obj_count_children(lv_obj_t * obj);
2017-11-19 20:45:40 +01:00
/*---------------------
* Coordinate get
*--------------------*/
/**
* Copy the coordinates of an object to an area
* @param obj pointer to an object
* @param cords_p pointer to an area to store the coordinates
*/
void lv_obj_get_coords(lv_obj_t * obj, area_t * cords_p);
/**
* Get the x coordinate of object
* @param obj pointer to an object
* @return distance of 'obj' from the left side of its parent
*/
2016-10-07 11:15:46 +02:00
cord_t lv_obj_get_x(lv_obj_t * obj);
/**
* Get the y coordinate of object
* @param obj pointer to an object
* @return distance of 'obj' from the top of its parent
*/
2016-10-07 11:15:46 +02:00
cord_t lv_obj_get_y(lv_obj_t * obj);
/**
* Get the width of an object
* @param obj pointer to an object
* @return the width
*/
2016-10-07 11:15:46 +02:00
cord_t lv_obj_get_width(lv_obj_t * obj);
/**
* Get the height of an object
* @param obj pointer to an object
* @return the height
*/
2016-10-07 11:15:46 +02:00
cord_t lv_obj_get_height(lv_obj_t * obj);
/**
* Get the extended size attribute of an object
* @param obj pointer to an object
* @return the extended size attribute
*/
2017-04-28 16:12:35 +02:00
cord_t lv_obj_get_ext_size(lv_obj_t * obj);
2017-11-19 20:45:40 +01:00
/*-----------------
* Appearance get
*---------------*/
/**
2017-05-12 16:09:37 +02:00
* Get the style pointer of an object (if NULL get style of the parent)
* @param obj pointer to an object
* @return pointer to a style
*/
lv_style_t * lv_obj_get_style(lv_obj_t * obj);
2017-11-19 20:45:40 +01:00
/*-----------------
* Attribute get
*----------------*/
/**
* Get the hidden attribute of an object
* @param obj pointer to an object
* @return true: the object is hidden
*/
bool lv_obj_get_hidden(lv_obj_t * obj);
/**
* Get the click enable attribute of an object
* @param obj pointer to an object
* @return true: the object is clickable
*/
2016-10-07 11:15:46 +02:00
bool lv_obj_get_click(lv_obj_t * obj);
/**
* Get the top enable attribute of an object
* @param obj pointer to an object
* @return true: the auto top feture is enabled
*/
2016-10-07 11:15:46 +02:00
bool lv_obj_get_top(lv_obj_t * obj);
/**
* Get the drag enable attribute of an object
* @param obj pointer to an object
* @return true: the object is dragable
*/
2016-10-07 11:15:46 +02:00
bool lv_obj_get_drag(lv_obj_t * obj);
/**
* Get the drag thow enable attribute of an object
* @param obj pointer to an object
* @return true: drag throw is enabled
*/
2016-10-07 11:15:46 +02:00
bool lv_obj_get_drag_throw(lv_obj_t * obj);
/**
* Get the drag parent attribute of an object
* @param obj pointer to an object
* @return true: drag parent is enabled
*/
2016-10-07 11:15:46 +02:00
bool lv_obj_get_drag_parent(lv_obj_t * obj);
/**
* Get the protect field of an object
* @param obj pointer to an object
* @return protect field ('OR'ed values of lv_obj_prot_t)
*/
uint8_t lv_obj_get_protect(lv_obj_t * obj);
/**
* Check at least one bit of a given protect bitfield is set
* @param obj pointer to an object
* @param prot protect bits to test ('OR'ed values of lv_obj_prot_t)
* @return false: none of the given bits are set, true: at least one bit is set
*/
bool lv_obj_is_protected(lv_obj_t * obj, uint8_t prot);
2016-06-08 07:25:08 +02:00
/**
* Get the signal function of an object
* @param obj pointer to an object
* @return the signal function
*/
lv_signal_func_t lv_obj_get_signal_func(lv_obj_t * obj);
/**
* Get the design function of an object
* @param obj pointer to an object
* @return the design function
*/
lv_design_func_t lv_obj_get_design_func(lv_obj_t * obj);
2017-11-19 20:45:40 +01:00
/*------------------
* Other get
*-----------------*/
/**
* Get the ext pointer
* @param obj pointer to an object
* @return the ext pointer but not the dynamic version
2017-11-19 20:45:40 +01:00
* Use it as ext->data1, and NOT da(ext)->data1
*/
void * lv_obj_get_ext_attr(lv_obj_t * obj);
2017-11-19 19:28:45 +01:00
#ifdef LV_OBJ_FREE_NUM_TYPE
/**
* Get the free number
* @param obj pointer to an object
* @return the free number
*/
2017-11-19 19:28:45 +01:00
LV_OBJ_FREE_NUM_TYPE lv_obj_get_free_num(lv_obj_t * obj);
2017-05-01 16:47:27 +02:00
#endif
2016-06-08 07:25:08 +02:00
2017-10-20 15:37:50 +02:00
#if LV_OBJ_FREE_PTR != 0
/**
* Get the free pointer
* @param obj pointer to an object
* @return the free pointer
*/
2017-11-19 20:45:40 +01:00
void * lv_obj_get_free_ptr(lv_obj_t * obj);
2017-05-01 16:47:27 +02:00
#endif
2016-06-08 07:25:08 +02:00
#if LV_OBJ_GROUP != 0
/**
* Get the group of the object
* @param obj pointer to an object
* @return the pointer to group of the object
*/
void * lv_obj_get_group(lv_obj_t * obj);
#endif
2017-10-20 15:37:50 +02:00
2017-11-19 20:45:40 +01:00
2016-06-08 07:25:08 +02:00
/**********************
* MACROS
**********************/
2017-10-20 15:37:50 +02:00
#define LV_SCALE(x) (x << LV_ANTIALIAS)
2016-06-08 07:25:08 +02:00
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
} /* extern "C" */
2016-06-08 07:25:08 +02:00
#endif
2017-07-09 15:32:49 +02:00
#endif /*LV_OBJ_H*/