/** * @file lv_obj.h * */ #ifndef LV_OBJ_H #define LV_OBJ_H #ifdef __cplusplus extern "C" { #endif /********************* * INCLUDES *********************/ #ifdef LV_CONF_INCLUDE_SIMPLE #include "lv_conf.h" #else #include "../../../lv_conf.h" #endif #include #include #include "lv_style.h" #include "../lv_misc/lv_types.h" #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_misc/lv_log.h" #include "../lv_misc/lv_bidi.h" #include "../lv_hal/lv_hal.h" /********************* * DEFINES *********************/ /*Error check of lv_conf.h*/ #if LV_HOR_RES_MAX == 0 || LV_VER_RES_MAX == 0 #error "LittlevGL: LV_HOR_RES_MAX and LV_VER_RES_MAX must be greater than 0" #endif #if LV_ANTIALIAS > 1 #error "LittlevGL: LV_ANTIALIAS can be only 0 or 1" #endif #define LV_MAX_ANCESTOR_NUM 8 #define LV_EXT_CLICK_AREA_OFF 0 #define LV_EXT_CLICK_AREA_TINY 1 #define LV_EXT_CLICK_AREA_FULL 2 /********************** * TYPEDEFS **********************/ struct _lv_obj_t; /** Design modes */ enum { 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 */ }; typedef uint8_t lv_design_mode_t; /** 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; /** * 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. */ 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); enum { 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, LV_EVENT_DRAG_END, LV_EVENT_DRAG_THROW_BEGIN, LV_EVENT_KEY, LV_EVENT_FOCUSED, LV_EVENT_DEFOCUSED, LV_EVENT_VALUE_CHANGED, /**< The object's value has changed (i.e. slider moved) */ LV_EVENT_INSERT, LV_EVENT_REFRESH, 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 */ }; typedef uint8_t lv_event_t; /**< Type of event being sent to the object. */ /** * @brief Event callback. * Events are used to notify the user of some action being taken on the object. * For details, see ::lv_event_t. */ typedef void (*lv_event_cb_t)(struct _lv_obj_t * obj, lv_event_t event); /** 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. */ enum { /*General signals*/ LV_SIGNAL_CLEANUP, /**< Object is being deleted */ LV_SIGNAL_CHILD_CHG, /**< Child was removed/added */ LV_SIGNAL_CORD_CHG, /**< Object coordinates/size have changed */ LV_SIGNAL_PARENT_SIZE_CHG, /**< Parent's size has changed */ LV_SIGNAL_STYLE_CHG, /**< Object's style has changed */ LV_SIGNAL_BASE_DIR_CHG, /**