home *** CD-ROM | disk | FTP | other *** search
/ The Net: Ultimate Internet Guide / WWLCD1.ISO / mac / SiteBldr / AMOVIE / SDK / _SETUP / COMMON.Z / textout.h < prev    next >
Encoding:
Text File  |  1996-05-16  |  3.7 KB  |  93 lines

  1. //==========================================================================;
  2. //
  3. //  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  4. //  KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  5. //  IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  6. //  PURPOSE.
  7. //
  8. //  Copyright (c) 1992 - 1996  Microsoft Corporation.  All Rights Reserved.
  9. //
  10. //--------------------------------------------------------------------------;
  11.  
  12. // You MUST change this when adapting this sample!
  13. // Run uuidgen.exe from any SDK to get a new GUID
  14.  
  15. DEFINE_GUID(CLSID_PlainText,
  16. 0x48025242, 0x2d39, 0x11ce, 0x87, 0x5d, 0x0, 0x60, 0x8c, 0xb7, 0x80, 0x66);
  17.  
  18. class CTextOutFilter;
  19. class CTextOutWindow;
  20.  
  21. // These are our video window styles
  22.  
  23. const LPTSTR TextClassName = TEXT("TextRendererBaseClass");
  24. const DWORD TextClassStyles = (CS_HREDRAW | CS_VREDRAW | CS_BYTEALIGNCLIENT);
  25. const DWORD TextWindowStyles = (WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN);
  26.  
  27. // Derived class handling window interactions. We did have the main renderer
  28. // object inheriting from CBaseControlWindow so that we didn't have to have
  29. // a separate class but that means there are two many classes derived from
  30. // CUnknown, so when in the final text out filter class you call something
  31. // like GetOwner it gets really confusing to know who is actually going to
  32. // be called. So in the end we made it a separate class for the window. We
  33. // have to specialise the base class to provide the PURE virtual method that
  34. // returns the class and window information (GetClassWindowStyles). We are
  35. // also interested in certain window messages like WM_PAINT and WM_NCHITTEST
  36.  
  37. class CTextOutWindow : public CBaseControlWindow
  38. {
  39.     CTextOutFilter *m_pRenderer;
  40.  
  41. public:
  42.  
  43.     CTextOutWindow(TCHAR *pName,                 // Object description
  44.                    LPUNKNOWN pUnk,               // Normal COM ownership
  45.                    HRESULT *phr,                 // OLE failure code
  46.                    CCritSec *pLock,              // Our interface Lock
  47.                    CTextOutFilter *pRenderer);   // Delegates locking to
  48.  
  49.     ~CTextOutWindow();
  50.     BOOL OnClose();
  51.  
  52.     LRESULT OnReceiveMessage(HWND hwnd,             // Window handle
  53.                              UINT uMsg,             // Message ID
  54.                              WPARAM wParam,         // First parameter
  55.                              LPARAM lParam);        // Other parameter
  56.  
  57.     LPTSTR GetClassWindowStyles(DWORD *pClassStyles,
  58.                                 DWORD *pWindowStyles,
  59.                                 DWORD *pWindowStylesEx);
  60. };
  61.  
  62. // Overall filter object for the text renderer. We have to provide our own
  63. // version of NonDelegatingQueryInterface so that we can expose not only the
  64. // interfaces supported by the base renderer but also pass on queries for
  65. // IVideoWindow to our window handling class (m_TextWindow). The rest of the
  66. // methods we override are pretty dull, dealing with type checking and so on
  67.  
  68. class CTextOutFilter : public CBaseRenderer
  69. {
  70.     CTextOutWindow m_TextWindow;
  71.  
  72. public:
  73.  
  74.     static CUnknown *CreateInstance(LPUNKNOWN pUnk, HRESULT *phr);
  75.  
  76.     // setup helper
  77.     LPAMOVIESETUP_FILTER GetSetupData();
  78.  
  79.     CTextOutFilter(LPUNKNOWN pUnk,HRESULT *phr);
  80.     ~CTextOutFilter();
  81.     STDMETHODIMP NonDelegatingQueryInterface(REFIID, void **);
  82.  
  83.     STDMETHODIMP Pause();
  84.     HRESULT BreakConnect();
  85.     HRESULT CheckMediaType(const CMediaType *pmt);
  86.     BOOL OnPaint(COLORREF WindowColour);
  87.     HRESULT DoRenderSample(IMediaSample *pMediaSample);
  88.     void OnReceiveFirstSample(IMediaSample *pMediaSample);
  89.     void DrawText(IMediaSample *pMediaSample);
  90. };
  91.  
  92. 
  93.