2016-06-08 07:25:08 +02:00
|
|
|
/**
|
2016-12-15 16:19:23 +01:00
|
|
|
* @file lv_obj.h
|
2018-06-19 09:49:58 +02:00
|
|
|
*
|
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
|
|
|
|
*********************/
|
2019-12-26 02:49:30 +01:00
|
|
|
#include "../lv_conf_internal.h"
|
2018-07-07 11:53:22 +02:00
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdbool.h>
|
2017-11-26 23:57:39 +01:00
|
|
|
#include "lv_style.h"
|
2019-05-14 15:45:03 +02:00
|
|
|
#include "../lv_misc/lv_types.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"
|
2019-10-08 16:26:55 +02:00
|
|
|
#include "../lv_misc/lv_bidi.h"
|
2019-02-10 11:06:47 +01:00
|
|
|
#include "../lv_hal/lv_hal.h"
|
2019-12-17 09:20:40 +01:00
|
|
|
#include "../lv_draw/lv_draw_rect.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*/
|
2019-02-07 19:17:10 +01:00
|
|
|
#if LV_HOR_RES_MAX == 0 || LV_VER_RES_MAX == 0
|
2019-03-30 06:03:23 +01:00
|
|
|
#error "LittlevGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0"
|
2016-06-08 07:25:08 +02:00
|
|
|
#endif
|
|
|
|
|
2018-02-15 10:12:28 +01:00
|
|
|
#if LV_ANTIALIAS > 1
|
|
|
|
#error "LittlevGL: LV_ANTIALIAS can be only 0 or 1"
|
2016-06-08 07:25:08 +02:00
|
|
|
#endif
|
|
|
|
|
2019-04-11 06:26:41 +02:00
|
|
|
#define LV_MAX_ANCESTOR_NUM 8
|
|
|
|
|
2019-12-17 09:20:40 +01:00
|
|
|
#define LV_EXT_CLICK_AREA_OFF 0
|
|
|
|
#define LV_EXT_CLICK_AREA_TINY 1
|
|
|
|
#define LV_EXT_CLICK_AREA_FULL 2
|
2019-01-23 12:23:49 +01:00
|
|
|
|
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
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
|
|
|
|
/** Design modes */
|
2019-04-04 07:15:40 +02:00
|
|
|
enum {
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_DESIGN_DRAW_MAIN, /**< Draw the main portion of the object */
|
|
|
|
LV_DESIGN_DRAW_POST, /**< Draw extras on the object */
|
|
|
|
LV_DESIGN_COVER_CHK, /**< Check if the object fully covers the 'mask_p' area */
|
2018-09-18 13:59:40 +02:00
|
|
|
};
|
|
|
|
typedef uint8_t lv_design_mode_t;
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2019-09-06 19:53:39 +02:00
|
|
|
|
|
|
|
/** Design results */
|
|
|
|
enum {
|
|
|
|
LV_DESIGN_RES_OK, /**< Draw ready */
|
|
|
|
LV_DESIGN_RES_COVER, /**< Returned on `LV_DESIGN_COVER_CHK` if the areas is fully covered*/
|
|
|
|
LV_DESIGN_RES_NOT_COVER, /**< Returned on `LV_DESIGN_COVER_CHK` if the areas is not covered*/
|
|
|
|
LV_DESIGN_RES_MASKED, /**< Returned on `LV_DESIGN_COVER_CHK` if the areas is masked out (children also not cover)*/
|
|
|
|
};
|
|
|
|
typedef uint8_t lv_design_res_t;
|
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
/**
|
|
|
|
* The design callback is used to draw the object on the screen.
|
|
|
|
* It accepts the object, a mask area, and the mode in which to draw the object.
|
|
|
|
*/
|
2019-09-06 19:53:39 +02:00
|
|
|
typedef lv_design_res_t (*lv_design_cb_t)(struct _lv_obj_t * obj, const lv_area_t * clip_area, lv_design_mode_t mode);
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2019-03-26 00:19:38 +02:00
|
|
|
enum {
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_EVENT_PRESSED, /**< The object has been pressed*/
|
|
|
|
LV_EVENT_PRESSING, /**< The object is being pressed (called continuously while pressing)*/
|
|
|
|
LV_EVENT_PRESS_LOST, /**< User is still pressing but slid cursor/finger off of the object */
|
|
|
|
LV_EVENT_SHORT_CLICKED, /**< User pressed object for a short period of time, then released it. Not called if dragged. */
|
|
|
|
LV_EVENT_LONG_PRESSED, /**< Object has been pressed for at least `LV_INDEV_LONG_PRESS_TIME`. Not called if dragged.*/
|
|
|
|
LV_EVENT_LONG_PRESSED_REPEAT, /**< Called after `LV_INDEV_LONG_PRESS_TIME` in every
|
|
|
|
`LV_INDEV_LONG_PRESS_REP_TIME` ms. Not called if dragged.*/
|
|
|
|
LV_EVENT_CLICKED, /**< Called on release if not dragged (regardless to long press)*/
|
|
|
|
LV_EVENT_RELEASED, /**< Called in every cases when the object has been released*/
|
|
|
|
LV_EVENT_DRAG_BEGIN,
|
2019-02-26 09:25:46 +01:00
|
|
|
LV_EVENT_DRAG_END,
|
|
|
|
LV_EVENT_DRAG_THROW_BEGIN,
|
2020-01-16 19:24:08 -05:00
|
|
|
LV_EVENT_GESTURE, /**< The object has been getture*/
|
2019-05-15 06:43:16 +02:00
|
|
|
LV_EVENT_KEY,
|
2019-02-26 09:25:46 +01:00
|
|
|
LV_EVENT_FOCUSED,
|
|
|
|
LV_EVENT_DEFOCUSED,
|
2020-01-24 14:55:56 +01:00
|
|
|
LV_EVENT_LEAVE,
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved) */
|
2019-03-20 05:46:21 +01:00
|
|
|
LV_EVENT_INSERT,
|
2019-02-26 09:25:46 +01:00
|
|
|
LV_EVENT_REFRESH,
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_EVENT_APPLY, /**< "Ok", "Apply" or similar specific button has clicked*/
|
|
|
|
LV_EVENT_CANCEL, /**< "Close", "Cancel" or similar specific button has clicked*/
|
|
|
|
LV_EVENT_DELETE, /**< Object is being deleted */
|
2019-03-26 00:19:38 +02:00
|
|
|
};
|
2019-06-27 18:07:26 -04:00
|
|
|
typedef uint8_t lv_event_t; /**< Type of event being sent to the object. */
|
2019-02-26 09:25:46 +01:00
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
/**
|
|
|
|
* @brief Event callback.
|
|
|
|
* Events are used to notify the user of some action being taken on the object.
|
|
|
|
* For details, see ::lv_event_t.
|
|
|
|
*/
|
2019-02-26 09:25:46 +01:00
|
|
|
typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event);
|
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
/** Signals are for use by the object itself or to extend the object's functionality.
|
|
|
|
* Applications should use ::lv_obj_set_event_cb to be notified of events that occur
|
|
|
|
* on the object. */
|
2019-04-04 07:15:40 +02:00
|
|
|
enum {
|
2017-07-20 12:26:34 +02:00
|
|
|
/*General signals*/
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_SIGNAL_CLEANUP, /**< Object is being deleted */
|
|
|
|
LV_SIGNAL_CHILD_CHG, /**< Child was removed/added */
|
2020-01-05 01:16:13 +01:00
|
|
|
LV_SIGNAL_COORD_CHG, /**< Object coordinates/size have changed */
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_SIGNAL_PARENT_SIZE_CHG, /**< Parent's size has changed */
|
2019-10-08 16:26:55 +02:00
|
|
|
LV_SIGNAL_STYLE_CHG, /**< Object's style has changed */
|
|
|
|
LV_SIGNAL_BASE_DIR_CHG, /**<The base dir has changed*/
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_SIGNAL_REFR_EXT_DRAW_PAD, /**< Object's extra padding has changed */
|
|
|
|
LV_SIGNAL_GET_TYPE, /**< LittlevGL needs to retrieve the object's type */
|
2019-12-17 09:20:40 +01:00
|
|
|
LV_SIGNAL_GET_STYLE, /**<Get the style of an object*/
|
2020-01-24 14:55:56 +01:00
|
|
|
LV_SIGNAL_GET_STATE_DSC, /**<Get the state of the object*/
|
2017-07-20 12:26:34 +02:00
|
|
|
|
2018-06-19 09:49:58 +02:00
|
|
|
/*Input device related*/
|
2019-12-22 13:51:02 +00:00
|
|
|
LV_SIGNAL_HIT_TEST, /**< Advanced hit-testing */
|
2019-06-27 18:07:26 -04:00
|
|
|
LV_SIGNAL_PRESSED, /**< The object has been pressed*/
|
|
|
|
LV_SIGNAL_PRESSING, /**< The object is being pressed (called continuously while pressing)*/
|
|
|
|
LV_SIGNAL_PRESS_LOST, /**< User is still pressing but slid cursor/finger off of the object */
|
|
|
|
LV_SIGNAL_RELEASED, /**< User pressed object for a short period of time, then released it. Not called if dragged. */
|
|
|
|
LV_SIGNAL_LONG_PRESS, /**< Object has been pressed for at least `LV_INDEV_LONG_PRESS_TIME`. Not called if dragged.*/
|
2019-06-28 08:36:53 -04:00
|
|
|
LV_SIGNAL_LONG_PRESS_REP, /**< Called after `LV_INDEV_LONG_PRESS_TIME` in every `LV_INDEV_LONG_PRESS_REP_TIME` ms. Not called if dragged.*/
|
|
|
|
LV_SIGNAL_DRAG_BEGIN,
|
2019-09-19 14:58:07 +02:00
|
|
|
LV_SIGNAL_DRAG_THROW_BEGIN,
|
2019-06-28 08:36:53 -04:00
|
|
|
LV_SIGNAL_DRAG_END,
|
2020-01-24 14:55:56 +01:00
|
|
|
LV_SIGNAL_GESTURE, /**< The object has been gesture*/
|
|
|
|
LV_SIGNAL_LEAVE, /**< Another object is clicked or chosen via an input device */
|
2019-10-08 16:26:55 +02:00
|
|
|
|
2018-06-19 09:49:58 +02:00
|
|
|
/*Group related*/
|
2017-07-25 09:02:21 +02:00
|
|
|
LV_SIGNAL_FOCUS,
|
|
|
|
LV_SIGNAL_DEFOCUS,
|
2019-03-19 07:15:00 +01:00
|
|
|
LV_SIGNAL_CONTROL,
|
2018-07-25 21:52:50 +02:00
|
|
|
LV_SIGNAL_GET_EDITABLE,
|
2018-09-18 13:59:40 +02:00
|
|
|
};
|
|
|
|
typedef uint8_t lv_signal_t;
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2019-04-04 07:15:40 +02:00
|
|
|
typedef lv_res_t (*lv_signal_cb_t)(struct _lv_obj_t * obj, lv_signal_t sign, void * param);
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2019-04-11 06:26:41 +02:00
|
|
|
#if LV_USE_OBJ_REALIGN
|
2019-04-04 07:15:40 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2018-11-23 11:35:13 +01:00
|
|
|
const struct _lv_obj_t * base;
|
2018-11-22 14:59:38 +01:00
|
|
|
lv_coord_t xofs;
|
|
|
|
lv_coord_t yofs;
|
|
|
|
lv_align_t align;
|
2019-04-04 07:15:40 +02:00
|
|
|
uint8_t auto_realign : 1;
|
2019-06-27 18:07:26 -04:00
|
|
|
uint8_t origo_align : 1; /**< 1: the origo (center of the object) was aligned with
|
2019-04-04 07:15:40 +02:00
|
|
|
`lv_obj_align_origo`*/
|
2019-12-22 22:40:02 +01:00
|
|
|
} lv_realign_t;
|
2018-11-22 14:59:38 +01:00
|
|
|
#endif
|
|
|
|
|
2019-12-19 11:05:04 +01:00
|
|
|
/*Protect some attributes (max. 8 bit)*/
|
|
|
|
enum {
|
|
|
|
LV_PROTECT_NONE = 0x00,
|
|
|
|
LV_PROTECT_CHILD_CHG = 0x01, /**< Disable the child change signal. Used by the library*/
|
|
|
|
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)*/
|
|
|
|
LV_PROTECT_FOLLOW = 0x08, /**< Prevent the object be followed in automatic ordering (e.g. in
|
|
|
|
lv_cont PRETTY layout)*/
|
|
|
|
LV_PROTECT_PRESS_LOST = 0x10, /**< If the `indev` was pressing this object but swiped out while
|
|
|
|
pressing do not search other object.*/
|
|
|
|
LV_PROTECT_CLICK_FOCUS = 0x20, /**< Prevent focusing the object by clicking on it*/
|
|
|
|
};
|
|
|
|
typedef uint8_t lv_protect_t;
|
|
|
|
|
|
|
|
enum {
|
2020-01-24 14:55:56 +01:00
|
|
|
LV_OBJ_STATE_NORMAL = 0,
|
2019-12-19 11:05:04 +01:00
|
|
|
LV_OBJ_STATE_CHECKED = (LV_STYLE_STATE_CHECKED >> LV_STYLE_STATE_POS),
|
|
|
|
LV_OBJ_STATE_FOCUS = (LV_STYLE_STATE_FOCUS >> LV_STYLE_STATE_POS),
|
|
|
|
LV_OBJ_STATE_EDIT = (LV_STYLE_STATE_EDIT >> LV_STYLE_STATE_POS),
|
|
|
|
LV_OBJ_STATE_HOVER = (LV_STYLE_STATE_HOVER >> LV_STYLE_STATE_POS),
|
|
|
|
LV_OBJ_STATE_PRESSED = (LV_STYLE_STATE_PRESSED >> LV_STYLE_STATE_POS),
|
|
|
|
LV_OBJ_STATE_DISABLED = (LV_STYLE_STATE_DISABLED >> LV_STYLE_STATE_POS),
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef uint8_t lv_obj_state_t;
|
|
|
|
|
2020-01-24 14:55:56 +01:00
|
|
|
typedef struct {
|
|
|
|
lv_obj_state_t act;
|
|
|
|
lv_obj_state_t prev;
|
|
|
|
uint8_t anim;
|
|
|
|
}lv_obj_state_dsc_t;
|
|
|
|
|
2017-11-19 19:28:45 +01:00
|
|
|
typedef struct _lv_obj_t
|
2016-06-08 07:25:08 +02:00
|
|
|
{
|
2020-01-08 21:31:05 +01:00
|
|
|
struct _lv_obj_t * parent; /**< Pointer to the parent object*/
|
2019-06-27 18:07:26 -04:00
|
|
|
lv_ll_t child_ll; /**< Linked list to store the children objects*/
|
2018-06-19 09:49:58 +02:00
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
lv_area_t coords; /**< Coordinates of the object (x1, y1, x2, y2)*/
|
2016-06-20 18:18:36 +02:00
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
lv_event_cb_t event_cb; /**< Event callback function */
|
|
|
|
lv_signal_cb_t signal_cb; /**< Object type specific signal function*/
|
|
|
|
lv_design_cb_t design_cb; /**< Object type specific design function*/
|
2018-06-19 09:49:58 +02:00
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
void * ext_attr; /**< Object type specific extended data*/
|
2020-01-16 21:25:11 +01:00
|
|
|
lv_style_list_t style_list;
|
2016-06-20 18:18:36 +02:00
|
|
|
|
2019-04-11 06:26:41 +02:00
|
|
|
|
|
|
|
#if LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_TINY
|
2019-06-27 18:07:26 -04:00
|
|
|
uint8_t ext_click_pad_hor; /**< Extra click padding in horizontal direction */
|
|
|
|
uint8_t ext_click_pad_ver; /**< Extra click padding in vertical direction */
|
2019-12-31 22:13:32 +01:00
|
|
|
#elif LV_USE_EXT_CLICK_AREA == LV_EXT_CLICK_AREA_FULL
|
2019-06-27 18:07:26 -04:00
|
|
|
lv_area_t ext_click_pad; /**< Extra click padding area. */
|
2019-04-11 06:26:41 +02:00
|
|
|
#endif
|
|
|
|
|
2019-12-31 22:13:32 +01:00
|
|
|
lv_coord_t ext_draw_pad; /**< EXTtend the size in every direction for drawing. */
|
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/*Attributes and states*/
|
2019-12-31 22:13:32 +01:00
|
|
|
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*/
|
|
|
|
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 parent_event :1; /**< 1: Send the object's events to the parent too. */
|
|
|
|
uint8_t adv_hittest :1; /**< 1: Use advanced hit-testing (slower) */
|
2020-01-16 19:24:08 -05:00
|
|
|
uint8_t gesture_parent : 1; /**< 1: Parent will be gesture instead*/
|
2019-12-31 22:13:32 +01:00
|
|
|
|
|
|
|
lv_drag_dir_t drag_dir :2; /**< Which directions the object can be dragged in */
|
|
|
|
lv_bidi_dir_t base_dir :2; /**< Base direction of texts related to this object */
|
2019-04-04 07:15:40 +02:00
|
|
|
|
2019-12-31 22:13:32 +01:00
|
|
|
#if LV_USE_GROUP != 0
|
2020-01-21 15:56:03 +01:00
|
|
|
void * group_p;
|
2019-12-31 22:13:32 +01:00
|
|
|
#endif
|
|
|
|
|
|
|
|
uint8_t protect; /**< Automatically happening actions can be prevented.
|
|
|
|
'OR'ed values from `lv_protect_t`*/
|
2020-01-24 14:55:56 +01:00
|
|
|
lv_obj_state_dsc_t state_dsc;
|
2019-06-06 06:05:40 +02:00
|
|
|
|
2019-04-11 06:26:41 +02:00
|
|
|
#if LV_USE_OBJ_REALIGN
|
2019-12-22 22:40:02 +01:00
|
|
|
lv_realign_t realign; /**< Information about the last call to ::lv_obj_align. */
|
2018-11-22 14:59:38 +01:00
|
|
|
#endif
|
2016-06-20 18:18:36 +02:00
|
|
|
|
2019-05-15 18:51:31 +02:00
|
|
|
#if LV_USE_USER_DATA
|
2019-06-27 18:07:26 -04:00
|
|
|
lv_obj_user_data_t user_data; /**< Custom user data for object. */
|
2019-03-02 20:53:51 +01:00
|
|
|
#endif
|
|
|
|
|
2018-06-19 09:49:58 +02:00
|
|
|
} lv_obj_t;
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2019-12-17 09:20:40 +01:00
|
|
|
enum {
|
2019-12-31 06:10:50 +01:00
|
|
|
LV_OBJ_PART_MAIN,
|
2020-01-07 23:43:57 +01:00
|
|
|
_LV_OBJ_PART_VIRTUAL_LAST = 0x01,
|
|
|
|
_LV_OBJ_PART_REAL_LAST = 0x40,
|
|
|
|
_LV_OBJ_PART_ALL = 0xFF,
|
2019-12-17 09:20:40 +01:00
|
|
|
};
|
|
|
|
|
2019-12-31 06:10:50 +01:00
|
|
|
typedef uint8_t lv_obj_part_t;
|
2019-12-17 09:20:40 +01:00
|
|
|
|
2019-06-27 18:07:26 -04:00
|
|
|
/** Used by `lv_obj_get_type()`. The object's and its ancestor types are stored here*/
|
2019-04-04 07:15:40 +02:00
|
|
|
typedef struct
|
|
|
|
{
|
2019-06-27 18:07:26 -04:00
|
|
|
const char * type[LV_MAX_ANCESTOR_NUM]; /**< [0]: the actual type, [1]: ancestor, [2] #1's ancestor
|
2019-04-04 07:15:40 +02:00
|
|
|
... [x]: "lv_obj" */
|
2018-06-19 09:49:58 +02:00
|
|
|
} lv_obj_type_t;
|
2018-02-28 15:37:41 +01:00
|
|
|
|
2020-01-05 20:05:11 +01:00
|
|
|
typedef struct
|
2019-12-22 13:51:02 +00:00
|
|
|
{
|
|
|
|
lv_point_t *point;
|
|
|
|
bool result;
|
|
|
|
} lv_hit_test_info_t;
|
|
|
|
|
2020-01-07 23:43:57 +01:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint8_t part;
|
2020-01-16 14:26:36 +01:00
|
|
|
lv_style_list_t * result;
|
2020-01-07 23:43:57 +01:00
|
|
|
} lv_get_style_info_t;
|
|
|
|
|
2020-01-05 20:05:11 +01:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
uint8_t part;
|
2020-01-24 14:55:56 +01:00
|
|
|
lv_obj_state_dsc_t * result;
|
2020-01-05 20:05:11 +01:00
|
|
|
} lv_get_state_info_t;
|
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/**********************
|
|
|
|
* GLOBAL PROTOTYPES
|
|
|
|
**********************/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Init. the 'lv' library.
|
|
|
|
*/
|
2016-06-08 07:25:08 +02:00
|
|
|
void lv_init(void);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-12-22 01:35:00 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Deinit the 'lv' library
|
2019-12-31 22:13:32 +01:00
|
|
|
* Currently only implemented when not using custom allocators, or GC is enabled.
|
2019-12-22 01:35:00 +02:00
|
|
|
*/
|
|
|
|
#if LV_ENABLE_GC || !LV_MEM_CUSTOM
|
|
|
|
void lv_deinit(void);
|
|
|
|
#endif
|
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*--------------------
|
|
|
|
* Create and delete
|
|
|
|
*-------------------*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2019-04-04 07:15:40 +02:00
|
|
|
lv_obj_t * lv_obj_create(lv_obj_t * parent, const lv_obj_t * copy);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete 'obj' and all of its children
|
2017-05-01 16:47:27 +02:00
|
|
|
* @param obj pointer to an object to delete
|
2017-12-19 22:00:32 +01:00
|
|
|
* @return LV_RES_INV because the object is deleted
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
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
|
|
|
|
2019-07-06 15:47:02 -04:00
|
|
|
/**
|
|
|
|
* Helper function for asynchronously deleting objects.
|
|
|
|
* Useful for cases where you can't delete an object directly in an `LV_EVENT_DELETE` handler (i.e. parent).
|
|
|
|
* @param obj object to delete
|
|
|
|
* @see lv_async_call
|
|
|
|
*/
|
|
|
|
void lv_obj_del_async(struct _lv_obj_t *obj);
|
|
|
|
|
2017-10-31 16:25:52 +01:00
|
|
|
/**
|
|
|
|
* Delete all children of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
*/
|
2019-04-04 07:15:40 +02:00
|
|
|
void lv_obj_clean(lv_obj_t * obj);
|
2017-10-31 16:25:52 +01:00
|
|
|
|
2020-01-20 14:47:05 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Mark an area of an object as invalid.
|
|
|
|
* This area will be redrawn by 'lv_refr_task'
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param area the area to redraw
|
|
|
|
*/
|
|
|
|
void lv_obj_invalidate_area(const lv_obj_t * obj, const lv_area_t * area);
|
|
|
|
|
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
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
void lv_obj_invalidate(const lv_obj_t * obj);
|
2017-05-12 16:09:37 +02:00
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*=====================
|
|
|
|
* Setter functions
|
|
|
|
*====================*/
|
|
|
|
|
|
|
|
/*--------------------
|
|
|
|
* Parent/children set
|
|
|
|
*--------------------*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Set a new parent for an object. Its relative position will be the same.
|
2018-08-15 12:32:53 +02:00
|
|
|
* @param obj pointer to an object. Can't be a screen.
|
|
|
|
* @param parent pointer to the new parent object. (Can't be NULL)
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2016-10-07 11:15:46 +02:00
|
|
|
void lv_obj_set_parent(lv_obj_t * obj, lv_obj_t * parent);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-05-03 19:25:58 +02:00
|
|
|
/**
|
|
|
|
* Move and object to the foreground
|
|
|
|
* @param obj pointer to an object
|
|
|
|
*/
|
|
|
|
void lv_obj_move_foreground(lv_obj_t * obj);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Move and object to the background
|
|
|
|
* @param obj pointer to an object
|
|
|
|
*/
|
|
|
|
void lv_obj_move_background(lv_obj_t * obj);
|
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*--------------------
|
|
|
|
* Coordinate set
|
|
|
|
* ------------------*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2017-11-23 21:28:36 +01:00
|
|
|
void lv_obj_set_pos(lv_obj_t * obj, lv_coord_t x, lv_coord_t y);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the x coordinate of a object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param x new distance from the left side from the parent
|
|
|
|
*/
|
2017-11-23 21:28:36 +01:00
|
|
|
void lv_obj_set_x(lv_obj_t * obj, lv_coord_t x);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the y coordinate of a object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param y new distance from the top of the parent
|
|
|
|
*/
|
2017-11-23 21:28:36 +01:00
|
|
|
void lv_obj_set_y(lv_obj_t * obj, lv_coord_t y);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the size of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param w new width
|
|
|
|
* @param h new height
|
|
|
|
*/
|
2017-11-23 21:28:36 +01:00
|
|
|
void lv_obj_set_size(lv_obj_t * obj, lv_coord_t w, lv_coord_t h);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the width of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param w new width
|
|
|
|
*/
|
2017-11-23 21:28:36 +01:00
|
|
|
void lv_obj_set_width(lv_obj_t * obj, lv_coord_t w);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the height of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param h new height
|
|
|
|
*/
|
2017-11-23 21:28:36 +01:00
|
|
|
void lv_obj_set_height(lv_obj_t * obj, lv_coord_t h);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2019-06-06 06:05:40 +02:00
|
|
|
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2018-11-23 11:35:13 +01:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2019-06-06 06:05:40 +02:00
|
|
|
void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod);
|
2018-11-23 11:35:13 +01:00
|
|
|
|
2018-11-22 14:59:38 +01:00
|
|
|
/**
|
|
|
|
* Realign the object based on the last `lv_obj_align` parameters.
|
|
|
|
* @param obj pointer to an object
|
|
|
|
*/
|
|
|
|
void lv_obj_realign(lv_obj_t * obj);
|
|
|
|
|
|
|
|
/**
|
2019-04-04 07:15:40 +02:00
|
|
|
* Enable the automatic realign of the object when its size has changed based on the last
|
|
|
|
* `lv_obj_align` parameters.
|
2018-11-22 14:59:38 +01:00
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param en true: enable auto realign; false: disable auto realign
|
|
|
|
*/
|
|
|
|
void lv_obj_set_auto_realign(lv_obj_t * obj, bool en);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-04-11 06:26:41 +02:00
|
|
|
/**
|
|
|
|
* Set the size of an extended clickable area
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param left extended clickable are on the left [px]
|
|
|
|
* @param right extended clickable are on the right [px]
|
|
|
|
* @param top extended clickable are on the top [px]
|
|
|
|
* @param bottom extended clickable are on the bottom [px]
|
|
|
|
*/
|
|
|
|
void lv_obj_set_ext_click_area(lv_obj_t * obj, lv_coord_t left, lv_coord_t right, lv_coord_t top, lv_coord_t bottom);
|
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*---------------------
|
|
|
|
* Appearance set
|
|
|
|
*--------------------*/
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new style for an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param style_p pointer to the new style
|
|
|
|
*/
|
2019-04-11 19:59:55 +08:00
|
|
|
void lv_obj_set_style(lv_obj_t * obj, const lv_style_t * style);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-12-22 22:40:02 +01:00
|
|
|
void lv_obj_set_style_color(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_color_t color);
|
2019-12-14 23:39:26 +01:00
|
|
|
|
2020-01-14 08:36:36 +01:00
|
|
|
void lv_obj_set_style_int(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_style_int_t value);
|
2019-12-14 23:39:26 +01:00
|
|
|
|
2019-12-22 22:40:02 +01:00
|
|
|
void lv_obj_set_style_opa(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, lv_opa_t opa);
|
2019-12-14 23:39:26 +01:00
|
|
|
|
2020-02-02 14:09:19 +01:00
|
|
|
void lv_obj_set_style_ptr(lv_obj_t * obj, uint8_t type, lv_style_property_t prop, const void * p);
|
2019-12-19 22:44:18 +01:00
|
|
|
|
2020-01-16 21:25:11 +01:00
|
|
|
void lv_obj_add_style(lv_obj_t * obj, uint8_t type, lv_style_t * style);
|
2019-12-22 22:40:02 +01:00
|
|
|
|
2020-01-18 23:34:34 +01:00
|
|
|
void lv_obj_add_theme(void * obj, uint8_t part, uint16_t name);
|
2019-12-22 22:40:02 +01:00
|
|
|
|
|
|
|
void lv_obj_reset_style(lv_obj_t * obj, uint8_t type);
|
|
|
|
|
2017-05-12 16:09:37 +02:00
|
|
|
/**
|
|
|
|
* Notify an object about its style is modified
|
|
|
|
* @param obj pointer to an object
|
|
|
|
*/
|
2020-01-07 23:43:57 +01:00
|
|
|
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-12-17 01:54:09 +01:00
|
|
|
void lv_obj_report_style_mod(lv_style_t * style);
|
2017-11-19 20:45:40 +01:00
|
|
|
|
|
|
|
/*-----------------
|
|
|
|
* Attribute set
|
|
|
|
*----------------*/
|
2017-05-12 16:09:37 +02:00
|
|
|
|
2017-01-13 23:27:49 +01: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);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-12-22 13:51:02 +00:00
|
|
|
/**
|
|
|
|
* Set whether advanced hit-testing is enabled on an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param en true: advanced hit-testing is enabled
|
|
|
|
*/
|
|
|
|
void lv_obj_set_adv_hittest(lv_obj_t * obj, bool en);
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* 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);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-04-04 21:51:13 -04:00
|
|
|
/**
|
|
|
|
* Set the directions an object can be dragged in
|
|
|
|
* @param obj pointer to an object
|
2019-04-05 08:48:39 -04:00
|
|
|
* @param drag_dir bitwise OR of allowed drag directions
|
2019-04-04 21:51:13 -04:00
|
|
|
*/
|
2019-04-05 08:48:39 -04:00
|
|
|
void lv_obj_set_drag_dir(lv_obj_t * obj, lv_drag_dir_t drag_dir);
|
2019-04-04 21:51:13 -04:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* 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);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2020-01-16 19:24:08 -05:00
|
|
|
/**
|
|
|
|
* Enable to use parent for gesture related operations.
|
|
|
|
* If trying to gesture the object the parent will be moved instead
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param en true: enable the 'gesture parent' for the object
|
|
|
|
*/
|
|
|
|
void lv_obj_set_gesture_parent(lv_obj_t * obj, bool en);
|
|
|
|
|
2018-07-25 21:52:50 +02:00
|
|
|
/**
|
2019-03-12 06:20:45 +01:00
|
|
|
* Propagate the events to the parent too
|
2018-07-25 21:52:50 +02:00
|
|
|
* @param obj pointer to an object
|
2019-03-12 06:20:45 +01:00
|
|
|
* @param en true: enable the event propagation
|
2018-07-25 21:52:50 +02:00
|
|
|
*/
|
2019-03-12 06:20:45 +01:00
|
|
|
void lv_obj_set_parent_event(lv_obj_t * obj, bool en);
|
2018-07-25 21:52:50 +02:00
|
|
|
|
2020-01-16 19:24:08 -05:00
|
|
|
|
2019-10-08 16:26:55 +02:00
|
|
|
void lv_obj_set_base_dir(lv_obj_t * obj, lv_bidi_dir_t dir);
|
2020-01-16 19:24:08 -05:00
|
|
|
|
2018-06-14 13:08:19 +02:00
|
|
|
/**
|
|
|
|
* Set the opa scale enable parameter (required to set opa_scale with `lv_obj_set_opa_scale()`)
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param en true: opa scaling is enabled for this object and all children; false: no opa scaling
|
|
|
|
*/
|
|
|
|
void lv_obj_set_opa_scale_enable(lv_obj_t * obj, bool en);
|
|
|
|
|
|
|
|
/**
|
2019-07-05 07:19:09 +02:00
|
|
|
* Set the opa scale of an object.
|
|
|
|
* The opacity of this object and all it's children will be scaled down with this factor.
|
|
|
|
* `lv_obj_set_opa_scale_enable(obj, true)` needs to be called to enable it.
|
|
|
|
* (not for all children just for the parent where to start the opa scaling)
|
2018-06-14 13:08:19 +02:00
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param opa_scale a factor to scale down opacity [0..255]
|
|
|
|
*/
|
|
|
|
void lv_obj_set_opa_scale(lv_obj_t * obj, lv_opa_t opa_scale);
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Set a bit or bits in the protect filed
|
|
|
|
* @param obj pointer to an object
|
2018-08-28 14:43:02 +02:00
|
|
|
* @param prot 'OR'-ed values from `lv_protect_t`
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2017-01-03 17:09:35 +01:00
|
|
|
void lv_obj_set_protect(lv_obj_t * obj, uint8_t prot);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Clear a bit or bits in the protect filed
|
|
|
|
* @param obj pointer to an object
|
2018-08-28 14:43:02 +02:00
|
|
|
* @param prot 'OR'-ed values from `lv_protect_t`
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2017-10-20 10:17:02 +02:00
|
|
|
void lv_obj_clear_protect(lv_obj_t * obj, uint8_t prot);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-12-22 22:40:02 +01:00
|
|
|
void lv_obj_set_state(lv_obj_t * obj, lv_obj_state_t state);
|
|
|
|
|
2020-01-28 22:15:45 +01:00
|
|
|
void lv_obj_add_state(lv_obj_t * obj, lv_obj_state_t state);
|
|
|
|
|
2019-12-22 22:40:02 +01:00
|
|
|
void lv_obj_clear_state(lv_obj_t * obj, lv_obj_state_t state);
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2019-02-26 09:25:46 +01:00
|
|
|
* Set a an event handler function for an object.
|
|
|
|
* Used by the user to react on event which happens with the object.
|
|
|
|
* @param obj pointer to an object
|
2019-04-23 14:56:40 +02:00
|
|
|
* @param event_cb the new event function
|
2019-02-26 09:25:46 +01:00
|
|
|
*/
|
2019-04-23 14:56:40 +02:00
|
|
|
void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb);
|
2019-02-26 09:25:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send an event to the object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param event the type of the event from `lv_event_t`.
|
2019-03-19 06:30:05 +01:00
|
|
|
* @param data arbitrary data depending on the object type and the event. (Usually `NULL`)
|
2019-03-07 00:05:16 +01:00
|
|
|
* @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event
|
2019-02-26 09:25:46 +01:00
|
|
|
*/
|
2019-03-19 06:30:05 +01:00
|
|
|
lv_res_t lv_event_send(lv_obj_t * obj, lv_event_t event, const void * data);
|
|
|
|
|
2019-05-07 12:15:02 +02:00
|
|
|
/**
|
|
|
|
* Call an event function with an object, event, and data.
|
2019-06-20 06:19:07 +02:00
|
|
|
* @param event_xcb an event callback function. If `NULL` `LV_RES_OK` will return without any actions.
|
|
|
|
* (the 'x' in the argument name indicates that its not a fully generic function because it not follows
|
|
|
|
* the `func_name(object, callback, ...)` convention)
|
2019-05-07 12:15:02 +02:00
|
|
|
* @param obj pointer to an object to associate with the event (can be `NULL` to simply call the `event_cb`)
|
|
|
|
* @param event an event
|
|
|
|
* @param data pointer to a custom data
|
|
|
|
* @return LV_RES_OK: `obj` was not deleted in the event; LV_RES_INV: `obj` was deleted in the event
|
|
|
|
*/
|
2019-06-20 06:19:07 +02:00
|
|
|
lv_res_t lv_event_send_func(lv_event_cb_t event_xcb, lv_obj_t * obj, lv_event_t event, const void * data);
|
2019-05-07 12:15:02 +02:00
|
|
|
|
2019-03-19 06:30:05 +01:00
|
|
|
/**
|
|
|
|
* Get the `data` parameter of the current event
|
|
|
|
* @return the `data` parameter
|
|
|
|
*/
|
|
|
|
const void * lv_event_get_data(void);
|
2019-02-26 09:25:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set the a signal function of an object. Used internally by the library.
|
2017-01-13 23:27:49 +01:00
|
|
|
* Always call the previous signal function in the new.
|
|
|
|
* @param obj pointer to an object
|
2019-04-23 14:56:40 +02:00
|
|
|
* @param signal_cb the new signal function
|
2019-02-26 09:25:46 +01:00
|
|
|
*/
|
2019-04-23 14:56:40 +02:00
|
|
|
void lv_obj_set_signal_cb(lv_obj_t * obj, lv_signal_cb_t signal_cb);
|
2019-02-26 09:25:46 +01:00
|
|
|
|
2019-12-17 09:20:40 +01:00
|
|
|
|
2019-02-26 09:25:46 +01:00
|
|
|
/**
|
|
|
|
* Send an event to the object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param event the type of the event from `lv_event_t`.
|
2019-12-17 09:20:40 +01:00
|
|
|
* @return LV_RES_OK or LV_RES_INV
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2019-12-17 09:20:40 +01:00
|
|
|
lv_res_t lv_signal_send(lv_obj_t * obj, lv_signal_t signal, void * param);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a new design function for an object
|
|
|
|
* @param obj pointer to an object
|
2019-04-23 14:56:40 +02:00
|
|
|
* @param design_cb the new design function
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2019-04-23 14:56:40 +02:00
|
|
|
void lv_obj_set_design_cb(lv_obj_t * obj, lv_design_cb_t design_cb);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*----------------
|
|
|
|
* Other set
|
|
|
|
*--------------*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Allocate a new ext. data for an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param ext_size the size of the new ext. data
|
2018-04-05 22:21:44 +02:00
|
|
|
* @return pointer to the allocated ext
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2017-10-20 10:17:02 +02:00
|
|
|
void * lv_obj_allocate_ext_attr(lv_obj_t * obj, uint16_t ext_size);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Send a 'LV_SIGNAL_REFR_EXT_SIZE' signal to the object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
*/
|
2019-04-11 06:26:41 +02:00
|
|
|
void lv_obj_refresh_ext_draw_pad(lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*=======================
|
|
|
|
* Getter functions
|
|
|
|
*======================*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Return with the screen of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return pointer to a screen
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_obj_t * lv_obj_get_screen(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-02-20 23:58:13 +01:00
|
|
|
/**
|
|
|
|
* Get the display of an object
|
|
|
|
* @param scr pointer to an object
|
|
|
|
* @return pointer the object's display
|
|
|
|
*/
|
2019-02-12 15:38:13 +01:00
|
|
|
lv_disp_t * lv_obj_get_disp(const lv_obj_t * obj);
|
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*---------------------
|
|
|
|
* Parent/children get
|
|
|
|
*--------------------*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Returns with the parent of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return pointer to the parent of 'obj'
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_obj_t * lv_obj_get_parent(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
2017-11-19 20:45:40 +01:00
|
|
|
* Iterate through the children of an object (start from the "youngest, lastly created")
|
2017-01-13 23:27:49 +01:00
|
|
|
* @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
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_obj_t * lv_obj_get_child(const lv_obj_t * obj, const lv_obj_t * child);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-10-31 16:25:52 +01:00
|
|
|
/**
|
2017-11-19 20:45:40 +01:00
|
|
|
* Iterate through the children of an object (start from the "oldest", firstly created)
|
2017-10-31 16:25:52 +01:00
|
|
|
* @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
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_obj_t * lv_obj_get_child_back(const lv_obj_t * obj, const lv_obj_t * child);
|
2017-10-31 16:25:52 +01:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Count the children of an object (only children directly on 'obj')
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return children number of 'obj'
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
uint16_t lv_obj_count_children(const lv_obj_t * obj);
|
2016-12-16 07:41:34 +01:00
|
|
|
|
2019-05-13 09:06:01 -07:00
|
|
|
/** Recursively count the children of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return children number of 'obj'
|
|
|
|
*/
|
|
|
|
uint16_t lv_obj_count_children_recursive(const lv_obj_t * obj);
|
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*---------------------
|
|
|
|
* Coordinate get
|
|
|
|
*--------------------*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
void lv_obj_get_coords(const lv_obj_t * obj, lv_area_t * cords_p);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-06-01 21:37:04 -04:00
|
|
|
/**
|
2019-06-07 14:52:14 +02:00
|
|
|
* Reduce area retried by `lv_obj_get_coords()` the get graphically usable area of an object.
|
|
|
|
* (Without the size of the border or other extra graphical elements)
|
|
|
|
* @param coords_p store the result area here
|
2019-06-01 21:37:04 -04:00
|
|
|
*/
|
2019-06-27 07:16:15 +02:00
|
|
|
void lv_obj_get_inner_coords(const lv_obj_t * obj, lv_area_t * coords_p);
|
2019-06-01 21:37:04 -04:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Get the x coordinate of object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return distance of 'obj' from the left side of its parent
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_coord_t lv_obj_get_x(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the y coordinate of object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return distance of 'obj' from the top of its parent
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_coord_t lv_obj_get_y(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the width of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return the width
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_coord_t lv_obj_get_width(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the height of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return the height
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_coord_t lv_obj_get_height(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-03-15 07:27:58 +01:00
|
|
|
/**
|
|
|
|
* Get that width reduced by the left and right padding.
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return the width which still fits into the container
|
|
|
|
*/
|
2019-11-25 22:09:38 -08:00
|
|
|
lv_coord_t lv_obj_get_width_fit(const lv_obj_t * obj);
|
2019-03-15 07:27:58 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get that height reduced by the top an bottom padding.
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return the height which still fits into the container
|
|
|
|
*/
|
2019-11-25 22:09:38 -08:00
|
|
|
lv_coord_t lv_obj_get_height_fit(const lv_obj_t * obj);
|
2019-03-15 07:27:58 +01:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2019-04-11 06:26:41 +02:00
|
|
|
* Get the automatic realign property of the object.
|
2017-01-13 23:27:49 +01:00
|
|
|
* @param obj pointer to an object
|
2019-04-11 06:26:41 +02:00
|
|
|
* @return true: auto realign is enabled; false: auto realign is disabled
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2019-11-25 22:09:38 -08:00
|
|
|
bool lv_obj_get_auto_realign(const lv_obj_t * obj);
|
2019-04-11 06:26:41 +02:00
|
|
|
|
2018-11-22 14:59:38 +01:00
|
|
|
/**
|
2019-05-24 06:26:56 +02:00
|
|
|
* Get the left padding of extended clickable area
|
2018-11-22 14:59:38 +01:00
|
|
|
* @param obj pointer to an object
|
2019-05-24 06:26:56 +02:00
|
|
|
* @return the extended left padding
|
2018-11-22 14:59:38 +01:00
|
|
|
*/
|
2019-05-24 06:26:56 +02:00
|
|
|
lv_coord_t lv_obj_get_ext_click_pad_left(const lv_obj_t * obj);
|
2019-04-04 14:14:40 +03:00
|
|
|
|
2019-04-03 19:34:58 +03:00
|
|
|
/**
|
2019-05-24 06:26:56 +02:00
|
|
|
* Get the right padding of extended clickable area
|
2019-04-03 19:34:58 +03:00
|
|
|
* @param obj pointer to an object
|
2019-05-24 06:26:56 +02:00
|
|
|
* @return the extended right padding
|
2019-04-03 19:34:58 +03:00
|
|
|
*/
|
2019-05-24 06:26:56 +02:00
|
|
|
lv_coord_t lv_obj_get_ext_click_pad_right(const lv_obj_t * obj);
|
2019-04-04 14:14:40 +03:00
|
|
|
|
2019-05-24 06:26:56 +02:00
|
|
|
/**
|
|
|
|
* Get the top padding of extended clickable area
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return the extended top padding
|
|
|
|
*/
|
|
|
|
lv_coord_t lv_obj_get_ext_click_pad_top(const lv_obj_t * obj);
|
2019-04-03 19:34:58 +03:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2019-05-24 06:26:56 +02:00
|
|
|
* Get the bottom padding of extended clickable area
|
2017-01-13 23:27:49 +01:00
|
|
|
* @param obj pointer to an object
|
2019-05-24 06:26:56 +02:00
|
|
|
* @return the extended bottom padding
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2019-05-24 06:26:56 +02:00
|
|
|
lv_coord_t lv_obj_get_ext_click_pad_bottom(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2018-11-22 14:59:38 +01:00
|
|
|
/**
|
2019-04-11 06:26:41 +02:00
|
|
|
* Get the extended size attribute of an object
|
2018-11-22 14:59:38 +01:00
|
|
|
* @param obj pointer to an object
|
2019-04-11 06:26:41 +02:00
|
|
|
* @return the extended size attribute
|
2018-11-22 14:59:38 +01:00
|
|
|
*/
|
2019-04-11 06:26:41 +02:00
|
|
|
lv_coord_t lv_obj_get_ext_draw_pad(const lv_obj_t * obj);
|
2018-11-22 14:59:38 +01:00
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*-----------------
|
|
|
|
* Appearance get
|
|
|
|
*---------------*/
|
|
|
|
|
2020-01-16 21:25:11 +01:00
|
|
|
lv_style_int_t lv_obj_get_style_int(const lv_obj_t * obj, uint8_t type, lv_style_property_t prop);
|
2019-12-14 23:39:26 +01:00
|
|
|
|
2020-01-16 21:25:11 +01:00
|
|
|
lv_color_t lv_obj_get_style_color(const lv_obj_t * obj, uint8_t type, lv_style_property_t prop);
|
2019-12-14 23:39:26 +01:00
|
|
|
|
2020-01-16 21:25:11 +01:00
|
|
|
lv_opa_t lv_obj_get_style_opa(const lv_obj_t * obj, uint8_t type, lv_style_property_t prop);
|
2019-12-14 23:39:26 +01:00
|
|
|
|
2020-01-16 21:25:11 +01:00
|
|
|
const void * lv_obj_get_style_ptr(const lv_obj_t * obj, uint8_t type, lv_style_property_t prop);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2020-01-01 15:25:16 +01:00
|
|
|
|
2020-02-02 14:09:19 +01:00
|
|
|
lv_style_list_t * lv_obj_get_style_list(const lv_obj_t * obj, uint8_t type);
|
|
|
|
|
|
|
|
#define LV_OBJ_STYLE_SET_GET_DECLARE(prop_name, func_name, value_type, style_type) \
|
|
|
|
static inline value_type lv_obj_get_style_##func_name (const lv_obj_t * obj, uint8_t part) \
|
|
|
|
{ \
|
|
|
|
return (value_type) lv_obj_get_style##style_type (obj, part, LV_STYLE_##prop_name); \
|
|
|
|
} \
|
2020-02-07 01:44:22 +01:00
|
|
|
static inline void lv_obj_set_style_##func_name (lv_obj_t * obj, uint8_t part, lv_style_state_t state, value_type value) \
|
2020-02-02 14:09:19 +01:00
|
|
|
{ \
|
2020-02-07 01:44:22 +01:00
|
|
|
lv_obj_set_style##style_type (obj, part, LV_STYLE_##prop_name | state, value); \
|
2020-02-02 14:09:19 +01:00
|
|
|
} \
|
2020-02-04 02:09:15 +01:00
|
|
|
static inline int16_t lv_style_get_##func_name (lv_style_t * style, void * res) \
|
|
|
|
{ \
|
|
|
|
return lv_style_get##style_type (style, LV_STYLE_##prop_name, res); \
|
|
|
|
} \
|
|
|
|
static inline void lv_style_set_##func_name (lv_style_t * style, lv_style_state_t state, value_type value) \
|
|
|
|
{ \
|
|
|
|
lv_style_set##style_type (style, LV_STYLE_##prop_name | (state), value); \
|
|
|
|
} \
|
2020-02-02 14:09:19 +01:00
|
|
|
|
|
|
|
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(RADIUS, radius, lv_style_int_t,_int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(CLIP_CORNER, clip_corner, bool, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(TRANSITION_TIME, transition_time, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(OPA_SCALE, opa_scale, lv_opa_t, _opa);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_TOP, pad_top, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_BOTTOM, pad_bottom, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_LEFT, pad_left, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_RIGHT, pad_right, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PAD_INNER, pad_inner, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BG_MAIN_STOP, bg_main_stop, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_STOP, bg_grad_stop, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BG_COLOR, bg_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BG_GRAD_COLOR, bg_grad_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BG_OPA, bg_opa, lv_opa_t , _opa);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_WIDTH, border_width, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_SIDE, border_side, lv_border_side_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_POST, border_post, bool, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_COLOR, border_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(BORDER_OPA, border_opa, lv_opa_t, _opa);
|
2020-02-10 19:47:00 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_WIDTH, outline_width, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_PAD, outline_pad, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_BLEND_MODE, outline_blend_mode, lv_blend_mode_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_COLOR, outline_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(OUTLINE_OPA, outline_opa, lv_opa_t, _opa);
|
2020-02-02 14:09:19 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_WIDTH, shadow_width, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_X, shadow_offset_x, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OFFSET_Y, shadow_offset_y, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_SPREAD, shadow_spread, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_BLEND_MODE, shadow_blend_mode, lv_blend_mode_t, _int );
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_COLOR, shadow_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SHADOW_OPA, shadow_opa, lv_opa_t, _opa);
|
2020-02-10 00:30:12 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_REPEAT, pattern_repeat, bool, _int );
|
2020-02-07 01:44:22 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_BLEND_MODE, pattern_blend_mode, lv_blend_mode_t, _int );
|
2020-02-02 14:09:19 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR, pattern_recolor, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_OPA, pattern_opa, lv_opa_t, _opa);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_RECOLOR_OPA, pattern_recolor_opa, lv_opa_t, _opa);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(PATTERN_IMAGE, pattern_image, const void *, _ptr);
|
2020-02-07 01:44:22 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LETTER_SPACE, value_letter_space, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_LINE_SPACE, value_line_space, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_BLEND_MODE, value_blend_mode, lv_blend_mode_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_X, value_ofs_x, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OFS_Y, value_ofs_y, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_ALIGN, value_align, lv_align_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_COLOR, value_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_OPA, value_opa, lv_opa_t, _opa);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_FONT, value_font, const lv_font_t * , _ptr);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(VALUE_STR, value_str, const char * , _ptr);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LETTER_SPACE, letter_space, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_LINE_SPACE, line_space, lv_style_int_t, _int);
|
2020-02-02 14:09:19 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_COLOR, text_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_OPA, text_opa, lv_opa_t, _opa);
|
2020-02-07 01:44:22 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(TEXT_FONT, font, const lv_font_t * , _ptr);
|
2020-02-02 14:09:19 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_WIDTH, line_width, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_DASH_GAP, line_dash_gap, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_ROUNDED, line_rounded, bool, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_COLOR, line_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(LINE_OPA, line_opa, lv_opa_t, _opa);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR, image_recolor, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_OPA, image_opa, lv_opa_t, _opa);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t, _opa);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SIZE, size, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_WIDTH, scale_width, lv_style_int_t, _int);
|
2020-02-03 20:49:34 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t, _int);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t, _int);
|
2020-02-02 14:09:19 +01:00
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_COLOR, scale_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_GRAD_COLOR, scale_grad_color, lv_color_t, _color);
|
|
|
|
LV_OBJ_STYLE_SET_GET_DECLARE(SCALE_END_COLOR, scale_end_color, lv_color_t, _color);
|
2020-01-01 15:25:16 +01:00
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*-----------------
|
|
|
|
* Attribute get
|
|
|
|
*----------------*/
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Get the hidden attribute of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: the object is hidden
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_obj_get_hidden(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-12-22 13:51:02 +00:00
|
|
|
/**
|
|
|
|
* Get whether advanced hit-testing is enabled on an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: advanced hit-testing is enabled
|
|
|
|
*/
|
|
|
|
bool lv_obj_get_adv_hittest(const lv_obj_t * obj);
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Get the click enable attribute of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: the object is clickable
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_obj_get_click(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the top enable attribute of an object
|
|
|
|
* @param obj pointer to an object
|
2018-12-26 07:58:06 +01:00
|
|
|
* @return true: the auto top feature is enabled
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_obj_get_top(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the drag enable attribute of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: the object is dragable
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_obj_get_drag(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-04-04 21:51:13 -04:00
|
|
|
/**
|
|
|
|
* Get the directions an object can be dragged
|
|
|
|
* @param obj pointer to an object
|
2019-04-05 08:48:39 -04:00
|
|
|
* @return bitwise OR of allowed directions an object can be dragged in
|
2019-04-04 21:51:13 -04:00
|
|
|
*/
|
2019-04-05 08:48:39 -04:00
|
|
|
lv_drag_dir_t lv_obj_get_drag_dir(const lv_obj_t * obj);
|
2019-04-04 21:51:13 -04:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2018-12-26 07:58:06 +01:00
|
|
|
* Get the drag throw enable attribute of an object
|
2017-01-13 23:27:49 +01:00
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: drag throw is enabled
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_obj_get_drag_throw(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the drag parent attribute of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: drag parent is enabled
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_obj_get_drag_parent(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2019-03-12 06:20:45 +01:00
|
|
|
/**
|
|
|
|
* Get the drag parent attribute of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: drag parent is enabled
|
|
|
|
*/
|
|
|
|
bool lv_obj_get_parent_event(const lv_obj_t * obj);
|
2019-01-01 01:32:16 +01:00
|
|
|
|
2020-01-16 19:24:08 -05:00
|
|
|
/**
|
|
|
|
* Get the gesture parent attribute of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: gesture parent is enabled
|
|
|
|
*/
|
|
|
|
bool lv_obj_get_gesture_parent(const lv_obj_t * obj);
|
2019-10-08 16:26:55 +02:00
|
|
|
|
|
|
|
lv_bidi_dir_t lv_obj_get_base_dir(const lv_obj_t * obj);
|
|
|
|
|
2019-01-01 01:32:16 +01:00
|
|
|
/**
|
|
|
|
* Get the opa scale enable parameter
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: opa scaling is enabled for this object and all children; false: no opa scaling
|
|
|
|
*/
|
|
|
|
lv_opa_t lv_obj_get_opa_scale_enable(const lv_obj_t * obj);
|
|
|
|
|
2018-06-14 13:08:19 +02:00
|
|
|
/**
|
|
|
|
* Get the opa scale parameter of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return opa scale [0..255]
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
lv_opa_t lv_obj_get_opa_scale(const lv_obj_t * obj);
|
2018-06-14 13:08:19 +02:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Get the protect field of an object
|
|
|
|
* @param obj pointer to an object
|
2018-08-28 14:43:02 +02:00
|
|
|
* @return protect field ('OR'ed values of `lv_protect_t`)
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
uint8_t lv_obj_get_protect(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check at least one bit of a given protect bitfield is set
|
|
|
|
* @param obj pointer to an object
|
2018-08-28 14:43:02 +02:00
|
|
|
* @param prot protect bits to test ('OR'ed values of `lv_protect_t`)
|
2017-01-13 23:27:49 +01:00
|
|
|
* @return false: none of the given bits are set, true: at least one bit is set
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_obj_is_protected(const lv_obj_t * obj, uint8_t prot);
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2020-01-24 14:55:56 +01:00
|
|
|
lv_obj_state_dsc_t * lv_obj_get_state_dsc(const lv_obj_t * obj, uint8_t part);
|
|
|
|
|
2020-01-05 20:05:11 +01:00
|
|
|
lv_obj_state_t lv_obj_get_state(const lv_obj_t * obj, uint8_t part);
|
2019-12-19 11:05:04 +01:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* Get the signal function of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return the signal function
|
|
|
|
*/
|
2019-04-10 06:40:49 +02:00
|
|
|
lv_signal_cb_t lv_obj_get_signal_cb(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the design function of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return the design function
|
|
|
|
*/
|
2019-04-10 06:40:49 +02:00
|
|
|
lv_design_cb_t lv_obj_get_design_cb(const lv_obj_t * obj);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the event function of an object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return the event function
|
|
|
|
*/
|
|
|
|
lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2017-11-19 20:45:40 +01:00
|
|
|
/*------------------
|
|
|
|
* Other get
|
|
|
|
*-----------------*/
|
|
|
|
|
2020-01-04 08:48:37 -05:00
|
|
|
/**
|
|
|
|
* Check if a given screen-space point is on an object's coordinates.
|
|
|
|
*
|
|
|
|
* This method is intended to be used mainly by advanced hit testing algorithms to check
|
|
|
|
* whether the point is even within the object (as an optimization).
|
|
|
|
* @param obj object to check
|
|
|
|
* @param point screen-space point
|
|
|
|
*/
|
2020-01-04 08:52:52 -05:00
|
|
|
bool lv_obj_is_point_on_coords(lv_obj_t * obj, const lv_point_t * point);
|
2020-01-04 08:48:37 -05:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Hit-test an object given a particular point in screen space.
|
|
|
|
* @param obj object to hit-test
|
|
|
|
* @param point screen-space point
|
|
|
|
* @return true if the object is considered under the point
|
|
|
|
*/
|
2019-12-22 13:51:02 +00:00
|
|
|
bool lv_obj_hittest(lv_obj_t * obj, lv_point_t * point);
|
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
|
|
|
* 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
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
void * lv_obj_get_ext_attr(const lv_obj_t * obj);
|
2017-01-13 23:27:49 +01:00
|
|
|
|
2018-02-28 15:37:41 +01:00
|
|
|
/**
|
|
|
|
* Get object's and its ancestors type. Put their name in `type_buf` starting with the current type.
|
|
|
|
* E.g. buf.type[0]="lv_btn", buf.type[1]="lv_cont", buf.type[2]="lv_obj"
|
|
|
|
* @param obj pointer to an object which type should be get
|
|
|
|
* @param buf pointer to an `lv_obj_type_t` buffer to store the types
|
|
|
|
*/
|
2019-11-25 22:09:38 -08:00
|
|
|
void lv_obj_get_type(const lv_obj_t * obj, lv_obj_type_t * buf);
|
2018-02-28 15:37:41 +01:00
|
|
|
|
2019-05-15 18:51:31 +02:00
|
|
|
#if LV_USE_USER_DATA
|
2019-05-09 09:02:11 -07:00
|
|
|
/**
|
|
|
|
* Get the object's user data
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return user data
|
|
|
|
*/
|
2019-11-25 22:09:38 -08:00
|
|
|
lv_obj_user_data_t lv_obj_get_user_data(const lv_obj_t * obj);
|
2019-05-09 09:02:11 -07:00
|
|
|
|
2017-01-13 23:27:49 +01:00
|
|
|
/**
|
2019-03-06 23:14:19 +01:00
|
|
|
* Get a pointer to the object's user data
|
2017-01-13 23:27:49 +01:00
|
|
|
* @param obj pointer to an object
|
2019-03-06 23:14:19 +01:00
|
|
|
* @return pointer to the user data
|
2017-01-13 23:27:49 +01:00
|
|
|
*/
|
2019-11-25 22:09:38 -08:00
|
|
|
lv_obj_user_data_t * lv_obj_get_user_data_ptr(const lv_obj_t * obj);
|
2019-04-14 13:24:12 +08:00
|
|
|
|
|
|
|
/**
|
2019-04-18 14:12:30 +08:00
|
|
|
* Set the object's user data. The data will be copied.
|
2019-04-14 13:24:12 +08:00
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param data user data
|
|
|
|
*/
|
|
|
|
void lv_obj_set_user_data(lv_obj_t * obj, lv_obj_user_data_t data);
|
|
|
|
|
2017-05-01 16:47:27 +02:00
|
|
|
#endif
|
2016-06-08 07:25:08 +02:00
|
|
|
|
2019-03-07 00:05:16 +01:00
|
|
|
#if LV_USE_GROUP
|
2017-07-20 01:09:20 +02:00
|
|
|
/**
|
|
|
|
* Get the group of the object
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return the pointer to group of the object
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
void * lv_obj_get_group(const lv_obj_t * obj);
|
2018-07-13 00:37:28 +02:00
|
|
|
|
|
|
|
/**
|
2018-12-26 07:58:06 +01:00
|
|
|
* Tell whether the object is the focused object of a group or not.
|
2018-07-13 00:37:28 +02:00
|
|
|
* @param obj pointer to an object
|
|
|
|
* @return true: the object is focused, false: the object is not focused or not in a group
|
|
|
|
*/
|
2018-07-30 06:52:29 +02:00
|
|
|
bool lv_obj_is_focused(const lv_obj_t * obj);
|
2018-07-13 00:37:28 +02:00
|
|
|
|
2017-07-20 01:09:20 +02:00
|
|
|
#endif
|
2017-10-20 15:37:50 +02:00
|
|
|
|
2019-09-26 10:51:54 +02:00
|
|
|
/*-------------------
|
|
|
|
* OTHER FUNCTIONS
|
|
|
|
*------------------*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Used in the signal callback to handle `LV_SIGNAL_GET_TYPE` signal
|
2019-11-25 22:09:38 -08:00
|
|
|
* @param buf pointer to `lv_obj_type_t`. (`param` in the signal callback)
|
|
|
|
* @param name name of the object. E.g. "lv_btn". (Only the pointer is saved)
|
2019-09-26 10:51:54 +02:00
|
|
|
* @return LV_RES_OK
|
|
|
|
*/
|
2019-09-26 12:54:40 +02:00
|
|
|
lv_res_t lv_obj_handle_get_type_signal(lv_obj_type_t * buf, const char * name);
|
2019-09-26 10:51:54 +02:00
|
|
|
|
2019-12-17 09:20:40 +01:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initialize a rectangle descriptor from an object's styles
|
|
|
|
* @param obj pointer to an object
|
|
|
|
* @param type type of style. E.g. `LV_OBJ_STYLE_MAIN`, `LV_BTN_STYLE_REL` or `LV_PAGE_STYLE_SCRL`
|
|
|
|
* @param draw_dsc the descriptor the initialize
|
|
|
|
* @note Only the relevant fields will be set.
|
|
|
|
* E.g. if `border width == 0` the other border properties won't be evaluated.
|
|
|
|
*/
|
2019-12-19 23:16:53 +01:00
|
|
|
void lv_obj_init_draw_rect_dsc(lv_obj_t * obj, uint8_t type, lv_draw_rect_dsc_t * draw_dsc);
|
2019-12-17 09:20:40 +01:00
|
|
|
|
2019-12-19 23:16:53 +01:00
|
|
|
void lv_obj_init_draw_label_dsc(lv_obj_t * obj, uint8_t type, lv_draw_label_dsc_t * draw_dsc);
|
2019-12-19 22:44:18 +01:00
|
|
|
|
2019-12-31 22:13:32 +01:00
|
|
|
void lv_obj_init_draw_img_dsc(lv_obj_t * obj, uint8_t part, lv_draw_img_dsc_t * draw_dsc);
|
2020-01-01 21:44:16 +01:00
|
|
|
|
|
|
|
void lv_obj_init_draw_line_dsc(lv_obj_t * obj, uint8_t part, lv_draw_line_dsc_t * draw_dsc);
|
|
|
|
|
2020-02-11 06:06:10 +01:00
|
|
|
/**
|
|
|
|
* Get the required extra size (around the object's part) to draw shadow, outline, value etc.
|
|
|
|
* @param obj poinr to an object
|
|
|
|
* @param part part of the object
|
|
|
|
*/
|
|
|
|
lv_coord_t lv_obj_get_draw_rect_ext_pad_size(lv_obj_t * obj, uint8_t part);
|
|
|
|
|
2016-06-08 07:25:08 +02:00
|
|
|
/**********************
|
|
|
|
* MACROS
|
|
|
|
**********************/
|
|
|
|
|
2019-05-18 13:48:13 +02:00
|
|
|
/**
|
|
|
|
* Helps to quickly declare an event callback function.
|
|
|
|
* Will be expanded to: `void <name> (lv_obj_t * obj, lv_event_t e)`
|
|
|
|
*
|
|
|
|
* Examples:
|
|
|
|
* static LV_EVENT_CB_DECLARE(my_event1); //Protoype declaration
|
|
|
|
*
|
|
|
|
* static LV_EVENT_CB_DECLARE(my_event1)
|
|
|
|
* {
|
|
|
|
* if(e == LV_EVENT_CLICKED) {
|
|
|
|
* lv_obj_set_hidden(obj ,true);
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
*/
|
2019-05-18 11:21:16 +02:00
|
|
|
#define LV_EVENT_CB_DECLARE(name) void name(lv_obj_t * obj, lv_event_t e)
|
|
|
|
|
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*/
|