From 839757e6c88f23d79f0cb9a2bc0d93a568683036 Mon Sep 17 00:00:00 2001 From: Gabor Kiss-Vamosi Date: Tue, 18 Sep 2018 14:30:48 +0200 Subject: [PATCH] enum refactor fixes --- lv_core/lv_obj.h | 2 +- lv_objx/lv_page.h | 2 +- lv_objx/lv_ta.h | 6 +++--- lv_objx/lv_tabview.c | 1 + lv_objx/lv_tabview.h | 15 ++++++++------- 5 files changed, 14 insertions(+), 12 deletions(-) diff --git a/lv_core/lv_obj.h b/lv_core/lv_obj.h index 6c3c35619..9ebc7a633 100644 --- a/lv_core/lv_obj.h +++ b/lv_core/lv_obj.h @@ -163,7 +163,7 @@ enum LV_PROTECT_PRESS_LOST= 0x10, /*If the `indev` was pressing this object but swiped out while pressing do not search other object.*/ LV_PROTECT_CLICK_FOCUS= 0x20,/*Prevent focusing the object by clicking on it*/ }; -typedef uint16_t lv_protect_t; +typedef uint8_t lv_protect_t; /*Used by `lv_obj_get_type()`. The object's and its ancestor types are stored here*/ diff --git a/lv_objx/lv_page.h b/lv_objx/lv_page.h index 68b7d20e5..ee69d40aa 100644 --- a/lv_objx/lv_page.h +++ b/lv_objx/lv_page.h @@ -63,7 +63,7 @@ typedef struct lv_area_t ver_area; /*Vertical scrollbar area relative to the page (Handled by the library)*/ uint8_t hor_draw :1; /*1: horizontal scrollbar is visible now (Handled by the library)*/ uint8_t ver_draw :1; /*1: vertical scrollbar is visible now (Handled by the library)*/ - lv_sb_mode_t mode :3; /*Scrollbar visibility from 'lv_page_sb_mode_t'*/ + lv_sb_mode_t mode:3; /*Scrollbar visibility from 'lv_page_sb_mode_t'*/ } sb; uint8_t arrow_scroll :1; /*1: Enable scrolling with LV_GROUP_KEY_LEFT/RIGHT/UP/DOWN*/ } lv_page_ext_t; diff --git a/lv_objx/lv_ta.h b/lv_objx/lv_ta.h index a3e79ce42..a0a93d9b1 100644 --- a/lv_objx/lv_ta.h +++ b/lv_objx/lv_ta.h @@ -51,7 +51,7 @@ enum { LV_CURSOR_UNDERLINE, LV_CURSOR_HIDDEN = 0x10, /*Or it to any value to hide the cursor temporally*/ }; -typedef uint16_t lv_cursor_type_t; +typedef uint8_t lv_cursor_type_t; /*Data of text area*/ typedef struct @@ -68,7 +68,7 @@ typedef struct lv_style_t *style; /*Style of the cursor (NULL to use label's style)*/ lv_coord_t valid_x; /*Used when stepping up/down in text area when stepping to a shorter line. (Handled by the library)*/ uint16_t pos; /*The current cursor position (0: before 1. letter; 1: before 2. letter etc.)*/ - lv_cursor_type_t type; /*Shape of the cursor*/ + lv_cursor_type_t type:2; /*Shape of the cursor*/ uint8_t state :1; /*Indicates that the cursor is visible now or not (Handled by the library)*/ } cursor; } lv_ta_ext_t; @@ -78,7 +78,7 @@ enum { LV_TA_STYLE_SB, LV_TA_STYLE_CURSOR, }; -typedef uint16_t lv_ta_style_t; +typedef uint8_t lv_ta_style_t; /********************** * GLOBAL PROTOTYPES diff --git a/lv_objx/lv_tabview.c b/lv_objx/lv_tabview.c index e7f90618a..5fdffdedd 100644 --- a/lv_objx/lv_tabview.c +++ b/lv_objx/lv_tabview.c @@ -90,6 +90,7 @@ lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy) ext->indic = NULL; ext->btns = NULL; ext->tab_load_action = NULL; + ext->btns_pos = LV_TABVIEW_BTNS_POS_TOP; ext->anim_time = LV_TABVIEW_ANIM_TIME; diff --git a/lv_objx/lv_tabview.h b/lv_objx/lv_tabview.h index da3bfffd9..0356f39c4 100644 --- a/lv_objx/lv_tabview.h +++ b/lv_objx/lv_tabview.h @@ -45,6 +45,13 @@ extern "C" { /* parametes: pointer to a tabview object, tab_id*/ typedef void (*lv_tabview_action_t)(lv_obj_t *, uint16_t); + +enum { + LV_TABVIEW_BTNS_POS_TOP, + LV_TABVIEW_BTNS_POS_BOTTOM, +}; +typedef uint8_t lv_tabview_btns_pos_t; + /*Data of tab*/ typedef struct { @@ -61,7 +68,7 @@ typedef struct uint8_t slide_enable :1; /*1: enable horizontal sliding by touch pad*/ uint8_t draging :1; uint8_t drag_hor :1; - uint8_t btns_pos : 1; + lv_tabview_btns_pos_t btns_pos :1; lv_tabview_action_t tab_load_action; } lv_tabview_ext_t; @@ -76,12 +83,6 @@ enum { }; typedef uint8_t lv_tabview_style_t; -enum { - LV_TABVIEW_BTNS_POS_TOP, - LV_TABVIEW_BTNS_POS_BOTTOM, -}; -typedef uint8_t lv_tabview_btns_pos_t; - /********************** * GLOBAL PROTOTYPES **********************/