首页 ucGUI触摸消息响应过程

ucGUI触摸消息响应过程

举报
开通vip

ucGUI触摸消息响应过程ucGUI390ucGUI3902006-12-1121:292280(2)ucGUI390byNathan.Yu2006-12-11>>>GUI_TOUCH_Exec>GUI_TOUCH_StoreUnstable(x,y)>GUI_TOUCH_StoreState(x,y)staticGUI_PID_STATE_Stateif((x>=0)&&(y>=0)){_State.Pressed=1;_State.x=x;_State.y=y;}else(_St...

ucGUI触摸消息响应过程
ucGUI390ucGUI3902006-12-1121:292280(2)ucGUI390byNathan.Yu2006-12-11>>>GUI_TOUCH_Exec>GUI_TOUCH_StoreUnstable(x,y)>GUI_TOUCH_StoreState(x,y)staticGUI_PID_STATE_Stateif((x>=0)&&(y>=0)){_State.Pressed=1;_State.x=x;_State.y=y;}else(_State.Pressed=0;}>GUI_TOUCH_StoreStateEx(&_State)if(memcmp(pState,&_State,sizeof(_State)))(_State=*pState;GUI_PID_StoreState(pState);}>voidGUI_PID_StoreState(constGUI_PID_STATE*pState)(_PID_Load();if(memcmp(&_State,pState,sizeof(_State)))(_State=*pState;GUI_X_SIGNAL_EVENT();}}>staticvoid_PID_Load(void)(#if(GUI_WINSUPPORT)<!--[if!vml]--><!--[endif]-->WM_pfHandlePID=WM_HandlePID;#endif}>>GUI_Exec()>GUI_Exec1()>WM_Exec()>WM_Exec1()>WM_Exec1()<!--[if!vml]--><!--[endif]-->if(WM_pfHandlePID){if(WM_pfHandlePID())//WM_HandlePID;return1;/*Wehavedonesomething...*/}WM_HandlePIDWMTouch.cGUI_PID_GetState(&StateNew);//CHWin.hWin=_Screen2Win(&StateNew);//staticWM_HWIN_Screen2Win(GUI_PID_STATE*pState)if(WM__hCapture==0)(returnWM_Screen2hWin(pState->x,pState->y);}returnWM__hCapture;}>WM_HWINWM_Screen2hWin(intx,inty)(WM_HWINr;WM_LOCK();r=_Screen2hWin(WM__FirstWin,0,x,y);//yhm20061211AC,WM—FirstWin=hNew;in//func_AddToLinListWM_UNLOCK();returnr;//yhm20061211AC,returnthehandleoftheobjwhichishitted!!!}>staticWM_HWIN_Screen2hWin(WM_HWINhWin,WM_HWINhStop,intx,inty)(WM_Obj*pWin=WM_HANDLE2PTR(hWin);WM_HWINhChild;WM_HWINhHit;/*Firstcheckifthecoordinatesareinthegivenwindow.Ifnot,return0*/if(WM__IsInWindow(pWin,x,y)==0){return0;}/*Ifthecoordinatesareinachild,searchdeeper...*/for(hChild=pWin->hFirstChild;hChild&&(hChild!=hStop);){WM_Obj*pChild=WM_HANDLE2PTR(hChild);if((hHit=_Screen2hWin(hChild,hStop,x,y))!=0){hWin=hHit;/*Foundawindow*/}hChild=pChild->hNext;}returnhWin;/*NoChildaffected...Theparentistherightone*/}3)WM__IsInModalArea(CHWin.hWin)//if((WM_PID_StateLast.Pressed!=StateNew.Pressed)&&CHWin.hWin)Msg.MsgId=WM_PID_STATE_CHANGED;WM—SendMessageIfEnabled(CHWin.hWin,&Msg);BUTTON_CallbackWIDGET_HandleActive(hObj,pMsg)caseWM_PID_STATE_CHANGED:if(pWidget->State&WIDGET_STATE_FOCUSSABLE){constWM_PID_STATE_CHANGED_INFO*pInfo=(constWM_PID_STATE_CHANGED_INFO*)pMsg->Data.p;if(pInfo->State){//WM_SetFocus(hObj);}}WM_HandlePIDMsg.MsgId=WM_TOUCH;WM_TOUCHif(StateNew.Pressed)(/*Movedout->nolongerinthiswindow*SendaNULLpointerasdata*/Msg.Data.p=NULL;////Uart_Printf("Moveout/n");}WM__SendTouchMessage(WM__CHWinLast.hWin,&Msg);WMCHWinLast.hWin=0;WM—SendTouchMessagevoidWM__SendPIDMessage(WM_HWINhWin,WM_MESSAGE*pMsg)(WM_MESSAGEMsg;/*Sendmessagetotheaffectedwindow*/Msg=*pMsg;/*Savemessageasitmaybemodifiedincallback(asreturnvalue)*/WM—SendMessageIfEnabled(hWin,&Msg);/*Sendnotificationtoallancestors.Weneedtocheckifthewindowwhichhasreceivedthelastmessagestillexists,sinceitmayhavedeleteditselfanditsparentasresultofthemessage.*/Msg.hWinSrc=hWin;Msg.MsgId=WM_TOUCH_CHILD;while(WM_IsWindow(hWin)){hWin=WM_GetParent(hWin);if(hWin){Msg.Data.p=pMsg;/*Needstobesetforeachwindow,ascallbackisallowedtomodifyit*/WM__SendMessageIfEnabled(hWin,&Msg);/*Sendmessagetotheancestors*/}}}BUTTON_CallbackcaseWM_TOUCH:_OnTouch(hObj,pObj,pMsg);_OnTouchstaticvoid_OnTouch(BUTTON_HandlehObj,BUTTON_Obj*pObj,WM_MESSAGE*pMsg){constGUI_PID_STATE*pState=(constGUI_PID_STATE*)pMsg->Data.p;#ifBUTTON_REACT_ON_LEVELif(!pMsg->Data.p){/*Mousemovedout*/_ButtonReleased(hObj,pObj,WM_NOTIFICATION_MOVED_OUT);}#elseif(pMsg->Data.p){/*Somethinghappenedinourarea(pressedorreleased)*/if(pState->Pressed){if((pObj->Widget.State&BUTTON_STATE_PRESSED)==0){_ButtonPressed(hObj,pObj);}}else{/*Reactonlyifbuttonwaspressedbefore...avoidproblemswithmoving/hidingwindowsabove(suchasdropdown)*/BUTTON_STATE_PRESSED)(_ButtonReleased(hObj,pObj,WM_NOTIFICATION_RELEASED);}}}else(//pMsg->Data.pNULL_ButtonReleased(hObj,pObj,WM_NOTIFICATION_MOVED_OUT);}#endif_ButtonReleasedstaticvoid_ButtonReleased(BUTTON_HandlehObj,BUTTON_Obj*pObj,intNotification)(WIDGET_AndState(hObj,BUTTON_STATE_PRESSED);if(pObj->Widget.Win.Status&WM_SF_ISVIS)(WM_NotifyParent(hObj,Notification);}if(Notification==WM_NOTIFICATION_RELEASED)(GUI_DEBUG_LOG("BUTTON:Hit/n");}}WM_NotifyParentWM_NOTIFICATION_MOVED_OUTFRAMEWIN_ObjFRAMEWIN_ObjFRAMEWIN__cbClientFrameWin_Obj:DialogClientDialogClient:Button,Edit,TextButton<!--[if!vml]--><!--[endif]-->WM_HandlePIDWM_TOUCHWM—CHWinLast.hWin=CHWin.hWin;Msg.Data.p=(void*)&StateNew;WM—SendTouchMessage(CHWin.hWin,&Msg);BUTTON.C_OnTouchpMsg->Data.pNULLif(pMsg->Data.p)(/*Somethinghappenedinourarea(pressedorreleased)*/if(pState->Pressed)(if((pObj->Widget.State&BUTTON_STATE_PRESSED)==0)(//_ButtonPressed(hObj,pObj);}}else(/*Reactonlyifbuttonwaspressedbefore...avoidproblemswithmoving/hidingwindowsabove(suchasdropdown)*/if(pObj->Widget.State&BUTTON_STATE_PRESSED)(//_ButtonReleased(hObj,pObj,WM_NOTIFICATION_RELEASED);}}}staticvoid_ButtonPressed(BUTTON_HandlehObj,BUTTON_Obj*pObj)(WIDGET_OrState(hObj,BUTTON_STATE_PRESSED);if(pObj->Widget.Win.Status&WM_SF_ISVIS)(WM_NotifyParent(hObj,WM_NOTIFICATION_CLICKED);//}}caseWM_NOTIFY_PARENT:Id=WM_GetId(pMsg->hWinSrc);/*Idofwidget*/NCode=pMsg->Data.v;/*Notificationcode*/switch(NCode)(caseWM_NOTIFICATION_RELEASED:/*Reactonlyifreleased*/if(Id==GUI_ID_OK)(/*OKButton*/GUI_MessageBox("Thistextisshown/ninamessagebox","Caption/Title",GUI_MESSAGEBOX_CF_MOVEABLE);if(Id==GUI_ID_CANCEL)(/*CancelButton*/GUI_EndDialog(hWin,1);}break;}break;ucgui3901chenbeixin2012-03-2218:44
本文档为【ucGUI触摸消息响应过程】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
个人认证用户
花果山庄乐园
暂无简介~
格式:doc
大小:8KB
软件:Word
页数:20
分类:
上传时间:2023-05-02
浏览量:0