Cardview
Card effect container widget, which can nest cards. You can switch cards by swiping.

Usage
Create Widget
Using gui_cardview_create()
to create a cardview widget.
Callback
When the state of the cardview changes, it triggers a callback, and the callback function gui_cardview_status_cb()
can be used to perform specific actions.
Set Style
There are five styles in the cardview widget gui_cardview_set_style()
.
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 Center Alignment
This function gui_cardview_alignment()
sets the card to automatic center alignment.
Set Bottom Space
This function gui_cardview_set_bottom_space()
sets the bottom spacing of the card.
Y-axis Slide Callback
The event of the card container sliding on the Y-axis can add the corresponding callback function gui_cardview_up()
.
Example
Please refer to the section: Card
API
Functions
-
gui_cardview_t *gui_cardview_create(void *parent, const char *name, int16_t x, int16_t y, int16_t w, int16_t h)
cardview create.
- Parameters:
parent – the father widget it nested in.
name – this tab widget’s name.
x – the X-axis coordinate of the widget.
x – the Y-axis coordinate of the widget.
w – the width of the widget.
h – the hight of the widget.
- Returns:
gui_cardview_t*
-
void gui_cardview_set_style(gui_cardview_t *this, T_CARDVIEW_STYLE style)
set cardview style.
- Parameters:
this – widget pointer.
style – refer to T_SLIDE_STYLE.
-
void gui_cardview_status_cb(gui_cardview_t *this, void (*cb)(gui_cardview_t *this))
listen to cardview’s event.
- Parameters:
this – widget pointer.
cb – callback to be triggered.
-
void gui_cardview_alignment(gui_cardview_t *this, int align_height)
automatic center alignment.
- Parameters:
this – widget pointer.
align_height – align height.
-
void gui_cardview_set_bottom_space(gui_cardview_t *this, uint8_t bottom_space)
set bottom_space.
- Parameters:
this – widget pointer.
bottom_space – bottom_space_count.
-
void gui_cardview_up(gui_cardview_t *this, void *callback, void *parameter)
Add a callback function to the event of sliding the cardview upwards in the Y-axis direction.
- Parameters:
this – widget pointer.
callback – callback to be triggered.
parameter – parameter of callback function.
-
void gui_cardview_down(gui_cardview_t *this, void *callback, void *parameter)
Add a callback function to the event of sliding the cardview downwards in the Y-axis direction.
- Parameters:
this – widget pointer.
callback – callback to be triggered.
parameter – parameter of callback function.
-
struct gui_cardview_t
cardview structure
Public Members
-
gui_obj_t base
-
uint16_t height
-
uint16_t card_height
-
uint16_t total_cnt
-
uint16_t cur_id
-
T_CARDVIEW_STYLE style
-
int16_t hold_y
-
int16_t target_y
-
int16_t offset_y
-
int16_t speed
-
int16_t recode[5]
-
void (*status_cb)(struct gui_cardview *this)
-
gui_animate_t *animate
-
uint8_t checksum
-
uint8_t bottom_space_count
-
int yold
-
int target
-
int start_x
-
int start_y
-
int align_hight
-
int get_yend
-
bool release
-
bool press
-
bool gesture_flag
-
bool top_slide_only
-
uint8_t status
-
gui_obj_t base