1
0
mirror of https://github.com/lvgl/lvgl.git synced 2025-01-14 06:42:58 +08:00
lvgl/lv_objx/lv_page.h

95 lines
2.1 KiB
C

/**
* @file lv_page.h
*
*/
#ifndef LV_PAGE_H
#define LV_PAGE_H
/*********************
* INCLUDES
*********************/
#include "lv_conf.h"
#if USE_LV_PAGE != 0
/*Testing of dependencies*/
#if USE_LV_RECT == 0
#error "lv_page: lv_rect is required. Enable it in lv_conf.h (USE_LV_RECT 1) "
#endif
#include "../lv_obj/lv_obj.h"
#include "lv_rect.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef enum
{
LV_PAGE_SB_MODE_OFF,
LV_PAGE_SB_MODE_ON,
LV_PAGE_SB_MODE_DRAG,
LV_PAGE_SB_MODE_AUTO,
}lv_page_sb_mode_t;
/*Style of page*/
typedef struct
{
lv_rects_t bg_rects; /*Style of ancestor*/
/*New style element for this type */
lv_rects_t scrl_rects;
lv_rects_t sb_rects;
cord_t sb_width;
lv_page_sb_mode_t sb_mode;
uint8_t sb_opa;
}lv_pages_t;
/*Built-in styles of page*/
typedef enum
{
LV_PAGES_DEF,
LV_PAGES_SIMPLE,
LV_PAGES_TRANSP,
}lv_pages_builtin_t;
/*Data of page*/
typedef struct
{
lv_rect_ext_t rect_ext; /*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * scrl; /*The scrollable object on the background*/
lv_action_t rel_action;
lv_action_t pr_action;
area_t sbh; /*Horizontal scrollbar*/
area_t sbv; /*Vertical scrollbar*/
uint8_t sbh_draw :1; /*1: horizontal scrollbar is visible now*/
uint8_t sbv_draw :1; /*1: vertical scrollbar is visible now*/
}lv_page_ext_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/*Create function*/
lv_obj_t * lv_page_create(lv_obj_t * par, lv_obj_t * copy);
lv_pages_t * lv_pages_get(lv_pages_builtin_t style, lv_pages_t * copy);
bool lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
void lv_page_set_rel_action(lv_obj_t * page, lv_action_t rel_action);
void lv_page_set_pr_action(lv_obj_t * page, lv_action_t pr_action);
void lv_page_glue_obj(lv_obj_t * obj, bool glue);
void lv_page_focus(lv_obj_t * page, lv_obj_t * obj, bool anim_en);
lv_obj_t * lv_page_get_scrl(lv_obj_t * page);
/**********************
* MACROS
**********************/
#endif
#endif