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.

113 lines
2.8 KiB

  1. // External.cpp : Implementation of CMarsExternal
  2. #include "precomp.h"
  3. #include "mcinc.h"
  4. #include "marswin.h"
  5. #include "external.h"
  6. #include "panel.h"
  7. #include "place.h"
  8. /////////////////////////////////////////////////////////////////////////////
  9. // CMarsExternal
  10. /////////////////////////////////////////////////////////////////////////////
  11. CMarsExternal::CMarsExternal(CMarsPanel *pParent, CMarsWindow *pMarsWindow) :
  12. CMarsPanelSubObject(pParent)
  13. {
  14. m_spMarsWindow = pMarsWindow;
  15. }
  16. HRESULT CMarsExternal::DoPassivate()
  17. {
  18. m_spMarsWindow.Release();
  19. return S_OK;
  20. }
  21. IMPLEMENT_ADDREF_RELEASE(CMarsExternal);
  22. //------------------------------------------------------------------------------
  23. // IUnknown::QueryInterface
  24. STDMETHODIMP CMarsExternal::QueryInterface(REFIID iid, void **ppvObject)
  25. {
  26. HRESULT hr = E_INVALIDARG;
  27. if (API_IsValidWritePtr(ppvObject))
  28. {
  29. if ((iid == IID_IUnknown) ||
  30. (iid == IID_IDispatch) ||
  31. (iid == IID_IMarsExternal))
  32. {
  33. AddRef();
  34. *ppvObject = SAFECAST(this, IMarsExternal *);
  35. hr = S_OK;
  36. }
  37. else
  38. {
  39. *ppvObject = NULL;
  40. hr = E_NOINTERFACE;
  41. }
  42. }
  43. return hr;
  44. }
  45. //------------------------------------------------------------------------------
  46. STDMETHODIMP CMarsExternal::put_singleButtonMouse(VARIANT_BOOL bVal)
  47. {
  48. ATLASSERT(IsValidVariantBoolVal(bVal));
  49. if (VerifyNotPassive())
  50. {
  51. m_spMarsWindow->put_SingleButtonMouse(bVal);
  52. }
  53. return S_OK;
  54. }
  55. //------------------------------------------------------------------------------
  56. STDMETHODIMP CMarsExternal::get_singleButtonMouse(VARIANT_BOOL *pbVal)
  57. {
  58. HRESULT hr = E_INVALIDARG;
  59. if (API_IsValidWritePtr(pbVal))
  60. {
  61. if (VerifyNotPassive(&hr))
  62. {
  63. *pbVal = m_spMarsWindow->get_SingleButtonMouse();
  64. hr = S_OK;
  65. }
  66. }
  67. return hr;
  68. }
  69. //------------------------------------------------------------------------------
  70. STDMETHODIMP CMarsExternal::get_panels(IMarsPanelCollection **ppPanels)
  71. {
  72. return m_spMarsWindow->get_panels( ppPanels );
  73. }
  74. //------------------------------------------------------------------------------
  75. STDMETHODIMP CMarsExternal::get_places(IMarsPlaceCollection **ppPlaces)
  76. {
  77. return m_spMarsWindow->get_places( ppPlaces );
  78. }
  79. //------------------------------------------------------------------------------
  80. STDMETHODIMP CMarsExternal::get_window(IMarsWindowOM **ppWindow)
  81. {
  82. HRESULT hr = E_INVALIDARG;
  83. if (API_IsValidWritePtr(ppWindow))
  84. {
  85. *ppWindow = NULL;
  86. if (VerifyNotPassive(&hr))
  87. {
  88. hr = m_spMarsWindow->QueryInterface(IID_IMarsWindowOM, (void **)ppWindow);
  89. }
  90. }
  91. return hr;
  92. }