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
+13
View File
@@ -1,6 +1,7 @@
#include "callbacks.h"
#include "globals.h"
#include "registry.h"
#include "utils.h"
#include <string.h>
#include <stdio.h>
@@ -17,6 +18,8 @@ int btn_new_cb(Ihandle *self)
IupSetAttributeId(list_path, "", count, buffer);
IupSetInt(list_path, "COUNT", count);
IupSetInt(list_path, "VALUE", count);
refresh_list_style();
}
}
return IUP_DEFAULT;
@@ -63,6 +66,8 @@ int btn_browse_cb(Ihandle *self)
IupSetAttributeId(list_path, "", count, value);
IupSetInt(list_path, "COUNT", count);
IupSetInt(list_path, "VALUE", count);
refresh_list_style();
}
}
IupDestroy(filedlg);
@@ -77,6 +82,9 @@ int btn_del_cb(Ihandle *self)
return IUP_DEFAULT;
IupSetAttribute(list_path, "REMOVEITEM", "SELECTED");
// 重新刷新,因为删除了中间项,后面的奇偶性变了
refresh_list_style();
return IUP_DEFAULT;
}
@@ -101,6 +109,9 @@ int btn_up_cb(Ihandle *self)
IupSetAttributeId(list_path, "", selected - 1, buf_curr);
IupSetInt(list_path, "VALUE", selected - 1);
// 刷新样式(虽然颜色不需要变,但为了保险)
refresh_list_style();
return IUP_DEFAULT;
}
@@ -125,6 +136,8 @@ int btn_down_cb(Ihandle *self)
IupSetAttributeId(list_path, "", selected + 1, buf_curr);
IupSetInt(list_path, "VALUE", selected + 1);
refresh_list_style();
return IUP_DEFAULT;
}