home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-01-02 | 5.0 KB | 139 lines | [TEXT/????] |
- //
- // CBaseSite.h
- //
- // Copyright (C) Microsoft Corporation, 1996
- //
-
- #ifndef _H_CBaseSite
- #define _H_CBaseSite
- #pragma once
-
- class CInitialDataStreamNotify; // Forward reference
- class CBindHost; // Forward reference
- class CPropertyBag; // Forward reference
-
- typedef struct
- {
- RgnHandle ClipRgn;
- Rect PortRect;
- PenState PenState;
- Int16 TextFont;
- Int16 TextMode;
- Int16 TextSize;
- Int16 TextFace;
- RGBColor ForeColor;
- RGBColor BackColor;
- }
- PortState;
-
- class CXSite:
- public CBaseCOM,
- public IContainerSite,
- public IControl,
- public IServiceProvider,
- public IThreadScheduler
- {
-
- public:
-
- // *** Construction/Destruction ***
- CXSite(void);
- ~CXSite(void);
- static CXSite* CreateSite(void);
-
- // CBaseSite methods //
- STDMETHOD (AddParam) (THIS_ Char8* inName, Char8* inValue) ;
- STDMETHOD (FindControl)(void);
- STDMETHOD (CreateControl) (THIS_ Boolean8 inDoDownload) ;
- STDMETHOD (DestroyControl)(THIS) ;
- STDMETHOD (SetContainerData)(THIS_ IUnknown* inUnkOuter, void* inContainerData) ;
- STDMETHOD (GetContainerData)(THIS_ void** outContainerData) ;
- STDMETHOD (SetBaseURL)(THIS_ Char8* inURL) ;
- STDMETHOD (SetThreadScheduler)(THIS_ ProcPtr inThreadScheduler)
- { mThreadScheduler = inThreadScheduler; return S_OK; }
-
- // *** IUnknown methods ***
- STDMETHOD(QueryInterface)(REFIID inRefID, void** outObj);
- STDMETHOD_(ULONG, AddRef)(void) { return CBaseCOM::AddRef(); }
- STDMETHOD_(ULONG, Release)(void) { return CBaseCOM::Release(); }
-
- // **** IContainerSite methods ***
- STDMETHOD (GetContainer)(THIS_ IContainer** outContainer) ;
- STDMETHOD (RequestFocus) (THIS_ Boolean8 inAcquire, FocusSet inFocus) ;
- STDMETHOD (RequestSizeChange) (THIS_ PlatformPoint* ioSize) ;
- STDMETHOD (OnChange) (THIS_ ChangeType inChangeType);
- STDMETHOD (AcquireContext) (THIS_ Uint32 inContextID, DrawContext* outContext) ;
- STDMETHOD (ReleaseContext) (THIS_ DrawContext* inContext) ;
- STDMETHOD (SetIdleTime) (Int32 WaitTicks, Uint32 IdleRefCon) ;
-
- // **** IControl methods ***
- STDMETHOD (Draw) (THIS_ DrawContext* inContext) ;
- STDMETHOD (OnContextChange)(THIS_ UInt32 inContextID, ContextCommand inCommand) ;
- STDMETHOD (GetID)(THIS_ Int32 inBufferSize, Char8* outID) ;
- STDMETHOD (GetUsedArea)(THIS_ PlatformRegion* outUsedArea);
- STDMETHOD (SetFocus)(THIS_ FocusCommand inCommand, FocusSet inFocus) ;
- STDMETHOD (DoMouse)(THIS_ MouseEventType inMouseET, PlatformEvent* inEvent) ;
- STDMETHOD (DoKey)(THIS_ KeyEventType inKeyET, Char8 inChar, PlatformEvent* inEvent) ;
- STDMETHOD (DoActivate)(THIS_ ActivateEventType inActiveET, UInt32 inContextID, PlatformEvent* inEvent) ;
- STDMETHOD (DoSystemEvent)(THIS_ PlatformEvent* inEvent) ;
- STDMETHOD (DoIdle)(THIS_ Uint32 IdleRefCon) ;
-
- // *** IServiceProvider methods ***
- STDMETHOD(QueryService)(REFGUID inRSID, REFIID inRefID, void** outObj);
-
- // **** IThreadScheduler methods ***
- STDMETHOD(GetScheduler)(THIS_ ProcPtr* outScheduler);
-
-
- /********** Public data members *************/
- CLSID m_clsid; // This control's class id
- void* m_ClientInstance; // Pointer to client instance data
- LPOLESTR m_pszCodeURL; // URL to code for this control
- DWORD m_dwMinimumVersion; // Minimum version of codebase allowed
- Boolean m_fHaveInitialStream; // TRUE if we have an initial stream
- Char8* m_BaseURL; // Base URL to data for this control
-
- #ifdef PLUGIN_ADAPTER
- CInitialDataStreamNotify *m_pInitialDataStreamNotify;
- CNetscapeStreamNotify *m_pUnattachedList;
- #endif
-
- LPUNKNOWN m_punkObject;
-
-
- protected:
-
- void SavePortState(PlatformPort* Port);
- void RestorePortState(void);
- void RemoveSite(CXSite *inSite);
- Uint32 GetCount(void);
- void FetchSite(short Index, CXSite** outSite);
- void DrawControl(void);
-
- virtual Boolean8 GetContextID (Int32 inContextIndex, UInt32* outContextID);
-
-
- /************** data members ***************/
- IUnknown* mUnkOuter; // Outer unknown
- IContainer* mContainerP; // This control's container
- void* mContainerData; // Container-specific data for this control
- Int32 mContextCount; // Number of contexts for this control
- IObjectWithSite* mObjSiteP; // Object Site interface for control
- IControl* mControlP; // Primary control interface
- CPropertyBag* mPropertyBagP; // Property bag for storing params
- CBindHost* mBindHostP; // BindHost for the site;
- ProcPtr mThreadScheduler; // Thread Scheduler for hosting application
-
- Boolean8 mHavePort; // has the port been acquired?
- GrafPtr mSavePort; // which port should be restored after release draw context
- PortState mOldPortState; // data which should be restored to the current draw context port
-
- Uint32 mCachedActiveContextID; // cached Active Context ID for delayed control instantiation
- Boolean8 mCachedDraw; // true if we were told to draw before control was created
- Boolean8 mCachedContextChange; // true if we were told to change context before control was created
- Boolean8 mDestroyed; // control has been destroyed but not site due
- // to ref counting. Added to handle aborted download
- };
-
- #endif
-