home *** CD-ROM | disk | FTP | other *** search
/ Troubleshooting Netware Systems / CSTRIAL0196.BIN / attach / msj / v10n04 / olecont.exe / CNTLITEM.H < prev    next >
C/C++ Source or Header  |  1995-04-01  |  5KB  |  137 lines

  1. ///////////////////////////////////////////////////////////////////////////
  2. // CNTLITEM.H -- Prototypes and declarations for the CControlItem class.
  3. //        This class processes OLE Custom Control Events and allows a
  4. //        container to add in event handling capability without a lot of fuss.
  5.  
  6.  
  7. #ifndef __CNTLITEM_H__
  8. #define __CNTLITEM_H__
  9.  
  10. ///////////////////////////////////////////////////////////////////////////
  11. // classes declared in this file.
  12.  
  13. // class COleClientItem;    // MFC OLE Item Class
  14.     class CControlItem;    // Provides OCX Container Item Support
  15.  
  16.                                                           
  17. ///////////////////////////////////////////////////////////////////////////
  18. // forward declarations
  19.  
  20. class CContainerDoc;
  21. class CContainerView;
  22.  
  23.                                                           
  24.                                                           
  25. ///////////////////////////////////////////////////////////////////////////
  26. // class CControlItem
  27.  
  28. class CControlItem : public COleClientItem
  29. {
  30.     DECLARE_SERIAL(CControlItem)
  31.  
  32. // Constructors
  33. public:
  34.     CControlItem(CContainerDoc* pContainerDoc = NULL);
  35.     virtual      ~CControlItem();      
  36.     
  37. // Attributes
  38. public:  
  39.     // Event Information
  40.     DISPPARAMS    m_LastParams;              
  41.     DISPID        m_EventID;   
  42.     
  43.     DISPPARAMS FAR*     GetParams() { return &m_LastParams; };
  44.  
  45. protected:                          
  46.     // Attributes for the event connection and information
  47.     LPCONNECTIONPOINT     m_pConnPt;
  48.     DWORD                 m_dwEventConnection;
  49.     USHORT                 m_nEvents;
  50.     EVENTINFO*             m_pEventInfo;
  51.     LPDISPATCH            m_pCtlDispatch;
  52.  
  53.     // Attributes for the data binding notification connection
  54.     LPCONNECTIONPOINT     m_pConnPtrBind;
  55.     DWORD                m_dwBindConnection;
  56.     USHORT                m_nBinds;
  57.     BINDINFO*            m_pBindInfo;
  58.  
  59. public:
  60.     // Attributes for the OLE event interface
  61.     virtual LPUNKNOWN     GetInterfaceHook(const void FAR* iid);
  62.     LPUNKNOWN            GetCtlInterface(IID iidRequested);
  63.     
  64. protected:    
  65.     IID                    m_iidEvents;
  66.  
  67.  
  68. // Operations
  69. public:
  70.     // Handler routines for Events and Property Notifications
  71.     // At some point, this could be replaced by maps, but not here.
  72.     virtual void     OnEvent(DISPID dispID, DISPPARAMS FAR* pDispParams);
  73.     virtual HRESULT    OnPropertyNotification(DISPID dispID, UINT idsOccurence);
  74.  
  75.     void            CleanUpParams();
  76.     void            CopyParams(DISPPARAMS FAR* lpDispparams);
  77.     
  78. // Overrides
  79. protected:
  80.     virtual         BOOL FinishCreate(HRESULT hr);
  81.     virtual         void Release(OLECLOSE dwCloseOption = OLECLOSE_NOSAVE);
  82.  
  83.  
  84. // Implementation
  85. protected:     
  86. #ifdef _DEBUG
  87.     virtual void AssertValid() const;
  88.     virtual void Dump(CDumpContext& dc) const;
  89. #endif
  90.     
  91.     // Control Initialization Routines
  92.     void         InitControlInfo();
  93.     void         InitEventInfo(LPTYPEINFO);
  94.     void        InitBindInfo();
  95.  
  96.     // Control Maintenance Routines
  97.     void         FreeControlInfo();
  98.     EVENTINFO*     GetEventInfo(MEMBERID memid);
  99.     PARAMPROPINFO* GetParamPropInfo(DISPID id);
  100.  
  101. // Implemented Interfaces
  102. protected:
  103.     // Interface for Event Handling
  104.     BEGIN_INTERFACE_PART(EventHandler, IDispatch)
  105.         STDMETHOD(GetTypeInfoCount)(unsigned int FAR*);
  106.         STDMETHOD(GetTypeInfo)(unsigned int, LCID, ITypeInfo FAR* FAR*);
  107.         STDMETHOD(GetIDsOfNames)(REFIID, LPTSTR FAR*, unsigned int, LCID, DISPID FAR*);
  108.         STDMETHOD(Invoke)(DISPID, REFIID, LCID, unsigned short, DISPPARAMS FAR*,
  109.                           VARIANT FAR*, EXCEPINFO FAR*, unsigned int FAR*);
  110.     END_INTERFACE_PART(EventHandler)
  111.  
  112.     // Interface for Property Notifications
  113.     BEGIN_INTERFACE_PART(PropertyNotifySink, IPropertyNotifySink)
  114.         STDMETHOD(OnChanged)(DISPID dispid);
  115.         STDMETHOD(OnRequestEdit)(DISPID dispid);
  116.     END_INTERFACE_PART(PropertyNotifySink)
  117.  
  118.     // Interface for Ambient Properties
  119.     BEGIN_INTERFACE_PART(AmbientProps, IDispatch)
  120.         STDMETHOD(GetTypeInfoCount)(unsigned int FAR*);
  121.         STDMETHOD(GetTypeInfo)(unsigned int, LCID, ITypeInfo FAR* FAR*);
  122.         STDMETHOD(GetIDsOfNames)(REFIID, LPTSTR FAR*, unsigned int, LCID, DISPID FAR*);
  123.         STDMETHOD(Invoke)(DISPID, REFIID, LCID, unsigned short, DISPPARAMS FAR*,
  124.                           VARIANT FAR*, EXCEPINFO FAR*, unsigned int FAR*);
  125.     END_INTERFACE_PART(AmbientProps)
  126.  
  127.     DECLARE_INTERFACE_MAP()
  128. };
  129.  
  130. ///////////////////////////////////////////////////////////////////////////
  131.  
  132. #endif // __CNTLITEM_H__
  133.  
  134. ///////////////////////////////////////////////////////////////////////////
  135.  
  136.  
  137.