1 /** 2 * @file lv_tabview.h 3 * 4 */ 5 6 #ifndef LV_TABVIEW_H 7 #define LV_TABVIEW_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_TABVIEW 20 21 /********************* 22 * DEFINES 23 *********************/ 24 25 LV_ATTRIBUTE_EXTERN_DATA extern const lv_obj_class_t lv_tabview_class; 26 27 /********************** 28 * GLOBAL PROTOTYPES 29 **********************/ 30 31 /** 32 * Create a tabview widget 33 * @param parent pointer to a parent widget 34 * @return the created tabview 35 */ 36 lv_obj_t * lv_tabview_create(lv_obj_t * parent); 37 38 /** 39 * Add a tab to the tabview 40 * @param obj pointer to a tabview widget 41 * @param name the name of the tab, it will be displayed on the tab bar 42 * @return the widget where the content of the tab can be created 43 */ 44 lv_obj_t * lv_tabview_add_tab(lv_obj_t * obj, const char * name); 45 46 /** 47 * Change the name of the tab 48 * @param obj pointer to a tabview widget 49 * @param idx the index of the tab to rename 50 * @param new_name the new name as a string 51 */ 52 void lv_tabview_rename_tab(lv_obj_t * obj, uint32_t idx, const char * new_name); 53 54 /** 55 * Show a tab 56 * @param obj pointer to a tabview widget 57 * @param idx the index of the tab to show 58 * @param anim_en LV_ANIM_ON/OFF 59 */ 60 void lv_tabview_set_active(lv_obj_t * obj, uint32_t idx, lv_anim_enable_t anim_en); 61 62 /** 63 * Set the position of the tab bar 64 * @param obj pointer to a tabview widget 65 * @param dir LV_DIR_TOP/BOTTOM/LEFT/RIGHT 66 */ 67 void lv_tabview_set_tab_bar_position(lv_obj_t * obj, lv_dir_t dir); 68 69 /** 70 * Set the width or height of the tab bar 71 * @param obj pointer to tabview widget 72 * @param size size of the tab bar in pixels or percentage. 73 * will be used as width or height based on the position of the tab bar) 74 */ 75 void lv_tabview_set_tab_bar_size(lv_obj_t * obj, int32_t size); 76 77 /** 78 * Get the number of tabs 79 * @param obj pointer to a tabview widget 80 * @return the number of tabs 81 */ 82 uint32_t lv_tabview_get_tab_count(lv_obj_t * obj); 83 84 /** 85 * Get the current tab's index 86 * @param obj pointer to a tabview widget 87 * @return the zero based index of the current tab 88 */ 89 uint32_t lv_tabview_get_tab_active(lv_obj_t * obj); 90 91 /** 92 * Get the widget where the container of each tab is created 93 * @param obj pointer to a tabview widget 94 * @return the main container widget 95 */ 96 lv_obj_t * lv_tabview_get_content(lv_obj_t * obj); 97 98 /** 99 * Get the tab bar where the buttons are created 100 * @param obj pointer to a tabview widget 101 * @return the tab bar 102 */ 103 lv_obj_t * lv_tabview_get_tab_bar(lv_obj_t * obj); 104 105 /********************** 106 * MACROS 107 **********************/ 108 109 #endif /*LV_USE_TABVIEW*/ 110 111 #ifdef __cplusplus 112 } /*extern "C"*/ 113 #endif 114 115 #endif /*LV_TABVIEW_H*/ 116