Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
CTCaer
GitHub Repository: CTCaer/hekate
Path: blob/master/bdk/libs/lvgl/lv_objx/lv_cont.h
1476 views
1
/**
2
* @file lv_cont.h
3
*
4
*/
5
6
#ifndef LV_CONT_H
7
#define LV_CONT_H
8
9
#ifdef __cplusplus
10
extern "C" {
11
#endif
12
13
/*********************
14
* INCLUDES
15
*********************/
16
#ifdef LV_CONF_INCLUDE_SIMPLE
17
#include "lv_conf.h"
18
#else
19
#include "../../lv_conf.h"
20
#endif
21
22
#if USE_LV_CONT != 0
23
24
#include "../lv_core/lv_obj.h"
25
26
/*********************
27
* DEFINES
28
*********************/
29
30
/**********************
31
* TYPEDEFS
32
**********************/
33
34
/*Layout options*/
35
enum
36
{
37
LV_LAYOUT_OFF = 0,
38
LV_LAYOUT_CENTER,
39
LV_LAYOUT_COL_L, /*Column left align*/
40
LV_LAYOUT_COL_M, /*Column middle align*/
41
LV_LAYOUT_COL_R, /*Column right align*/
42
LV_LAYOUT_ROW_T, /*Row top align*/
43
LV_LAYOUT_ROW_M, /*Row middle align*/
44
LV_LAYOUT_ROW_B, /*Row bottom align*/
45
LV_LAYOUT_PRETTY, /*Put as many object as possible in row and begin a new row*/
46
LV_LAYOUT_GRID, /*Align same-sized object into a grid*/
47
};
48
typedef uint8_t lv_layout_t;
49
50
typedef struct
51
{
52
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
53
/*New data for this type */
54
uint8_t layout :4; /*A layout from 'lv_cont_layout_t' enum*/
55
uint8_t hor_fit :1; /*1: Enable horizontal fit to involve all children*/
56
uint8_t ver_fit :1; /*1: Enable horizontal fit to involve all children*/
57
} lv_cont_ext_t;
58
59
60
/**********************
61
* GLOBAL PROTOTYPES
62
**********************/
63
64
/**
65
* Create a container objects
66
* @param par pointer to an object, it will be the parent of the new container
67
* @param copy pointer to a container object, if not NULL then the new object will be copied from it
68
* @return pointer to the created container
69
*/
70
lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy);
71
72
/*=====================
73
* Setter functions
74
*====================*/
75
76
/**
77
* Set a layout on a container
78
* @param cont pointer to a container object
79
* @param layout a layout from 'lv_cont_layout_t'
80
*/
81
void lv_cont_set_layout(lv_obj_t * cont, lv_layout_t layout);
82
83
84
/**
85
* Enable the horizontal or vertical fit.
86
* The container size will be set to involve the children horizontally or vertically.
87
* @param cont pointer to a container object
88
* @param hor_en true: enable the horizontal fit
89
* @param ver_en true: enable the vertical fit
90
*/
91
void lv_cont_set_fit(lv_obj_t * cont, bool hor_en, bool ver_en);
92
93
/**
94
* Set the style of a container
95
* @param cont pointer to a container object
96
* @param style pointer to the new style
97
*/
98
static inline void lv_cont_set_style(lv_obj_t *cont, lv_style_t * style)
99
{
100
lv_obj_set_style(cont, style);
101
}
102
103
/*=====================
104
* Getter functions
105
*====================*/
106
107
/**
108
* Get the layout of a container
109
* @param cont pointer to container object
110
* @return the layout from 'lv_cont_layout_t'
111
*/
112
lv_layout_t lv_cont_get_layout(const lv_obj_t * cont);
113
114
/**
115
* Get horizontal fit enable attribute of a container
116
* @param cont pointer to a container object
117
* @return true: horizontal fit is enabled; false: disabled
118
*/
119
bool lv_cont_get_hor_fit(const lv_obj_t * cont);
120
121
/**
122
* Get vertical fit enable attribute of a container
123
* @param cont pointer to a container object
124
* @return true: vertical fit is enabled; false: disabled
125
*/
126
bool lv_cont_get_ver_fit(const lv_obj_t * cont);
127
128
129
/**
130
* Get that width reduced by the horizontal padding. Useful if a layout is used.
131
* @param cont pointer to a container object
132
* @return the width which still fits into the container
133
*/
134
lv_coord_t lv_cont_get_fit_width(lv_obj_t * cont);
135
136
/**
137
* Get that height reduced by the vertical padding. Useful if a layout is used.
138
* @param cont pointer to a container object
139
* @return the height which still fits into the container
140
*/
141
lv_coord_t lv_cont_get_fit_height(lv_obj_t * cont);
142
143
/**
144
* Get the style of a container
145
* @param cont pointer to a container object
146
* @return pointer to the container's style
147
*/
148
static inline lv_style_t * lv_cont_get_style(const lv_obj_t *cont)
149
{
150
return lv_obj_get_style(cont);
151
}
152
153
/**********************
154
* MACROS
155
**********************/
156
157
#endif /*USE_LV_CONT*/
158
159
#ifdef __cplusplus
160
} /* extern "C" */
161
#endif
162
163
#endif /*LV_CONT_H*/
164
165