Source code of Windows XP (NT5)
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.

109 lines
2.9 KiB

  1. // FullScCtl.h : Declaration of the CFullScCtl
  2. #ifndef __FULLSCCTL_H_
  3. #define __FULLSCCTL_H_
  4. #include "resource.h" // main symbols
  5. #include <atlctl.h>
  6. #include <exdisp.h>
  7. /////////////////////////////////////////////////////////////////////////////
  8. // CFullScCtl
  9. class ATL_NO_VTABLE CFullScCtl :
  10. public CComObjectRootEx<CComSingleThreadModel>,
  11. public IDispatchImpl<IFullScCtl, &IID_IFullScCtl, &LIBID_FULLSCLib>,
  12. public CComControl<CFullScCtl>,
  13. // public IPersistStreamInitImpl<CFullScCtl>,
  14. public IOleControlImpl<CFullScCtl>,
  15. public IOleObjectImpl<CFullScCtl>,
  16. public IOleInPlaceActiveObjectImpl<CFullScCtl>,
  17. public IViewObjectExImpl<CFullScCtl>,
  18. public IOleInPlaceObjectWindowlessImpl<CFullScCtl>,
  19. public CComCoClass<CFullScCtl, &CLSID_FullScCtl>,
  20. public IObjectSafetyImpl<CFullScCtl, (INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACESAFE_FOR_UNTRUSTED_DATA)>
  21. {
  22. public:
  23. CFullScCtl()
  24. {
  25. }
  26. DECLARE_REGISTRY_RESOURCEID(IDR_FULLSCCTL)
  27. DECLARE_PROTECT_FINAL_CONSTRUCT()
  28. BEGIN_COM_MAP(CFullScCtl)
  29. COM_INTERFACE_ENTRY(IFullScCtl)
  30. COM_INTERFACE_ENTRY(IDispatch)
  31. COM_INTERFACE_ENTRY(IViewObjectEx)
  32. COM_INTERFACE_ENTRY(IViewObject2)
  33. COM_INTERFACE_ENTRY(IViewObject)
  34. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  35. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  36. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  37. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  38. COM_INTERFACE_ENTRY(IOleControl)
  39. COM_INTERFACE_ENTRY(IOleObject)
  40. /*
  41. COM_INTERFACE_ENTRY(IPersistStreamInit)
  42. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  43. */
  44. COM_INTERFACE_ENTRY(IObjectSafety)
  45. END_COM_MAP()
  46. BEGIN_PROP_MAP(CFullScCtl)
  47. PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  48. PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  49. // Example entries
  50. // PROP_ENTRY("Property Description", dispid, clsid)
  51. // PROP_PAGE(CLSID_StockColorPage)
  52. END_PROP_MAP()
  53. BEGIN_MSG_MAP(CFullScCtl)
  54. CHAIN_MSG_MAP(CComControl<CFullScCtl>)
  55. DEFAULT_REFLECTION_HANDLER()
  56. END_MSG_MAP()
  57. // Handler prototypes:
  58. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  59. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  60. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  61. // IViewObjectEx
  62. DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
  63. // IFullScCtl
  64. public:
  65. STDMETHOD(get_FullScreen)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  66. STDMETHOD(put_FullScreen)(/*[in]*/ VARIANT_BOOL newVal);
  67. HRESULT HideTitleBar(IWebBrowser2 *pBrowser);
  68. HRESULT OnDraw(ATL_DRAWINFO& di)
  69. {
  70. RECT& rc = *(RECT*)di.prcBounds;
  71. Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
  72. SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
  73. LPCTSTR pszText = _T("ATL 3.0 : FullScCtl");
  74. TextOut(di.hdcDraw,
  75. (rc.left + rc.right) / 2,
  76. (rc.top + rc.bottom) / 2,
  77. pszText,
  78. lstrlen(pszText));
  79. return S_OK;
  80. }
  81. };
  82. #endif //__FULLSCCTL_H_