Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

145 lines
3.5 KiB

  1. /**************************************************************************
  2. THIS CODE AND INFORMATION IS PROVIDED 'AS IS' WITHOUT WARRANTY OF
  3. ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
  4. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
  5. PARTICULAR PURPOSE.
  6. Copyright 1998 Microsoft Corporation. All Rights Reserved.
  7. **************************************************************************/
  8. /**************************************************************************
  9. File: DropSrc.cpp
  10. Description: CDropSource implementation.
  11. **************************************************************************/
  12. /**************************************************************************
  13. #include statements
  14. **************************************************************************/
  15. #include "DropSrc.h"
  16. /**************************************************************************
  17. CDropSource::CDropSource()
  18. **************************************************************************/
  19. CDropSource::CDropSource(void)
  20. {
  21. g_DllRefCount++;
  22. m_ObjRefCount = 1;
  23. }
  24. /**************************************************************************
  25. CDropSource::~CDropSource()
  26. **************************************************************************/
  27. CDropSource::~CDropSource(void)
  28. {
  29. g_DllRefCount--;
  30. }
  31. ///////////////////////////////////////////////////////////////////////////
  32. //
  33. // IUnknown Implementation
  34. //
  35. /**************************************************************************
  36. CDropSource::QueryInterface()
  37. **************************************************************************/
  38. STDMETHODIMP CDropSource::QueryInterface(REFIID riid, LPVOID *ppReturn)
  39. {
  40. *ppReturn = NULL;
  41. //IUnknown
  42. if(IsEqualIID(riid, IID_IUnknown))
  43. {
  44. *ppReturn = this;
  45. }
  46. //IDropTarget
  47. else if(IsEqualIID(riid, IID_IDropSource))
  48. {
  49. *ppReturn = (IDropSource*)this;
  50. }
  51. if(*ppReturn)
  52. {
  53. (*(LPUNKNOWN*)ppReturn)->AddRef();
  54. return S_OK;
  55. }
  56. return E_NOINTERFACE;
  57. }
  58. /**************************************************************************
  59. CDropSource::AddRef()
  60. **************************************************************************/
  61. STDMETHODIMP_(DWORD) CDropSource::AddRef(VOID)
  62. {
  63. return ++m_ObjRefCount;
  64. }
  65. /**************************************************************************
  66. CDropSource::Release()
  67. **************************************************************************/
  68. STDMETHODIMP_(DWORD) CDropSource::Release(VOID)
  69. {
  70. if(--m_ObjRefCount == 0)
  71. {
  72. delete this;
  73. return 0;
  74. }
  75. return m_ObjRefCount;
  76. }
  77. ///////////////////////////////////////////////////////////////////////////
  78. //
  79. // IDropSource Implementation
  80. //
  81. /**************************************************************************
  82. CDropSource::QueryContinueDrag()
  83. **************************************************************************/
  84. STDMETHODIMP CDropSource::QueryContinueDrag(BOOL fEsc, DWORD dwKeyState)
  85. {
  86. if(fEsc)
  87. return DRAGDROP_S_CANCEL;
  88. // Make sure the left mouse button is still down
  89. if(!(dwKeyState & MK_LBUTTON))
  90. return DRAGDROP_S_DROP;
  91. return S_OK;
  92. }
  93. /**************************************************************************
  94. CDropSource::GiveFeedback()
  95. **************************************************************************/
  96. STDMETHODIMP CDropSource::GiveFeedback(DWORD dwEffect)
  97. {
  98. return DRAGDROP_S_USEDEFAULTCURSORS;
  99. }