Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Namespace Members | Class Members | File Members

GraphBase.cpp

Go to the documentation of this file.
00001 //
00002 // GraphBase.cpp
00003 //
00004 // Copyright (c) Shareaza Development Team, 2002-2005.
00005 // This file is part of SHAREAZA (www.shareaza.com)
00006 //
00007 // Shareaza is free software; you can redistribute it
00008 // and/or modify it under the terms of the GNU General Public License
00009 // as published by the Free Software Foundation; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // Shareaza is distributed in the hope that it will be useful,
00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015 // GNU General Public License for more details.
00016 //
00017 // You should have received a copy of the GNU General Public License
00018 // along with Shareaza; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020 //
00021 
00022 #include "StdAfx.h"
00023 #include "Shareaza.h"
00024 #include "GraphBase.h"
00025 
00026 #ifdef _DEBUG
00027 #undef THIS_FILE
00028 static char THIS_FILE[]=__FILE__;
00029 #define new DEBUG_NEW
00030 #endif
00031 
00032 
00034 // CGraphBase construction
00035 
00036 CGraphBase::CGraphBase()
00037 {
00038         m_hOldImage = NULL;
00039         m_szImage       = CSize( 0, 0 );
00040         m_hOldImage     = NULL;
00041 }
00042 
00043 CGraphBase::~CGraphBase()
00044 {
00045         if ( m_hOldImage )
00046         {
00047                 m_pDC.SelectObject( CBitmap::FromHandle( m_hOldImage ) );
00048                 m_pDC.DeleteDC();
00049                 m_pImage.DeleteObject();
00050                 m_hOldImage = NULL;
00051         }
00052 }
00053 
00055 // CGraphBase defaults
00056 
00057 void CGraphBase::CreateDefaults()
00058 {
00059 }
00060 
00062 // CGraphBase serialize
00063 
00064 void CGraphBase::Serialize(CArchive& ar)
00065 {
00066 }
00067 
00069 // CGraphBase update
00070 
00071 BOOL CGraphBase::Update()
00072 {
00073         return FALSE;
00074 }
00075 
00077 // CGraphBase clear
00078 
00079 void CGraphBase::Clear()
00080 {
00081 }
00082 
00084 // CGraphBase paint
00085 
00086 void CGraphBase::Paint(CDC* pDC, CRect* pRect)
00087 {
00088 }
00089 
00091 // CGraphBase buffered paint
00092 
00093 void CGraphBase::BufferedPaint(CDC* pDC, CRect* pRect)
00094 {
00095         CSize sz = pRect->Size();
00096 
00097         if ( sz.cx < 0 || sz.cy < 0 ) return;
00098 
00099         if ( sz != m_szImage || m_hOldImage == NULL )
00100         {
00101                 if ( m_hOldImage != NULL )
00102                 {
00103                         m_pDC.SelectObject( CBitmap::FromHandle( m_hOldImage ) );
00104                         m_pDC.DeleteDC();
00105                         m_pImage.DeleteObject();
00106                 }
00107 
00108                 m_szImage = sz;
00109                 m_pImage.CreateCompatibleBitmap( pDC, sz.cx, sz.cy );
00110                 m_pDC.CreateCompatibleDC( pDC );
00111                 m_hOldImage = (HBITMAP)m_pDC.SelectObject( &m_pImage )->GetSafeHandle();
00112         }
00113 
00114         CRect rc( 0, 0, sz.cx, sz.cy );
00115         Paint( &m_pDC, &rc );
00116 
00117         pDC->BitBlt( pRect->left, pRect->top, sz.cx, sz.cy, &m_pDC, 0, 0, SRCCOPY );
00118 }

Generated on Thu Dec 15 10:39:43 2005 for Shareaza 2.2.1.0 by  doxygen 1.4.2