|
发表于 2018-9-11 09:05:44
|
显示全部楼层
感謝大神支援
代碼如下,附件是所有的頁面,再麻煩大神幫我看一下。
- /*********************************************************************
- *
- * _aDialogCreate
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
- { WINDOW_CreateIndirect, "WindowHome", ID_WINDOW_0, 0, 0, 480, 272, 0, 0x0, 0 },
- { IMAGE_CreateIndirect, "ImageHome", ID_IMAGE_0, 0, 0, 480, 272, 0, 0, 0 },
- { BUTTON_CreateIndirect, "Setting", ID_BUTTON_0, 0, 36, 64, 55, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Status", ID_BUTTON_1, 0, 90, 64, 55, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Log", ID_BUTTON_2, 0, 145, 64, 55, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Info", ID_BUTTON_3, 0, 200, 64, 55, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "Home", ID_BUTTON_4, 396, 12, 50, 20, 0, 0x0, 0 },
- // USER START (Optionally insert additional widgets)
- // USER END
- };
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- static void _cbButton(WM_MESSAGE * pMsg) //--------------(3)
- {
- WM_HWIN hWin;
- hWin = pMsg->hWin;
- switch(pMsg->MsgId)
- {
- case WM_PAINT:
- if (BUTTON_IsPressed(hWin))
- {
- WM_HideWindow(hPage[0]);
- WM_ShowWindow(hPage[1]);
- }
- else
- {
- //GUI_SetAlpha(0xFF);
- }
- break;
- default:
- BUTTON_Callback(pMsg);
- }
- }
- static void _cbButton1(WM_MESSAGE * pMsg) //--------------(3)
- {
- WM_HWIN hWin;
- hWin = pMsg->hWin;
- switch(pMsg->MsgId)
- {
- case WM_PAINT:
- if (BUTTON_IsPressed(hWin))
- {
- WM_HideWindow(hPage[0]);
- WM_ShowWindow(hPage[2]);
- }
- else
- {
- //GUI_SetAlpha(0xFF);
- }
- break;
- default:
- BUTTON_Callback(pMsg);
- }
- }
- static void _cbButton2(WM_MESSAGE * pMsg) //--------------(3)
- {
- WM_HWIN hWin;
- hWin = pMsg->hWin;
- switch(pMsg->MsgId)
- {
- case WM_PAINT:
- if (BUTTON_IsPressed(hWin))
- {
- WM_HideWindow(hPage[0]);
- WM_ShowWindow(hPage[3]);
- }
- else
- {
- //GUI_SetAlpha(0xFF);
- }
- break;
- default:
- BUTTON_Callback(pMsg);
- }
- }
- static void _cbButton3(WM_MESSAGE * pMsg) //--------------(3)
- {
- WM_HWIN hWin;
- hWin = pMsg->hWin;
- switch(pMsg->MsgId)
- {
- case WM_PAINT:
- if (BUTTON_IsPressed(hWin))
- {
- WM_HideWindow(hPage[0]);
- WM_ShowWindow(hPage[4]);
- }
- else
- {
- //GUI_SetAlpha(0xFF);
- }
- break;
- default:
- BUTTON_Callback(pMsg);
- }
- }
- static void _cbButton4(WM_MESSAGE * pMsg) //--------------(3)
- {
- WM_HWIN hWin;
- hWin = pMsg->hWin;
- switch(pMsg->MsgId)
- {
- case WM_PAINT:
- if (BUTTON_IsPressed(hWin))
- {
- //GUI_SetAlpha(0xFF);
- }
- else
- {
- //GUI_SetAlpha(0xFF);
- }
- break;
- default:
- BUTTON_Callback(pMsg);
- }
- }
- /*********************************************************************
- *
- * _GetImageById
- */
- static const void * _GetImageById(U32 Id, U32 * pSize) {
- switch (Id) {
- case ID_IMAGE_0_IMAGE_0:
- *pSize = sizeof(_acImage_0);
- return (const void *)_acImage_0;
- }
- return NULL;
- }
- // USER START (Optionally insert additional static code)
- // USER END
- /*********************************************************************
- *
- * _cbDialog
- */
- static void _cbDialog(WM_MESSAGE * pMsg) {
- const void * pData;
- WM_HWIN hItem;
- U32 FileSize;
- int NCode;
- int Id;
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'ImageHome'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_IMAGE_0);
- pData = _GetImageById(ID_IMAGE_0_IMAGE_0, &FileSize);
- IMAGE_SetBMP(hItem, pData, FileSize);
- // USER START (Optionally insert additional code for further widget initialization)
- // USER END
-
-
- GUI_SetAlpha(0xFF);
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
- WM_SetHasTrans(hItem);
- GUI_SetAlpha(0);
- WM_SetCallback(hItem, _cbButton);
-
- GUI_SetAlpha(0xFF);
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
- WM_SetHasTrans(hItem);
- GUI_SetAlpha(0);
- WM_SetCallback(hItem, _cbButton1);
- GUI_SetAlpha(0xFF);
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_2);
- WM_SetHasTrans(hItem);
- GUI_SetAlpha(0);
- WM_SetCallback(hItem, _cbButton2);
- GUI_SetAlpha(0xFF);
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_3);
- WM_SetHasTrans(hItem);
- GUI_SetAlpha(0);
- WM_SetCallback(hItem, _cbButton3);
- GUI_SetAlpha(0xFF);
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_4);
- WM_SetHasTrans(hItem);
- GUI_SetAlpha(0);
- WM_SetCallback(hItem, _cbButton4);
- break;
- case WM_NOTIFY_PARENT:
- Id = WM_GetId(pMsg->hWinSrc);
- NCode = pMsg->Data.v;
- switch(Id) {
- case ID_BUTTON_0: // Notifications sent by 'Setting'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- case WM_NOTIFICATION_RELEASED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_1: // Notifications sent by 'Status'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- case WM_NOTIFICATION_RELEASED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_2: // Notifications sent by 'Log'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- case WM_NOTIFICATION_RELEASED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_3: // Notifications sent by 'Info'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- case WM_NOTIFICATION_RELEASED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_4: // Notifications sent by 'Home'
- switch(NCode) {
- case WM_NOTIFICATION_CLICKED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- case WM_NOTIFICATION_RELEASED:
- // USER START (Optionally insert code for reacting on notification message)
- // USER END
- break;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- // USER START (Optionally insert additional code for further Ids)
- // USER END
- }
- break;
- // USER START (Optionally insert additional message handling)
- // USER END
- default:
- WM_DefaultProc(pMsg);
- break;
- }
- }
- /*********************************************************************
- *
- * Public code
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * CreateWindowHome
- */
- WM_HWIN CreateWindowHome(void);
- WM_HWIN CreateWindowHome(void) {
- WM_HWIN hWin;
- hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
- return hWin;
- }
- // USER START (Optionally insert additional public code)
- // USER END
- /*************************** End of file ****************************/
复制代码
另再請教一下,emwin在運行時,程序會自行將圖片等較大的檔案般到SRAM中嗎?還是需要自行設定?
|
|