Exemple #1
0
WM_RESULT WM_DefaultProc(WM_MESSAGE* pMsg) {
  WM_HWIN hWin = pMsg->hWin;
  void *p = pMsg->Data.p;
  WM_Obj* pWin = WM_H2P(hWin);
  /* Exec message */
  switch (pMsg->MsgId) {
  case WM_GETORG:
    ((GUI_POINT*)p)->x = pWin->Rect.x0;
    ((GUI_POINT*)p)->y = pWin->Rect.y0;
    break;
  case WM_GETCLIENTRECT:     /* return client window in window coordinates */
    WM__GetClientRectWin(pWin, (GUI_RECT*)p);
    break;
  case WM_GETCLIENTRECT_ABS:      /* return client window in absolute (screen) coordinates */
    WM__GetClientRectWin(pWin, (GUI_RECT*)p);
    GUI_MoveRect((GUI_RECT*)p, pWin->Rect.x0, pWin->Rect.y0);
    break;
  case WM_GET_CLIENT_WINDOW:      /* return handle to client window. For most windows, there is no seperate client window, so it is the same handle */
    pMsg->Data.v = hWin;
    return;                       /* Message handled */
  case WM_KEY:
    WM_SendToParent(hWin, pMsg);
    return;                       /* Message handled */
   case WM_GET_BKCOLOR:
    pMsg->Data.Color = GUI_INVALID_COLOR;
    return;                       /* Message handled */
  }
  /* Message not handled. If it queries something, we return 0 to be on the safe side. */
  pMsg->Data.v = 0;
  pMsg->Data.p = 0;
}
Exemple #2
0
/*********************************************************************
*
*       WIDGET_HandleActive
*/
int WIDGET_HandleActive(WM_HWIN hObj, WM_MESSAGE* pMsg) {
  WM_MESSAGE Msg;
  WIDGET* pWidget = WIDGET_H2P(hObj);
  switch (pMsg->MsgId) {
    case WM_GET_ID:
      pMsg->Data.v = pWidget->Id;
      return 0;                        /* Message handled -> Return */
    case WM_SET_FOCUS:
      if (pMsg->Data.v == 1) {
        WIDGET_SetState(hObj, pWidget->State |  WIDGET_STATE_FOCUS);

      } else {
        WIDGET_SetState(hObj, pWidget->State & ~WIDGET_STATE_FOCUS);
      }
      Msg.MsgId = WM_NOTIFY_CHILD_HAS_FOCUS;
      Msg.Data.v = pMsg->Data.v;
      WM_SendToParent(hObj, &Msg);
      return 0;
    case WM_GET_HAS_FOCUS:
      pMsg->Data.v = pWidget->State & WIDGET_STATE_FOCUS;
      return 0;                         /* Message handled */
    case WM_SET_ENABLE:
      if (pMsg->Data.v) {
        WIDGET_OrState(hObj, WIDGET_STATE_ENABLED);
      } else {
        WIDGET_AndState(hObj, WIDGET_STATE_ENABLED);
      }
    case WM_GET_ACCEPT_FOCUS:
      pMsg->Data.v = (pWidget->State & WIDGET_STATE_FOCUSSABLE) ? 1 : 0;               /* Can handle focus */
      return 0;                         /* Message handled */
     case WM_GET_INSIDE_RECT:
      WIDGET__GetInsideRect(pWidget, (GUI_RECT*)pMsg->Data.p);
      return 0;                         /* Message handled */

  }
  return 1;                           /* Message NOT handled */
}
Exemple #3
0
/*********************************************************************
*
*       WM_NotifyParent
*/
void WM_NotifyParent(WM_HWIN hWin, int Notification) {
  WM_MESSAGE Msg;
  Msg.MsgId   = WM_NOTIFY_PARENT;
  Msg.Data.v  = Notification;
  WM_SendToParent(hWin, &Msg);
}