git-subtree-dir: sdk git-subtree-mainline:17a972d46fgit-subtree-split:2e7561d74f
50 lines
2.6 KiB
C
50 lines
2.6 KiB
C
/*
|
||
* meow_ui_dialog.h — SDK 模态(App 层,非系统叠加):Dialog / BottomSheet(§5.8.6)。
|
||
*
|
||
* 原 meow_ui.h 拆分的一部分(dialog 模块)。复用 §5.6 B③ 弹窗 / §5.7 B④ 底部面板模板
|
||
* (与 launcher s_dd_modal 同构),控件化。阻塞式(内层 meow_input_pop 轮询,与
|
||
* meow_ui_text_input 同构);打开前排空残留触摸。关闭途径:点卡片内选项=确认、点卡片外=取消、
|
||
* 左缘返回手势=取消。不压状态栏(y 钳制)。
|
||
*/
|
||
#ifndef MEOW_UI_DIALOG_H
|
||
#define MEOW_UI_DIALOG_H
|
||
|
||
#include "meow_ui_types.h"
|
||
#include "meow_ui_ime.h" /* meow_ime_ctx(Dialog INPUT 型) */
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
/* ============================================================ */
|
||
/* §5.8.6 模态(App 层,非系统叠加):Dialog / BottomSheet
|
||
* 复用 §5.6 B③ 弹窗 / §5.7 B④ 底部面板模板(与 launcher s_dd_modal 同构),控件化。
|
||
* 阻塞式(内层 meow_input_pop 轮询,与 meow_ui_text_input 同构);打开前排空残留触摸。
|
||
* 关闭途径:点卡片内选项=确认、点卡片外=取消、左缘返回手势=取消。不压状态栏(y 钳制)。 */
|
||
/* ============================================================ */
|
||
|
||
/* ---- Dialog(弹窗:确认/选择/输入/信息)---- */
|
||
typedef enum { MEOW_DLG_CONFIRM, MEOW_DLG_SELECT, MEOW_DLG_INPUT, MEOW_DLG_INFO } meow_dlg_t;
|
||
typedef struct meow_dialog meow_dialog;
|
||
meow_dialog *meow_dialog_create(meow_dlg_t t, const char *title);
|
||
void meow_dialog_set_items(meow_dialog *d, const char *const *item, int n, int cur); /* SELECT 型 */
|
||
void meow_dialog_set_ime(meow_dialog *d, meow_ime_ctx *ime); /* INPUT 型 */
|
||
void meow_dialog_show(meow_dialog *d); /* 阻塞到确认/取消 */
|
||
int meow_dialog_result(meow_dialog *d); /* SELECT=选项下标;CONFIRM/INFO 确认=1、取消=0 */
|
||
void meow_dialog_close(meow_dialog *d); /* 程序化关闭(App 亦可驱动) */
|
||
void meow_dialog_free(meow_dialog *d);
|
||
/* CONFIRM 型便捷:点「确定」返回 1,取消/遮罩=0 */
|
||
int meow_dialog_confirm(meow_dialog *d);
|
||
|
||
/* ---- BottomSheet(底部面板:标题 + 选项列表;open 阻塞返回选中 idx/-1)---- */
|
||
typedef struct meow_sheet meow_sheet;
|
||
meow_sheet *meow_sheet_create(const char *title, int h);
|
||
int meow_sheet_add_item(meow_sheet *s, const char *label); /* 返回项下标 */
|
||
int meow_sheet_open(meow_sheet *s); /* 阻塞;返回选中 idx / -1=取消 */
|
||
void meow_sheet_free(meow_sheet *s);
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
#endif /* MEOW_UI_DIALOG_H */
|