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.

801 lines
28 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Factories.h
  5. Abstract:
  6. This file contains the declaration of various binary behaviors.
  7. Revision History:
  8. Davide Massarenti (Dmassare) 07/12/2000
  9. created
  10. ******************************************************************************/
  11. #if !defined(__INCLUDED___PCH___FACTORIES_H___)
  12. #define __INCLUDED___PCH___FACTORIES_H___
  13. #include <Behaviors.h>
  14. //
  15. // From BehaviorsTypeLib.idl
  16. //
  17. #include <BehaviorsTypeLib.h>
  18. #define INCREASESIZE(x) x.reserve( (x.size() + 4097) & ~4095 )
  19. ////////////////////////////////////////////////////////////////////////////////
  20. typedef IDispatchImpl<IPCHBehaviors_Common , &IID_IPCHBehaviors_Common , &LIBID_BehaviorsTypeLib> CPCHBehavior__IDispatch_Event;
  21. typedef IDispatchImpl<IPCHBehaviors_SubSite , &IID_IPCHBehaviors_SubSite , &LIBID_BehaviorsTypeLib> CPCHBehavior__IDispatch_SubSite;
  22. typedef IDispatchImpl<IPCHBehaviors_Tree , &IID_IPCHBehaviors_Tree , &LIBID_BehaviorsTypeLib> CPCHBehavior__IDispatch_Tree;
  23. typedef IDispatchImpl<IPCHBehaviors_TreeNode, &IID_IPCHBehaviors_TreeNode, &LIBID_BehaviorsTypeLib> CPCHBehavior__IDispatch_TreeNode;
  24. typedef IDispatchImpl<IPCHBehaviors_Context , &IID_IPCHBehaviors_Context , &LIBID_BehaviorsTypeLib> CPCHBehavior__IDispatch_Context;
  25. typedef IDispatchImpl<IPCHBehaviors_State , &IID_IPCHBehaviors_State , &LIBID_BehaviorsTypeLib> CPCHBehavior__IDispatch_State;
  26. ////////////////////////////////////////////////////////////////////////////////
  27. class ATL_NO_VTABLE CPCHBehavior_EVENT : public CPCHBehavior, public CPCHBehavior__IDispatch_Event
  28. {
  29. long m_lCookieIN;
  30. LONG* m_lCookieOUT;
  31. CComQIPtr<IPCHEvent> m_evCurrent;
  32. ////////////////////
  33. HRESULT onFire( DISPID, DISPPARAMS*, VARIANT* );
  34. public:
  35. BEGIN_COM_MAP(CPCHBehavior_EVENT)
  36. COM_INTERFACE_ENTRY(IDispatch)
  37. COM_INTERFACE_ENTRY(IPCHBehaviors_Common)
  38. COM_INTERFACE_ENTRY_CHAIN(CPCHBehavior)
  39. END_COM_MAP()
  40. CPCHBehavior_EVENT();
  41. virtual ~CPCHBehavior_EVENT();
  42. //
  43. // IElementBehavior
  44. //
  45. STDMETHOD(Init )( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  46. STDMETHOD(Detach)( );
  47. //
  48. // IPCHBehaviors_Common
  49. //
  50. STDMETHOD(get_data )( /*[out, retval]*/ VARIANT *pVal );
  51. STDMETHOD(get_element)( /*[out, retval]*/ IDispatch* *pVal );
  52. STDMETHOD(Load )( /*[in ]*/ BSTR newVal );
  53. STDMETHOD(Save )( /*[out, retval]*/ BSTR *pVal );
  54. STDMETHOD(Locate )( /*[in]*/ BSTR bstrKey, /*[out, retval]*/ VARIANT *pVal );
  55. STDMETHOD(Unselect)( );
  56. };
  57. /////////////////////////////////////////////////////////////////////////////
  58. class ATL_NO_VTABLE CPCHBehavior_BODY : public CPCHBehavior
  59. {
  60. HRESULT onEvent( DISPID, DISPPARAMS*, VARIANT* );
  61. ////////////////////
  62. public:
  63. CPCHBehavior_BODY();
  64. //
  65. // IElementBehavior
  66. //
  67. STDMETHOD(Init)( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  68. };
  69. /////////////////////////////////////////////////////////////////////////////
  70. class ATL_NO_VTABLE CPCHBehavior_A : public CPCHBehavior
  71. {
  72. HRESULT onClick( DISPID, DISPPARAMS*, VARIANT* );
  73. HRESULT onMouseMovement( DISPID, DISPPARAMS*, VARIANT* );
  74. public:
  75. CPCHBehavior_A();
  76. //
  77. // IElementBehavior
  78. //
  79. STDMETHOD(Init)( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  80. };
  81. /////////////////////////////////////////////////////////////////////////////
  82. class ATL_NO_VTABLE CPCHBehavior_HANDLE : public CPCHBehavior
  83. {
  84. bool m_fCaptured;
  85. long m_xStart;
  86. ////////////////////
  87. HRESULT onMouse( DISPID, DISPPARAMS*, VARIANT* );
  88. public:
  89. CPCHBehavior_HANDLE();
  90. //
  91. // IElementBehavior
  92. //
  93. STDMETHOD(Init )( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  94. STDMETHOD(Detach)( );
  95. };
  96. /////////////////////////////////////////////////////////////////////////////
  97. ////class ATL_NO_VTABLE CPCHBehavior_TOPLEVEL : public CPCHBehavior, public CPCHBehavior__IDispatch_SubSite
  98. ////{
  99. //// struct Node;
  100. //// friend struct Node;
  101. ////
  102. //// typedef std::list< Node* > List;
  103. //// typedef List::iterator Iter;
  104. //// typedef List::const_iterator IterConst;
  105. ////
  106. //// ////////////////////////////////////////
  107. ////
  108. //// struct Node : public CComObjectRootEx<MPC::CComSafeMultiThreadModel>, public IUnknown
  109. //// {
  110. //// CPCHBehavior_TOPLEVEL* m_owner;
  111. //// CComPtr<CPCHQueryResult> m_qrNode;
  112. ////
  113. //// CComPtr<IHTMLElement> m_TR_title;
  114. //// CComPtr<IHTMLElement> m_TR_description;
  115. //// CComPtr<IHTMLElement> m_TD_title;
  116. //// CComPtr<IHTMLElement> m_TD_description;
  117. ////
  118. //// ////////////////////
  119. ////
  120. //// BEGIN_COM_MAP(Node)
  121. //// COM_INTERFACE_ENTRY(IUnknown)
  122. //// END_COM_MAP()
  123. ////
  124. //// Node();
  125. ////
  126. //// void Detach();
  127. //// };
  128. ////
  129. //// ////////////////////////////////////////
  130. ////
  131. //// long m_lCookie_onClick;
  132. //// long m_lCookie_onContextSelect;
  133. //// long m_lCookie_onSelect;
  134. //// long m_lCookie_onUnselect;
  135. ////
  136. //// CComBSTR m_bstrRoot;
  137. //// CComPtr<Node> m_selectedNode;
  138. //// List m_lstNodes;
  139. ////
  140. //// ////////////////////
  141. ////
  142. //// HRESULT onMouse( DISPID, DISPPARAMS*, VARIANT* );
  143. ////
  144. //// void FromElementToNode( /*[in/out]*/ CComPtr<Node>& node, /*[in]*/ IHTMLElement* elem );
  145. ////
  146. //// void Empty();
  147. ////
  148. ////public:
  149. ////BEGIN_COM_MAP(CPCHBehavior_TOPLEVEL)
  150. //// COM_INTERFACE_ENTRY(IDispatch)
  151. //// COM_INTERFACE_ENTRY(IPCHBehaviors_Common)
  152. //// COM_INTERFACE_ENTRY_CHAIN(CPCHBehavior)
  153. ////END_COM_MAP()
  154. ////
  155. //// CPCHBehavior_TOPLEVEL();
  156. //// ~CPCHBehavior_TOPLEVEL();
  157. ////
  158. //// //
  159. //// // IElementBehavior
  160. //// //
  161. //// STDMETHOD(Init )( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  162. //// STDMETHOD(Detach)( );
  163. ////
  164. ////
  165. //// //
  166. //// // IPCHBehaviors_Common
  167. //// //
  168. //// STDMETHOD(get_data )( /*[out, retval]*/ VARIANT *pVal );
  169. //// STDMETHOD(get_element)( /*[out, retval]*/ IDispatch* *pVal );
  170. ////
  171. //// STDMETHOD(Refresh)( );
  172. //// STDMETHOD(Load )( /*[in ]*/ BSTR newVal );
  173. //// STDMETHOD(Save )( /*[out, retval]*/ BSTR *pVal );
  174. //// STDMETHOD(Locate )( /*[in]*/ BSTR bstrKey, /*[out, retval]*/ VARIANT *pVal );
  175. ////
  176. //// //
  177. //// // IPCHBehaviors_SubSite
  178. //// //
  179. //// STDMETHOD(get_root)( /*[out, retval]*/ BSTR *pVal );
  180. //// STDMETHOD(put_root)( /*[in ]*/ BSTR newVal );
  181. ////
  182. //// STDMETHOD(Select)( /*[in]*/ BSTR bstrNode, /*[in]*/ BSTR bstrURL, /*[in]*/ VARIANT_BOOL fNotify );
  183. ////};
  184. /////////////////////////////////////////////////////////////////////////////
  185. class ATL_NO_VTABLE CPCHBehavior_BasicTree : public CPCHBehavior, public MPC::Thread<CPCHBehavior_BasicTree,IDispatch>
  186. {
  187. protected:
  188. struct Node;
  189. friend struct Node;
  190. typedef std::list< Node* > List;
  191. typedef List::iterator Iter;
  192. typedef List::const_iterator IterConst;
  193. ////////////////////////////////////////
  194. typedef enum
  195. {
  196. NODETYPE__FRAME1 ,
  197. NODETYPE__FRAME2 ,
  198. NODETYPE__FRAME3 ,
  199. NODETYPE__FRAME1_EXPAND,
  200. NODETYPE__FRAME2_EXPAND,
  201. NODETYPE__FRAME3_EXPAND,
  202. NODETYPE__EXPANDO ,
  203. NODETYPE__EXPANDO_LINK ,
  204. NODETYPE__EXPANDO_TOPIC,
  205. NODETYPE__GROUP ,
  206. NODETYPE__LINK ,
  207. NODETYPE__SPACER ,
  208. } NodeType;
  209. typedef enum
  210. {
  211. SELECTION__NONE ,
  212. SELECTION__ACTIVE ,
  213. SELECTION__NEXTACTIVE ,
  214. SELECTION__NEXTACTIVE_NOTIFY,
  215. } SelectionMode;
  216. struct Node : public CComObjectRootEx<MPC::CComSafeMultiThreadModel>, public IUnknown
  217. {
  218. CPCHBehavior_BasicTree* m_owner;
  219. Node* m_parent;
  220. CComBSTR m_bstrNode;
  221. NodeType m_iType;
  222. SelectionMode m_iSelection;
  223. bool m_fLoaded_Self;
  224. bool m_fLoaded_Children;
  225. bool m_fDisplayed_Self;
  226. bool m_fDisplayed_Children;
  227. bool m_fInvalid;
  228. bool m_fRefreshNotification;
  229. bool m_fExpanded;
  230. bool m_fMouseOver;
  231. bool m_fMouseDown;
  232. CComPtr<IHTMLElement> m_parentElement;
  233. CComBSTR m_bstrID;
  234. CComPtr<IHTMLElement> m_DIV;
  235. CComPtr<IHTMLElement> m_IMG;
  236. CComPtr<IHTMLElement> m_DIV_children;
  237. List m_lstSubnodes;
  238. ////////////////////
  239. BEGIN_COM_MAP(Node)
  240. COM_INTERFACE_ENTRY(IUnknown)
  241. END_COM_MAP()
  242. Node();
  243. virtual ~Node();
  244. HRESULT Init( /*[in]*/ LPCWSTR szNode, /*[in]*/ NodeType iType = NODETYPE__EXPANDO );
  245. HRESULT NotifyMainThread();
  246. Node* FindNode( /*[in]*/ LPCWSTR szNode, /*[in]*/ bool fUseID );
  247. HRESULT OnMouse( /*[in]*/ DISPID id, /*[in]*/ long lButton, /*[in]*/ long lKey, /*[in]*/ bool fIsImage );
  248. HRESULT LoadHTML( /*[in]*/ LPCWSTR szHTML );
  249. HRESULT GenerateHTML( /*[in]*/ LPCWSTR szTitle, /*[in]*/ LPCWSTR szDescription, /*[in]*/ LPCWSTR szIcon, /*[in]*/ LPCWSTR szURL );
  250. void InsertOptionalTarget( /*[in/out]*/ MPC::wstring& strHTML );
  251. ////////////////////
  252. virtual HRESULT Passivate ( );
  253. virtual HRESULT ProcessRefreshRequest( );
  254. virtual HRESULT CreateInstance ( /*[in]*/ CPCHBehavior_BasicTree* owner, /*[in]*/ Node* parent, /*[out]*/ Node*& subnode ) = 0;
  255. virtual HRESULT PopulateSelf ( ) = 0;
  256. virtual HRESULT PopulateChildren ( ) = 0;
  257. virtual HRESULT GenerateSelf ( ) = 0;
  258. virtual HRESULT GenerateChildren ( );
  259. virtual HRESULT Display ( );
  260. virtual bool IsParentDisplayingUs ( );
  261. virtual HRESULT Load( /*[in]*/ MPC::Serializer& stream );
  262. virtual HRESULT Save( /*[in]*/ MPC::Serializer& stream, /*[in]*/ bool fSaveChildren );
  263. };
  264. struct NodeToSelect
  265. {
  266. CComBSTR m_bstrNode;
  267. CComBSTR m_bstrURL;
  268. bool m_fNotify;
  269. };
  270. ////////////////////
  271. CComBSTR m_bstrTargetFrame;
  272. long m_lCookie_onContextSelect;
  273. long m_lCookie_onSelect;
  274. long m_lCookie_onUnselect;
  275. Node* m_nTopNode;
  276. Node* m_nSelected;
  277. Node* m_nCurrent;
  278. NodeToSelect* m_nToSelect;
  279. CPCHTimerHandle m_Timer;
  280. bool m_fRefreshing;
  281. long m_lNavModel;
  282. ////////////////////
  283. void Empty ();
  284. void ProtectFromDetach ();
  285. void UnprotectFromDetach();
  286. HRESULT onMouse( DISPID, DISPPARAMS*, VARIANT* );
  287. HRESULT RefreshThread ( );
  288. void SetRefreshingFlag( /*[in]*/ bool fVal );
  289. void WaitForRefreshing( /*[in]*/ MPC::SmartLock<_ThreadModel>& lock, /*[in]*/ bool fYield = false );
  290. HRESULT NotifyMainThread ( /*[in]*/ Node* node );
  291. HRESULT ChangeSelection ( /*[in]*/ Node* node, /*[in]*/ bool fNotify );
  292. Node* NodeFromElement( /*[in]*/ IHTMLElement* elem );
  293. Node* NodeFromKey ( /*[in]*/ LPCWSTR szNode, /*[in]*/ bool fUseID = false );
  294. HRESULT InterceptInvoke( /*[in]*/ DISPID dispidMember, /*[in]*/ DISPPARAMS* pdispparams );
  295. HRESULT TimerCallback_ScrollIntoView( /*[in]*/ VARIANT );
  296. ////////////////////
  297. virtual HRESULT RefreshThread_Enter() = 0;
  298. virtual void RefreshThread_Leave() = 0;
  299. virtual HRESULT Load( /*[in]*/ MPC::Serializer& stream );
  300. virtual HRESULT Save( /*[in]*/ MPC::Serializer& stream );
  301. HRESULT Persist_Load( /*[in ]*/ BSTR newVal );
  302. HRESULT Persist_Save( /*[out, retval]*/ BSTR *pVal );
  303. public:
  304. CPCHBehavior_BasicTree();
  305. ~CPCHBehavior_BasicTree();
  306. void SetNavModel ( /*[in]*/ long lNavModel ) { if(lNavModel != QR_DEFAULT) m_lNavModel = lNavModel; }
  307. long GetNavModel ( ) { return m_lNavModel; }
  308. NodeToSelect* GetNodeToSelect( ) { return m_nToSelect; }
  309. bool IsRTL ( ) { return m_fRTL; }
  310. //
  311. // IElementBehavior
  312. //
  313. STDMETHOD(Init )( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  314. STDMETHOD(Detach)( );
  315. };
  316. /////////////////////////////////////////////////////////////////////////////
  317. class ATL_NO_VTABLE CPCHBehavior_SUBSITE : public CPCHBehavior_BasicTree, public CPCHBehavior__IDispatch_SubSite
  318. {
  319. protected:
  320. struct QueryNode;
  321. friend struct QueryNode;
  322. ////////////////////////////////////////
  323. struct QueryNode : public CPCHBehavior_BasicTree::Node
  324. {
  325. CComPtr<CPCHQueryResult> m_qrNode;
  326. bool m_fQueryDone;
  327. bool m_fTopic;
  328. ////////////////////
  329. public:
  330. QueryNode();
  331. virtual ~QueryNode();
  332. HRESULT Init( /*[in]*/ LPCWSTR szNode, /*[in]*/ NodeType iType, /*[in]*/ CPCHQueryResult* qr, /*[in]*/ bool fTopic );
  333. virtual HRESULT ProcessRefreshRequest( );
  334. virtual HRESULT CreateInstance ( /*[in]*/ CPCHBehavior_BasicTree* owner, /*[in]*/ Node* parent, /*[out]*/ Node*& subnode );
  335. virtual HRESULT PopulateSelf ( );
  336. virtual HRESULT PopulateChildren ( );
  337. virtual HRESULT GenerateSelf ( );
  338. virtual HRESULT Load( /*[in]*/ MPC::Serializer& stream );
  339. virtual HRESULT Save( /*[in]*/ MPC::Serializer& stream, /*[in]*/ bool fSaveChildren );
  340. static HRESULT CreateInstance_QueryNode( /*[in]*/ CPCHBehavior_BasicTree* owner, /*[in]*/ Node* parent, /*[out]*/ Node*& subnode );
  341. };
  342. ////////////////////
  343. CPCHProxy_IPCHTaxonomyDatabase* m_db;
  344. CComBSTR m_bstrRoot;
  345. bool m_fExpand;
  346. ////////////////////
  347. virtual HRESULT RefreshThread_Enter();
  348. virtual void RefreshThread_Leave();
  349. virtual HRESULT Load( /*[in]*/ MPC::Serializer& stream );
  350. virtual HRESULT Save( /*[in]*/ MPC::Serializer& stream );
  351. public:
  352. BEGIN_COM_MAP(CPCHBehavior_SUBSITE)
  353. COM_INTERFACE_ENTRY(IDispatch)
  354. COM_INTERFACE_ENTRY(IPCHBehaviors_Common)
  355. COM_INTERFACE_ENTRY(IPCHBehaviors_SubSite)
  356. COM_INTERFACE_ENTRY_CHAIN(CPCHBehavior_BasicTree)
  357. END_COM_MAP()
  358. CPCHBehavior_SUBSITE();
  359. //
  360. // IDispatch
  361. //
  362. STDMETHOD(Invoke)( DISPID dispidMember ,
  363. REFIID riid ,
  364. LCID lcid ,
  365. WORD wFlags ,
  366. DISPPARAMS* pdispparams ,
  367. VARIANT* pvarResult ,
  368. EXCEPINFO* pexcepinfo ,
  369. UINT* puArgErr );
  370. // IElementBehavior
  371. //
  372. STDMETHOD(Init)( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  373. //
  374. // IPCHBehaviors_Common
  375. //
  376. STDMETHOD(get_data )( /*[out, retval]*/ VARIANT *pVal );
  377. STDMETHOD(get_element)( /*[out, retval]*/ IDispatch* *pVal );
  378. STDMETHOD(Load )( /*[in ]*/ BSTR newVal );
  379. STDMETHOD(Save )( /*[out, retval]*/ BSTR *pVal );
  380. STDMETHOD(Locate )( /*[in]*/ BSTR bstrKey, /*[out, retval]*/ VARIANT *pVal );
  381. STDMETHOD(Unselect)( );
  382. //
  383. // IPCHBehaviors_SubSite
  384. //
  385. STDMETHOD(get_root)( /*[out, retval]*/ BSTR *pVal );
  386. STDMETHOD(put_root)( /*[in ]*/ BSTR newVal );
  387. STDMETHOD(Select)( /*[in]*/ BSTR bstrNode, /*[in]*/ BSTR bstrURL, /*[in]*/ VARIANT_BOOL fNotify );
  388. };
  389. /////////////////////////////////////////////////////////////////////////////
  390. class ATL_NO_VTABLE CPCHBehavior_TREE : public CPCHBehavior_BasicTree, public CPCHBehavior__IDispatch_Tree
  391. {
  392. protected:
  393. struct TreeNode;
  394. friend struct TreeNode;
  395. friend class CPCHBehavior_TREENODE;
  396. ////////////////////////////////////////
  397. struct TreeNode : public CPCHBehavior_BasicTree::Node
  398. {
  399. CComBSTR m_bstrTitle;
  400. CComBSTR m_bstrDescription;
  401. CComBSTR m_bstrIcon;
  402. CComBSTR m_bstrURL;
  403. ////////////////////
  404. public:
  405. TreeNode();
  406. virtual ~TreeNode();
  407. virtual HRESULT CreateInstance ( /*[in]*/ CPCHBehavior_BasicTree* owner, /*[in]*/ Node* parent, /*[out]*/ Node*& subnode );
  408. virtual HRESULT PopulateSelf ( );
  409. virtual HRESULT PopulateChildren( );
  410. virtual HRESULT GenerateSelf ( );
  411. virtual HRESULT Load( /*[in]*/ MPC::Serializer& stream );
  412. virtual HRESULT Save( /*[in]*/ MPC::Serializer& stream, /*[in]*/ bool fSaveChildren );
  413. static HRESULT CreateInstance_TreeNode( /*[in]*/ CPCHBehavior_BasicTree* owner, /*[in]*/ Node* parent, /*[out]*/ Node*& subnode );
  414. static HRESULT PopulateFromXML( /*[in]*/ CPCHBehavior_TREE* owner, /*[in]*/ TreeNode* parent, /*[in]*/ IXMLDOMNode* xdnNode );
  415. };
  416. ////////////////////
  417. virtual HRESULT RefreshThread_Enter();
  418. virtual void RefreshThread_Leave();
  419. virtual HRESULT Load( /*[in]*/ MPC::Serializer& stream );
  420. virtual HRESULT Save( /*[in]*/ MPC::Serializer& stream );
  421. HRESULT WrapData( /*[in]*/ TreeNode* node, /*[out, retval]*/ VARIANT* pVal );
  422. public:
  423. BEGIN_COM_MAP(CPCHBehavior_TREE)
  424. COM_INTERFACE_ENTRY(IDispatch)
  425. COM_INTERFACE_ENTRY(IPCHBehaviors_Common)
  426. COM_INTERFACE_ENTRY(IPCHBehaviors_Tree)
  427. COM_INTERFACE_ENTRY_CHAIN(CPCHBehavior_BasicTree)
  428. END_COM_MAP()
  429. static NodeType LookupType( /*[in]*/ LPCWSTR szNodeType );
  430. static LPCWSTR LookupType( /*[in]*/ NodeType iNodeType );
  431. //
  432. // IDispatch
  433. //
  434. STDMETHOD(Invoke)( DISPID dispidMember ,
  435. REFIID riid ,
  436. LCID lcid ,
  437. WORD wFlags ,
  438. DISPPARAMS* pdispparams ,
  439. VARIANT* pvarResult ,
  440. EXCEPINFO* pexcepinfo ,
  441. UINT* puArgErr );
  442. //
  443. // IElementBehavior
  444. //
  445. STDMETHOD(Init)( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  446. //
  447. // IPCHBehaviors_Common
  448. //
  449. STDMETHOD(get_data )( /*[out, retval]*/ VARIANT *pVal );
  450. STDMETHOD(get_element)( /*[out, retval]*/ IDispatch* *pVal );
  451. STDMETHOD(Load )( /*[in ]*/ BSTR newVal );
  452. STDMETHOD(Save )( /*[out, retval]*/ BSTR *pVal );
  453. STDMETHOD(Locate )( /*[in]*/ BSTR bstrKey, /*[out, retval]*/ VARIANT *pVal );
  454. STDMETHOD(Unselect)( );
  455. //
  456. // IPCHBehaviors_Tree
  457. //
  458. STDMETHOD(Populate)( /*[in]*/ VARIANT newVal );
  459. };
  460. class ATL_NO_VTABLE CPCHBehavior_TREENODE : public CComObjectRootEx<MPC::CComSafeMultiThreadModel>, public CPCHBehavior__IDispatch_TreeNode
  461. {
  462. friend class CPCHBehavior_TREE;
  463. CPCHBehavior_TREE::TreeNode* m_data;
  464. public:
  465. BEGIN_COM_MAP(CPCHBehavior_TREENODE)
  466. COM_INTERFACE_ENTRY(IDispatch)
  467. COM_INTERFACE_ENTRY(IPCHBehaviors_TreeNode)
  468. END_COM_MAP()
  469. CPCHBehavior_TREENODE();
  470. ~CPCHBehavior_TREENODE();
  471. //
  472. // IPCHBehaviors_TreeNode
  473. //
  474. STDMETHOD(get_Type )( /*[out, retval]*/ BSTR *pVal );
  475. STDMETHOD(get_Key )( /*[out, retval]*/ BSTR *pVal );
  476. STDMETHOD(get_Title )( /*[out, retval]*/ BSTR *pVal );
  477. STDMETHOD(get_Description)( /*[out, retval]*/ BSTR *pVal );
  478. STDMETHOD(get_Icon )( /*[out, retval]*/ BSTR *pVal );
  479. STDMETHOD(get_URL )( /*[out, retval]*/ BSTR *pVal );
  480. };
  481. /////////////////////////////////////////////////////////////////////////////
  482. class ATL_NO_VTABLE CPCHBehavior_CONTEXT : public CPCHBehavior, public CPCHBehavior__IDispatch_Context
  483. {
  484. public:
  485. BEGIN_COM_MAP(CPCHBehavior_CONTEXT)
  486. COM_INTERFACE_ENTRY(IDispatch)
  487. COM_INTERFACE_ENTRY(IPCHBehaviors_Context)
  488. COM_INTERFACE_ENTRY_CHAIN(CPCHBehavior)
  489. END_COM_MAP()
  490. //
  491. // IElementBehavior
  492. //
  493. STDMETHOD(Init)( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  494. //
  495. // IPCHBehaviors_TreeNode
  496. //
  497. STDMETHOD(get_minimized)( /*[out, retval]*/ VARIANT_BOOL *pVal );
  498. STDMETHOD(put_minimized)( /*[in ]*/ VARIANT_BOOL newVal );
  499. STDMETHOD(get_maximized)( /*[out, retval]*/ VARIANT_BOOL *pVal );
  500. STDMETHOD(put_maximized)( /*[in ]*/ VARIANT_BOOL newVal );
  501. STDMETHOD(get_x )( /*[out, retval]*/ long *pVal );
  502. STDMETHOD(get_y )( /*[out, retval]*/ long *pVal );
  503. STDMETHOD(get_width )( /*[out, retval]*/ long *pVal );
  504. STDMETHOD(get_height )( /*[out, retval]*/ long *pVal );
  505. STDMETHOD(changeContext )( /*[in]*/ BSTR bstrName, /*[in,optional]*/ VARIANT vInfo, /*[in,optional]*/ VARIANT vURL );
  506. STDMETHOD(setWindowDimensions)( /*[in]*/ long lX, /*[in]*/ long lY, /*[in]*/ long lW, /*[in]*/ long lH );
  507. STDMETHOD(bringToForeground )();
  508. };
  509. /////////////////////////////////////////////////////////////////////////////
  510. class ATL_NO_VTABLE CPCHBehavior_STATE : public CPCHBehavior, public CPCHBehavior__IDispatch_State
  511. {
  512. long m_lCookie_PERSISTLOAD;
  513. long m_lCookie_PERSISTSAVE;
  514. CComBSTR m_bstrIdentity;
  515. ////////////////////
  516. HRESULT onPersistLoad( DISPID, DISPPARAMS*, VARIANT* );
  517. HRESULT onPersistSave( DISPID, DISPPARAMS*, VARIANT* );
  518. public:
  519. BEGIN_COM_MAP(CPCHBehavior_STATE)
  520. COM_INTERFACE_ENTRY(IDispatch)
  521. COM_INTERFACE_ENTRY(IPCHBehaviors_State)
  522. COM_INTERFACE_ENTRY_CHAIN(CPCHBehavior)
  523. END_COM_MAP()
  524. CPCHBehavior_STATE();
  525. //
  526. // IElementBehavior
  527. //
  528. STDMETHOD(Init )( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  529. STDMETHOD(Notify)( /*[in]*/ LONG lEvent, /*[in/out]*/ VARIANT* pVar );
  530. STDMETHOD(Detach)( );
  531. //
  532. // IPCHBehaviors_State
  533. //
  534. STDMETHOD(get_stateProperty)( /*[in]*/ BSTR bstrName, /*[out, retval]*/ VARIANT *pVal );
  535. STDMETHOD(put_stateProperty)( /*[in]*/ BSTR bstrName, /*[in] */ VARIANT newVal );
  536. };
  537. /////////////////////////////////////////////////////////////////////////////
  538. class ATL_NO_VTABLE CPCHBehavior_GRADIENT : public CPCHBehavior, public IHTMLPainter
  539. {
  540. long m_lCookie;
  541. COLORREF m_clsStart;
  542. COLORREF m_clsEnd;
  543. bool m_fHorizontal;
  544. bool m_fReturnToZero;
  545. void GetColors( /*[in]*/ bool fForce );
  546. HRESULT onEvent( DISPID, DISPPARAMS*, VARIANT* );
  547. ////////////////////
  548. public:
  549. BEGIN_COM_MAP(CPCHBehavior_GRADIENT)
  550. COM_INTERFACE_ENTRY(IHTMLPainter)
  551. COM_INTERFACE_ENTRY_CHAIN(CPCHBehavior)
  552. END_COM_MAP()
  553. CPCHBehavior_GRADIENT();
  554. //
  555. // IElementBehavior
  556. //
  557. STDMETHOD(Init )( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  558. STDMETHOD(Detach)( );
  559. //
  560. // IHTMLPainter
  561. //
  562. STDMETHOD(Draw)( /*[in]*/ RECT rcBounds ,
  563. /*[in]*/ RECT rcUpdate ,
  564. /*[in]*/ LONG lDrawFlags ,
  565. /*[in]*/ HDC hdc ,
  566. /*[in]*/ LPVOID pvDrawObject );
  567. STDMETHOD(GetPainterInfo)( /*[in]*/ HTML_PAINTER_INFO *pInfo );
  568. STDMETHOD(HitTestPoint)( /*[in]*/ POINT pt ,
  569. /*[in]*/ BOOL* pbHit ,
  570. /*[in]*/ LONG* plPartID );
  571. STDMETHOD(OnResize)( /*[in]*/ SIZE pt );
  572. };
  573. /////////////////////////////////////////////////////////////////////////////
  574. class ATL_NO_VTABLE CPCHBehavior_BITMAP : public CPCHBehavior, public IHTMLPainter
  575. {
  576. CComBSTR m_bstrBaseURL;
  577. CComBSTR m_bstrImage;
  578. CComBSTR m_bstrImageNormal;
  579. CComBSTR m_bstrImageMouseOver;
  580. CComBSTR m_bstrImageMouseDown;
  581. bool m_fFlipH;
  582. bool m_fAutoRTL;
  583. HIMAGELIST m_himl;
  584. HBITMAP m_hBMP;
  585. BITMAP m_bm;
  586. LONG m_lWidth;
  587. LONG m_lHeight;
  588. bool m_fMouseOver;
  589. bool m_fMouseDown;
  590. ////////////////////
  591. void ReleaseImage( /*[in]*/ bool fOnlyIL );
  592. HRESULT GrabImage ( );
  593. HRESULT ScaleImage ( /*[in]*/ LPRECT prc );
  594. HRESULT RefreshImages();
  595. HRESULT onMouse( DISPID, DISPPARAMS*, VARIANT* );
  596. public:
  597. BEGIN_COM_MAP(CPCHBehavior_BITMAP)
  598. COM_INTERFACE_ENTRY(IHTMLPainter)
  599. COM_INTERFACE_ENTRY_CHAIN(CPCHBehavior)
  600. END_COM_MAP()
  601. CPCHBehavior_BITMAP();
  602. virtual ~CPCHBehavior_BITMAP();
  603. //
  604. // IElementBehavior
  605. //
  606. STDMETHOD(Init)( /*[in]*/ IElementBehaviorSite* pBehaviorSite );
  607. //
  608. // IHTMLPainter
  609. //
  610. STDMETHOD(Draw)( /*[in]*/ RECT rcBounds ,
  611. /*[in]*/ RECT rcUpdate ,
  612. /*[in]*/ LONG lDrawFlags ,
  613. /*[in]*/ HDC hdc ,
  614. /*[in]*/ LPVOID pvDrawObject );
  615. STDMETHOD(GetPainterInfo)( /*[in]*/ HTML_PAINTER_INFO *pInfo );
  616. STDMETHOD(HitTestPoint)( /*[in]*/ POINT pt ,
  617. /*[in]*/ BOOL* pbHit ,
  618. /*[in]*/ LONG* plPartID );
  619. STDMETHOD(OnResize)( /*[in]*/ SIZE pt );
  620. };
  621. /////////////////////////////////////////////////////////////////////////////
  622. #endif // !defined(__INCLUDED___PCH___BEHAVIORS_H___)