WM_SetCapture.c
上传用户:zbk8730
上传日期:2017-08-10
资源大小:12168k
文件大小:2k
源码类别:

uCOS

开发平台:

C/C++

  1. /*
  2. *********************************************************************************************************
  3. *                                                uC/GUI
  4. *                        Universal graphic software for embedded applications
  5. *
  6. *                       (c) Copyright 2002, Micrium Inc., Weston, FL
  7. *                       (c) Copyright 2002, SEGGER Microcontroller Systeme GmbH
  8. *
  9. *              礐/GUI is protected by international copyright laws. Knowledge of the
  10. *              source code may not be used to write a similar product. This file may
  11. *              only be used in accordance with a license and should not be redistributed
  12. *              in any way. We appreciate your understanding and fairness.
  13. *
  14. ----------------------------------------------------------------------
  15. File        : WM_SetCapture.c
  16. Purpose     : Implementation of WM_SetCapture
  17. ----------------------------------------------------------------------
  18. */
  19. #include "WM_Intern.H"
  20. #if GUI_WINSUPPORT
  21. void WM__ReleaseCapture(void) {
  22.   if (WM__hCapture) {
  23.     WM_MESSAGE Msg;
  24.     Msg.MsgId  = WM_CAPTURE_RELEASED;
  25.     WM_SendMessage(WM__hCapture, &Msg);
  26.     WM__hCapture = 0;
  27.   }
  28. }
  29. /*******************************************************************
  30. *
  31. *        Public code
  32. *
  33. ********************************************************************
  34. */
  35. void WM_SetCapture(WM_HWIN hObj, int AutoRelease) {
  36.   WM_LOCK();
  37.   if (WM__hCapture != hObj) {
  38.     WM__ReleaseCapture();
  39.   }
  40.   WM__hCapture = hObj;
  41.   WM__CaptureReleaseAuto = AutoRelease;
  42.   WM_UNLOCK();
  43. }
  44. void WM_ReleaseCapture(void) {
  45.   WM_LOCK();
  46.   WM__ReleaseCapture();
  47.   WM_UNLOCK();
  48. }
  49. #else
  50. void WM_SetCapture_c(void) {} /* avoid empty object files */
  51. #endif /* GUI_WINSUPPORT */