/**1* @file lv_cont.h2*3*/45#ifndef LV_CONT_H6#define LV_CONT_H78#ifdef __cplusplus9extern "C" {10#endif1112/*********************13* INCLUDES14*********************/15#ifdef LV_CONF_INCLUDE_SIMPLE16#include "lv_conf.h"17#else18#include "../../lv_conf.h"19#endif2021#if USE_LV_CONT != 02223#include "../lv_core/lv_obj.h"2425/*********************26* DEFINES27*********************/2829/**********************30* TYPEDEFS31**********************/3233/*Layout options*/34enum35{36LV_LAYOUT_OFF = 0,37LV_LAYOUT_CENTER,38LV_LAYOUT_COL_L, /*Column left align*/39LV_LAYOUT_COL_M, /*Column middle align*/40LV_LAYOUT_COL_R, /*Column right align*/41LV_LAYOUT_ROW_T, /*Row top align*/42LV_LAYOUT_ROW_M, /*Row middle align*/43LV_LAYOUT_ROW_B, /*Row bottom align*/44LV_LAYOUT_PRETTY, /*Put as many object as possible in row and begin a new row*/45LV_LAYOUT_GRID, /*Align same-sized object into a grid*/46};47typedef uint8_t lv_layout_t;4849typedef struct50{51/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/52/*New data for this type */53uint8_t layout :4; /*A layout from 'lv_cont_layout_t' enum*/54uint8_t hor_fit :1; /*1: Enable horizontal fit to involve all children*/55uint8_t ver_fit :1; /*1: Enable horizontal fit to involve all children*/56} lv_cont_ext_t;575859/**********************60* GLOBAL PROTOTYPES61**********************/6263/**64* Create a container objects65* @param par pointer to an object, it will be the parent of the new container66* @param copy pointer to a container object, if not NULL then the new object will be copied from it67* @return pointer to the created container68*/69lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy);7071/*=====================72* Setter functions73*====================*/7475/**76* Set a layout on a container77* @param cont pointer to a container object78* @param layout a layout from 'lv_cont_layout_t'79*/80void lv_cont_set_layout(lv_obj_t * cont, lv_layout_t layout);818283/**84* Enable the horizontal or vertical fit.85* The container size will be set to involve the children horizontally or vertically.86* @param cont pointer to a container object87* @param hor_en true: enable the horizontal fit88* @param ver_en true: enable the vertical fit89*/90void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en);9192/**93* Set the style of a container94* @param cont pointer to a container object95* @param style pointer to the new style96*/97static inline void lv_cont_set_style(lv_obj_t *cont, lv_style_t * style)98{99lv_obj_set_style(cont, style);100}101102/*=====================103* Getter functions104*====================*/105106/**107* Get the layout of a container108* @param cont pointer to container object109* @return the layout from 'lv_cont_layout_t'110*/111lv_layout_t lv_cont_get_layout(const lv_obj_t * cont);112113/**114* Get horizontal fit enable attribute of a container115* @param cont pointer to a container object116* @return true: horizontal fit is enabled; false: disabled117*/118bool lv_cont_get_hor_fit(const lv_obj_t * cont);119120/**121* Get vertical fit enable attribute of a container122* @param cont pointer to a container object123* @return true: vertical fit is enabled; false: disabled124*/125bool lv_cont_get_ver_fit(const lv_obj_t * cont);126127128/**129* Get that width reduced by the horizontal padding. Useful if a layout is used.130* @param cont pointer to a container object131* @return the width which still fits into the container132*/133lv_coord_t lv_cont_get_fit_width(lv_obj_t * cont);134135/**136* Get that height reduced by the vertical padding. Useful if a layout is used.137* @param cont pointer to a container object138* @return the height which still fits into the container139*/140lv_coord_t lv_cont_get_fit_height(lv_obj_t * cont);141142/**143* Get the style of a container144* @param cont pointer to a container object145* @return pointer to the container's style146*/147static inline lv_style_t * lv_cont_get_style(const lv_obj_t *cont)148{149return lv_obj_get_style(cont);150}151152/**********************153* MACROS154**********************/155156#endif /*USE_LV_CONT*/157158#ifdef __cplusplus159} /* extern "C" */160#endif161162#endif /*LV_CONT_H*/163164165