147 lines
4.1 KiB
C
147 lines
4.1 KiB
C
/* Copyright(C) 2010- , JIELI TECHNOLOGY, Inc.
|
|
* All right reserved.
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
/**
|
|
* @file layer.h
|
|
*
|
|
* @brief 图层控件API头文件
|
|
*
|
|
* @author
|
|
*
|
|
* @version V2.0.1
|
|
*
|
|
* @date 2022-12-14
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
|
|
#ifndef __UI_LAYER_WIDGET_H__
|
|
#define __UI_LAYER_WIDGET_H__
|
|
|
|
|
|
#include "jlui/layout.h"
|
|
#include "jlui/control.h"
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief 图层控件句柄结构形式
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
struct layer {
|
|
struct element elm; //must be first
|
|
|
|
u8 inited/* : 1 */; // 是否初始化标志
|
|
u8 highlight/* : 1 */; // 是否高亮标志
|
|
u8 css_num/* : 2 */; // 属性数量,UI资源存储用 2bit,这里为对齐用 6bit
|
|
u8 ctrl_num/* : 7 */; // 控件数量,UI资源存储用 7bit,这里为对齐用 8bit
|
|
// 这里对齐 32bit
|
|
|
|
u32 css[2]; // 属性指针
|
|
struct draw_context dc; // DC 结构体,一个图层只有一个,目前一个页面指允许一个图层,则DC指针也只有一个
|
|
struct layout *layout; // 子控件、布局指针,图层下只能放布局
|
|
const struct layer_info *info; // 图层信息指针,从flash获取的UI框架控件信息
|
|
const struct element_event_handler *handler; // 回调句柄,由应用层注册,不可省略
|
|
}; // 312 byte
|
|
|
|
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief layer_for_id 通过图层ID获取图层控件句柄
|
|
*
|
|
* @param id 图层控件ID
|
|
*
|
|
* @return layer 图层控件句柄
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
#define layer_for_id(id) \
|
|
ui_element_for_id(id, struct layer)
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief layer_new 创建图层(内部调用)
|
|
*
|
|
* @param info 图层控件信息
|
|
* @param num 图层数量
|
|
* @param parent 父控件
|
|
*
|
|
* @return layer 图层句柄
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
struct layer *layer_new(struct layer_info *info, int num, struct element *parent);
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief layer_delete_probe 准备删除图层(内部调用)
|
|
*
|
|
* @param layer
|
|
* @param num
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
void layer_delete_probe(struct layer *layer, int num);
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief layer_delete 删除图层(内部调用)
|
|
*
|
|
* @param layer
|
|
* @param num
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
void layer_delete(struct layer *layer, int num);
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief layer_show 显示图层控件
|
|
*
|
|
* @param id 图层控件ID
|
|
*
|
|
* @return 0 正常,-22 控件不存在
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
int layer_show(int id);
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief layer_hide 隐藏图层控件
|
|
*
|
|
* @param id 图层控件ID
|
|
*
|
|
* @return 0 正常,-22 控件不存在
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
int layer_hide(int id);
|
|
|
|
|
|
/* ------------------------------------------------------------------------------------*/
|
|
/**
|
|
* @brief layer_toggle 图层的显示、隐藏状态切换。原来为显示则设置为隐藏,原来为隐藏则设置为显示。
|
|
*
|
|
* @param id 图层控件的ID
|
|
*
|
|
* @return 0 隐藏,1 显示,-22 控件不存在
|
|
*/
|
|
/* ------------------------------------------------------------------------------------*/
|
|
int layer_toggle(int id);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|