/* Copyright(C) 2010- , JIELI TECHNOLOGY, Inc. * All right reserved. */ /* ------------------------------------------------------------------------------------*/ /* * @file ui_pic.h * * @brief 图片控件API接口头文件 * * @author * * @version V201 * * @date 2022-12-15 */ /* ------------------------------------------------------------------------------------*/ #ifndef __UI_PIC_WIDGET_H__ #define __UI_PIC_WIDGET_H__ #include "jlui/ui_core.h" /* ------------------------------------------------------------------------------------*/ /** * @brief 图片自动播放标志定义 */ /* ------------------------------------------------------------------------------------*/ enum { PLAY_NONE, // 不自动播放 PLAY_ONCE, // 播放一次 PLAY_LOOP, // 循环播放 }; /* ------------------------------------------------------------------------------------*/ /** * @brief 图片控件句柄结构定义 */ /* ------------------------------------------------------------------------------------*/ struct ui_pic { struct element elm; // 共同属性,必须在第一个 char source[9]; // 数据源 u8 index; // 当前图片索引,后面会有3个byte空余用作对齐 u16 play_mode: 2; // 播放模式,三种模式:不播放,单次播放,循环播放 u16 play_interval: 14; // 定时器时间 u16 timer; // 定时器ID,应使用 u16 的变量存储 const struct ui_pic_info *info; const struct element_event_handler *handler; }; // 88byte /* ------------------------------------------------------------------------------------*/ /** * @brief 通过ID获取图片控件句柄 */ /* ------------------------------------------------------------------------------------*/ #define ui_pic_for_id(id) \ ui_element_for_id(id, struct ui_pic) /* ------------------------------------------------------------------------------------*/ /** * @brief ui_pic_enable 图片控件使能(内部调用) */ /* ------------------------------------------------------------------------------------*/ void ui_pic_enable(); /* ------------------------------------------------------------------------------------*/ /** * @brief new_ui_pic 创建图片控件(内部调用) * * @param _info 图片控件信息 * @param parent 父控件句柄 * * @return 图片控件句柄 */ /* ------------------------------------------------------------------------------------*/ void *new_ui_pic(const void *_info, struct element *parent); /* ------------------------------------------------------------------------------------*/ /** * @brief ui_pic_show_image_by_id 设置图片控件显示的图片索引(带redraw) * * @param id 图片控件ID * @param index 图片在“图片列表”中的索引 * * @return 0 正常,-22 控件不存在 */ /* ------------------------------------------------------------------------------------*/ int ui_pic_show_image_by_id(int id, int index); /* ------------------------------------------------------------------------------------*/ /** * @brief ui_pic_set_image_index 设置图片控件显示的图片索引(不带redraw) * * @param pic 图片控件句柄 * @param index 图片在“图片列表”的索引 * * @return 0 正常,-22 控件不存在 */ /* ------------------------------------------------------------------------------------*/ int ui_pic_set_image_index(struct ui_pic *pic, int index); /* ------------------------------------------------------------------------------------*/ /** * @brief ui_pic_get_normal_image_number_by_id 获取“普通图片列表”中图片数量 * * @param id 图片控件ID * * @return “普通图片列表”中图片的数量 */ /* ------------------------------------------------------------------------------------*/ int ui_pic_get_normal_image_number_by_id(int id); /* ------------------------------------------------------------------------------------*/ /** * @brief ui_pic_get_highlgiht_image_number_by_id 获取“高亮图片列表”中图片的数量 * * @param id 图片控件ID * * @return “高亮图片列表”中图片的数量 */ /* ------------------------------------------------------------------------------------*/ int ui_pic_get_highlgiht_image_number_by_id(int id); /* ------------------------------------------------------------------------------------*/ /** * @brief ui_pic_set_hide_by_id 设置图片控件显示或隐藏 * * @param id 图片控件ID * @param hide 是否隐藏(true 隐藏,false显示) * * @return 0 正常,-22 控件不存在 */ /* ------------------------------------------------------------------------------------*/ int ui_pic_set_hide_by_id(int id, int hide); int ui_pic_show_image(struct ui_pic *pic, int index); #endif