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

  1. //----------------------------------------------------------------------------
  2. // ObjectComponents
  3. // Copyright (c) 1994, 1996 by Borland International, All Rights Reserved
  4. //
  5. // $Revision:   2.10  $
  6. //
  7. //  Implements the Bolero half of the OLE2 control object.
  8. //    BOleControl objects impersonate the OCX from the point of view of the 
  9. //    Bolero customer who's writing a OCX container.
  10. //----------------------------------------------------------------------------
  11. #ifndef _BOLECTRL_H
  12. #define _BOLECTRL_H 
  13.  
  14. #ifndef _BOLEPART_H
  15. #include "BOlePart.h"
  16. #endif
  17.  
  18.  
  19. class _ICLASS BOleControl : public IBControl,
  20.                             public BOlePart,
  21.                             public IOleControlSite,
  22.                             public IPropertyNotifySink
  23. {
  24. protected:
  25.    IDispatch     *pIEvents;
  26.    IDispatch     *pIAmbients;
  27.    IDispatch     *pCtrlDispatch;
  28.    IOleControl   *pOleCtrl;
  29.    IBControlSite *pCSite;
  30.    BOleControl   *pNextCtrl, *pPrevCtrl;
  31.  
  32.    IID            iidEvents;   // iid for object's events interface
  33.    DWORD          ConnEvents;  // returned from connection point advise
  34.    DWORD          ConnProp;    // returned from connection point advise
  35.    CONTROLINFO    CtrlInfo;
  36.       
  37.    BOOL    ObjectEventsIID (IID *piid);
  38.    HRESULT InvokeStdMethod (DISPID id);
  39.  
  40. private:
  41.   void AddToCtrlList ();
  42.   void RemoveFromCtrlList ();
  43.  
  44. public:
  45.    BOleControl (BOleClassManager *pF, IBUnknownMain * pO, BOleDocument * pOD);
  46.    ~BOleControl ();
  47.  
  48.    BOleControl *GetNextControl () {return pNextCtrl;}
  49.    IOleControl *GetOleControl ()  {return pOleCtrl;}
  50.    HRESULT     _IFUNC BOleCreate (BOleInitInfo *pBI, DWORD dwRenderOpt, 
  51.                                                       LPVOID FAR *ppv);
  52.  
  53. // IBControl methods
  54.    virtual HRESULT _IFUNC GetEventIID (IID *iidEvent);
  55.    virtual HRESULT _IFUNC GetEventTypeInfo (LPTYPEINFO *ppTypeInfo);
  56.    virtual HRESULT _IFUNC GetCtrlDispatch (IDispatch FAR * FAR *ppDispatch);
  57.    virtual HRESULT _IFUNC SetEventDispatch (IDispatch *);
  58.    virtual HRESULT _IFUNC SetAmbientDispatch (IDispatch *);
  59.    virtual HRESULT _IFUNC AmbientChanged (DISPID dispid);
  60.  
  61.    // standard control methods - other methods by IDispatch
  62.    virtual HRESULT _IFUNC Refresh ();
  63.    virtual HRESULT _IFUNC DoClick ();
  64.    virtual HRESULT _IFUNC AboutBox ();
  65.  
  66.         // function passed down by BOleControlSite (typically NOIMPL) here
  67.    virtual HRESULT _IFUNC GetControlInfo (LPCONTROLINFO pCI);
  68.    virtual HRESULT _IFUNC OnMnemonic (LPMSG pMsg);
  69.    virtual HRESULT _IFUNC FreezeEvents (BOOL bFreeze);
  70.    virtual HRESULT _IFUNC GetClassInfo (LPTYPEINFO FAR* ppTI);
  71.    virtual HRESULT _IFUNC GetSizeMax (ULARGE_INTEGER FAR*);
  72.    virtual HRESULT _IFUNC Save (LPSTREAM);
  73.  
  74. public:
  75.    // IUnknown Methods
  76.    DEFINE_IUNKNOWN(pObjOuter);
  77.    virtual HRESULT _IFUNC QueryInterfaceMain(REFIID iid, LPVOID FAR* pif);
  78.  
  79. // IOleControlSite methods
  80.    HRESULT _IFUNC OnControlInfoChanged (void);
  81.    HRESULT _IFUNC LockInPlaceActive (BOOL fLock);
  82.    HRESULT _IFUNC GetExtendedControl (LPDISPATCH FAR* ppDisp);
  83.    HRESULT _IFUNC TransformCoords (POINTL FAR* lpptlHimetric,
  84.                                  POINTF FAR* lpptfContainer, DWORD flags);
  85.    HRESULT _IFUNC TranslateAccelerator (LPMSG lpMsg, DWORD grfModifiers);
  86.    HRESULT _IFUNC OnFocus (BOOL fGotFocus);
  87.    HRESULT _IFUNC ShowPropertyFrame (void);
  88.  
  89.    // IPropertyNotifySink methods
  90.    HRESULT _IFUNC OnChanged (DISPID dispid);
  91.    HRESULT _IFUNC OnRequestEdit (DISPID dispid);
  92.  
  93. public:
  94. // IBPart methods
  95.    virtual HRESULT _IFUNC Init(PIBSite, BOleInitInfo FAR*);
  96.  
  97.    virtual HRESULT _IFUNC Open (BOOL bOpen)                {return BOlePart::Open (bOpen);};
  98.    virtual HRESULT _IFUNC Show (BOOL bShow)                {return BOlePart::Show (bShow);};
  99.    virtual HRESULT _IFUNC Close ()                         {return BOlePart::Close ();}
  100.    virtual HRESULT _IFUNC Activate (BOOL fActivate)        {return BOlePart::Activate (fActivate);}
  101.    virtual HWND    _IFUNC OpenInPlace (HWND hWnd)          {return BOlePart::OpenInPlace (hWnd);}
  102.    virtual HRESULT _IFUNC CanOpenInPlace ()                {return BOlePart::CanOpenInPlace ();}
  103.    virtual HRESULT _IFUNC GetPalette (LPLOGPALETTE FAR*ppPal) {return BOlePart::GetPalette (ppPal);};
  104.    virtual HRESULT _IFUNC SetHost (IBContainer FAR *pObjContainer) {return BOlePart::SetHost (pObjContainer);};
  105.    virtual LPOLESTR _IFUNC GetName (BOlePartName nameCode) {return BOlePart::GetName (nameCode);};
  106.    virtual HRESULT _IFUNC GetPartSize (LPSIZE pSize)       {return BOlePart::GetPartSize (pSize);};
  107.    virtual HRESULT _IFUNC SetPartSize (LPSIZE pSize)       {return BOlePart::SetPartSize (pSize);} ;
  108.    virtual HRESULT _IFUNC SetPartPos (LPRECT pRect)        {return BOlePart::SetPartPos (pRect);};
  109.    virtual HRESULT _IFUNC Draw (HDC hdc, LPCRECTL lpExtent, LPCRECTL lpClip, BOleAspect aspect, BOleDraw flags) \
  110.                      {return BOlePart::Draw (hdc, lpExtent, lpClip, aspect, flags);};
  111.    virtual HRESULT _IFUNC InsertMenus (HMENU, BOleMenuWidths*)  {return ResultFromScode (E_NOTIMPL);};
  112.    virtual void    _IFUNC FrameResized (const RECT *, BOOL) {};
  113.    virtual HRESULT _IFUNC ShowTools (BOOL)                 {return ResultFromScode (E_NOTIMPL);};
  114.    virtual HRESULT _IFUNC EnumVerbs (BOleVerb *pV)         {return BOlePart::EnumVerbs (pV);};
  115.    virtual HRESULT _IFUNC DragFeedback(POINT*,BOOL)        {return ResultFromScode (E_NOTIMPL);};
  116.    virtual HRESULT _IFUNC DoVerb (UINT verb)               {return BOlePart::DoVerb (verb);};
  117.    virtual HRESULT _IFUNC DoQueryInterface(REFIID iid, void FAR* FAR* pif)   {return BOlePart::DoQueryInterface(iid, pif);};
  118.  
  119. //Clipboard methods inherited from IBDataProvider
  120.    virtual UINT    _IFUNC CountFormats ()                  {return BOlePart::CountFormats();};
  121.    virtual HRESULT _IFUNC GetFormat (UINT i, BOleFormat *Fmt)  {return BOlePart::GetFormat (i, Fmt);};
  122.    virtual HANDLE  _IFUNC GetFormatData (BOleFormat *pf)   {return BOlePart::GetFormatData (pf);};
  123.    virtual HRESULT _IFUNC Save (PIStorage pStg, BOOL fLoad, BOOL fRemember)  \
  124.                      {return BOlePart::Save (pStg, fLoad, fRemember);};
  125.  
  126. };
  127.  
  128.  
  129. #endif
  130.