feat(ui): 为路径列表添加斑马纹样式并移除横线分隔符

- 新增 refresh_list_style 函数,根据行号奇偶性设置交替背景色
- 在列表加载、新增、删除、上下移动条目时自动刷新样式
- 移除原有的横线分隔符,使界面更简洁
- 调整主函数中控制台编码设置的位置
This commit is contained in:
2026-03-16 17:44:38 +08:00
parent 1493ba6872
commit fd9dca924a
5 changed files with 43 additions and 11 deletions
+22
View File
@@ -1,4 +1,5 @@
#include "utils.h"
#include "globals.h"
#include <stdio.h>
#include <stdlib.h>
#include <iup.h>
@@ -36,4 +37,25 @@ int check_admin()
return 1;
}
return 0;
}
// 刷新列表样式(斑马纹)
void refresh_list_style()
{
if (!list_path)
return;
int count = IupGetInt(list_path, "COUNT");
for (int i = 1; i <= count; i++)
{
// 奇数行:白色
// 偶数行:极浅灰色 (245 245 245)
if (i % 2 == 0)
{
IupSetAttributeId(list_path, "ITEMBGCOLOR", i, "245 245 245");
}
else
{
IupSetAttributeId(list_path, "ITEMBGCOLOR", i, "255 255 255");
}
}
}