static void _DrawNext(void) { int UpdateRem = 1; WM_HWIN iWin = (NextDrawWin == WM_HWIN_NULL) ? WM__FirstWin : NextDrawWin; GUI_CONTEXT ContextOld; GUI_SaveContext(&ContextOld); /* Make sure the next window to redraw is valid */ for (; (iWin!=WM_HWIN_NULL) && UpdateRem; ) { WM_Obj* pWin = WM_H2P(iWin); if (pWin->Status & WM_SF_INVALID) { U8 Status = (pWin->Status &= ~WM_SF_INVALID); /* Clear invalid flag */ WM__NumInvalidWindows--; /* Send WM_PAINT if window is visible and a callback is defined */ if ((pWin->cb != NULL) && (Status & WM_SF_ISVIS)) { WM_MESSAGE Msg; Msg.hWin = iWin; Msg.MsgId = WM_PAINT; Msg.Data.p = (GUI_RECT*)&pWin->InvalidRect; WM_SelectWindow(iWin); WM_SetDefault(); #if GUI_SUPPORT_MEMDEV if (Status & WM_SF_MEMDEV) { GUI_RECT r = pWin->InvalidRect; GUI_MoveRect (&r, pWin->Rect.x0, pWin->Rect.y0); GUI_MEMDEV_Draw(&r, cbPaint, &Msg, 0, (Status & WM_SF_HASTRANS) ? GUI_MEMDEV_HASTRANS : 0); } else #endif WM_SendMessage(iWin, &Msg); UpdateRem--; /* Only the given number of windows at a time ... */ } } iWin = pWin->hNextLin; } NextDrawWin = iWin; /* Remember the window */ GUI_RestoreContext(&ContextOld); }
void WM_Paint(WM_HWIN hObj) { WM_MESSAGE Msg; WM_SelectWindow(hObj); WM_ValidateWindow(hObj); WM_SetDefault(); Msg.MsgId = WM_PAINT; Msg.Data.p = NULL; WM_SendMessage(hObj, &Msg); }