|
WM_CreateWindowAsChild(xPos, yPos, xSize, ySize, WM_HBKWIN, WM_CF_SHOW | WM_CF_HASTRANS, _cbWin1, 0);
GUI_CreateDialogBox(_aDialogCreate, GUI_COUNTOF(_aDialogCreate), _cbWin2, hParent, 0, 0);
_cbWin1 ,_cbWin2,这两个回调函数实现机制有啥区别?
我想在 WM_CreateWindowAsChild 的_cbWin1 管理按钮、文本框等操作,找到了例程序(如下),但是不知道ID_BUTTON_0 是什么时候被注册的?
static void _cbWin(WM_MESSAGE * pMsg) {
GUI_RECT Rect;
int Id;
int NCode;
int ReleasedItem;
int ActiveWindow;
switch (pMsg->MsgId) {
case WM_PAINT:
//
// Draw a thin black frame around the SWIPELIST
//
WM_GetClientRect(&Rect);
GUI_SetColor(GUI_BLACK);
GUI_AA_DrawRoundedRect(Rect.x0, Rect.y0, Rect.x1, Rect.y1, 5);
break;
case WM_NOTIFY_PARENT:
Id = WM_GetId(pMsg->hWinSrc);
NCode = pMsg->Data.v;
switch(Id) {
//
// If the button gets released we start an animation
//
case ID_BUTTON_0:
switch(NCode) {
case WM_NOTIFICATION_CLICKED:
break;
case WM_NOTIFICATION_RELEASED:
_CreateAnim(&_hAnim, &_Data, _AnimSwipeInOut);
break;
}
break;
case ID_SWIPELIST_0:
switch (NCode) {
//
// An item has been reeleased
//
case WM_NOTIFICATION_RELEASED:
//
// Receive the ID of the item which has been released
//
ReleasedItem = SWIPELIST_GetReleasedItem(pMsg->hWinSrc);
ActiveWindow = SWIPELIST_GetItemUserData(pMsg->hWinSrc, ReleasedItem);
//
// if it is different to the active window or not present
//
if ((_aDataWindow.ActiveItem != ActiveWindow) || (_aDataWindow.Data.Dir == 0)) {
_DoAnimation = 1;
//
// If it is not displayed already, create an animation
//
if (_aDataWindow.Data.Dir == 0) {
_CreateAnim(&_aDataWindow.hAnim, &_aDataWindow.Data, _AnimMoveWindows);
}
//
// Remeber the active window
//
_aDataWindow.ActiveItem = ActiveWindow;
}
break;
}
break;
}
default:
WM_DefaultProc(pMsg);
}
}
|
|