/***************************************************************************
 *                          Zanoza Modeler v2.x                            *
 *      This is unpublished propietary source code of Zanoza Software.     *
 *      The copyright notice does not evidence any actual or intended      *
 *                    publication of such source code.                     *
 *                                                                         *
 *                Copyright (c) 2002-2003 Zanoza Software.                 *
 *                                                                         *
 *                        All rights reserved.                             *
 ***************************************************************************
 *--------------------------------------------------------------------------
 * @author:   Oleg M.
 *--------------------------------------------------------------------------
 * @purpose:  ZModeler 2.x IViewport=>CDC* extraction class
 *--------------------------------------------------------------------------
 * @histroy: 04.08.2003. Created
 */
#ifndef viewportdchelper_h_included
#define viewportdchelper_h_included

#include <zmodeler.h>
#include <core/ui/IViewport.h>

//------------------------------------------------------------------
//
// @Description : IViewport->CDC class
// @Purpose     : Extracts CDC from IViewport
//
//------------------------------------------------------------------
class DLL_LINKAGE CViewportDC
{
public:
  CViewportDC(core::IProcParams* pProcParams);
  CViewportDC(core::ui::IViewport* pViewport);
  virtual ~CViewportDC();
public:
  inline bool operator! () { return m_pDC == NULL; }
  inline CDC* operator->() { return m_pDC; }
private:
  ZStdPtr<CWnd> m_pWnd;
  ZStdPtr<CDC>  m_pDC;
};//class


#ifndef ZM_NO_GDIPLUS
class DLL_LINKAGE CViewportGraphics
{
public:
  CViewportGraphics(core::IProcParams* pProcParams);
  CViewportGraphics(core::ui::IViewport* pViewport);
  virtual ~CViewportGraphics();
public:
  inline bool operator! () { return m_pGraph == NULL; }
  inline Gdiplus::Graphics* operator->() { return m_pGraph; }
private:
  ZStdPtr<CWnd>               m_pWnd;
  ZStdPtr<CDC>                m_pDC;
  ZStdPtr<Gdiplus::Graphics>  m_pGraph;
};//class
#endif //ZM_NO_GDIPLUS

#endif //viewportdchelper_h_included



