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.

542 lines
24 KiB

  1. /*************************************************************************/
  2. /* Copyright (C) 1999 Microsoft Corporation */
  3. /* File: MFBar.h */
  4. /* Description: Declaration of CMFBar */
  5. /* Author: David Janecek */
  6. /*************************************************************************/
  7. #ifndef __MFBAR_H_
  8. #define __MFBAR_H_
  9. #include "resource.h" // main symbols
  10. #include "MSMFCnt.h"
  11. #include <atlctl.h>
  12. #include <activscp.h>
  13. #include <list>
  14. #include "chobj.h"
  15. #include "eobj.h"
  16. #include "cbitmap.h"
  17. #include "CstUtils.h"
  18. #include "MSMFCntCP.h"
  19. using namespace std;
  20. /*************************************************************************/
  21. /* Template list containing contained objects. */
  22. /*************************************************************************/
  23. typedef list<CHostedObject*> CNTOBJ;
  24. typedef list<CEventObject*> CNTEVNT;
  25. /*************************************************************************/
  26. /* Class: CMFBar */
  27. /*************************************************************************/
  28. class ATL_NO_VTABLE CMFBar :
  29. public CComObjectRootEx<CComSingleThreadModel>,
  30. public CStockPropImpl<CMFBar, IMSMFBar, &IID_IMSMFBar, &LIBID_MSMFCNTLib>,
  31. //public IDispatchImpl<IMFBar, &IID_IMFBar, &LIBID_BBTNLib>,
  32. public CComControl<CMFBar>,
  33. public IPersistStreamInitImpl<CMFBar>,
  34. public IOleControlImpl<CMFBar>,
  35. public IOleObjectImpl<CMFBar>,
  36. public IOleInPlaceActiveObjectImpl<CMFBar>,
  37. public IViewObjectExImpl<CMFBar>,
  38. public IOleInPlaceObjectWindowlessImpl<CMFBar>,
  39. public IPersistPropertyBagImpl<CMFBar>,
  40. // ##### BEGIN ACTIVEX SCRIPTING SUPPORT #####
  41. public IActiveScriptSite,
  42. public IActiveScriptSiteWindow,
  43. // public IProvideMultipleClassInfo, // Implemented via template above
  44. // ##### END ACTIVEX SCRIPTING SUPPORT #####
  45. public IObjectSafetyImpl<CMFBar, INTERFACESAFE_FOR_UNTRUSTED_CALLER| INTERFACESAFE_FOR_UNTRUSTED_DATA>,
  46. //public IProvideMultipleClassInfoImpl<CMFBar, &CLSID_MFBar, &DIID__MFBar, &LIBID_BBTNLib>,
  47. public IProvideClassInfo2Impl<&CLSID_MSMFBar, &DIID__IMSMFBar, &LIBID_MSMFCNTLib>,
  48. // #### BEGIN CONTAINER SUPPORT ####
  49. public IOleClientSite,
  50. public IOleContainer,
  51. public IOleInPlaceFrame,
  52. public IOleControlSite,
  53. public IOleInPlaceSiteWindowless,
  54. // #### END CONTAINER SUPPORT ####
  55. public CComCoClass<CMFBar, &CLSID_MSMFBar>,
  56. public IConnectionPointContainerImpl<CMFBar>,
  57. public CProxy_IMSMFBar<CMFBar>,
  58. public CMSMFCntrlUtils<CMFBar> // custom utilities we share across controls
  59. {
  60. public:
  61. CMFBar(){Init();};
  62. virtual ~CMFBar();
  63. DECLARE_REGISTRY_RESOURCEID(IDR_MSMFBAR)
  64. DECLARE_PROTECT_FINAL_CONSTRUCT()
  65. BEGIN_COM_MAP(CMFBar)
  66. COM_INTERFACE_ENTRY(IMSMFBar)
  67. COM_INTERFACE_ENTRY(IDispatch)
  68. COM_INTERFACE_ENTRY(IViewObjectEx)
  69. COM_INTERFACE_ENTRY(IViewObject2)
  70. COM_INTERFACE_ENTRY(IViewObject)
  71. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  72. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  73. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  74. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  75. COM_INTERFACE_ENTRY(IOleControl)
  76. COM_INTERFACE_ENTRY(IOleObject)
  77. COM_INTERFACE_ENTRY_IMPL_IID(IID_IPersist, IPersistPropertyBag)
  78. COM_INTERFACE_ENTRY_IMPL(IPersistPropertyBag)
  79. // ##### BEGIN ACTIVEX SCRIPTING SUPPORT #####
  80. COM_INTERFACE_ENTRY(IActiveScriptSite)
  81. COM_INTERFACE_ENTRY(IActiveScriptSiteWindow)
  82. // COM_INTERFACE_ENTRY(IProvideMultipleClassInfo)
  83. // ##### END ACTIVEX SCRIPTING SUPPORT #####
  84. COM_INTERFACE_ENTRY(IPersistStreamInit)
  85. COM_INTERFACE_ENTRY(IObjectSafety)
  86. COM_INTERFACE_ENTRY(IProvideClassInfo)
  87. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  88. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  89. COM_INTERFACE_ENTRY_IMPL(IConnectionPointContainer)
  90. // #### BEGIN CONTAINER SUPPORT ####
  91. COM_INTERFACE_ENTRY(IOleClientSite)
  92. COM_INTERFACE_ENTRY(IOleContainer)
  93. COM_INTERFACE_ENTRY(IOleInPlaceFrame)
  94. COM_INTERFACE_ENTRY(IOleInPlaceUIWindow)
  95. COM_INTERFACE_ENTRY(IOleControlSite)
  96. COM_INTERFACE_ENTRY(IOleInPlaceSiteWindowless)
  97. COM_INTERFACE_ENTRY(IOleInPlaceSiteEx)
  98. COM_INTERFACE_ENTRY(IOleInPlaceSite)
  99. // #### END CONTAINER SUPPORT ####
  100. END_COM_MAP()
  101. BEGIN_PROP_MAP(CMFBar)
  102. PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  103. PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  104. PROP_ENTRY("TransparentBlitType", 20, CLSID_NULL)
  105. PROP_ENTRY("ScriptFile", 10, CLSID_NULL)
  106. PROP_ENTRY("BackColor", DISPID_BACKCOLOR, CLSID_StockColorPage)
  107. PROP_ENTRY("Window", DISPID_HWND, CLSID_NULL)
  108. PROP_ENTRY("Caption", DISPID_CAPTION, CLSID_NULL)
  109. PROP_ENTRY("ResourceDLL", 32, CLSID_NULL)
  110. PROP_ENTRY("BackgroundImage", 19, CLSID_NULL)
  111. PROP_ENTRY("AutoLoad", 25, CLSID_NULL)
  112. // Example entries
  113. // PROP_ENTRY("Property Description", dispid, clsid)
  114. // PROP_PAGE(CLSID_StockColorPage)
  115. END_PROP_MAP()
  116. BEGIN_MSG_MAP(CMFBar)
  117. MESSAGE_HANDLER(WM_PAINT, OnPaint)
  118. MESSAGE_HANDLER(WM_ERASEBKGND, OnErase)
  119. MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
  120. MESSAGE_HANDLER(WM_KILLFOCUS, OnKillFocus)
  121. MESSAGE_HANDLER(WM_CLOSE, OnClose)
  122. MESSAGE_HANDLER(WM_SIZING, OnSizing)
  123. MESSAGE_HANDLER(WM_SIZE, OnSize)
  124. MESSAGE_HANDLER(WM_SYSCOMMAND, OnSysCommand)
  125. MESSAGE_HANDLER(WM_CAPTURECHANGED, OnCaptureChanged)
  126. MESSAGE_HANDLER(WM_SETICON, OnSetIcon)
  127. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  128. MESSAGE_HANDLER(WM_HELP, OnHelp)
  129. MESSAGE_HANDLER(WM_TIMER, OnTimer)
  130. MESSAGE_HANDLER(WM_QUERYNEWPALETTE, OnQueryNewPalette)
  131. MESSAGE_HANDLER(WM_PALETTECHANGED, OnPaletteChanged)
  132. MESSAGE_RANGE_HANDLER(WM_MOUSEFIRST, WM_MOUSELAST, OnMouseMessage)
  133. MESSAGE_RANGE_HANDLER(WM_KEYFIRST, WM_KEYLAST, OnKeyMessage)
  134. MESSAGE_HANDLER(WM_USER_FOCUS, OnUserFocus)
  135. // add m_bMessageReflect
  136. lResult = ReflectNotifications(uMsg, wParam, lParam, bHandled);
  137. if(bHandled) return TRUE;
  138. MESSAGE_HANDLER(WM_FORWARDMSG, OnForwardMsg)
  139. CHAIN_MSG_MAP(CComControl<CMFBar>)
  140. DEFAULT_REFLECTION_HANDLER()
  141. END_MSG_MAP()
  142. // Handler prototypes:
  143. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  144. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  145. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  146. LRESULT OnErase(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  147. LRESULT OnClose(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  148. LRESULT OnSize(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  149. LRESULT OnSizing(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  150. LRESULT OnSysCommand(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  151. LRESULT OnTimer(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  152. LRESULT OnCaptureChanged(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  153. LRESULT OnHelp(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  154. LRESULT OnSetIcon(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  155. LRESULT OnInitDialog(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  156. LRESULT OnSetFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  157. LRESULT OnKillFocus(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& bHandled);
  158. LRESULT OnUserFocus(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  159. LRESULT OnMouseMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  160. LRESULT OnButtonDown(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  161. LRESULT OnButtonUp(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  162. LRESULT OnMouseMove(UINT, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  163. LRESULT OnKeyMessage(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  164. LRESULT ReflectNotifications(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  165. LRESULT OnForwardMsg(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM lParam, BOOL& /*bHandled*/);
  166. LRESULT OnQueryNewPalette(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  167. LRESULT OnPaletteChanged(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  168. // IViewObjectEx
  169. DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
  170. BEGIN_CONNECTION_POINT_MAP(CMFBar)
  171. CONNECTION_POINT_ENTRY(DIID__IMSMFBar)
  172. END_CONNECTION_POINT_MAP()
  173. // IMFBar
  174. public:
  175. STDMETHOD(Load)();
  176. STDMETHOD(Run)(BSTR strStatement);
  177. STDMETHOD(About)();
  178. STDMETHOD(CreateObject)(BSTR strObjectID, BSTR strProgID, long lx, long ly, long lWidth,
  179. long lHeight,BSTR strPropBag, VARIANT_BOOL fDisabled, BSTR strScriptHook);
  180. STDMETHOD(ShowSelfSite)(long nCmd);
  181. STDMETHOD(SetupSelfSite)(long lx, long ly, long lWitdh, long lHeight, BSTR strPropBag,
  182. VARIANT_BOOL fDisabled, VARIANT_BOOL fHelpDisabled,VARIANT_BOOL fWindowDisabled);
  183. STDMETHOD(AddObject)(BSTR strObjectID, LPDISPATCH pDisp);
  184. STDMETHOD(AddScriptlet)(BSTR strObjectID, BSTR strEvent, BSTR strEventCode);
  185. STDMETHOD(EnableObject)(BSTR strObjectID, VARIANT_BOOL fEnable);
  186. STDMETHOD(ObjectEnabled)(BSTR strObjectID, VARIANT_BOOL* pfEnabled);
  187. STDMETHOD(SetObjectPosition)(BSTR strObjectID, long xPos, long yPos, long lWidth, long lHeight);
  188. STDMETHOD(GetObjectPosition)(BSTR strObjectID, long* pxPos, long* pyPos, long* plWidth, long* plHeight);
  189. STDMETHOD(GetObjectUnknown)(BSTR strObjectID, IUnknown** ppUnk);
  190. STDMETHOD(get_ScriptFile)(/*[out, retval]*/ BSTR *pVal);
  191. STDMETHOD(put_ScriptFile)(/*[in]*/ BSTR newVal);
  192. STDMETHOD(get_ScriptLanguage)(/*[out, retval]*/ BSTR *pVal);
  193. STDMETHOD(put_ScriptLanguage)(/*[in]*/ BSTR newVal);
  194. STDMETHOD(HookScriptlet)(BSTR strObjectID, BSTR strEvent, BSTR strEventCode);
  195. STDMETHOD(DestroyScriptEngine)();
  196. STDMETHOD(get_MinHeight)(/*[out, retval]*/ long *pVal);
  197. STDMETHOD(put_MinHeight)(/*[in]*/ long newVal);
  198. STDMETHOD(get_MinWidth)(/*[out, retval]*/ long *pVal);
  199. STDMETHOD(put_MinWidth)(/*[in]*/ long newVal);
  200. STDMETHOD(put_Caption)(BSTR bstrCaption);
  201. STDMETHOD(WinHelp)(long lCommand, long dwData, BSTR strHelpFile);
  202. LRESULT OnPaint(UINT /* uMsg */, WPARAM wParam, LPARAM /* lParam */, BOOL& /* lResult */);
  203. HRESULT OnDraw(ATL_DRAWINFO& di);
  204. STDMETHOD(Close)(DWORD dwSaveOption);
  205. STDMETHOD(SetObjectRects)(LPCRECT prcPos,LPCRECT prcClip){
  206. HRESULT hr = IOleInPlaceObjectWindowlessImpl<CMFBar>::SetObjectRects(prcPos, prcClip);
  207. if(FAILED(hr)) return(hr);
  208. AdjustRects(prcPos); return (hr);
  209. }/* end of function SetObjectRects */
  210. STDMETHOD(Close)();
  211. STDMETHOD(get_BackgroundImage)(/*[out, retval]*/ BSTR *pVal);
  212. STDMETHOD(put_BackgroundImage)(/*[in]*/ BSTR newVal);
  213. STDMETHOD(SetPriority)(long lPriority);
  214. STDMETHOD(SetPriorityClass)(long lPriorityClass);
  215. STDMETHOD(get_AutoLoad)(/*[out, retval]*/ VARIANT_BOOL *pVal);
  216. STDMETHOD(put_AutoLoad)(/*[in]*/ VARIANT_BOOL newVal);
  217. STDMETHOD(SetRoundRectRgn)(long x1, long y1, long x2, long y2, long width, long height);
  218. STDMETHOD(SetRectRgn)(long x1, long y1, long x2, long y2 );
  219. STDMETHOD(SetObjectFocus)(BSTR strObjectID, VARIANT_BOOL fEnable);
  220. STDMETHOD(ForceKey)(LONG lVirtKey, LONG lKeyData, VARIANT_BOOL fEat);
  221. STDMETHOD(SetObjectExtent)(BSTR strID, long lWidth, long lHeight);
  222. STDMETHOD(MessageBox)(BSTR strText, BSTR strCaption, long lType);
  223. STDMETHOD(get_ActivityTimeout)(/*[out, retval]*/ long *plTimeout);
  224. STDMETHOD(put_ActivityTimeout)(/*[in]*/ long lTimout);
  225. STDMETHOD(Sleep)(long lMiliseconds);
  226. STDMETHOD(SetTimeout)(long lMilliseconds, long lId);
  227. STDMETHOD(GetUserLCID)(long *plcid);
  228. USE_MF_TRANSPARENT_FLAG
  229. //STDMETHOD(get_TransparentBlit)(/*[out, retval]*/ TransparentBlitType *pVal);
  230. //STDMETHOD(put_TransparentBlit)(/*[in]*/ TransparentBlitType newVal);
  231. USE_MF_RESOURCEDLL // replaces the two lines below
  232. //STDMETHOD(get_ResourceDLL)(/*[out, retval]*/ BSTR *pVal);
  233. //STDMETHOD(put_ResourceDLL)(/*[in]*/ BSTR newVal);
  234. STDMETHOD(get_CmdLine)(/*[out, retval]*/ BSTR *pVal);
  235. STDMETHOD(put_CmdLine)(/*[in]*/ BSTR newVal);
  236. STDMETHOD(ResetFocusArray)();
  237. STDMETHOD(AddFocusObject)(BSTR strObjectID);
  238. HRESULT OnPostVerbInPlaceActivate();
  239. static HICON m_hIcon;
  240. static CWndClassInfo& GetWndClassInfo(){
  241. static HBRUSH wcBrush = ::CreateSolidBrush(RGB(0,0,0));
  242. static CWndClassInfo wc = {{ sizeof(WNDCLASSEX), CS_DBLCLKS /*CS_OWNDC*/, StartWindowProc,
  243. 0, 0, NULL, m_hIcon, NULL, wcBrush /* (HBRUSH)(COLOR_BTNFACE + 1) */,
  244. NULL, TEXT("MSMFVideoClass"), NULL },
  245. NULL, NULL, IDC_ARROW, TRUE, 0, _T("") };
  246. return wc;
  247. }/* end of function GetWndClassInfo */
  248. // ##### BEGIN ACTIVEX SCRIPTING SUPPORT #####
  249. // *** IActiveScriptSite methods ***
  250. STDMETHOD(GetLCID)(LCID *plcid);
  251. STDMETHOD(GetItemInfo)(LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti);
  252. STDMETHOD(GetDocVersionString)(BSTR *pszVersion);
  253. //STDMETHOD(RequestItems)(void);
  254. //STDMETHOD(RequestTypeLibs)(void);
  255. STDMETHOD(OnScriptTerminate)(const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo);
  256. STDMETHOD(OnStateChange)(SCRIPTSTATE ssScriptState);
  257. STDMETHOD(OnScriptError)(IActiveScriptError *pscripterror);
  258. STDMETHOD(OnEnterScript)(void);
  259. STDMETHOD(OnLeaveScript)(void);
  260. // *** IActiveScriptSiteWindow methods ***
  261. STDMETHOD(GetWindow)(HWND *phwnd);
  262. STDMETHOD(EnableModeless)(BOOL fEnable);
  263. // *** IProvideMultipleClassInfo methods ***
  264. // Implemented in the template above
  265. //STDMETHOD(GetMultiTypeInfoCount)(ULONG *pcti);
  266. //STDMETHOD(GetInfoOfIndex)(ULONG iti, DWORD dwFlags, ITypeInfo** pptiCoClass, DWORD* pdwTIFlags, ULONG* pcdispidReserved, IID* piidPrimary, IID* piidSource);
  267. // ##### END ACTIVEX SCRIPTING SUPPORT #####
  268. // #### BEGIN CONTAINER SUPPORT ####
  269. // IOleClientSite
  270. STDMETHOD(SaveObject)(){ATLTRACENOTIMPL(_T("IOleClientSite::SaveObject"));}
  271. STDMETHOD(GetMoniker)(DWORD /*dwAssign*/, DWORD /*dwWhichMoniker*/, IMoniker** /*ppmk*/){ATLTRACENOTIMPL(_T("IOleClientSite::GetMoniker"));}
  272. STDMETHOD(GetContainer)(IOleContainer** ppContainer){ATLTRACENOTIMPL(_T("IOleClientSite::GetContainer"));}
  273. STDMETHOD(ShowObject)(){ATLTRACENOTIMPL(_T("IOleClientSite::ShowObject"));}
  274. STDMETHOD(OnShowWindow)(BOOL /*fShow*/){ATLTRACENOTIMPL(_T("IOleClientSite::OnShowWindow"));}
  275. STDMETHOD(RequestNewObjectLayout)(){ATLTRACENOTIMPL(_T("IOleClientSite::RequestNewObjectLayout"));}
  276. // IOleContainer
  277. STDMETHOD(ParseDisplayName)(IBindCtx* /*pbc*/, LPOLESTR /*pszDisplayName*/, ULONG* /*pchEaten*/, IMoniker** /*ppmkOut*/){ATLTRACENOTIMPL(_T("IOleClientSite::ParseDisplayName"));}
  278. STDMETHOD(EnumObjects)(DWORD /*grfFlags*/, IEnumUnknown** ppenum);
  279. STDMETHOD(LockContainer)(BOOL fLock){ATLTRACENOTIMPL(_T("IOleClientSite::LockContainer"));}
  280. // IOleInPlaceFrameWindow
  281. STDMETHOD(InsertMenus)(HMENU /*hmenuShared*/, LPOLEMENUGROUPWIDTHS /*lpMenuWidths*/)
  282. {
  283. ATLTRACE2(atlTraceHosting, 2, TEXT("CMFBar::InsertMenus\n"));
  284. return S_OK;
  285. }
  286. STDMETHOD(SetMenu)(HMENU /*hmenuShared*/, HOLEMENU /*holemenu*/, HWND /*hwndActiveObject*/)
  287. {
  288. ATLTRACE2(atlTraceHosting, 2, TEXT("CMFBar::SetMenu\n"));
  289. return S_OK;
  290. }
  291. STDMETHOD(RemoveMenus)(HMENU /*hmenuShared*/)
  292. {
  293. ATLTRACE2(atlTraceHosting, 2, TEXT("CMFBar::RemoveMenus\n"));
  294. return S_OK;
  295. }
  296. STDMETHOD(SetStatusText)(LPCOLESTR /*pszStatusText*/)
  297. {
  298. ATLTRACE2(atlTraceHosting, 2, TEXT("CMFBar::SetStatusText\n"));
  299. return S_OK;
  300. }
  301. /********** Implemented somewhere Else ***/
  302. #if 0
  303. STDMETHOD(EnableModeless)(BOOL /*fEnable*/)
  304. {
  305. return S_OK;
  306. }
  307. #endif
  308. STDMETHOD(TranslateAccelerator)(LPMSG /*lpMsg*/, WORD /*wID*/)
  309. {
  310. ATLTRACE2(atlTraceHosting, 2, TEXT("CMFBar::TranslateAccelerator\n"));
  311. return S_FALSE;
  312. }
  313. // IOleWindow
  314. #if 0 // implemented somwhere else, but implementation might need to be revised
  315. STDMETHOD(GetWindow)(HWND* phwnd){
  316. *phwnd = m_hWnd;
  317. return S_OK;
  318. }
  319. #endif
  320. STDMETHOD(ContextSensitiveHelp)(BOOL /*fEnterMode*/)
  321. {
  322. ATLTRACE2(atlTraceHosting, 2, TEXT("CMFBar::ContextSensitiveHelp\n"));
  323. return S_OK;
  324. }
  325. // IOleInPlaceUIWindow
  326. STDMETHOD(GetBorder)(LPRECT /*lprectBorder*/)
  327. {
  328. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleInPlaceUIWindow::GetBorder\n"));
  329. return S_OK;
  330. }
  331. STDMETHOD(RequestBorderSpace)(LPCBORDERWIDTHS /*pborderwidths*/)
  332. {
  333. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleInPlaceUIWindow::RequestBorderSpace\n"));
  334. return INPLACE_E_NOTOOLSPACE;
  335. }
  336. STDMETHOD(SetBorderSpace)(LPCBORDERWIDTHS /*pborderwidths*/)
  337. {
  338. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleInPlaceUIWindow::SetBorderSpace\n"));
  339. return S_OK;
  340. }
  341. STDMETHOD(SetActiveObject)(IOleInPlaceActiveObject* pActiveObject, LPCOLESTR /*pszObjName*/){
  342. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleInPlaceUIWindow::SetActiveObject\n"));
  343. m_spActiveObject = pActiveObject;
  344. return S_OK;
  345. }
  346. // IOleControlSite
  347. STDMETHOD(OnControlInfoChanged)()
  348. {
  349. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleControlSite::OnControlInfoChanged\n"));
  350. return S_OK;
  351. }
  352. STDMETHOD(LockInPlaceActive)(BOOL /*fLock*/)
  353. {
  354. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleControlSite::LockInPlaceActive\n"));
  355. return S_OK;
  356. }
  357. STDMETHOD(GetExtendedControl)(IDispatch** ppDisp)
  358. {
  359. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleControlSite::GetExtendedControl\n"));
  360. ATLASSERT(FALSE); // TODO, this interface needs to be moved to the hosted object
  361. if (ppDisp == NULL)
  362. return E_POINTER;
  363. return m_spOleObject.QueryInterface(ppDisp);
  364. }
  365. STDMETHOD(TransformCoords)(POINTL* /*pPtlHimetric*/, POINTF* /*pPtfContainer*/, DWORD /*dwFlags*/)
  366. {
  367. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleControlSite::TransformCoords\n"));
  368. return S_OK;
  369. }
  370. STDMETHOD(TranslateAccelerator)(LPMSG /*lpMsg*/, DWORD /*grfModifiers*/)
  371. {
  372. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleControlSite::TranslateAccelerator\n"));
  373. return S_FALSE;
  374. }
  375. STDMETHOD(OnFocus)(BOOL /*fGotFocus*/)
  376. {
  377. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleControlSite::OnFocus\n"));
  378. return S_OK;
  379. }
  380. STDMETHOD(ShowPropertyFrame)()
  381. {
  382. ATLTRACE2(atlTraceHosting, 2, TEXT("IOleControlSite::ShowPropertyFrame\n"));
  383. return E_NOTIMPL;
  384. }
  385. // IOleInPlaceSite
  386. #if 0
  387. STDMETHOD(GetWindow)(HWND* phwnd)
  388. {
  389. *phwnd = m_hWnd;
  390. return S_OK;
  391. }
  392. STDMETHOD(ContextSensitiveHelp)(BOOL /*fEnterMode*/)
  393. {
  394. ATLTRACENOTIMPL(_T("IOleWindow::CanInPlaceActivate"));
  395. }
  396. #endif
  397. STDMETHOD(CanInPlaceActivate)(){return S_OK;}
  398. STDMETHOD(OnInPlaceActivate)(){ATLTRACENOTIMPL(_T("IOleInPlaceSite::OnInPlaceActivate"));}
  399. STDMETHOD(OnInPlaceDeactivate)(){ATLTRACENOTIMPL(_T("IOleInPlaceSite::OnInPlaceDeactivate"));}
  400. STDMETHOD(OnUIDeactivate)(BOOL /*fUndoable*/){ATLTRACENOTIMPL(_T("IOleInPlaceSite::OnUIDeactivate\n"));}
  401. STDMETHOD(OnUIActivate)()
  402. {
  403. ATLTRACE2(atlTraceHosting, 0, _T("IOleInPlaceSite::OnUIActivate\n"));
  404. m_bUIActive = TRUE;
  405. return S_OK;
  406. }
  407. STDMETHOD(GetWindowContext)(IOleInPlaceFrame** ppFrame, IOleInPlaceUIWindow** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO pFrameInfo){
  408. ATLTRACENOTIMPL(_T("IOleInPlaceSite::GetWindowContext"));}
  409. STDMETHOD(Scroll)(SIZE /*scrollExtant*/){ATLTRACENOTIMPL(_T("IOleInPlaceSite::Scroll"));}
  410. STDMETHOD(DiscardUndoState)(){ATLTRACENOTIMPL(_T("IOleInPlaceSite::DiscardUndoState"));}
  411. STDMETHOD(DeactivateAndUndo)(){ATLTRACENOTIMPL(_T("IOleInPlaceSite::DeactivateAndUndo"));}
  412. STDMETHOD(OnPosRectChange)(LPCRECT /*lprcPosRect*/){ATLTRACENOTIMPL(_T("IOleInPlaceSite::OnPosRectChange"));}
  413. // IOleInPlaceSiteEx
  414. STDMETHOD(OnInPlaceActivateEx)(BOOL* /*pfNoRedraw*/, DWORD dwFlags){ATLTRACENOTIMPL(_T("IOleInPlaceSiteEx::OnInPlaceActivateEx"));};
  415. STDMETHOD(OnInPlaceDeactivateEx)(BOOL /*fNoRedraw*/){ATLTRACENOTIMPL(_T("IOleInPlaceSiteEx::OnInPlaceDeactivateEx"));};
  416. STDMETHOD(RequestUIActivate)(){return S_OK;}
  417. STDMETHOD(CanWindowlessActivate)();
  418. STDMETHOD(GetCapture)();
  419. STDMETHOD(SetCapture)(BOOL fCapture);
  420. STDMETHOD(GetFocus)();
  421. STDMETHOD(SetFocus)(BOOL fFocus);
  422. STDMETHOD(GetDC)(LPCRECT /*pRect*/, DWORD /*grfFlags*/, HDC* phDC);
  423. STDMETHOD(ReleaseDC)(HDC hDC);
  424. STDMETHOD(InvalidateRect)(LPCRECT pRect, BOOL fErase);
  425. STDMETHOD(InvalidateRgn)(HRGN hRGN = NULL, BOOL fErase = FALSE);
  426. STDMETHOD(ScrollRect)(INT /*dx*/, INT /*dy*/, LPCRECT /*pRectScroll*/, LPCRECT /*pRectClip*/){return S_OK;}
  427. STDMETHOD(AdjustRect)(LPRECT /*prc*/){return S_OK;}
  428. STDMETHOD(OnDefWindowMessage)(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT* plResult);
  429. // #### END CONTAINER SUPPORT ####
  430. protected: // member variables
  431. // ##### BEGIN ACTIVEX SCRIPTING SUPPORT #####
  432. CComPtr<IActiveScript> m_ps;
  433. CComPtr<IActiveScriptParse> m_psp;
  434. // ##### END ACTIVEX SCRIPTING SUPPORT #####
  435. // #### BEGIN CONTAINER SUPPORT ####
  436. // !!!!TODO: Take these out and implement the interfaces !!!!
  437. CComPtr<IOleObject> m_spOleObject; // TODO: Implement this in the outer container, move out
  438. CComPtr<IOleInPlaceActiveObject> m_spActiveObject;
  439. CNTOBJ m_cntObj; // collection of contained controls
  440. CNTEVNT m_cntEvnt; // collection of events
  441. CNTOBJ m_cntFocus; // collection of contained controls
  442. CComBSTR m_strScriptLanguage;
  443. CComBSTR m_strScriptFile;
  444. bool m_fSelfHosted; // see if we are hosting our self
  445. LONG m_lMinWidth; // the smallest Width we allow
  446. LONG m_lMinHeight; // the smallest Height we allow
  447. bool m_fHandleHelp; // flag to change the help
  448. //TransparentBlitType m_blitType; moved to common utils
  449. POINT m_ptMouse; // last mouse point
  450. // Ambient property storage
  451. unsigned long m_bCanWindowlessActivate:1;
  452. unsigned long m_ulCapture;
  453. CComBSTR m_bstrBackImageFilename;
  454. CBitmap *m_pBackBitmap;
  455. VARIANT_BOOL m_fAutoLoad;
  456. bool m_fForceKey; // flag to see if the force Key method was fired
  457. VARIANT_BOOL m_fEat;
  458. LONG m_lVirtKey; // virt key passed down by the force key
  459. LONG m_lKeyData; // data passes by force key method
  460. RECT m_rcWnd;
  461. bool m_bMouseDown;
  462. int m_HitRegion;
  463. long m_lTimeout; // activity timeout
  464. bool m_fUserActivity; // flag if there is a user activity
  465. bool m_fWaitingForActivity; // flag which set when we wait for an activity
  466. // #### END CONTAINER SUPPORT ####
  467. public: // member variables
  468. STDMETHOD(HasObjectFocus)(BSTR strObjectID, VARIANT_BOOL* pfFocus);
  469. OLE_COLOR m_clrBackColor; // stock property implemeted in the CStockPropImpl
  470. CComBSTR m_bstrCaption; // stock property for caption
  471. CComBSTR m_strCmdLine; // command line argument we set
  472. LONG m_nReadyState; // ready state change stock property
  473. protected: // private helper functions
  474. HRESULT Init(); // Initializes the internal variables
  475. HRESULT Cleanup(); // End of function cleanup
  476. HRESULT AdjustRects(const LPCRECT prcPos); // calls all our contained objects and the adjusts their
  477. // rects in the case we have moved
  478. HRESULT CreateScriptEngine();
  479. HRESULT GetParentHWND(HWND* pWnd);
  480. BOOL GetClientRect(LPRECT lpRect) const;
  481. HWND GetParent();
  482. HRESULT GetToolbarName(BSTR* strToolbarName);
  483. HRESULT SendMessageToCtl(CHostedObject* pObj, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled, LONG& lRes, bool fWndwlsOnly = true);
  484. HRESULT SetReadyState(LONG lReadyState);
  485. HRESULT ResetCaptureFlags();
  486. HRESULT ResetFocusFlags();
  487. HRESULT SendMouseMessageToCtl(CHostedObject* pObj, UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled, LONG& lRes);
  488. int ResizeHitRegion(POINT p);
  489. HRESULT UpdateCursor(int hitRegion);
  490. HRESULT SetObjectFocus(CHostedObject* pObj, BOOL fSet, LONG& lRes);
  491. HRESULT FindObject(BSTR strObjectID, CHostedObject** ppObj);
  492. HRESULT MoveFocus(bool fForward, LONG& lRes);
  493. HRESULT SetClosestFocus(LONG& lRes, CHostedObject* pStartObj = NULL, bool fForward = true);
  494. };
  495. #endif //__MFBAR_H_
  496. /*************************************************************************/
  497. /* End of file: MFBar.h */
  498. /*************************************************************************/