Files
player/Project/Src/MyWinApp/mywin_user_light.c

92 lines
2.3 KiB
C
Raw Normal View History

#include "mywin_user_light.h"
2025-06-27 00:32:57 +08:00
#include "mywin_inc.h"
#include "mywin_user_menu.h"
#include "date.h"
#include "system_file.h"
const static MENU_ItemStruct ptr[] = {
{0, "5 <20><>"}, {0, "15 <20><>"}, {0, "30 <20><>"}, {0, "90 <20><>"}, {0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD>"},
2025-06-27 00:32:57 +08:00
};
const static uint8_t g_time[5] = {5, 15, 30, 90, 0};
2025-06-27 00:32:57 +08:00
// <20><><EFBFBD><EFBFBD>
WIN_MenuStruct *MENU_LightSet(WIN_WindowStruct *base) {
WIN_MenuStruct *menu = WIN_CreatMenu(
base, (void (*)(WIN_WindowStruct *, WIN_MsgStruct *))MENU_LightSetMsgLoop,
0, 0, base->x_size, base->y_size);
((WIN_WindowStruct *)menu)->intercept = 1; // <20><><EFBFBD><EFBFBD><EFBFBD>Ͱ<EFBFBD><CDB0><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
2025-06-27 00:32:57 +08:00
WIN_SetBackPicPath((WIN_WindowStruct *)menu, base->pic_path);
MENU_SetTitle(menu, 0, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>");
2025-06-27 00:32:57 +08:00
MENU_SetMaxItem(menu, 5);
for (int i = 0; i < 5; i++) {
MENU_AddItem(menu, ptr[i].img, (char *)ptr[i].txt);
}
2025-06-27 00:32:57 +08:00
WIN_ShowWindow((WIN_WindowStruct *)menu);
return menu;
2025-06-27 00:32:57 +08:00
}
static void MENU_Enter(WIN_MenuStruct *menu) {
2025-06-27 00:32:57 +08:00
SysFile_GetSysFile()->screenOffTime = g_time[MENU_GetIndex(menu)];
char txt[20] = {0};
sprintf(txt, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD> %d <20><><EFBFBD><EFBFBD>Ϩ<EFBFBD><CFA8>", g_time[MENU_GetIndex(menu)]);
MSGBOX_TipsTime((WIN_WindowStruct *)menu, "<EFBFBD><EFBFBD>ʾ", txt, "ȷ<EFBFBD><EFBFBD>", 5000);
}
2025-06-27 00:32:57 +08:00
// <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
void MENU_LightSetMsgLoop(WIN_MenuStruct *menu, WIN_MsgStruct *msg) {
WIN_MoveStruct *m = 0;
WIN_TouchStruct *t = 0;
WIN_KeyStruct *k = 0;
switch (msg->msg) {
case WIN_MSG_KEY:
k = msg->data.p;
if (k->shortPress & KEY_VALUE_ENTER) {
MENU_Enter(menu);
} else {
MENU_DefaultMsgLoop(menu, msg);
}
break; // case WIN_MSG_KEY:
case WIN_MSG_MOVE:
m = msg->data.p;
switch (m->moveType) {
case MOVE_DATA_SHORT:
if (m->y_move > ((WIN_WindowStruct *)menu)->y_size / 2 - 20 &&
m->y_move < ((WIN_WindowStruct *)menu)->y_size / 2 + 20) {
MENU_Enter(menu);
}
break;
default:
MENU_DefaultMsgLoop(menu, msg);
break;
}
break;
case WIN_MSG_CHID:
switch (msg->data.v) {
case CHID_DELETE:
break;
case CHID_USER: {
if (msg->srcWin == menu->bar) {
if (msg->data2.v == SCROLLBAR_PRESSED) {
MENU_Enter(menu);
}
} else {
MENU_DefaultMsgLoop(menu, msg);
}
} break;
default:
break;
}
break;
default:
MENU_DefaultMsgLoop(menu, msg);
break;
}
2025-06-27 00:32:57 +08:00
}