Tabview

The tabview widget is the container to store and depends on user selection to change the tab for different functions. As shown in the following figure, each rectangle represents a different tab widget, and 9 tab widgets together form a tab container, with the blue area representing the current display area. The idx stands for the index on the X-axis, and the idy stands for the index on Y-axis.

https://foruda.gitee.com/images/1727058851305177488/b3542c64_13408154.png

Tab Distribution

Usage

Create Tabview Widget

The gui_tabview_create() function can be used to establish a tabview.

Switch the Tab

In usage scenarios, tab switching is generally accomplished by horizontal or vertical swiping. However, if users wish to quickly navigate to a specific tab page, they can use the function gui_tabview_jump_tab() to achieve this. This function allows for jumping to a specified tab page by using the indices idx and idy to specify the position of the tab page.

Set Tabview Style

Developers can use gui_tabview_set_style() to set the desired style of tabview. By default, the classic style is CLASSIC. The available switching effects include the following:

typedef enum t_slide_style
{
    CLASSIC          = 0x0000,
    REDUCTION        = 0x0001,
    FADE             = 0x0002,
    REDUCTION_FADE   = 0x0003,
    STACKING         = 0x0004,

    TAB_ROTATE       = 0x0005,
    TAB_CUBE         = 0x0006,
    TAB_PAGE         = 0x0007,
    TAB_ROTATE_BOOK  = 0x0008,
} T_SLIDE_STYLE;

Set Tabview Loop

The tabview loop function is a clever feature that allows users to easily navigate through all the tabs that have been created. By enabling the reverse loop display function using gui_tabview_loop_x() for the x-axis and gui_tabview_loop_y() for the y-axis, as shown in Figure-a, you will see a blue outer box indicating the visible area of the screen for the tab widget. The direction of the arrow represents the direction of tab switching. When swiping left, once all tabs have moved to the left side of the visible area, another left swipe will cycle back to the leftmost tab that was created. Conversely, as shown in Figure-b, when swiping right again, the display will cycle from the rightmost tab.

https://foruda.gitee.com/images/1737357436952016270/569e58cc_13408154.png

Figure-a

https://foruda.gitee.com/images/1737357500617800758/e845c1e5_13408154.png

Figure-b

Example

Please refer to the section: Tab

API

Enums

enum T_SLIDE_STYLE

Values:

enumerator CLASSIC
enumerator REDUCTION
enumerator FADE
enumerator REDUCTION_FADE
enumerator STACKING
enumerator TAB_ROTATE
enumerator TAB_CUBE
enumerator TAB_PAGE
enumerator TAB_ROTATE_BOOK

Functions

gui_tabview_t *gui_tabview_create(void *parent, const char *name, int16_t x, int16_t y, int16_t w, int16_t h)

create a tabview widget, which can nest tabs.

Parameters:
  • parent – the father widget it nested in.

  • filename – _this tabview widget’s name.

  • x – the X-axis coordinate relative to parent widget

  • y – the Y-axis coordinate relative to parent widget

  • w – width

  • h – height

Returns:

return the widget object pointer.

void gui_tabview_jump_tab(gui_tabview_t *parent_tabview, int8_t idx, int8_t idy)

jump to a specify tab

Parameters:
  • parent_tabview – tabview pointer

  • idx – Horizontal index value

  • idy – Vertical index value

void gui_tabview_set_style(gui_tabview_t *_this, T_SLIDE_STYLE style)

config slide effect

Parameters:
  • _this – tabview pointer

  • style – refer to T_SLIDE_STYLE

void gui_tabview_loop_x(gui_tabview_t *tabview, bool loop)

Config tabview loop_x sliding feature. The default setting is no looping.

Parameters:
  • tabview – tabview pointer.

  • loop – Loops when set to true, does not loop when set to false.

void gui_tabview_loop_y(gui_tabview_t *tabview, bool loop)

Config tabview loop_y sliding feature. The default setting is no looping.

Parameters:
  • tabview – tabview pointer.

  • loop – Loops when set to true, does not loop when set to false.

void gui_tabview_tp_disable(gui_tabview_t *tabview, bool disable_tp)

disable tp action for _this tabview.

Parameters:
  • tabview – tabview pointer.

  • disable_tp – true: disable tp action, false: enable tp action.

void gui_tabview_enable_pre_load(gui_tabview_t *_this, bool enable)

enable tab widget cache

Parameters:
  • _this – tabview pointer.

  • enable – true: enable tab widget cache, false: disable tab widget cache.

void gui_tabview_tab_change(gui_tabview_t *tabview, void *callback, void *parameter)

Register callback for tab change.

Parameters:
  • tabview – tabview pointer.

  • callback – callback func.

  • parameter – callback parameter.

struct gui_tabview_tab_id_t

Public Members

int32_t x
int32_t y
struct gui_index_t

Public Members

int8_t x
int8_t y
struct gui_jump_t

Public Members

bool jump_flag
gui_index_t jump_id
struct gui_tabview_t

tabview structure

Public Members

gui_obj_t base
uint16_t tab_cnt
int8_t tab_cnt_left
int8_t tab_cnt_right
int8_t tab_cnt_up
int8_t tab_cnt_down
gui_tabview_tab_id_t cur_id
gui_jump_t jump
T_SLIDE_STYLE style
int16_t release_x
int16_t release_y
uint8_t loop_x
uint8_t loop_y
bool enable_pre_load
bool tab_change_ready
bool tab_need_pre_load
bool tp_disable
bool initial
uint8_t *left_shot
uint8_t *center_shot
uint8_t *right_shot
uint8_t checksum