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.

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