コード例 #1
0
void WM_ResizeWindow(WM_HWIN hWin, int dx, int dy) {
  GUI_RECT r;
  WM_LOCK();
  r = WM_HANDLE2PTR(hWin)->Rect;
  if (dx>0)
    r.x1+=dx;
  if (dy>0)
    r.y1+=dy;
  WM_HANDLE2PTR(hWin)->Rect.x1+=dx;
  WM_HANDLE2PTR(hWin)->Rect.y1+=dy;
  WM_InvalidateArea(&r);
/* Send size message to the window */
  WM__SendMsgNoData(hWin, WM_SIZE);
  WM_UNLOCK();
}
コード例 #2
0
ファイル: WM_GetOrg.c プロジェクト: byxob/calendar
/*********************************************************************
*
*       WM_GetWindowOrgY
*/
int WM_GetWindowOrgY(WM_HWIN hWin) {
  int r;
  WM_LOCK();
  r = WM_HANDLE2PTR(hWin)->Rect.y0;
  WM_UNLOCK();
  return r;
}
コード例 #3
0
/*********************************************************************
*
*       _GetNextChild
*
* Purpose:
*   Returns a handle to the next child of a window.
*
* Parameters:
*   hParent:  handle of parent window.
*   hChild:   handle of child to begin our search to its next sibling.
*
* Return value:
*   Handle to next child if we found one.
*   0 if window has no other children.
*/
static WM_HWIN _GetNextChild(WM_HWIN hParent, WM_HWIN hChild) {
  WM_HWIN hObj = 0;
  WM_Obj* pObj;
  if (hChild) {
    pObj = WM_HANDLE2PTR(hChild);
    hObj = pObj->hNext;
  }
  if (!hObj) {
    pObj = WM_HANDLE2PTR(hParent);
    hObj = pObj->hFirstChild;
  }
  if (hObj != hChild) {
    return hObj;
  }
  return 0;
}
コード例 #4
0
ファイル: WM_Move.c プロジェクト: Cee/uCOS-II-Timebomb
static void _MoveAllChildren(WM_HWIN hChild, int dx, int dy) {
  while (hChild) {
    WM_Obj* pChild = WM_HANDLE2PTR(hChild);
    WM__MoveWindow(hChild, dx, dy);
    hChild = pChild->hNext;
  }
}
コード例 #5
0
ファイル: WM_Move.c プロジェクト: ChunHungLiu/ubuntu230os
/*********************************************************************
*
*       WM__MoveTo
*/
void WM__MoveTo(WM_HWIN hWin, int x, int y) {
  if (hWin) {
    WM_Obj* pWin = WM_HANDLE2PTR(hWin);
    x -= pWin->Rect.x0;
    y -= pWin->Rect.y0;
    WM__MoveWindow(hWin, x, y);
  }
}
コード例 #6
0
ファイル: WM_Screen2Win.c プロジェクト: stormbay/DragonVer1.0
/*******************************************************************
*
*         _Screen2hWin

  This routine is recursive.
  It checks if the given coordinates are in the window or a decendant.
  Returns:
  0:   If coordinates are neither in the given window nor a decendent
  !=0  Handle of the topmost visible decendent in which the given
       coordinate falls.

*/
static WM_HWIN _Screen2hWin(WM_HWIN hWin, int x, int y) {
  WM_Obj* pWin = WM_HANDLE2PTR(hWin);
  WM_HWIN hChild, hHit;
  /* First check if the  coordinates are in the given window. If not, return 0 */
  if (_CheckHit(pWin, x, y) == 0) {
    return 0;
  }
  /* If the coordinates are in a child, search deeper ... */
  for (hChild = pWin->hFirstChild; hChild; ) {
    WM_Obj* pChild = WM_HANDLE2PTR(hChild);
    if ((hHit = _Screen2hWin(hChild, x, y)) != 0) {
      hWin = hHit;        /* Found a window */
    }
    hChild = pChild->hNext;
  }
  return hWin;            /* No Child affected ... The parent is the right one */
}
コード例 #7
0
ファイル: WM_GetWindowRect.c プロジェクト: byxob/calendar
void WM_GetWindowRect(GUI_RECT* pRect) {
  WM_LOCK();
  if (pRect) {
    WM_Obj* pWin = WM_HANDLE2PTR(GUI_Context.hAWin);
    *pRect = pWin->Rect;
  }
  WM_UNLOCK();
}
コード例 #8
0
ファイル: WM_GetOrg.c プロジェクト: Jaly314/CH-K-Lib
/*********************************************************************
*
*       WM_GetWindowOrgX
*/
int WM_GetWindowOrgX(WM_HWIN hWin) {
  int r = 0;
  if (hWin) {
    WM_LOCK();
    r = WM_HANDLE2PTR(hWin)->Rect.x0;
    WM_UNLOCK();
  }
  return r;
}
コード例 #9
0
void WM__SendMessageNoPara(WM_HWIN hWin, int MsgId) {
  WM_MESSAGE Msg = {0};
  WM_Obj* pWin = WM_HANDLE2PTR(hWin);
  if (pWin->cb != NULL) {
    Msg.hWin  = hWin;
    Msg.MsgId = MsgId;
    (*pWin->cb)(&Msg);
  }
}
コード例 #10
0
void WM__SendMessage(WM_HWIN hWin, WM_MESSAGE* pMsg) {
  WM_Obj* pWin = WM_HANDLE2PTR(hWin);
  pMsg->hWin = hWin;
  if (pWin->cb != NULL) {
    (*pWin->cb)(pMsg);
  } else {
    WM_DefaultProc(pMsg);
  }
}
コード例 #11
0
ファイル: WM_SetSize.c プロジェクト: stormbay/DragonVer1.0
void WM_SetSize(WM_HWIN hWin, int XSize, int YSize) {
  WM_Obj* pWin;
  if (!hWin)
    return;
  WM_LOCK();
  pWin = WM_HANDLE2PTR(hWin);
  pWin->Rect.x1 = pWin->Rect.x0 + XSize - 1;
  pWin->Rect.y1 = pWin->Rect.y0 + YSize - 1;
  WM__GetClientRectWin(pWin, &pWin->InvalidRect);   /* Entire rectangle is invalid */
  WM_UNLOCK();
}
コード例 #12
0
ファイル: WM_Move.c プロジェクト: ChunHungLiu/ubuntu230os
/*********************************************************************
*
*       _MoveDescendents
*
* Description
*   Moves _MoveDescendents.
*   Since the parent has already been moved, there is no need to
*   take care of invalidation.
*
* Parameters
*   hWin    The first of all descendents to be moved (first child)
*/
static void _MoveDescendents(WM_HWIN hWin, int dx, int dy) {
  WM_Obj* pWin;

  for (;hWin; hWin = pWin->hNext) {
    pWin = WM_HANDLE2PTR(hWin);
    GUI_MoveRect(&pWin->Rect, dx, dy);
    GUI_MoveRect(&pWin->InvalidRect, dx, dy);
    _MoveDescendents(pWin->hFirstChild, dx, dy);  /* Children need to be moved along ...*/
    WM__SendMsgNoData(hWin, WM_MOVE);
  }
}
コード例 #13
0
void WM_ValidateWindow(WM_HWIN hWin) {
  WM_Obj* pWin;
  WM_LOCK();
  if (hWin) {
    pWin = WM_HANDLE2PTR(hWin);
    if (pWin->Status & WM_SF_INVALID) {
      pWin->Status &= ~WM_SF_INVALID;
      WM__NumInvalidWindows--;
    }
  }
  WM_UNLOCK();
}
コード例 #14
0
ファイル: WM_Move.c プロジェクト: Cee/uCOS-II-Timebomb
/*********************************************************************
*
*       Public module internal code
*
**********************************************************************
*/
void WM__MoveWindow(WM_HWIN hWin, int dx, int dy) {
  GUI_RECT r;
  WM_Obj* pWin;
  pWin = WM_HANDLE2PTR(hWin);
  r = pWin->Rect;
  GUI_MoveRect(&pWin->Rect, dx, dy);
  /* Invalidate old and new area ... */
  if (pWin->Status & WM_SF_ISVIS) {
    WM_InvalidateArea(&pWin->Rect);     /* Invalidate new area */
    WM_InvalidateArea(&r)         ;     /* Invalidate old area */
  }
  WM__SendMsgNoData(hWin, WM_MOVE); /* Notify window it has been moved */
  _MoveAllChildren(pWin->hFirstChild, dx, dy);  /* Children need to be moved along ...*/
}
コード例 #15
0
/*********************************************************************
*
*       static code
*
**********************************************************************
*/
static WM_HWIN _SetFocusOnNextChild(WM_HWIN hParent) {     /* Set the focus to the first child */
  WM_Obj* pParent = WM_HANDLE2PTR(hParent);
  WM_Obj* pi;
  WM_HWIN hChild  = WM_GetFocussedChild(hParent);
  WM_HWIN hi = hChild;
  if (pParent->hFirstChild == 0) {
    return 0;                                     /* "Parent" does not have a child ... */
  }
  do {
    if (hi == 0) {
      hi = pParent->hFirstChild;
    } else {
      pi = WM_HANDLE2PTR(hi);
      hi = pi->hNext;
    }
    if (hi == hChild) {
      break;                                      /* We have completed a round -- No other child to focus --- give up ! */
    }
    if (WM_SetFocus(hi)) {
      break;
    }
  } while (1);
  return hi;
}
コード例 #16
0
/*******************************************************************
*
*         WM_DialogItem

  Recursively scan window and its child windows until dialog item is
  found or all children have been scanned.
*/
WM_HWIN WM__GetDialogItem(WM_HWIN hWin, int Id) {
  WM_HWIN hi;
  WM_HWIN r =0;
  WM_Obj* pWin = WM_H2P(hWin);
  hi = pWin->hFirstChild;
  while (hi) {
    /* This windows Id matching ? */
    if (WM_GetId(hi) == Id)
      return hi;
    /* Any child windows Id matching ? */
    if ((r = WM__GetDialogItem(hi, Id)) != 0)
      break;
    hi = WM_HANDLE2PTR(hi)->hNext;
  }
  return r;
}
コード例 #17
0
ファイル: WM_Validate.c プロジェクト: ChunHungLiu/ubuntu230os
/*********************************************************************
*
*       WM_ValidateRect
*
  Use this function with great care ! It should under most circumstances not
  be necessary to use it, as validation is done automatically as soon as
  a window has been redrawn. If you validate a section of a window, this
  part will not be included in the paint-command and could therefor not
  be updated.
*/
void WM_ValidateRect(WM_HWIN hWin, const GUI_RECT*pRect) {
  WM_Obj* pWin;
  if (hWin) {
    WM_LOCK();
    pWin = WM_HANDLE2PTR(hWin);
    if (pWin->Status & WM_SF_INVALID) {
      if (pRect) {
        _SubRect(&pWin->InvalidRect, &pWin->InvalidRect, pRect);
        if (WM__RectIsNZ(&pWin->InvalidRect))
          goto Done;
      }
      pWin->Status &= ~WM_SF_INVALID;
      WM__NumInvalidWindows--;
    }
  Done:
    WM_UNLOCK();
  }
}
コード例 #18
0
ファイル: WM__SendMessage.c プロジェクト: Jaly314/CH-K-Lib
/*********************************************************************
*
*       WM__SendMessage
*/
void WM__SendMessage(WM_HWIN hWin, WM_MESSAGE* pMsg) {
  static int _EntranceCnt;
  WM_Obj* pWin;
  if (_EntranceCnt < GUI_MAX_MESSAGE_NESTING) {
    pWin = WM_HANDLE2PTR(hWin);
    pMsg->hWin = hWin;
    if (pWin->cb != NULL) {
      _EntranceCnt++;
      (*pWin->cb)(pMsg);
      _EntranceCnt--;
    } else {
      WM_DefaultProc(pMsg);
    }
  }
  #if GUI_DEBUG_LEVEL >= GUI_DEBUG_LEVEL_CHECK_PARA
  else {
    GUI_DEBUG_ERROROUT("Max. message nesting exceeded, Message skipped."); 
  }
  #endif
}
コード例 #19
0
ファイル: WM_SetUserClipRect.c プロジェクト: byxob/calendar
const GUI_RECT* WM_SetUserClipRect(const GUI_RECT* pRect) {
  const GUI_RECT* pRectReturn;
  GUI_RECT r;
  WM_Obj* pAWin;
  WM_LOCK();
  pRectReturn = GUI_Context.WM__pUserClipRect;
  GUI_Context.WM__pUserClipRect = pRect;
/* Activate it ... */
  if (pRect) {
    r = *pRect;
    pAWin = WM_HANDLE2PTR(GUI_Context.hAWin);
    WM__Client2Screen(pAWin, &r);
    LCD_SetClipRectEx(&r);
  } else {
    WM_GetWindowRect(&r);
    LCD_SetClipRectEx(&r);
  }
  WM_UNLOCK();
  return pRectReturn;
}
コード例 #20
0
/*********************************************************************
*
*       WM__GetFirstSibling

  Return value: Handle of parent, 0 if none
*/
WM_HWIN WM__GetFirstSibling(WM_HWIN hWin) {
  hWin = WM_GetParent(hWin);
  return (hWin) ? WM_HANDLE2PTR(hWin)->hFirstChild : 0;
}