83 lines
2.6 KiB
C
83 lines
2.6 KiB
C
#include "includes.h"
|
||
|
||
/* 0904 / 0902-08:返回 + 标题「恢复出厂设置」+ 竖排 确认(灰) / 取消(蓝),无底栏 */
|
||
|
||
extern const Touch_AreaTypeDef *pCurrentTouch_Area;
|
||
|
||
const Touch_AreaTypeDef Touch_Restore_Areas[] =
|
||
{
|
||
{ 0, 44, 0, 40, 0, 0, GUI_CANCEL, NULL },
|
||
{ UI0902_RESTORE_BTN_X,
|
||
(uint16_t)(UI0902_RESTORE_BTN_X + UI0902_RESTORE_BTN_W - 1),
|
||
UI0902_RESTORE_BTN_Y0,
|
||
(uint16_t)(UI0902_RESTORE_BTN_Y0 + UI0902_RESTORE_BTN_H - 1),
|
||
0, 0, GUI_CONFIRM, NULL },
|
||
{ UI0902_RESTORE_BTN_X,
|
||
(uint16_t)(UI0902_RESTORE_BTN_X + UI0902_RESTORE_BTN_W - 1),
|
||
UI0902_RESTORE_BTN_Y1,
|
||
(uint16_t)(UI0902_RESTORE_BTN_Y1 + UI0902_RESTORE_BTN_H - 1),
|
||
0, 0, GUI_CANCEL, NULL },
|
||
};
|
||
|
||
#define TOUCH_AREA_RESTORE_NUM (sizeof(Touch_Restore_Areas)/sizeof(Touch_AreaTypeDef))
|
||
|
||
static void UI_Restore_DrawButton(uint16_t y, uint16_t bg, const uint8_t *text_gbk)
|
||
{
|
||
uint16_t text_y = y + (UI0902_RESTORE_BTN_H - UI0902_RESTORE_BTN_FONT) / 2;
|
||
LCD_FillRoundRect(UI0902_RESTORE_BTN_X, y,
|
||
UI0902_RESTORE_BTN_W, UI0902_RESTORE_BTN_H,
|
||
UI0902_RADIUS_CARD, bg);
|
||
LCD_ShowChinese_AutoAlign(UI0902_RESTORE_BTN_X,
|
||
(uint16_t)(UI0902_RESTORE_BTN_X + UI0902_RESTORE_BTN_W),
|
||
text_y, text_gbk, LCD_ALIGN_CENTER, WHITE, bg, 0,
|
||
UI0902_RESTORE_BTN_FONT);
|
||
}
|
||
|
||
void UI_Restore_Select_Init(void)
|
||
{
|
||
UI_ClearFocus();
|
||
LCD_FillByColor(0, 0, 240, 320, UI0902_BG_COLOR);
|
||
UI_DrawSubPageHeader((const uint8_t *)"\xBB\xD6\xB8\xB4\xB3\xF6\xB3\xA7\xC9\xE8\xD6\xC3");
|
||
/* 确认 */
|
||
UI_Restore_DrawButton(UI0902_RESTORE_BTN_Y0, UI0902_ROW_BG,
|
||
(const uint8_t *)"\xC8\xB7\xC8\xCF");
|
||
/* 取消(主色,稿面默认安全项) */
|
||
UI_Restore_DrawButton(UI0902_RESTORE_BTN_Y1, COLOR_GRAD_MID,
|
||
(const uint8_t *)"\xC8\xA1\xCF\xFB");
|
||
pCurrentTouch_Area = Touch_Restore_Areas;
|
||
}
|
||
|
||
void UI_Restore_Select_Process(DisplayTaskMessage_Type msg)
|
||
{
|
||
switch (msg.MessageType)
|
||
{
|
||
case MSG_ID_TOUCH:
|
||
for (uint8_t k = 0; k < TOUCH_AREA_RESTORE_NUM; k++)
|
||
{
|
||
if (msg.HiByte >= pCurrentTouch_Area[k].x_min &&
|
||
msg.HiByte <= pCurrentTouch_Area[k].x_max &&
|
||
msg.LoByte >= pCurrentTouch_Area[k].y_min &&
|
||
msg.LoByte <= pCurrentTouch_Area[k].y_max)
|
||
{
|
||
switch (pCurrentTouch_Area[k].ID)
|
||
{
|
||
case GUI_CANCEL:
|
||
MenuPage_Setting_Proc();
|
||
break;
|
||
case GUI_CONFIRM:
|
||
RestoreSetting();
|
||
MenuPage_Setting_Proc();
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
ResetAutoPowerCount();
|
||
break;
|
||
}
|
||
}
|
||
break;
|
||
default:
|
||
break;
|
||
}
|
||
}
|