home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / com / inole2 / interfac / iviewobj.cpp < prev    next >
C/C++ Source or Header  |  1996-05-21  |  5KB  |  230 lines

  1. /*
  2.  * IVIEWOBJ.CPP
  3.  *
  4.  * Template IViewObject interface implementation.
  5.  *
  6.  * Copyright (c)1993-1995 Microsoft Corporation, All Rights Reserved
  7.  *
  8.  * Kraig Brockschmidt, Microsoft
  9.  * Internet  :  kraigb@microsoft.com
  10.  * Compuserve:  >INTERNET:kraigb@microsoft.com
  11.  */
  12.  
  13.  
  14. #include "iviewobj.h"
  15.  
  16.  
  17. /*
  18.  * CImpIViewObject::CImpIViewObject
  19.  * CImpIViewObject::~CImpIViewObject
  20.  *
  21.  * Parameters (Constructor):
  22.  *  pObj            LPVOID of the object we're in.
  23.  *  pUnkOuter       LPUNKNOWN to which we delegate.
  24.  */
  25.  
  26. CImpIViewObject::CImpIViewObject(LPVOID pObj, LPUNKNOWN pUnkOuter)
  27.     {
  28.     m_cRef=0;
  29.     m_pObj=pObj;
  30.     m_pUnkOuter=pUnkOuter;
  31.     return;
  32.     }
  33.  
  34. CImpIViewObject::~CImpIViewObject(void)
  35.     {
  36.     return;
  37.     }
  38.  
  39.  
  40.  
  41.  
  42. /*
  43.  * CImpIViewObject::QueryInterface
  44.  * CImpIViewObject::AddRef
  45.  * CImpIViewObject::Release
  46.  *
  47.  * Purpose:
  48.  *  Delegating IUnknown members for CImpIViewObject.
  49.  */
  50.  
  51. STDMETHODIMP CImpIViewObject::QueryInterface(REFIID riid
  52.     , LPVOID *ppv)
  53.     {
  54.     return m_pUnkOuter->QueryInterface(riid, ppv);
  55.     }
  56.  
  57. STDMETHODIMP_(ULONG) CImpIViewObject::AddRef(void)
  58.     {
  59.     ++m_cRef;
  60.     return m_pUnkOuter->AddRef();
  61.     }
  62.  
  63. STDMETHODIMP_(ULONG) CImpIViewObject::Release(void)
  64.     {
  65.     --m_cRef;
  66.     return m_pUnkOuter->Release();
  67.     }
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74. /*
  75.  * CImpIViewObject::Draw
  76.  *
  77.  * Purpose:
  78.  *  Draws the object on the given hDC specifically for the requested
  79.  *  aspect, device, and within the appropriate bounds.
  80.  *
  81.  * Parameters:
  82.  *  dwAspect        DWORD aspect to draw.
  83.  *  lindex          LONG index of the piece to draw.
  84.  *  pvAspect        LPVOID for extra information, always NULL.
  85.  *  ptd             DVTARGETDEVICE * containing device
  86.  *                  information.
  87.  *  hICDev          HDC containing the IC for the device.
  88.  *  hDC             HDC on which to draw.
  89.  *  pRectBounds     LPCRECTL describing the rectangle in which
  90.  *                  to draw.
  91.  *  pRectWBounds    LPCRECTL describing the placement rectangle
  92.  *                  if part of what you draw is another metafile.
  93.  *  pfnContinue     Function to call periodically during
  94.  *                  long repaints.
  95.  *  dwContinue      DWORD extra information to pass to the
  96.  *                  pfnContinue.
  97.  */
  98.  
  99. STDMETHODIMP CImpIViewObject::Draw(DWORD dwAspect, LONG lindex
  100.     , void *pvAspect, DVTARGETDEVICE *ptd, HDC hICDev
  101.     , HDC hDC, LPCRECTL pRectBounds, LPCRECTL pRectWBounds
  102.     , BOOL (CALLBACK *pfnContinue) (DWORD), DWORD dwContinue)
  103.     {
  104.     return ResultFromScode(E_NOTIMPL);
  105.     }
  106.  
  107.  
  108.  
  109.  
  110. /*
  111.  * CImpIViewObject::GetColorSet
  112.  *
  113.  * Purpose:
  114.  *  Retrieves the color palette used by the object.
  115.  *
  116.  * Parameters:
  117.  *  dwAspect        DWORD aspect of interest.
  118.  *  lindex          LONG piece of interest.
  119.  *  pvAspect        LPVOID with extra information, always NULL.
  120.  *  ptd             DVTARGETDEVICE * containing device info.
  121.  *  hICDev          HDC containing the IC for the device.
  122.  *  ppColorSet      LPLOGPALETTE * into which to return the
  123.  *                  pointer to the palette in this color set.
  124.  */
  125.  
  126. STDMETHODIMP CImpIViewObject::GetColorSet(DWORD dwDrawAspect
  127.     , LONG lindex, LPVOID pvAspect, DVTARGETDEVICE *ptd
  128.     , HDC hICDev, LPLOGPALETTE *ppColorSet)
  129.     {
  130.     return ResultFromScode(E_NOTIMPL);
  131.     }
  132.  
  133.  
  134.  
  135.  
  136.  
  137.  
  138. /*
  139.  * CImpIViewObject::Freeze
  140.  *
  141.  * Purpose:
  142.  *  Freezes the view of a particular aspect such that data
  143.  *  changes do not affect the view.
  144.  *
  145.  * Parameters:
  146.  *  dwAspect        DWORD aspect to freeze.
  147.  *  lindex          LONG piece index under consideration.
  148.  *  pvAspect        LPVOID for further information, always NULL.
  149.  *  pdwFreeze       LPDWORD in which to return the key.
  150.  */
  151.  
  152. STDMETHODIMP CImpIViewObject::Freeze(DWORD dwAspect, LONG lindex
  153.     , LPVOID pvAspect, LPDWORD pdwFreeze)
  154.     {
  155.     return ResultFromScode(E_NOTIMPL);
  156.     }
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163. /*
  164.  * CImpIViewObject::Unfreeze
  165.  *
  166.  * Purpose:
  167.  *  Thaws an aspect frozen in Freeze.
  168.  *
  169.  * Parameters:
  170.  *  dwFreeze        DWORD key returned from Freeze.
  171.  */
  172.  
  173. STDMETHODIMP CImpIViewObject::Unfreeze(DWORD dwFreeze)
  174.     {
  175.     return ResultFromScode(E_NOTIMPL);
  176.     }
  177.  
  178.  
  179.  
  180.  
  181.  
  182. /*
  183.  * CImpIViewObject::SetAdvise
  184.  *
  185.  * Purpose:
  186.  *  Provides an advise sink to the view object enabling
  187.  *  notifications for a specific aspect.
  188.  *
  189.  * Parameters:
  190.  *  dwAspects       DWORD describing the aspects of interest.
  191.  *  dwAdvf          DWORD containing advise flags.
  192.  *  pIAdviseSink    LPADVISESINK to notify.
  193.  */
  194.  
  195. STDMETHODIMP CImpIViewObject::SetAdvise(DWORD dwAspects
  196.     , DWORD dwAdvf, LPADVISESINK pIAdviseSink)
  197.     {
  198.     return ResultFromScode(E_NOTIMPL);
  199.     }
  200.  
  201.  
  202.  
  203.  
  204. /*
  205.  * CImpIViewObject::GetAdvise
  206.  *
  207.  * Purpose:
  208.  *  Returns the last known IAdviseSink seen by SetAdvise.
  209.  *
  210.  * Parameters:
  211.  *  pdwAspects      LPDWORD in which to store the last
  212.  *                  requested aspects.
  213.  *  pdwAdvf         LPDWORD in which to store the last
  214.  *                  requested flags.
  215.  *  ppIAdvSink      LPADVISESINK * in which to store the
  216.  *                  IAdviseSink.
  217.  */
  218.  
  219. STDMETHODIMP CImpIViewObject::GetAdvise(DWORD *pAspects
  220.     , DWORD *pAdvf, LPADVISESINK *ppAdvSink)
  221.     {
  222.     return ResultFromScode(E_NOTIMPL);
  223.     }
  224.  
  225.  
  226.  
  227.  
  228.  
  229.  
  230.