我想通过桌面窗口上的两个按钮,分别调出两个不一样的子窗口,但是不知道应该在什么地方添加这样子窗口创建函数?应该在按钮的CALLBACK函数中吗?如果还想在子窗口中绘制一些控件,又应该在哪里添加?
[mw_shl_code=c,true]void BUTTON_Callback(WM_MESSAGE *pMsg)
{
BUTTON_Handle hObj = pMsg->hWin;
BUTTON_Obj* pObj = BUTTON_H2P(hObj);
/* Let widget handle the standard messages */
if (WIDGET_HandleActive(hObj, pMsg) == 0)
{
return;
}
switch (pMsg->MsgId)
{
#if BUTTON_REACT_ON_LEVEL
case WM_PID_STATE_CHANGED:
_OnPidStateChange(hObj, pObj, pMsg);
return; /* Message handled. Do not call WM_DefaultProc, because the window may have been destroyed */
#endif
case WM_TOUCH:
_OnTouch(hObj, pObj, pMsg);
return; /* Message handled. Do not call WM_DefaultProc, because the window may have been destroyed */
case WM_PAINT:
GUI_DEBUG_LOG("BUTTON: _BUTTON_Callback(WM_PAINT)\n");
_Paint(pObj, hObj);
return;
case WM_DELETE:
GUI_DEBUG_LOG("BUTTON: _BUTTON_Callback(WM_DELETE)\n");
_Delete(pObj);
break; /* No return here ... WM_DefaultProc needs to be called */
#if 0 /* TBD: Button should react to space & Enter */
case WM_KEY:
{
int PressedCnt = ((WM_KEY_INFO*)(pMsg->Data.p))-> ressedCnt;
int Key = ((WM_KEY_INFO*)(pMsg->Data.p))->Key;
switch (Key)
{
case GUI_KEY_ENTER:
if (PressedCnt > 0)
{
_OnButtonPressed(hObj, pObj);
_OnButtonReleased(hObj, pObj, WM_NOTIFICATION_RELEASED);
return;
}
break;
case GUI_KEY_SPACE:
if (PressedCnt > 0)
{
_OnButtonPressed(hObj, pObj);
}
else
{
_OnButtonReleased(hObj, pObj, WM_NOTIFICATION_RELEASED);
}
return;
}
break;
}
#endif
}
WM_DefaultProc(pMsg);
}[/mw_shl_code]
|