初版
This commit is contained in:
@@ -0,0 +1,155 @@
|
||||
/* Copyright(C) 2010- , JIELI TECHNOLOGY, Inc.
|
||||
* All right reserved.
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @file layout.h
|
||||
*
|
||||
* @brief 布局控件API头文件
|
||||
*
|
||||
* @author
|
||||
*
|
||||
* @version
|
||||
*
|
||||
* @date 2022-12-14
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef __UI_LAYOUT_WIDGET_H__
|
||||
#define __UI_LAYOUT_WIDGET_H__
|
||||
|
||||
|
||||
#include "jlui/ui_core.h"
|
||||
#include "jlui/control.h"
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief 布局控件句柄结构
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
struct layout {
|
||||
struct element elm; //must be first
|
||||
u8 inited; // 是否初始化,只有 true、false 两种状态
|
||||
u8 release; // 子layout是否在onchange中释放标志,目前只有是、否两种状态
|
||||
// 空2byte
|
||||
struct layout *layout; // 子控件指针
|
||||
const struct layout_info *info; // layout info,从flash读进来
|
||||
const struct element_event_handler *handler; // 回调句柄
|
||||
}; // 80byte
|
||||
|
||||
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief layout_for_id 通过布局ID获取布局控件句柄
|
||||
*
|
||||
* @param id 布局控件ID
|
||||
*
|
||||
* @return layout布局控件句柄
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
#define layout_for_id(id) \
|
||||
ui_element_for_id(id, struct layout)
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief layout_new 创建layout控件(内部调用)
|
||||
*
|
||||
* @param info 布局控件信息
|
||||
* @param num 布局控件数量
|
||||
* @param parent 父控件句柄
|
||||
*
|
||||
* @return layout 布局控件句柄
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
struct layout *layout_new(struct layout_info *, int, struct element *);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief layout_delete_probe 布局控件准备删除(内部调用)
|
||||
*
|
||||
* @param layout 带删除布局控件
|
||||
* @param num 布局控件数量
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
void layout_delete_probe(struct layout *layout, int num);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief layout_delete 删除布局控件(内部调用)
|
||||
*
|
||||
* @param layout 布局控件句柄
|
||||
* @param num 布局控件数量
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
void layout_delete(struct layout *layout, int num);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief layout_show 显示布局控件
|
||||
*
|
||||
* @param id 布局控件ID
|
||||
*
|
||||
* @return 0 正常,-22控件不存在
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
int layout_show(int id);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief layout_hide 隐藏布局控件
|
||||
*
|
||||
* @param id 布局控件ID
|
||||
*
|
||||
* @return 0 正常,-22控件不存在
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
int layout_hide(int id);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief layout_toggle 布局控件显示状态切换,显示时切换为隐藏,隐藏时切换为显示
|
||||
*
|
||||
* @param id 布局控件ID
|
||||
*
|
||||
* @return 0 隐藏,1 显示,-22 控件不存在
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
int layout_toggle(int id);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief layout_on_focus 布局控件聚焦,将指定布局控件设置为焦点
|
||||
*
|
||||
* @param layout 布局控件句柄
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
void layout_on_focus(struct layout *layout);
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
/**
|
||||
* @brief layout_lose_focus 布局控件失焦,将布局控件焦点释放
|
||||
*
|
||||
* @param layout 布局控件句柄
|
||||
*/
|
||||
/* ------------------------------------------------------------------------------------*/
|
||||
void layout_lose_focus(struct layout *layout);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user