1 /**
2  * @file lv_msgbox.h
3  *
4  */
5 
6 #ifndef LV_MSGBOX_H
7 #define LV_MSGBOX_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../../core/lv_obj.h"
17 
18 #if LV_USE_MSGBOX
19 
20 /*Testing of dependencies*/
21 #if LV_USE_BUTTONMATRIX == 0
22 #error "lv_mbox: lv_buttonmatrix is required. Enable it in lv_conf.h (LV_USE_BUTTONMATRIX  1) "
23 #endif
24 
25 #if LV_USE_LABEL == 0
26 #error "lv_mbox: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL  1) "
27 #endif
28 
29 /*********************
30  *      DEFINES
31  *********************/
32 
33 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_class;
34 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_header_class;
35 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_content_class;
36 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_footer_class;
37 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_header_button_class;
38 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_footer_button_class;
39 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_msgbox_backdrop_class;
40 
41 /**********************
42  * GLOBAL PROTOTYPES
43  **********************/
44 
45 /**
46  * Create an empty message box
47  * @param parent        the parent or NULL to create a modal msgbox
48  * @return              the created message box
49  */
50 lv_obj_t * lv_msgbox_create(lv_obj_t * parent);
51 
52 /**
53  * Add title to the message box. It also creates a header for the title.
54  * @param obj           pointer to a message box
55  * @param title         the text of the tile
56  * @return              the created title label
57  */
58 lv_obj_t * lv_msgbox_add_title(lv_obj_t * obj, const char * title);
59 
60 /**
61  * Add a button to the header of to the message box. It also creates a header.
62  * @param obj           pointer to a message box
63  * @param icon          the icon of the button
64  * @return              the created button
65  */
66 lv_obj_t * lv_msgbox_add_header_button(lv_obj_t * obj, const void * icon);
67 
68 /**
69  * Add a text to the content area of message box. Multiple texts will be created below each other.
70  * @param obj           pointer to a message box
71  * @param text          text to add
72  * @return              the created button
73  */
74 lv_obj_t * lv_msgbox_add_text(lv_obj_t * obj, const char * text);
75 
76 /**
77  * Add a button to the footer of to the message box. It also creates a footer.
78  * @param obj           pointer to a message box
79  * @param text          the text of the button
80  * @return              the created button
81  */
82 lv_obj_t * lv_msgbox_add_footer_button(lv_obj_t * obj, const char * text);
83 
84 /**
85  * Add a close button to the message box. It also creates a header.
86  * @param obj           pointer to a message box
87  * @return              the created close button
88  */
89 lv_obj_t * lv_msgbox_add_close_button(lv_obj_t * obj);
90 
91 /**
92  * Get the header widget
93  * @param obj           pointer to a message box
94  * @return              the header, or NULL if not exists
95  */
96 lv_obj_t * lv_msgbox_get_header(lv_obj_t * obj);
97 
98 /**
99  * Get the footer widget
100  * @param obj           pointer to a message box
101  * @return              the footer, or NULL if not exists
102  */
103 lv_obj_t * lv_msgbox_get_footer(lv_obj_t * obj);
104 
105 /**
106  * Get the content widget
107  * @param obj           pointer to a message box
108  * @return              the content
109  */
110 lv_obj_t * lv_msgbox_get_content(lv_obj_t * obj);
111 
112 /**
113  * Get the title label
114  * @param obj           pointer to a message box
115  * @return              the title, or NULL if it does not exist
116  */
117 lv_obj_t * lv_msgbox_get_title(lv_obj_t * obj);
118 
119 /**
120  * Close a message box
121  * @param mbox           pointer to a message box
122  */
123 void lv_msgbox_close(lv_obj_t * mbox);
124 
125 /**
126  * Close a message box in the next call of the message box
127  * @param mbox           pointer to a message box
128  */
129 void lv_msgbox_close_async(lv_obj_t * mbox);
130 
131 /**********************
132  *      MACROS
133  **********************/
134 
135 #endif /*LV_USE_MSGBOX*/
136 
137 #ifdef __cplusplus
138 } /*extern "C"*/
139 #endif
140 
141 #endif /*LV_MSGBOX_H*/
142