LittlevGL  3.20.00.19
Data Structures | Macros | Typedefs | Enumerations | Functions
lv_obj.h File Reference
#include "../../../lv_conf.h"
#include <stddef.h>
#include <stdbool.h>
#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_hal/lv_hal.h"
Include dependency graph for lv_obj.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  _lv_obj_t
 
struct  lv_obj_type_t
 

Macros

#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
 
#define LV_EVENT_CB_DECLARE(name)   void name(lv_obj_t * obj, lv_event_t e)
 

Typedefs

typedef uint8_t lv_design_mode_t
 
typedef bool(* lv_design_cb_t) (struct _lv_obj_t *obj, const lv_area_t *mask_p, lv_design_mode_t mode)
 
typedef uint8_t lv_event_t
 
typedef void(* lv_event_cb_t) (struct _lv_obj_t *obj, lv_event_t event)
 Event callback. Events are used to notify the user of some action being taken on the object. For details, see lv_event_t. More...
 
typedef uint8_t lv_signal_t
 
typedef lv_res_t(* lv_signal_cb_t) (struct _lv_obj_t *obj, lv_signal_t sign, void *param)
 
typedef uint8_t lv_align_t
 
typedef uint8_t lv_drag_dir_t
 
typedef struct _lv_obj_t lv_obj_t
 
typedef uint8_t lv_protect_t
 

Enumerations

enum  { LV_DESIGN_DRAW_MAIN, LV_DESIGN_DRAW_POST, LV_DESIGN_COVER_CHK }
 
enum  {
  LV_EVENT_PRESSED, LV_EVENT_PRESSING, LV_EVENT_PRESS_LOST, LV_EVENT_SHORT_CLICKED,
  LV_EVENT_LONG_PRESSED, LV_EVENT_LONG_PRESSED_REPEAT, LV_EVENT_CLICKED, LV_EVENT_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, LV_EVENT_INSERT,
  LV_EVENT_REFRESH, LV_EVENT_APPLY, LV_EVENT_CANCEL, LV_EVENT_DELETE
}
 
enum  {
  LV_SIGNAL_CLEANUP, LV_SIGNAL_CHILD_CHG, LV_SIGNAL_CORD_CHG, LV_SIGNAL_PARENT_SIZE_CHG,
  LV_SIGNAL_STYLE_CHG, LV_SIGNAL_REFR_EXT_DRAW_PAD, LV_SIGNAL_GET_TYPE, LV_SIGNAL_PRESSED,
  LV_SIGNAL_PRESSING, LV_SIGNAL_PRESS_LOST, LV_SIGNAL_RELEASED, LV_SIGNAL_LONG_PRESS,
  LV_SIGNAL_LONG_PRESS_REP, LV_SIGNAL_DRAG_BEGIN, LV_SIGNAL_DRAG_END, LV_SIGNAL_FOCUS,
  LV_SIGNAL_DEFOCUS, LV_SIGNAL_CONTROL, LV_SIGNAL_GET_EDITABLE
}
 
enum  {
  LV_ALIGN_CENTER = 0, 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
}
 
enum  { LV_DRAG_DIR_HOR = 0x1, LV_DRAG_DIR_VER = 0x2, LV_DRAG_DIR_ALL = 0x3 }
 
enum  {
  LV_PROTECT_NONE = 0x00, LV_PROTECT_CHILD_CHG = 0x01, LV_PROTECT_PARENT = 0x02, LV_PROTECT_POS = 0x04,
  LV_PROTECT_FOLLOW = 0x08, LV_PROTECT_PRESS_LOST = 0x10, LV_PROTECT_CLICK_FOCUS = 0x20
}
 

Functions

void lv_init (void)
 
lv_obj_tlv_obj_create (lv_obj_t *parent, const lv_obj_t *copy)
 
lv_res_t lv_obj_del (lv_obj_t *obj)
 
void lv_obj_del_async (struct _lv_obj_t *obj)
 
void lv_obj_clean (lv_obj_t *obj)
 
void lv_obj_invalidate (const lv_obj_t *obj)
 
void lv_obj_set_parent (lv_obj_t *obj, lv_obj_t *parent)
 
void lv_obj_move_foreground (lv_obj_t *obj)
 
void lv_obj_move_background (lv_obj_t *obj)
 
void lv_obj_set_pos (lv_obj_t *obj, lv_coord_t x, lv_coord_t y)
 
void lv_obj_set_x (lv_obj_t *obj, lv_coord_t x)
 
void lv_obj_set_y (lv_obj_t *obj, lv_coord_t y)
 
void lv_obj_set_size (lv_obj_t *obj, lv_coord_t w, lv_coord_t h)
 
void lv_obj_set_width (lv_obj_t *obj, lv_coord_t w)
 
void lv_obj_set_height (lv_obj_t *obj, lv_coord_t h)
 
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)
 
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)
 
void lv_obj_realign (lv_obj_t *obj)
 
void lv_obj_set_auto_realign (lv_obj_t *obj, bool en)
 
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)
 
void lv_obj_set_style (lv_obj_t *obj, const lv_style_t *style)
 
void lv_obj_refresh_style (lv_obj_t *obj)
 
void lv_obj_report_style_mod (lv_style_t *style)
 
void lv_obj_set_hidden (lv_obj_t *obj, bool en)
 
void lv_obj_set_click (lv_obj_t *obj, bool en)
 
void lv_obj_set_top (lv_obj_t *obj, bool en)
 
void lv_obj_set_drag (lv_obj_t *obj, bool en)
 
void lv_obj_set_drag_dir (lv_obj_t *obj, lv_drag_dir_t drag_dir)
 
void lv_obj_set_drag_throw (lv_obj_t *obj, bool en)
 
void lv_obj_set_drag_parent (lv_obj_t *obj, bool en)
 
void lv_obj_set_parent_event (lv_obj_t *obj, bool en)
 
void lv_obj_set_opa_scale_enable (lv_obj_t *obj, bool en)
 
void lv_obj_set_opa_scale (lv_obj_t *obj, lv_opa_t opa_scale)
 
void lv_obj_set_protect (lv_obj_t *obj, uint8_t prot)
 
void lv_obj_clear_protect (lv_obj_t *obj, uint8_t prot)
 
void lv_obj_set_event_cb (lv_obj_t *obj, lv_event_cb_t event_cb)
 
lv_res_t lv_event_send (lv_obj_t *obj, lv_event_t event, const void *data)
 
lv_res_t lv_event_send_func (lv_event_cb_t event_xcb, lv_obj_t *obj, lv_event_t event, const void *data)
 
const void * lv_event_get_data (void)
 
void lv_obj_set_signal_cb (lv_obj_t *obj, lv_signal_cb_t signal_cb)
 
void lv_signal_send (lv_obj_t *obj, lv_signal_t signal, void *param)
 
void lv_obj_set_design_cb (lv_obj_t *obj, lv_design_cb_t design_cb)
 
void * lv_obj_allocate_ext_attr (lv_obj_t *obj, uint16_t ext_size)
 
void lv_obj_refresh_ext_draw_pad (lv_obj_t *obj)
 
lv_obj_tlv_obj_get_screen (const lv_obj_t *obj)
 
lv_disp_tlv_obj_get_disp (const lv_obj_t *obj)
 
lv_obj_tlv_obj_get_parent (const lv_obj_t *obj)
 
lv_obj_tlv_obj_get_child (const lv_obj_t *obj, const lv_obj_t *child)
 
lv_obj_tlv_obj_get_child_back (const lv_obj_t *obj, const lv_obj_t *child)
 
uint16_t lv_obj_count_children (const lv_obj_t *obj)
 
uint16_t lv_obj_count_children_recursive (const lv_obj_t *obj)
 
void lv_obj_get_coords (const lv_obj_t *obj, lv_area_t *cords_p)
 
void lv_obj_get_inner_coords (const lv_obj_t *obj, lv_area_t *coords_p)
 
lv_coord_t lv_obj_get_x (const lv_obj_t *obj)
 
lv_coord_t lv_obj_get_y (const lv_obj_t *obj)
 
lv_coord_t lv_obj_get_width (const lv_obj_t *obj)
 
lv_coord_t lv_obj_get_height (const lv_obj_t *obj)
 
lv_coord_t lv_obj_get_width_fit (lv_obj_t *obj)
 
lv_coord_t lv_obj_get_height_fit (lv_obj_t *obj)
 
bool lv_obj_get_auto_realign (lv_obj_t *obj)
 
lv_coord_t lv_obj_get_ext_click_pad_left (const lv_obj_t *obj)
 
lv_coord_t lv_obj_get_ext_click_pad_right (const lv_obj_t *obj)
 
lv_coord_t lv_obj_get_ext_click_pad_top (const lv_obj_t *obj)
 
lv_coord_t lv_obj_get_ext_click_pad_bottom (const lv_obj_t *obj)
 
lv_coord_t lv_obj_get_ext_draw_pad (const lv_obj_t *obj)
 
const lv_style_tlv_obj_get_style (const lv_obj_t *obj)
 
bool lv_obj_get_hidden (const lv_obj_t *obj)
 
bool lv_obj_get_click (const lv_obj_t *obj)
 
bool lv_obj_get_top (const lv_obj_t *obj)
 
bool lv_obj_get_drag (const lv_obj_t *obj)
 
lv_drag_dir_t lv_obj_get_drag_dir (const lv_obj_t *obj)
 
bool lv_obj_get_drag_throw (const lv_obj_t *obj)
 
bool lv_obj_get_drag_parent (const lv_obj_t *obj)
 
bool lv_obj_get_parent_event (const lv_obj_t *obj)
 
lv_opa_t lv_obj_get_opa_scale_enable (const lv_obj_t *obj)
 
lv_opa_t lv_obj_get_opa_scale (const lv_obj_t *obj)
 
uint8_t lv_obj_get_protect (const lv_obj_t *obj)
 
bool lv_obj_is_protected (const lv_obj_t *obj, uint8_t prot)
 
lv_signal_cb_t lv_obj_get_signal_cb (const lv_obj_t *obj)
 
lv_design_cb_t lv_obj_get_design_cb (const lv_obj_t *obj)
 
lv_event_cb_t lv_obj_get_event_cb (const lv_obj_t *obj)
 
void * lv_obj_get_ext_attr (const lv_obj_t *obj)
 
void lv_obj_get_type (lv_obj_t *obj, lv_obj_type_t *buf)
 

Macro Definition Documentation

§ LV_MAX_ANCESTOR_NUM

#define LV_MAX_ANCESTOR_NUM   8

§ LV_EXT_CLICK_AREA_OFF

#define LV_EXT_CLICK_AREA_OFF   0

§ LV_EXT_CLICK_AREA_TINY

#define LV_EXT_CLICK_AREA_TINY   1

§ LV_EXT_CLICK_AREA_FULL

#define LV_EXT_CLICK_AREA_FULL   2

§ LV_EVENT_CB_DECLARE

#define LV_EVENT_CB_DECLARE (   name)    void name(lv_obj_t * obj, lv_event_t e)

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); } }

Typedef Documentation

§ lv_design_mode_t

typedef uint8_t lv_design_mode_t

§ lv_design_cb_t

typedef bool(* lv_design_cb_t) (struct _lv_obj_t *obj, const lv_area_t *mask_p, lv_design_mode_t mode)

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.

§ lv_event_t

typedef uint8_t lv_event_t

Type of event being sent to the object.

§ lv_event_cb_t

typedef void(* lv_event_cb_t) (struct _lv_obj_t *obj, lv_event_t event)

Event callback. Events are used to notify the user of some action being taken on the object. For details, see lv_event_t.

§ lv_signal_t

typedef uint8_t lv_signal_t

§ lv_signal_cb_t

typedef lv_res_t(* lv_signal_cb_t) (struct _lv_obj_t *obj, lv_signal_t sign, void *param)

§ lv_align_t

typedef uint8_t lv_align_t

§ lv_drag_dir_t

typedef uint8_t lv_drag_dir_t

§ lv_obj_t

typedef struct _lv_obj_t lv_obj_t

§ lv_protect_t

typedef uint8_t lv_protect_t

Enumeration Type Documentation

§ anonymous enum

anonymous enum

Design modes

Enumerator
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

§ anonymous enum

anonymous enum
Enumerator
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

§ anonymous enum

anonymous enum

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.

Enumerator
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_REFR_EXT_DRAW_PAD 

Object's extra padding has changed

LV_SIGNAL_GET_TYPE 

LittlevGL needs to retrieve the object's type

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.

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 
LV_SIGNAL_DRAG_END 
LV_SIGNAL_FOCUS 
LV_SIGNAL_DEFOCUS 
LV_SIGNAL_CONTROL 
LV_SIGNAL_GET_EDITABLE 

§ anonymous enum

anonymous enum

Object alignment.

Enumerator
LV_ALIGN_CENTER 
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 

§ anonymous enum

anonymous enum
Enumerator
LV_DRAG_DIR_HOR 

Object can be dragged horizontally.

LV_DRAG_DIR_VER 

Object can be dragged vertically.

LV_DRAG_DIR_ALL 

Object can be dragged in all directions.

§ anonymous enum

anonymous enum
Enumerator
LV_PROTECT_NONE 
LV_PROTECT_CHILD_CHG 

Disable the child change signal. Used by the library

LV_PROTECT_PARENT 

Prevent automatic parent change (e.g. in lv_page)

LV_PROTECT_POS 

Prevent automatic positioning (e.g. in lv_cont layout)

LV_PROTECT_FOLLOW 

Prevent the object be followed in automatic ordering (e.g. in lv_cont PRETTY layout)

LV_PROTECT_PRESS_LOST 

If the indev was pressing this object but swiped out while pressing do not search other object.

LV_PROTECT_CLICK_FOCUS 

Prevent focusing the object by clicking on it

Function Documentation

§ lv_init()

void lv_init ( void  )

Init. the 'lv' library.

§ lv_obj_create()

lv_obj_t* lv_obj_create ( lv_obj_t parent,
const lv_obj_t copy 
)

Create a basic object

Parameters
parentpointer to a parent object. If NULL then a screen will be created
copypointer to a base object, if not NULL then the new object will be copied from it
Returns
pointer to the new object

§ lv_obj_del()

lv_res_t lv_obj_del ( lv_obj_t obj)

Delete 'obj' and all of its children

Parameters
objpointer to an object to delete
Returns
LV_RES_INV because the object is deleted

§ lv_obj_del_async()

void lv_obj_del_async ( struct _lv_obj_t obj)

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).

Parameters
objobject to delete
See also
lv_async_call

§ lv_obj_clean()

void lv_obj_clean ( lv_obj_t obj)

Delete all children of an object

Parameters
objpointer to an object

§ lv_obj_invalidate()

void lv_obj_invalidate ( const lv_obj_t obj)

Mark the object as invalid therefore its current position will be redrawn by 'lv_refr_task'

Parameters
objpointer to an object

§ lv_obj_set_parent()

void lv_obj_set_parent ( lv_obj_t obj,
lv_obj_t parent 
)

Set a new parent for an object. Its relative position will be the same.

Parameters
objpointer to an object. Can't be a screen.
parentpointer to the new parent object. (Can't be NULL)

§ lv_obj_move_foreground()

void lv_obj_move_foreground ( lv_obj_t obj)

Move and object to the foreground

Parameters
objpointer to an object

§ lv_obj_move_background()

void lv_obj_move_background ( lv_obj_t obj)

Move and object to the background

Parameters
objpointer to an object

§ lv_obj_set_pos()

void lv_obj_set_pos ( lv_obj_t obj,
lv_coord_t  x,
lv_coord_t  y 
)

Set relative the position of an object (relative to the parent)

Parameters
objpointer to an object
xnew distance from the left side of the parent
ynew distance from the top of the parent

§ lv_obj_set_x()

void lv_obj_set_x ( lv_obj_t obj,
lv_coord_t  x 
)

Set the x coordinate of a object

Parameters
objpointer to an object
xnew distance from the left side from the parent

§ lv_obj_set_y()

void lv_obj_set_y ( lv_obj_t obj,
lv_coord_t  y 
)

Set the y coordinate of a object

Parameters
objpointer to an object
ynew distance from the top of the parent

§ lv_obj_set_size()

void lv_obj_set_size ( lv_obj_t obj,
lv_coord_t  w,
lv_coord_t  h 
)

Set the size of an object

Parameters
objpointer to an object
wnew width
hnew height

§ lv_obj_set_width()

void lv_obj_set_width ( lv_obj_t obj,
lv_coord_t  w 
)

Set the width of an object

Parameters
objpointer to an object
wnew width

§ lv_obj_set_height()

void lv_obj_set_height ( lv_obj_t obj,
lv_coord_t  h 
)

Set the height of an object

Parameters
objpointer to an object
hnew height

§ lv_obj_align()

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 
)

Align an object to an other object.

Parameters
objpointer to an object to align
basepointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
aligntype of alignment (see 'lv_align_t' enum)
x_modx coordinate shift after alignment
y_mody coordinate shift after alignment

§ lv_obj_align_origo()

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 
)

Align an object to an other object.

Parameters
objpointer to an object to align
basepointer to an object (if NULL the parent is used). 'obj' will be aligned to it.
aligntype of alignment (see 'lv_align_t' enum)
x_modx coordinate shift after alignment
y_mody coordinate shift after alignment

§ lv_obj_realign()

void lv_obj_realign ( lv_obj_t obj)

Realign the object based on the last lv_obj_align parameters.

Parameters
objpointer to an object

§ lv_obj_set_auto_realign()

void lv_obj_set_auto_realign ( lv_obj_t obj,
bool  en 
)

Enable the automatic realign of the object when its size has changed based on the last lv_obj_align parameters.

Parameters
objpointer to an object
entrue: enable auto realign; false: disable auto realign

§ lv_obj_set_ext_click_area()

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 
)

Set the size of an extended clickable area

Parameters
objpointer to an object
leftextended clickable are on the left [px]
rightextended clickable are on the right [px]
topextended clickable are on the top [px]
bottomextended clickable are on the bottom [px]

§ lv_obj_set_style()

void lv_obj_set_style ( lv_obj_t obj,
const lv_style_t style 
)

Set a new style for an object

Parameters
objpointer to an object
style_ppointer to the new style

§ lv_obj_refresh_style()

void lv_obj_refresh_style ( lv_obj_t obj)

Notify an object about its style is modified

Parameters
objpointer to an object

§ lv_obj_report_style_mod()

void lv_obj_report_style_mod ( lv_style_t style)

Notify all object if a style is modified

Parameters
stylepointer to a style. Only the objects with this style will be notified (NULL to notify all objects)

§ lv_obj_set_hidden()

void lv_obj_set_hidden ( lv_obj_t obj,
bool  en 
)

Hide an object. It won't be visible and clickable.

Parameters
objpointer to an object
entrue: hide the object

§ lv_obj_set_click()

void lv_obj_set_click ( lv_obj_t obj,
bool  en 
)

Enable or disable the clicking of an object

Parameters
objpointer to an object
entrue: make the object clickable

§ lv_obj_set_top()

void lv_obj_set_top ( lv_obj_t obj,
bool  en 
)

Enable to bring this object to the foreground if it or any of its children is clicked

Parameters
objpointer to an object
entrue: enable the auto top feature

§ lv_obj_set_drag()

void lv_obj_set_drag ( lv_obj_t obj,
bool  en 
)

Enable the dragging of an object

Parameters
objpointer to an object
entrue: make the object dragable

§ lv_obj_set_drag_dir()

void lv_obj_set_drag_dir ( lv_obj_t obj,
lv_drag_dir_t  drag_dir 
)

Set the directions an object can be dragged in

Parameters
objpointer to an object
drag_dirbitwise OR of allowed drag directions

§ lv_obj_set_drag_throw()

void lv_obj_set_drag_throw ( lv_obj_t obj,
bool  en 
)

Enable the throwing of an object after is is dragged

Parameters
objpointer to an object
entrue: enable the drag throw

§ lv_obj_set_drag_parent()

void lv_obj_set_drag_parent ( 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

Parameters
objpointer to an object
entrue: enable the 'drag parent' for the object

§ lv_obj_set_parent_event()

void lv_obj_set_parent_event ( lv_obj_t obj,
bool  en 
)

Propagate the events to the parent too

Parameters
objpointer to an object
entrue: enable the event propagation

§ lv_obj_set_opa_scale_enable()

void lv_obj_set_opa_scale_enable ( lv_obj_t obj,
bool  en 
)

Set the opa scale enable parameter (required to set opa_scale with lv_obj_set_opa_scale())

Parameters
objpointer to an object
entrue: opa scaling is enabled for this object and all children; false: no opa scaling

§ lv_obj_set_opa_scale()

void lv_obj_set_opa_scale ( lv_obj_t obj,
lv_opa_t  opa_scale 
)

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)

Parameters
objpointer to an object
opa_scalea factor to scale down opacity [0..255]

§ lv_obj_set_protect()

void lv_obj_set_protect ( lv_obj_t obj,
uint8_t  prot 
)

Set a bit or bits in the protect filed

Parameters
objpointer to an object
prot'OR'-ed values from lv_protect_t

§ lv_obj_clear_protect()

void lv_obj_clear_protect ( lv_obj_t obj,
uint8_t  prot 
)

Clear a bit or bits in the protect filed

Parameters
objpointer to an object
prot'OR'-ed values from lv_protect_t

§ lv_obj_set_event_cb()

void lv_obj_set_event_cb ( lv_obj_t obj,
lv_event_cb_t  event_cb 
)

Set a an event handler function for an object. Used by the user to react on event which happens with the object.

Parameters
objpointer to an object
event_cbthe new event function

§ lv_event_send()

lv_res_t lv_event_send ( lv_obj_t obj,
lv_event_t  event,
const void *  data 
)

Send an event to the object

Parameters
objpointer to an object
eventthe type of the event from lv_event_t.
dataarbitrary data depending on the object type and the event. (Usually NULL)
Returns
LV_RES_OK: obj was not deleted in the event; LV_RES_INV: obj was deleted in the event

§ lv_event_send_func()

lv_res_t lv_event_send_func ( lv_event_cb_t  event_xcb,
lv_obj_t obj,
lv_event_t  event,
const void *  data 
)

Call an event function with an object, event, and data.

Parameters
event_xcban 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)
objpointer to an object to associate with the event (can be NULL to simply call the event_cb)
eventan event
datapointer to a custom data
Returns
LV_RES_OK: obj was not deleted in the event; LV_RES_INV: obj was deleted in the event

§ lv_event_get_data()

const void* lv_event_get_data ( void  )

Get the data parameter of the current event

Returns
the data parameter

§ lv_obj_set_signal_cb()

void lv_obj_set_signal_cb ( lv_obj_t obj,
lv_signal_cb_t  signal_cb 
)

Set the a signal function of an object. Used internally by the library. Always call the previous signal function in the new.

Parameters
objpointer to an object
signal_cbthe new signal function

§ lv_signal_send()

void lv_signal_send ( lv_obj_t obj,
lv_signal_t  signal,
void *  param 
)

Send an event to the object

Parameters
objpointer to an object
eventthe type of the event from lv_event_t.

§ lv_obj_set_design_cb()

void lv_obj_set_design_cb ( lv_obj_t obj,
lv_design_cb_t  design_cb 
)

Set a new design function for an object

Parameters
objpointer to an object
design_cbthe new design function

§ lv_obj_allocate_ext_attr()

void* lv_obj_allocate_ext_attr ( lv_obj_t obj,
uint16_t  ext_size 
)

Allocate a new ext. data for an object

Parameters
objpointer to an object
ext_sizethe size of the new ext. data
Returns
pointer to the allocated ext

§ lv_obj_refresh_ext_draw_pad()

void lv_obj_refresh_ext_draw_pad ( lv_obj_t obj)

Send a 'LV_SIGNAL_REFR_EXT_SIZE' signal to the object

Parameters
objpointer to an object

§ lv_obj_get_screen()

lv_obj_t* lv_obj_get_screen ( const lv_obj_t obj)

Return with the screen of an object

Parameters
objpointer to an object
Returns
pointer to a screen

§ lv_obj_get_disp()

lv_disp_t* lv_obj_get_disp ( const lv_obj_t obj)

Get the display of an object

Parameters
scrpointer to an object
Returns
pointer the object's display

§ lv_obj_get_parent()

lv_obj_t* lv_obj_get_parent ( const lv_obj_t obj)

Returns with the parent of an object

Parameters
objpointer to an object
Returns
pointer to the parent of 'obj'

§ lv_obj_get_child()

lv_obj_t* lv_obj_get_child ( const lv_obj_t obj,
const lv_obj_t child 
)

Iterate through the children of an object (start from the "youngest, lastly created")

Parameters
objpointer to an object
childNULL at first call to get the next children and the previous return value later
Returns
the child after 'act_child' or NULL if no more child

§ lv_obj_get_child_back()

lv_obj_t* lv_obj_get_child_back ( const lv_obj_t obj,
const lv_obj_t child 
)

Iterate through the children of an object (start from the "oldest", firstly created)

Parameters
objpointer to an object
childNULL at first call to get the next children and the previous return value later
Returns
the child after 'act_child' or NULL if no more child

§ lv_obj_count_children()

uint16_t lv_obj_count_children ( const lv_obj_t obj)

Count the children of an object (only children directly on 'obj')

Parameters
objpointer to an object
Returns
children number of 'obj'

§ lv_obj_count_children_recursive()

uint16_t lv_obj_count_children_recursive ( const lv_obj_t obj)

Recursively count the children of an object

Parameters
objpointer to an object
Returns
children number of 'obj'

§ lv_obj_get_coords()

void lv_obj_get_coords ( const lv_obj_t obj,
lv_area_t cords_p 
)

Copy the coordinates of an object to an area

Parameters
objpointer to an object
cords_ppointer to an area to store the coordinates

§ lv_obj_get_inner_coords()

void lv_obj_get_inner_coords ( const lv_obj_t obj,
lv_area_t coords_p 
)

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)

Parameters
coords_pstore the result area here

§ lv_obj_get_x()

lv_coord_t lv_obj_get_x ( const lv_obj_t obj)

Get the x coordinate of object

Parameters
objpointer to an object
Returns
distance of 'obj' from the left side of its parent

§ lv_obj_get_y()

lv_coord_t lv_obj_get_y ( const lv_obj_t obj)

Get the y coordinate of object

Parameters
objpointer to an object
Returns
distance of 'obj' from the top of its parent

§ lv_obj_get_width()

lv_coord_t lv_obj_get_width ( const lv_obj_t obj)

Get the width of an object

Parameters
objpointer to an object
Returns
the width

§ lv_obj_get_height()

lv_coord_t lv_obj_get_height ( const lv_obj_t obj)

Get the height of an object

Parameters
objpointer to an object
Returns
the height

§ lv_obj_get_width_fit()

lv_coord_t lv_obj_get_width_fit ( lv_obj_t obj)

Get that width reduced by the left and right padding.

Parameters
objpointer to an object
Returns
the width which still fits into the container

§ lv_obj_get_height_fit()

lv_coord_t lv_obj_get_height_fit ( lv_obj_t obj)

Get that height reduced by the top an bottom padding.

Parameters
objpointer to an object
Returns
the height which still fits into the container

§ lv_obj_get_auto_realign()

bool lv_obj_get_auto_realign ( lv_obj_t obj)

Get the automatic realign property of the object.

Parameters
objpointer to an object
Returns
true: auto realign is enabled; false: auto realign is disabled

§ lv_obj_get_ext_click_pad_left()

lv_coord_t lv_obj_get_ext_click_pad_left ( const lv_obj_t obj)

Get the left padding of extended clickable area

Parameters
objpointer to an object
Returns
the extended left padding

§ lv_obj_get_ext_click_pad_right()

lv_coord_t lv_obj_get_ext_click_pad_right ( const lv_obj_t obj)

Get the right padding of extended clickable area

Parameters
objpointer to an object
Returns
the extended right padding

§ lv_obj_get_ext_click_pad_top()

lv_coord_t lv_obj_get_ext_click_pad_top ( const lv_obj_t obj)

Get the top padding of extended clickable area

Parameters
objpointer to an object
Returns
the extended top padding

§ lv_obj_get_ext_click_pad_bottom()

lv_coord_t lv_obj_get_ext_click_pad_bottom ( const lv_obj_t obj)

Get the bottom padding of extended clickable area

Parameters
objpointer to an object
Returns
the extended bottom padding

§ lv_obj_get_ext_draw_pad()

lv_coord_t lv_obj_get_ext_draw_pad ( const lv_obj_t obj)

Get the extended size attribute of an object

Parameters
objpointer to an object
Returns
the extended size attribute

§ lv_obj_get_style()

const lv_style_t* lv_obj_get_style ( const lv_obj_t obj)

Get the style pointer of an object (if NULL get style of the parent)

Parameters
objpointer to an object
Returns
pointer to a style

§ lv_obj_get_hidden()

bool lv_obj_get_hidden ( const lv_obj_t obj)

Get the hidden attribute of an object

Parameters
objpointer to an object
Returns
true: the object is hidden

§ lv_obj_get_click()

bool lv_obj_get_click ( const lv_obj_t obj)

Get the click enable attribute of an object

Parameters
objpointer to an object
Returns
true: the object is clickable

§ lv_obj_get_top()

bool lv_obj_get_top ( const lv_obj_t obj)

Get the top enable attribute of an object

Parameters
objpointer to an object
Returns
true: the auto top feature is enabled

§ lv_obj_get_drag()

bool lv_obj_get_drag ( const lv_obj_t obj)

Get the drag enable attribute of an object

Parameters
objpointer to an object
Returns
true: the object is dragable

§ lv_obj_get_drag_dir()

lv_drag_dir_t lv_obj_get_drag_dir ( const lv_obj_t obj)

Get the directions an object can be dragged

Parameters
objpointer to an object
Returns
bitwise OR of allowed directions an object can be dragged in

§ lv_obj_get_drag_throw()

bool lv_obj_get_drag_throw ( const lv_obj_t obj)

Get the drag throw enable attribute of an object

Parameters
objpointer to an object
Returns
true: drag throw is enabled

§ lv_obj_get_drag_parent()

bool lv_obj_get_drag_parent ( const lv_obj_t obj)

Get the drag parent attribute of an object

Parameters
objpointer to an object
Returns
true: drag parent is enabled

§ lv_obj_get_parent_event()

bool lv_obj_get_parent_event ( const lv_obj_t obj)

Get the drag parent attribute of an object

Parameters
objpointer to an object
Returns
true: drag parent is enabled

§ lv_obj_get_opa_scale_enable()

lv_opa_t lv_obj_get_opa_scale_enable ( const lv_obj_t obj)

Get the opa scale enable parameter

Parameters
objpointer to an object
Returns
true: opa scaling is enabled for this object and all children; false: no opa scaling

§ lv_obj_get_opa_scale()

lv_opa_t lv_obj_get_opa_scale ( const lv_obj_t obj)

Get the opa scale parameter of an object

Parameters
objpointer to an object
Returns
opa scale [0..255]

§ lv_obj_get_protect()

uint8_t lv_obj_get_protect ( const lv_obj_t obj)

Get the protect field of an object

Parameters
objpointer to an object
Returns
protect field ('OR'ed values of lv_protect_t)

§ lv_obj_is_protected()

bool lv_obj_is_protected ( const lv_obj_t obj,
uint8_t  prot 
)

Check at least one bit of a given protect bitfield is set

Parameters
objpointer to an object
protprotect bits to test ('OR'ed values of lv_protect_t)
Returns
false: none of the given bits are set, true: at least one bit is set

§ lv_obj_get_signal_cb()

lv_signal_cb_t lv_obj_get_signal_cb ( const lv_obj_t obj)

Get the signal function of an object

Parameters
objpointer to an object
Returns
the signal function

§ lv_obj_get_design_cb()

lv_design_cb_t lv_obj_get_design_cb ( const lv_obj_t obj)

Get the design function of an object

Parameters
objpointer to an object
Returns
the design function

§ lv_obj_get_event_cb()

lv_event_cb_t lv_obj_get_event_cb ( const lv_obj_t obj)

Get the event function of an object

Parameters
objpointer to an object
Returns
the event function

§ lv_obj_get_ext_attr()

void* lv_obj_get_ext_attr ( const lv_obj_t obj)

Get the ext pointer

Parameters
objpointer to an object
Returns
the ext pointer but not the dynamic version Use it as ext->data1, and NOT da(ext)->data1

§ lv_obj_get_type()

void lv_obj_get_type ( lv_obj_t obj,
lv_obj_type_t buf 
)

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"

Parameters
objpointer to an object which type should be get
bufpointer to an lv_obj_type_t buffer to store the types
© Copyright 1995-2019, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale