コード例 #1
0
ファイル: WIDGET_Multiedit.c プロジェクト: dadianxukong/gps
/*********************************************************************
*
*       _OnTouch
*/
static int _OnTouch(FRAMEWIN_Handle hWin, WM_MESSAGE* pMsg) {
  if (pMsg->Data.p) {  /* Something happened in our area (pressed or released) */
    GUI_PID_STATE* pState;
    pState = (GUI_PID_STATE*)pMsg->Data.p;
    if (pState->Pressed) {
      int x, y;
      x = pState->x;
      y = pState->y;
      if (WM_HasCaptured(hWin) == 0) {
        GUI_RECT Rect;
        int Mode = 0;
        int BorderSize = 4;
        WM_GetClientRectEx(hWin, &Rect);
        if (x > (Rect.x1 - BorderSize)) {
          Mode |= RESIZE_X;
        } else if (x < BorderSize) {
          Mode |= RESIZE_X | REPOS_X;
        }
        if (y > (Rect.y1 - BorderSize)) {
          Mode |= RESIZE_Y;
        } else if (y < BorderSize) {
          Mode |= RESIZE_Y | REPOS_Y;
        }
        if (Mode) {
          WM_SetFocus(hWin);
          WM_BringToTop(hWin);
          _SetCapture(hWin, x, y, Mode);
          return 1;
        }
      } else if (_HasCaptured) {
        _ChangeWindowPosSize(hWin, &x, &y);
        _SetCapture(hWin, x, y, 0);
        return 1;
      }
    }
  }
  _HasCaptured = 0;
  return 0;
}
コード例 #2
0
/*********************************************************************
*
*       _OnTouch
*/
static int _OnTouch(FRAMEWIN_Handle hWin, WM_MESSAGE* pMsg) {
    const GUI_PID_STATE* pState = (const GUI_PID_STATE*)pMsg->Data.p;
    if (pState) {  /* Something happened in our area (pressed or released) */
        int x, y, Mode;
        x    = pState->x;
        y    = pState->y;
        Mode = _CheckReactBorder(hWin, x, y);
        if (pState->Pressed == 1) {
            if (_CaptureFlags & FRAMEWIN_RESIZE) {
                _ChangeWindowPosSize(hWin, &x, &y);
                _SetCapture(hWin, x, y, 0);
                return 1;
            } else if (Mode) {
                WM_SetFocus(hWin);
                WM_BringToTop(hWin);
                _SetCapture(hWin, x, y, Mode);
                return 1;
            }
#if (GUI_SUPPORT_MOUSE & GUI_SUPPORT_CURSOR)
            else if (_CaptureFlags) {
                WM_ReleaseCapture();
                return 1;
            }
#endif
        } else if (WM_HasCaptured(hWin)) {
            _CaptureFlags &= ~(FRAMEWIN_RESIZE);
#if (GUI_SUPPORT_MOUSE & GUI_SUPPORT_CURSOR)
            if (!Mode)
#endif
            {
                WM_ReleaseCapture();
            }
            return 1;
        }
    }
    return 0;
}