sdk: 增量同步主仓新模块(box/anim/scroll/dispatch/listvirt/str/sb_icons/img)
subtree pull sdk 来自主仓 pub/sdk(主仓 commit 68ce46a 等)。新增: - 布局引擎 meow_ui_box / 动画基座 meow_ui_anim / 滚动物理 meow_ui_scroll - §6.4 事件分发形式化 / W_LISTVIEW 虚拟化多行 / meow_str 字符串资源 i18n - sb_icons 动作图标扩充 + topbar 位图图标 / meow_img_downscale - tools/ 图标生成脚本与 SVG 源 - 对应宿主 test_*.c 与 demo_box_scroll.c build_sdk.sh 冲突解析:保留公开仓自包含版(vendored meow_font + -Iinclude -I.), OBJS 手工并入 4 个新模块(meow_ui_box/anim/scroll/str)。保留 vendored meow_font.c/ meow_ipc.h/meow_font.h/meow_notif.h,剔除宿主测试二进制与编译产物。
This commit is contained in:
commit
4b094d62a5
56 files changed
+4327
-117
No files matched your search
@@ -9,6 +9,7 @@
|
||||
#include "meow_ui.h"
|
||||
#include "meow_ui_internal.h"
|
||||
#include "meow_ui_view.h"
|
||||
#include "include/meow_ui_box.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -17,6 +18,50 @@
|
||||
static meow_view *g_view_by_id[MEOW_VIEW_BY_ID_MAX]; /* id → 顶层页 view(page_push/pop 查找) */
|
||||
static meow_view *g_top_view = NULL; /* 当前进入的顶层页 view(生命周期跟踪) */
|
||||
|
||||
/* ---- 布局提供者注册表(view → meow_box,opt-in) ---- */
|
||||
static struct { meow_view *v; meow_box *box; } g_view_layout[MEOW_VIEW_BY_ID_MAX];
|
||||
static int g_view_layout_n = 0;
|
||||
|
||||
static void layout_reg_set(meow_view *v, meow_box *box)
|
||||
{
|
||||
for (int i = 0; i < g_view_layout_n; i++) {
|
||||
if (g_view_layout[i].v == v) {
|
||||
g_view_layout[i].box = box;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (g_view_layout_n < MEOW_VIEW_BY_ID_MAX) {
|
||||
g_view_layout[g_view_layout_n].v = v;
|
||||
g_view_layout[g_view_layout_n].box = box;
|
||||
g_view_layout_n++;
|
||||
}
|
||||
}
|
||||
static meow_box *layout_reg_get(const meow_view *v)
|
||||
{
|
||||
for (int i = 0; i < g_view_layout_n; i++)
|
||||
if (g_view_layout[i].v == v) return g_view_layout[i].box;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 重排:把 view 的布局 box 解算一次(box 矩形未设时自动跟 view 内容矩形)。 */
|
||||
void meow_view_relayout(meow_view *v)
|
||||
{
|
||||
if (!v) return;
|
||||
meow_box *b = layout_reg_get(v);
|
||||
if (!b) return;
|
||||
int r[4]; meow_box_rect(b, r);
|
||||
if (r[2] <= 0 || r[3] <= 0) /* w/h 未设 → 跟 view 内容矩形 */
|
||||
meow_box_set_rect(b, v->x, v->y, v->w, v->h);
|
||||
meow_box_arrange(b);
|
||||
}
|
||||
void meow_view_set_layout(meow_view *v, struct meow_box *box)
|
||||
{
|
||||
if (!v) return;
|
||||
if (!box) { layout_reg_set(v, NULL); return; }
|
||||
layout_reg_set(v, box);
|
||||
meow_view_relayout(v); /* 立即按当前尺寸排一次 */
|
||||
}
|
||||
|
||||
static void run_fn(meow_view_fn f, meow_view *v)
|
||||
{
|
||||
if (f) f(v, v->ctx);
|
||||
@@ -146,6 +191,7 @@ void meow_view_page_push(int id)
|
||||
if (cur && cur != next) view_leave(cur);
|
||||
meow_ui_activity_push(id);
|
||||
view_enter(next);
|
||||
meow_view_relayout(next); /* 布局提供者(meow_box)随页进入自动排一次 */
|
||||
g_top_view = next ? next : cur;
|
||||
}
|
||||
|
||||
@@ -156,6 +202,7 @@ void meow_view_page_pop(void)
|
||||
meow_ui_activity_pop();
|
||||
meow_view *next = view_map_get(meow_ui_activity_active());
|
||||
view_enter(next);
|
||||
meow_view_relayout(next);
|
||||
g_top_view = next ? next : NULL;
|
||||
}
|
||||
|
||||
@@ -167,6 +214,7 @@ void meow_view_page_replace(int id)
|
||||
meow_view *next = view_map_get(id);
|
||||
if (cur && cur != next) view_leave(cur);
|
||||
view_enter(next);
|
||||
meow_view_relayout(next);
|
||||
g_top_view = next ? next : cur;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user