1
0

contnr.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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: contnr.h
  10. Description: This file contains the complete class specification of an
  11. ActiveX control container. This purpose of this container
  12. is to test a single control being hosted.
  13. **************************************************************************/
  14. #ifndef _CONTAINER_H_
  15. #define _CONTAINER_H_
  16. /**************************************************************************
  17. #include statements
  18. **************************************************************************/
  19. #include <ocidl.h>
  20. /**************************************************************************
  21. class definitions
  22. **************************************************************************/
  23. class CContainer : public IOleClientSite,
  24. public IOleInPlaceSite,
  25. public IOleInPlaceFrame,
  26. public IOleControlSite,
  27. public IDispatch
  28. {
  29. private:
  30. ULONG m_cRefs; // ref count
  31. HWND m_hwnd; // window handle of the container
  32. HWND m_hwndStatus; // status window handle
  33. IUnknown *m_punk; // IUnknown of contained object
  34. RECT m_rect; // size of control
  35. public:
  36. CContainer();
  37. ~CContainer();
  38. public:
  39. // *** IUnknown Methods ***
  40. STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject);
  41. STDMETHOD_(ULONG, AddRef)(void);
  42. STDMETHOD_(ULONG, Release)(void);
  43. // *** IOleClientSite Methods ***
  44. STDMETHOD (SaveObject)();
  45. STDMETHOD (GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER *ppMk);
  46. STDMETHOD (GetContainer)(LPOLECONTAINER *ppContainer);
  47. STDMETHOD (ShowObject)();
  48. STDMETHOD (OnShowWindow)(BOOL fShow);
  49. STDMETHOD (RequestNewObjectLayout)();
  50. // *** IOleWindow Methods ***
  51. STDMETHOD (GetWindow) (HWND * phwnd);
  52. STDMETHOD (ContextSensitiveHelp) (BOOL fEnterMode);
  53. // *** IOleInPlaceSite Methods ***
  54. STDMETHOD (CanInPlaceActivate) (void);
  55. STDMETHOD (OnInPlaceActivate) (void);
  56. STDMETHOD (OnUIActivate) (void);
  57. STDMETHOD (GetWindowContext) (IOleInPlaceFrame ** ppFrame, IOleInPlaceUIWindow ** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo);
  58. STDMETHOD (Scroll) (SIZE scrollExtent);
  59. STDMETHOD (OnUIDeactivate) (BOOL fUndoable);
  60. STDMETHOD (OnInPlaceDeactivate) (void);
  61. STDMETHOD (DiscardUndoState) (void);
  62. STDMETHOD (DeactivateAndUndo) (void);
  63. STDMETHOD (OnPosRectChange) (LPCRECT lprcPosRect);
  64. // *** IOleInPlaceUIWindow Methods ***
  65. STDMETHOD (GetBorder)(LPRECT lprectBorder);
  66. STDMETHOD (RequestBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
  67. STDMETHOD (SetBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
  68. STDMETHOD (SetActiveObject)(IOleInPlaceActiveObject * pActiveObject,
  69. LPCOLESTR lpszObjName);
  70. // *** IOleInPlaceFrame Methods ***
  71. STDMETHOD (InsertMenus)(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
  72. STDMETHOD (SetMenu)(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject);
  73. STDMETHOD (RemoveMenus)(HMENU hmenuShared);
  74. STDMETHOD (SetStatusText)(LPCOLESTR pszStatusText);
  75. STDMETHOD (EnableModeless)(BOOL fEnable);
  76. STDMETHOD (TranslateAccelerator)(LPMSG lpmsg, WORD wID);
  77. // *** IOleControlSite Methods ***
  78. STDMETHOD (OnControlInfoChanged)(void);
  79. STDMETHOD (LockInPlaceActive)(BOOL fLock);
  80. STDMETHOD (GetExtendedControl)(IDispatch **ppDisp);
  81. STDMETHOD (TransformCoords)(POINTL *pptlHimetric, POINTF *pptfContainer, DWORD dwFlags);
  82. STDMETHOD (TranslateAccelerator)(LPMSG pMsg, DWORD grfModifiers);
  83. STDMETHOD (OnFocus)(BOOL fGotFocus);
  84. STDMETHOD (ShowPropertyFrame)(void);
  85. // *** IDispatch Methods ***
  86. STDMETHOD (GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
  87. STDMETHOD (GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
  88. STDMETHOD (GetTypeInfoCount)(unsigned int FAR * pctinfo);
  89. STDMETHOD (Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
  90. public:
  91. void add(BSTR clsid);
  92. void remove();
  93. void setParent(HWND hwndParent);
  94. void setLocation(int x, int y, int width, int height);
  95. void setVisible(BOOL fVisible);
  96. void setFocus(BOOL fFocus);
  97. void setStatusWindow(HWND hwndStatus);
  98. void translateKey(MSG msg);
  99. IDispatch *getDispatch();
  100. IUnknown * getUnknown();
  101. };
  102. #endif