1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-21 06:53:01 +08:00
lvgl/lv_objx/lv_cont.h

142 lines
3.4 KiB
C
Raw Normal View History

2017-04-13 16:12:03 +02:00
/**
* @file lv_cont.h
*
*/
#ifndef LV_CONT_H
#define LV_CONT_H
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
extern "C" {
#endif
2017-04-13 16:12:03 +02:00
/*********************
* INCLUDES
*********************/
#include "lv_conf.h"
2017-04-24 16:16:36 +02:00
#if USE_LV_CONT != 0
2017-04-13 16:12:03 +02:00
#include "../lv_obj/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Layout options*/
typedef enum
{
LV_LAYOUT_OFF = 0,
LV_LAYOUT_CENTER,
LV_LAYOUT_COL_L, /*Column left align*/
LV_LAYOUT_COL_M, /*Column middle align*/
LV_LAYOUT_COL_R, /*Column right align*/
LV_LAYOUT_ROW_T, /*Row top align*/
LV_LAYOUT_ROW_M, /*Row middle align*/
LV_LAYOUT_ROW_B, /*Row bottom align*/
LV_LAYOUT_PRETTY, /*Put as many object as possible in row and begin a new row*/
LV_LAYOUT_GRID, /*Align same-sized object into a grid*/
}lv_layout_t;
2017-04-13 16:12:03 +02:00
typedef struct
{
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
/*New data for this type */
uint8_t layout :4; /*A layout from 'lv_cont_layout_t' enum*/
uint8_t hor_fit :1; /*1: Enable horizontal fit to involve all children*/
uint8_t ver_fit :1; /*1: Enable horizontal fir to involve all children*/
2017-04-13 16:12:03 +02:00
}lv_cont_ext_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a container objects
* @param par pointer to an object, it will be the parent of the new container
* @param copy pointer to a container object, if not NULL then the new object will be copied from it
* @return pointer to the created container
*/
lv_obj_t * lv_cont_create(lv_obj_t * par, lv_obj_t * copy);
2017-11-10 15:01:40 +01:00
/*=====================
* Setter functions
*====================*/
2017-04-13 16:12:03 +02:00
/**
2017-11-10 15:01:40 +01:00
* Set a layout on a container
2017-04-13 16:12:03 +02:00
* @param cont pointer to a container object
* @param layout a layout from 'lv_cont_layout_t'
*/
void lv_cont_set_layout(lv_obj_t * cont, lv_layout_t layout);
2017-04-13 16:12:03 +02:00
2017-11-10 15:01:40 +01:00
2017-04-13 16:12:03 +02:00
/**
* Enable the horizontal or vertical fit.
* The container size will be set to involve the children horizontally or vertically.
* @param cont pointer to a container object
2017-11-10 15:01:40 +01:00
* @param hor_en true: enable the horizontal fit
* @param ver_en true: enable the vertical fit
2017-04-13 16:12:03 +02:00
*/
void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en);
2017-11-10 15:01:40 +01:00
/**
* Set the style of a container
* @param cont pointer to a container object
* @param style pointer to the new style
*/
static inline void lv_cont_set_style(lv_obj_t *cont, lv_style_t * style)
{
lv_obj_set_style(cont, style);
}
/*=====================
* Getter functions
*====================*/
2017-04-13 16:12:03 +02:00
/**
* Get the layout of a container
* @param cont pointer to container object
* @return the layout from 'lv_cont_layout_t'
*/
lv_layout_t lv_cont_get_layout(lv_obj_t * cont);
2017-04-13 16:12:03 +02:00
/**
* Get horizontal fit enable attribute of a container
* @param cont pointer to a container object
* @return true: horizontal fit is enabled; false: disabled
2017-04-13 16:12:03 +02:00
*/
bool lv_cont_get_hor_fit(lv_obj_t * cont);
2017-04-13 16:12:03 +02:00
/**
2017-11-10 15:01:40 +01:00
* Get vertical fit enable attribute of a container
* @param cont pointer to a container object
2017-11-10 15:01:40 +01:00
* @return true: vertical fit is enabled; false: disabled
*/
2017-11-10 15:01:40 +01:00
bool lv_cont_get_ver_fit(lv_obj_t * cont);
/**
* Get the style of a container
* @param cont pointer to a container object
* @return pointer to the container's style
*/
2017-11-07 16:18:38 +01:00
static inline lv_style_t * lv_cont_get_style(lv_obj_t *cont)
{
2017-11-07 16:18:38 +01:00
return lv_obj_get_style(cont);
}
2017-04-13 16:12:03 +02:00
/**********************
* MACROS
**********************/
2017-07-09 15:32:49 +02:00
#endif /*USE_LV_CONT*/
2017-04-13 16:12:03 +02:00
2017-07-09 15:32:49 +02:00
#ifdef __cplusplus
} /* extern "C" */
2017-04-13 16:12:03 +02:00
#endif
2017-07-09 15:32:49 +02:00
#endif /*LV_CONT_H*/