/*********************************************************************
*
*       _GetPrevInGroup
*/
static WM_HWIN _GetPrevInGroup(WM_HWIN hWin, U8 GroupId) {
    for (hWin = WM__GetPrevSibling(hWin); hWin; hWin = WM__GetPrevSibling(hWin)) {
        if (_IsInGroup(hWin, GroupId)) {
            return hWin;
        }
    }
    return 0;
}
/*********************************************************************
*
*                Pull window in foreground (top of stack)
*
**********************************************************************
*/
void WM_BringToTop(WM_HWIN hWin) {
  WM_HWIN hPrev, hLast;
  WM_Obj* pWin;
  WM_Obj* pLast;
  if (hWin) {
    WM_LOCK();
    pWin = WM_H2P(hWin);
  /* First of all check if window is already top of stack */
    if (pWin->hNext && pWin->hParent) {
      /* unlink hWin */
      if ((hPrev = WM__GetPrevSibling(hWin)) != 0) {
        WM_Obj* pPrev;
        pPrev = WM_H2P(hPrev);
        pPrev->hNext = pWin->hNext;
      } else {
        WM_Obj* pParent;
        pParent= WM_H2P(pWin->hParent);
        pParent->hFirstChild = pWin->hNext;
      }
      /* Link last sibling */
      hLast = WM__GetLastSibling(hWin);
      pLast = WM_H2P(hLast);
      pLast->hNext = hWin;
      pWin->hNext = 0;
      /* Send message in order to make sure top window will be drawn */
      WM_InvalidateArea(&pWin->Rect);     /* Invalidate new area */
    }
    WM_UNLOCK();
  }
}
Example #3
0
/*********************************************************************
*
*       WM_GetPrevSibling
*/
WM_HWIN WM_GetPrevSibling(WM_HWIN hWin) {
  WM_HWIN hPrev = 0;
  WM_LOCK();
  if (hWin) {
    hPrev = WM__GetPrevSibling(hWin);
  }
  WM_UNLOCK();
  return hPrev;
}