/*********************************************************************
* SEGGER MICROCONTROLLER SYSTEME GmbH *
#include "GUI.h"
#include "SIM.h"
#include "FRAMEWIN.h"
#include "LISTBOX.h"
#include <stddef.h>
#include "WM.h"
#include "BUTTON.h"
WM_HWIN mainwin;
int status = 0;
static void MainBin**WinCallBack(WM_MESSAGE * pMsg)
{
WM_HWIN hWin = pMsg->hWin;
int i = 0;
switch (pMsg->MsgId)
{
case WM_CREATE:
//WIDGET_SetDefaultEffect(&WIDGET_Effect_None);
//LISTBOX_Handle hListBox;
/* Create the listbox */
//hListBox = LISTBOX_Create(_aListBox, 100, 100, 120, 75, WM_CF_SHOW);
//WM_SetFocus(hListBox);
//LISTBOX_SetFont(hListBox, &GUI_Font13B_1);
//SCROLLBAR_CreateAttached(hListBox, SCROLLBAR_CF_VERTICAL);
//BUTTON_CreateAsChild(10,10,10,10,mainwin,5,0);
WM_SetFocus(mainwin);
break;
case WM_PAINT:
GUI_SetBkColor(GUI_BLACK);
GUI_Clear();
GUI_SetColor(GUI_WHITE);
GUI_SetTextMode(GUI_TM_TRANS);
GUI_DispStringAt("hello world",50,50);
GUI_DispDecAt(status,100,100,2);
// GUI_DrawBitmap(&sg_start**,
// (MYWIN_XSIZE - sg_start**.XSize) / 2,
// (MYWIN_YSIZE - sg_start**.YSize) / 2);
break;
case WM_KEY:
printf(">>key aaaaaa \n");
switch (((WM_KEY_INFO*)pMsg->Data.p)->Key)
{
case 19:
printf("recv 19");
status = (status == 0)? 1: 0 ;
WM_InvalidateWindow(pMsg->hWin);
break;
}
break;
case WM_DELETE:
break;
default:
WM_DefaultProc(pMsg);
}
}
void MainTask(void) {
GUI_Init();
/* set callback routine for hardkey */
//SIM_HARDKEY_SetCallback(1, &_cbKeyUp);
//SIM_HARDKEY_SetCallback(2, &_cbKeyDown);
/* start demo */
mainwin = WM_CreateWindow(0, 0, 300, 300,
WM_CF_SHOW | WM_CF_MEMDEV, MainBin**WinCallBack, 0);
while(1){
GUI_Exec();
GUI_Delay(500);
GUI_SendKeyMsg(19, 1);
}
} |