|

楼主 |
发表于 2018-2-26 14:41:11
|
显示全部楼层
- /*********************************************************************
- * *
- * SEGGER Microcontroller GmbH & Co. KG *
- * Solutions for real time microcontroller applications *
- * *
- **********************************************************************
- * *
- * C-file generated by: *
- * *
- * GUI_Builder for emWin version 5.22 *
- * Compiled Jul 4 2013, 15:16:01 *
- * (c) 2013 Segger Microcontroller GmbH & Co. KG *
- * *
- **********************************************************************
- * *
- * Internet: www.segger.com Support: support@segger.com *
- * *
- **********************************************************************
- */
- // USER START (Optionally insert additional includes)
- // USER END
- #include "DIALOG.h"
- /*********************************************************************
- *
- * Defines
- *
- **********************************************************************
- */
- #define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
- #define ID_LISTBOX_0 (GUI_ID_USER + 0x01)
- #define ID_BUTTON_0 (GUI_ID_USER + 0x02)
- #define ID_BUTTON_1 (GUI_ID_USER + 0x03)
- // USER START (Optionally insert additional defines)
- // USER END
- /*********************************************************************
- *
- * Static data
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static data)
- // USER END
- /*********************************************************************
- *
- * _aDialogCreate
- */
- static const GUI_WIDGET_CREATE_INFO _aDialogCreate[] = {
- { FRAMEWIN_CreateIndirect, "Framewin", ID_FRAMEWIN_0, 27, 33, 320, 240, 0, 0x0, 0 },
- { LISTBOX_CreateIndirect, "Listbox", ID_LISTBOX_0, 10, 15, 80, 100, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "add", ID_BUTTON_0, 135, 26, 80, 20, 0, 0x0, 0 },
- { BUTTON_CreateIndirect, "delete", ID_BUTTON_1, 136, 70, 80, 20, 0, 0x0, 0 },
- // USER START (Optionally insert additional widgets)
- // USER END
- };
- /*********************************************************************
- *
- * Static code
- *
- **********************************************************************
- */
- // USER START (Optionally insert additional static code)
- // USER END
- /*********************************************************************
- *
- * _cbDialog
- */
- static void _cbDialog(WM_MESSAGE * pMsg) {
- WM_HWIN hWin = pMsg->hWin;
- WM_HWIN hItem;
- WM_HWIN hListbox;
- int NCode;
- int Id;
- unsigned char CurrentNum;
- unsigned char CurrentSel;
- char buf[5] = {"Item"};
- // USER START (Optionally insert additional variables)
- // USER END
- switch (pMsg->MsgId) {
- case WM_INIT_DIALOG:
- //
- // Initialization of 'Listbox'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_LISTBOX_0);
- LISTBOX_AddString(hItem, "Item 0");
- LISTBOX_AddString(hItem, "Item 1");
- LISTBOX_AddString(hItem, "Item 2");
- //
- // Initialization of 'add'
- //
- hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
- BUTTON_SetFont(hItem, GUI_FONT_13_1);
- // USER START (Optionally insert additional code for further widget initialization)
- // USER END
- break;
- case WM_NOTIFY_PARENT:
- Id = WM_GetId(pMsg->hWinSrc);
- NCode = pMsg->Data.v;
- switch(Id) {
- case ID_LISTBOX_0: // Notifications sent by 'Listbox'
- 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;
- case WM_NOTIFICATION_SEL_CHANGED:
- // 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_0: // Notifications sent by 'add'
- 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
- {
- hListbox = WM_GetDialogItem(hWin,ID_LISTBOX_0);
- CurrentNum = LISTBOX_GetNumItems(hListbox);
- CurrentNum += 1;
- buf[4] = '0' + CurrentNum;
- LISTBOX_AddString(hListbox,buf);
- }
- break;
- // USER START (Optionally insert additional code for further notification handling)
- // USER END
- }
- break;
- case ID_BUTTON_1: // Notifications sent by 'delete'
- 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
- {
- hListbox = WM_GetDialogItem(hWin,ID_LISTBOX_0);
- CurrentNum = LISTBOX_GetNumItems(hListbox); /*获取当前总模板数,板数不以0为基准*/
- CurrentSel = LISTBOX_GetSel(hListbox);
- LISTBOX_DeleteItem(hListbox,CurrentSel);
- }
- 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
- *
- **********************************************************************
- */
- /*********************************************************************
- *
- * CreateFramewin
- */
- WM_HWIN CreateFramewin(void);
- WM_HWIN CreateFramewin(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
- /*********************************************************************
- *
- * MainTask
- */
- void MainTask(void)
- {
- /* 窗口自动使用存储设备 */
- WM_SetCreateFlags(WM_CF_MEMDEV);
- /* 初始化 */
- GUI_Init();
- /* 创建对话框,使用 GUIBulder5.28 生成的对话框创建函数 */
- CreateFramewin();
- while(1)
- {
- GUI_Delay(10);
- }
- }
- /*************************** End of file ****************************/
复制代码 |
|