|
/*********************************************************************
* *
* SEGGER Microcontroller GmbH & Co. KG *
* Solutions for real time microcontroller applications *
* *
**********************************************************************
* *
* C-file generated by: *
* *
* GUI_Builder for emWin version 5.30 *
* Compiled Jul 1 2015, 10:50:32 *
* (c) 2015 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 "BUTTON.h"
/*********************************************************************
*
* Defines
*
**********************************************************************
*/
#define ID_WINDOW_0 (GUI_ID_USER + 0x0C)
#define ID_BUTTON_0 (GUI_ID_USER + 0x0B)
#define ID_BUTTON_1 (GUI_ID_USER + 0x0E)
#define ID_TEXT_0 (GUI_ID_USER + 0x0F)
#define ID_BUTTON_SET (GUI_ID_USER + 0x0D)
//void BUTTON_SetBitmapEx (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap, int x, int y);
extern const GUI_BITMAP bmSetup;
void WM_HideWindow(WM_HWIN hWin); //隐藏窗口函数,hWin是窗口的句柄
void WM_ShowWindow(WM_HWIN hWin); //显示窗口函数,hWin是窗口的句柄
// 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[] = {
{ WINDOW_CreateIndirect, "Window0", ID_WINDOW_0, 0, 0, 320, 240, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button", ID_BUTTON_0, 20, 130, 53, 53, 0, 0x0, 0 },
{ BUTTON_CreateIndirect, "Button", ID_BUTTON_1, 120, 130, 53, 53, 0, 0x0, 0 },
{ TEXT_CreateIndirect, "Text", ID_TEXT_0, 38, 31, 51, 25, 0, 0x64, 0 },
// USER START (Optionally insert additional widgets)
// USER END
};
/*********************************************************************
*
* Static code
*
**********************************************************************
*/
// extern const GUI_BITMAP bmSetup;
// BUTTON_Handle hButton;
// hButton = BUTTON_Create(10, 10, 100, 100, GUI_ID_BUTTON0, WM_CF_SHOW);
//BUTTON_SetBitmapEx(ID_BUTTON_0, BUTTON_BI_UNPRESSED, &bmSetup, 5, 5);
// USER START (Optionally insert additional static code)
// USER END
/*********************************************************************
*
* _cbDialog
*/
static void _cbDialog(WM_MESSAGE * pMsg) {
WM_HWIN hItem;
//BUTTON_Handle hButton ;
//WM_HWIN hButton
int NCode;
int Id ;
int ID ;
switch (pMsg->MsgId) {
case WM_INIT_DIALOG: //创建对话框后立即发送到对话框窗口
//hItem = pMsg->hWin;
hItem = BUTTON_Create(220, 130, 53, 53, ID_BUTTON_SET, WM_CF_SHOW);
BUTTON_SetBitmapEx (hItem, BUTTON_BI_UNPRESSED, &bmSetup, 3, 3);
// BUTTON_SetStreamedBitmapEx()
// BUTTON_SetStreamedBitmapEx(BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP_STREAM * pBitmap, int x, int y);
// BUTTON_SetBitmapEx (BUTTON_Handle hObj, unsigned int Index, const GUI_BITMAP * pBitmap, int x, int y);
BUTTON_SetText(hItem, "set");
hItem = pMsg->hWin;
WINDOW_SetBkColor(hItem, GUI_MAKE_COLOR(0x00FFFF80));
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_0);
BUTTON_SetText(hItem, "setting");
//
// Initialization of 'Button'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_BUTTON_1);
BUTTON_SetText(hItem, "print");
//
// Initialization of 'Text'
//
hItem = WM_GetDialogItem(pMsg->hWin, ID_TEXT_0);
TEXT_SetText(hItem, "home");
TEXT_SetTextColor(hItem, GUI_MAKE_COLOR(0x00A00000));
TEXT_SetFont(hItem, GUI_FONT_20_ASCII);
// 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 'Button'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
GUI_EndDialog(pMsg->hWin, 0);
WM_DeleteWindow(pMsg->hWin); // 删除窗口0
CreateWindow1(WM_HBKWIN); //setting
break;
// USER START (Optionally insert additional code for further notification handling)
// USER END
}
break;
case ID_BUTTON_1: // Notifications sent by 'Button'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
GUI_EndDialog(pMsg->hWin, 0);
WM_DeleteWindow(pMsg->hWin); // 删除窗口0
CreateWindow2(WM_HBKWIN); //setting
// 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_SET: // Notifications sent by 'Button'
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
// USER START (Optionally insert code for reacting on notification message)
// USER END
break;
case WM_NOTIFICATION_RELEASED:
GUI_EndDialog(pMsg->hWin, 0);
WM_DeleteWindow(pMsg->hWin); // 删除窗口0
CreateWindow1(WM_HBKWIN); //setting
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
*
**********************************************************************
*/
/*********************************************************************
*
* CreateWindow
*/
WM_HWIN CreateWindow0(void);
WM_HWIN CreateWindow0(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 ****************************/ |
|