/********************************************************************* * * _IsInGroup */ static int _IsInGroup(WM_HWIN hWin, U8 GroupId) { if (GroupId) { WM_MESSAGE Msg; Msg.MsgId = WM_GET_RADIOGROUP; WM__SendMessage(hWin, &Msg); return (Msg.Data.v == GroupId); } return 0; }
/********************************************************************* * * _NotifyOwner * * Purpose: * Notify owner of the window. * If no owner is registered, the parent is considered owner. */ static void _NotifyOwner(WM_HWIN hObj, int Notification) { WM_MESSAGE Msg = {0}; WM_HWIN hOwner; LISTVIEW_Obj* pObj = LISTVIEW_H2P(hObj); hOwner = pObj->hOwner ? pObj->hOwner : WM_GetParent(hObj); Msg.MsgId = WM_NOTIFY_PARENT; Msg.Data.v = Notification; Msg.hWinSrc = hObj; WM__SendMessage(hOwner, &Msg); }
/********************************************************************* * * WM__GetHasFocus Return value: 0 window does not have the focus 1 window has focus -1 0 handle */ int WM__GetHasFocus(WM_HWIN hWin) { int r; WM_MESSAGE Msg; if (hWin) { Msg.MsgId = WM_GET_HAS_FOCUS; Msg.Data.v = 0; WM__SendMessage(hWin, &Msg); r = Msg.Data.v; } else { r = -1; } return r; }
static int _ForwardMouseOverMsg(FRAMEWIN_Handle hWin, WM_MESSAGE* pMsg) { GUI_PID_STATE* pState = (GUI_PID_STATE *)pMsg->Data.p; WM_HWIN hBelow; pState->x += WM_GetWindowOrgX(hWin); pState->y += WM_GetWindowOrgY(hWin); hBelow = WM_Screen2hWin(pState->x, pState->y); if (hBelow && (hBelow != hWin)) { pState->x -= WM_GetWindowOrgX(hBelow); pState->y -= WM_GetWindowOrgY(hBelow); WM__SendMessage(hBelow, pMsg); return 1; } return 0; }
/********************************************************************* * * WM_OnKey Returns: 0 if message could not be handled */ int WM_OnKey(int Key, int Pressed) { int r = 0; WM_MESSAGE Msg; WM_LOCK(); if (WM__hWinFocus != 0) { WM_KEY_INFO Info; Info.Key = Key; Info.PressedCnt = Pressed; Msg.MsgId = WM_KEY; Msg.Data.p = &Info; WM__SendMessage(WM__hWinFocus, &Msg); r = 1; } WM_UNLOCK(); return r; }
/********************************************************************* * * _OnTimer * * This routine is called when a timer is expired. Its function is to * find out which window needs to receive a WM_TIMER message. */ static void _OnTimer(int TimerId) { TIMER_LINK* pLink; GUI_HMEM hLink; WM_LOCK(); hLink = _FindTimerByTimerId(TimerId); if (hLink) { WM_MESSAGE Msg; /* Send Message */ pLink = GUI_ALLOC_h2p(hLink); Msg.MsgId = WM_TIMER; Msg.Data.v = pLink->UserId; Msg.hWinSrc = 0; WM__SendMessage(pLink->hWin, &Msg); /* Since these timers are one shot, we need to delete the link item. */ _DeleteLinkItem(hLink); } WM_UNLOCK(); }
/********************************************************************* * * WM_SetEnableState */ void WM_SetEnableState(WM_HWIN hWin, int State) { if (hWin) { WM_Obj* pWin; U16 Status; WM_LOCK(); pWin = WM_H2P(hWin); Status = pWin->Status; if (State) { Status &= ~WM_SF_DISABLED; } else { Status |= WM_SF_DISABLED; } if (pWin->Status != Status) { WM_MESSAGE Msg; pWin->Status = Status; Msg.MsgId = WM_NOTIFY_ENABLE; Msg.Data.v = State; WM__SendMessage(hWin, &Msg); } WM_UNLOCK(); } }