home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / BOCOLE.PAK / BOCXCTRL.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  4.8 KB  |  148 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectComponents
  3. // Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
  4. //
  5. // $Revision:   2.7  $
  6. //
  7. //  Implements the Bolero half of the OLE2 Control
  8. //
  9. //  BOleControlSite objects impersonate the client application (Container)
  10. //    from the point of view of the Bolero customer who's
  11. //    writing a control (IBPart and IBControl)
  12. //    BOleControlSite aggregate BOleSite or BOleInProcServer and provide
  13. //    implementation for control specific interfaces.
  14. //    BOleControlSite uses IBControl to talk to the control whereas
  15. //    the aggregated BOleInProcServer (BOleSite) uses IBpart.
  16. //    In consequence a control must implement both IBPart and IBControl.
  17. //----------------------------------------------------------------------------
  18. #ifndef _BOCXCTRL_H
  19. #define _BOCXCTRL_H 
  20.  
  21. #ifndef _BOLEIPS_H
  22. #include <BOleIPS.h>
  23. #endif
  24.  
  25. #ifndef _OLECTL_H_
  26. #include <olectl.h>
  27. #endif
  28.  
  29. #define BOLE_USE_LIGHT             0
  30. #define BOLE_USE_EXE               1
  31. #define BOLE_USE_DLL               2
  32.  
  33. #define BOLE_DEFAULT_ENUM_SIZE         10
  34.  
  35.  
  36. //****************************************************************
  37. //  class BEventList
  38. //
  39. //****************************************************************
  40. class _ICLASS BEventList : public IEnumConnectionPoints
  41. {
  42.  
  43.   public:
  44.  
  45.     BEventList (UINT = BOLE_DEFAULT_ENUM_SIZE);
  46.     ~BEventList ();
  47.  
  48.     //**** IUnknown methods ****
  49.     ULONG _IFUNC AddRef ();
  50.     ULONG _IFUNC Release ();
  51.     HRESULT _IFUNC QueryInterface(REFIID, LPVOID FAR*);
  52.  
  53.     //**** IEnumConnectionPoints methods ****
  54.     HRESULT _IFUNC Next (ULONG, LPCONNECTIONPOINT FAR*, ULONG FAR*);
  55.     HRESULT _IFUNC Skip (ULONG);
  56.     HRESULT _IFUNC Reset ();
  57.     HRESULT _IFUNC Clone (LPENUMCONNECTIONPOINTS FAR*);
  58.  
  59.     // public functions
  60.     inline IConnectionPoint* operator [] (int nPos) { return pConnectionPoints[nPos]; }
  61.     HRESULT AddEventsSet (REFIID, LPUNKNOWN, UINT);
  62.     HRESULT Add (LPCONNECTIONPOINT);
  63.     void FreezeAll (bool);
  64.  
  65.   private:
  66.     BEventList (BEventList*);
  67.     int Expand ();
  68.  
  69.   private:
  70.     IConnectionPoint ** pConnectionPoints;
  71.     int nCurrPos;
  72.     int nSize;
  73.  
  74.     // lifetime counter
  75.     DWORD cRef;
  76. };
  77.  
  78. //****************************************************************
  79. //  class BOleControlSite
  80. //
  81. //****************************************************************
  82. class _ICLASS BOleControlSite : public BOleComponent,
  83.                       public IBControlSite,
  84.                       public IOleControl,
  85.                       public IProvideClassInfo,
  86.                       public IPersistStreamInit,
  87.                       public IBEventsHandler,
  88.                       public IConnectionPointContainer
  89. {
  90.  
  91.   public:
  92.     BOleControlSite (BOleClassManager *, IBUnknownMain *);
  93.     ~BOleControlSite();
  94.  
  95.     //**** IUnknown methods ****
  96.     DEFINE_IUNKNOWN(pObjOuter)
  97.     virtual HRESULT _IFUNC QueryInterfaceMain(REFIID, LPVOID FAR*);
  98.  
  99.     //**** IBControlSite methods ****
  100.     HRESULT _IFUNC Init (UINT, IBControl*,UINT);
  101.     HRESULT _IFUNC OnPropertyChanged (DISPID);
  102.     HRESULT _IFUNC OnPropertyRequestEdit (DISPID dispid);
  103.     HRESULT _IFUNC OnControlFocus (BOOL);
  104.     HRESULT _IFUNC TransformCoords (POINTL FAR* lpptlHimetric,
  105.                             TPOINTF FAR* lpptfContainer, DWORD flags);
  106.  
  107.     //**** IOleControl methods ****
  108.     HRESULT _IFUNC GetControlInfo (LPCONTROLINFO);
  109.     HRESULT _IFUNC OnMnemonic (LPMSG);
  110.     HRESULT _IFUNC OnAmbientPropertyChange (DISPID);
  111.     HRESULT _IFUNC FreezeEvents (BOOL);
  112.  
  113.     //**** IProvideClassInfo methods ****
  114.     HRESULT _IFUNC GetClassInfo (LPTYPEINFO FAR*);
  115.  
  116.     //**** IPersistStreamInit methods ****
  117.     HRESULT _IFUNC GetClassID (LPCLSID);
  118.     HRESULT _IFUNC IsDirty ();
  119.     HRESULT _IFUNC Load(LPSTREAM);
  120.     HRESULT _IFUNC Save (LPSTREAM, BOOL);
  121.     HRESULT _IFUNC GetSizeMax (ULARGE_INTEGER FAR*);
  122.     HRESULT _IFUNC InitNew ();
  123.  
  124.     //**** IBEventsHandler methods ****
  125.     HRESULT _IFUNC RegisterEventsSet (REFIID, UINT);
  126.     HRESULT _IFUNC RegisterConnectionPoint (LPCONNECTIONPOINT);
  127.     HRESULT _IFUNC GetSinkListForIID (REFIID, IBSinkList**);
  128.  
  129.     //**** IConnectionPointContainer methods ****
  130.     HRESULT _IFUNC EnumConnectionPoints (LPENUMCONNECTIONPOINTS FAR*);
  131.     HRESULT _IFUNC FindConnectionPoint (REFIID, LPCONNECTIONPOINT FAR*);
  132.  
  133.   private:
  134.     IBUnknownMain* pObjInner; // IUnknown of the aggregated Bolero Helper
  135.     BEventList * pEventList; // ConnectionPoints list
  136.  
  137.     IOleControlSite * pControlSite; // talk to the container
  138.  
  139.     IBControl * pControl; // talk to the control
  140.     
  141.     bool fRegConnPoint; // true if a control registered its own connection point
  142.     IBDataState* pDataDirty;
  143.  
  144. };
  145.  
  146. #endif
  147.  
  148.