|

楼主 |
发表于 2019-3-30 08:47:14
|
显示全部楼层
#include "GUI.h"
/*********************************************************************
* *
* SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
* *
**********************************************************************
* *
* C-file generated by: *
* *
* GUI_Builder for emWin version 5.36 *
* Compiled Aug 31 2016, 10:53:09 *
* (c) 2016 Segger Microcontroller GmbH & Co. KG *
* *
**********************************************************************
* *
* Internet: www.segger.com Support: support@segger.com *
* *
**********************************************************************
*/
// USER START (Optionally insert additional includes)
// USER END
#include "DIALOG.h"
#include "string.h"
#include "keyboard.h"
WM_HWIN hwinOld;
WM_HWIN CreateFramewin(void);
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
WM_HWIN focus_hItem;
#define ID_FRAMEWIN_0 (GUI_ID_USER + 0x00)
#define ID_BUTTON_0 (GUI_ID_USER + 0x01)
#define ID_BUTTON_1 (GUI_ID_USER + 0x02)
#define ID_EDIT_0 (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, "ygrong_test", ID_FRAMEWIN_0, 0, 0, 320, 480, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "OK", ID_BUTTON_0, 43, 370, 80, 20, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "cancel", ID_BUTTON_1, 179, 370, 80, 20, 0, 0x0, 0 },
{ EDIT_CreateIndirect, "Edit", ID_EDIT_0, 55, 235, 198, 20, 0, 0x64, 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) {
unsigned char buff[50];
WM_HWIN hwinOld;
int NCode;
int Id;
// USER START (Optionally insert additional variables)
// USER END
switch (pMsg->MsgId) {
case WM_PAINT:
//hwinOld = WM_SelectWindow((pMsg->hWin));
GUI_DrawGradientRoundedH(35, 100, 60, 20, 5, 0XFF, 0XFFFF);
//WM_SelectWindow(hwinOld);
break;
case WM_INIT_DIALOG:
//
// Initialization of 'Edit'
//
focus_hItem = WM_GetDialogItem(pMsg->hWin, ID_EDIT_0);
EDIT_SetTextAlign(focus_hItem, GUI_TA_LEFT | GUI_TA_VCENTER);
// 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_BUTTON_0: // Notifications sent by 'OK'
switch (NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_BUTTON_1: // Notifications sent by 'cancel'
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_EDIT_0: // Notifications sent by 'cancel'
switch (NCode) {
case WM_NOTIFICATION_LOST_FOCUS:
// USER START (Optionally insert code for reacting on notification message)
memset(buff, 0, sizeof(buff));
// USER END
break;
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)
CreateFramewin();
WM_SetFocus(WM_GetDialogItem(pMsg->hWin,ID_EDIT_0));
// 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
*
**********************************************************************
*/
/*********************************************************************
*
* Createygrong_test
*/
WM_HWIN Createygrong_test(void);
WM_HWIN Createygrong_test(void) {
WM_HWIN hWin;
hWin = GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbDialog, WM_HBKWIN, 0, 0);
GUI_Exec();
hwinOld = WM_SelectWindow(WM_GetClientWindow(hWin));
GUI_DrawGradientRoundedH(35, 100, 60, 20, 5, 0XFF, 0XFFFF);
WM_SelectWindow(hWin);
return hWin;
}
// USER START (Optionally insert additional public code)
// USER END
/*************************** End of file ****************************/
/*********************************************************************
*
* MainTask
*/
void MainTask(void)
{
GUI_Init();
//CreateFramewin();
Createygrong_test();
while (1)
{
GUI_Delay(10);
}
} |
|