1 /**
2  * @file lv_file_explorer.h
3  *
4  */
5 
6 #ifndef LV_FILE_EXPLORER_H
7 #define LV_FILE_EXPLORER_H
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 /*********************
14  *      INCLUDES
15  *********************/
16 #include "../../lv_conf_internal.h"
17 #include "../../core/lv_obj.h"
18 
19 #if LV_USE_FILE_EXPLORER != 0
20 
21 /*********************
22  *      DEFINES
23  *********************/
24 
25 /**********************
26  *      TYPEDEFS
27  **********************/
28 
29 typedef enum {
30     LV_EXPLORER_SORT_NONE,
31     LV_EXPLORER_SORT_KIND,
32 } lv_file_explorer_sort_t;
33 
34 #if LV_FILE_EXPLORER_QUICK_ACCESS
35 typedef enum {
36     LV_EXPLORER_HOME_DIR,
37     LV_EXPLORER_MUSIC_DIR,
38     LV_EXPLORER_PICTURES_DIR,
39     LV_EXPLORER_VIDEO_DIR,
40     LV_EXPLORER_DOCS_DIR,
41     LV_EXPLORER_FS_DIR,
42 } lv_file_explorer_dir_t;
43 #endif
44 
45 extern const lv_obj_class_t lv_file_explorer_class;
46 
47 /***********************
48  * GLOBAL VARIABLES
49  ***********************/
50 
51 /**********************
52  * GLOBAL PROTOTYPES
53  **********************/
54 lv_obj_t * lv_file_explorer_create(lv_obj_t * parent);
55 
56 /*=====================
57  * Setter functions
58  *====================*/
59 
60 #if LV_FILE_EXPLORER_QUICK_ACCESS
61 /**
62  * Set file_explorer
63  * @param obj   pointer to a label object
64  * @param dir   the dir from 'lv_file_explorer_dir_t' enum.
65  * @param path   path
66 
67  */
68 void lv_file_explorer_set_quick_access_path(lv_obj_t * obj, lv_file_explorer_dir_t dir, const char * path);
69 #endif
70 
71 /**
72  * Set file_explorer sort
73  * @param obj   pointer to a file explorer object
74  * @param sort  the sort from 'lv_file_explorer_sort_t' enum.
75  */
76 void lv_file_explorer_set_sort(lv_obj_t * obj, lv_file_explorer_sort_t sort);
77 
78 /*=====================
79  * Getter functions
80  *====================*/
81 
82 /**
83  * Get file explorer Selected file
84  * @param obj   pointer to a file explorer object
85  * @return      pointer to the file explorer selected file name
86  */
87 const char * lv_file_explorer_get_selected_file_name(const lv_obj_t * obj);
88 
89 /**
90  * Get file explorer cur path
91  * @param obj   pointer to a file explorer object
92  * @return      pointer to the file explorer cur path
93  */
94 const char * lv_file_explorer_get_current_path(const lv_obj_t * obj);
95 
96 /**
97  * Get file explorer file list obj(lv_table)
98  * @param obj   pointer to a file explorer object
99  * @return      pointer to the file explorer file table obj(lv_table)
100  */
101 lv_obj_t * lv_file_explorer_get_file_table(lv_obj_t * obj);
102 
103 /**
104  * Get file explorer head area obj
105  * @param obj   pointer to a file explorer object
106  * @return      pointer to the file explorer head area obj(lv_obj)
107  */
108 lv_obj_t * lv_file_explorer_get_header(lv_obj_t * obj);
109 
110 /**
111  * Get file explorer path obj(label)
112  * @param obj   pointer to a file explorer object
113  * @return      pointer to the file explorer path obj(lv_label)
114  */
115 lv_obj_t * lv_file_explorer_get_path_label(lv_obj_t * obj);
116 
117 #if LV_FILE_EXPLORER_QUICK_ACCESS
118 /**
119  * Get file explorer head area obj
120  * @param obj   pointer to a file explorer object
121  * @return      pointer to the file explorer quick access area obj(lv_obj)
122  */
123 lv_obj_t * lv_file_explorer_get_quick_access_area(lv_obj_t * obj);
124 
125 /**
126  * Get file explorer places list obj(lv_list)
127  * @param obj   pointer to a file explorer object
128  * @return      pointer to the file explorer places list obj(lv_list)
129  */
130 lv_obj_t * lv_file_explorer_get_places_list(lv_obj_t * obj);
131 
132 /**
133  * Get file explorer device list obj(lv_list)
134  * @param obj   pointer to a file explorer object
135  * @return      pointer to the file explorer device list obj(lv_list)
136  */
137 lv_obj_t * lv_file_explorer_get_device_list(lv_obj_t * obj);
138 #endif
139 
140 /**
141  * Set file_explorer sort
142  * @param obj   pointer to a file explorer object
143  * @return the current mode from 'lv_file_explorer_sort_t'
144  */
145 lv_file_explorer_sort_t lv_file_explorer_get_sort(const lv_obj_t * obj);
146 
147 /*=====================
148  * Other functions
149  *====================*/
150 
151 /**
152  * Open a specified path
153  * @param obj   pointer to a file explorer object
154  * @param dir   pointer to the path
155  */
156 void lv_file_explorer_open_dir(lv_obj_t * obj, const char * dir);
157 
158 /**********************
159  *      MACROS
160  **********************/
161 
162 #endif  /*LV_USE_FILE_EXPLORER*/
163 
164 #ifdef __cplusplus
165 } /*extern "C"*/
166 #endif
167 
168 #endif /*LV_FILE_EXPLORER_H*/
169