/////////////////////////////////////////////////////////////////////////////
// Name: dcclient.cpp
// Purpose: wxClientDC class
-// Author: Julian Smart
+// Author: David Webster
// Modified by:
-// Created: 01/02/97
+// Created: 09/21/99
// RCS-ID: $Id$
-// Copyright: (c) Julian Smart and Markus Holzem
+// Copyright: (c) David Webster
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// headers
// ----------------------------------------------------------------------------
-#ifdef __GNUG__
- #pragma implementation "dcclient.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#ifdef __BORLANDC__
- #pragma hdrstop
-#endif
-
#include "wx/string.h"
#include "wx/log.h"
#include "wx/window.h"
// macros
// ----------------------------------------------------------------------------
-#if !USE_SHARED_LIBRARY
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
-#endif
// ----------------------------------------------------------------------------
// global variables
wxWindowDC::wxWindowDC()
{
- m_canvas = NULL;
+ m_pCanvas = NULL;
}
wxWindowDC::wxWindowDC(wxWindow *the_canvas)
{
- m_canvas = the_canvas;
+ m_pCanvas = the_canvas;
m_hDC = (WXHDC) ::WinOpenWindowDC(GetWinHwnd(the_canvas) );
- m_hDCCount++;
+ m_nDCCount++;
//
// default under PM is that Window and Client DC's are the same
// so we offer a separate Presentation Space to use for the
);
::GpiAssociate(m_hPS, NULLHANDLE);
::GpiAssociate(m_hPS, m_hDC);
- SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
+ SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID));
}
wxWindowDC::~wxWindowDC()
{
- if (m_canvas && m_hDC)
+ if (m_pCanvas && m_hDC)
{
SelectOldObjects(m_hDC);
m_hDC = NULLHANDLE;
}
- m_hDCCount--;
+ m_nDCCount--;
}
// ----------------------------------------------------------------------------
wxClientDC::wxClientDC()
{
- m_canvas = NULL;
+ m_pCanvas = NULL;
}
wxClientDC::wxClientDC(wxWindow *the_canvas)
{
- m_canvas = the_canvas;
+ m_pCanvas = the_canvas;
//
// default under PM is that Window and Client DC's are the same
//
// Default mode is BM_LEAVEALONE so we make no call Set the mix
//
- SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
+ SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID));
}
wxClientDC::~wxClientDC()
{
- if ( m_canvas && GetHdc() )
+ if ( m_pCanvas && GetHdc() )
{
SelectOldObjects(m_hDC);
wxPaintDC::wxPaintDC()
{
- m_canvas = NULL;
+ m_pCanvas = NULL;
m_hDC = 0;
}
wxPaintDC::wxPaintDC(wxWindow *canvas)
{
- wxCHECK_RET( canvas, T("NULL canvas in wxPaintDC ctor") );
+ wxCHECK_RET( canvas, wxT("NULL canvas in wxPaintDC ctor") );
#ifdef __WXDEBUG__
if ( g_isPainting <= 0 )
{
- wxFAIL_MSG( T("wxPaintDC may be created only in EVT_PAINT handler!") );
+ wxFAIL_MSG( wxT("wxPaintDC may be created only in EVT_PAINT handler!") );
return;
}
#endif // __WXDEBUG__
- m_canvas = canvas;
+ m_pCanvas = canvas;
// do we have a DC for this window in the cache?
wxPaintDCInfo *info = FindInCache();
}
else // not in cache, create a new one
{
- m_hDC = (WXHDC)::WinBeginPaint(GetWinHwnd(m_canvas), NULLHANDLE, &g_paintStruct);
- ms_cache.Add(new wxPaintDCInfo(m_canvas, this));
+ m_hDC = (WXHDC)::WinBeginPaint(GetWinHwnd(m_pCanvas), NULLHANDLE, &g_paintStruct);
+ ms_cache.Add(new wxPaintDCInfo(m_pCanvas, this));
}
- SetBackground(wxBrush(m_canvas->GetBackgroundColour(), wxSOLID));
+ SetBackground(wxBrush(m_pCanvas->GetBackgroundColour(), wxSOLID));
}
wxPaintDC::~wxPaintDC()
size_t index;
wxPaintDCInfo *info = FindInCache(&index);
- wxCHECK_RET( info, T("existing DC should have a cache entry") );
+ wxCHECK_RET( info, wxT("existing DC should have a cache entry") );
if ( !--info->count )
{
for ( size_t n = 0; n < nCache; n++ )
{
info = &ms_cache[n];
- if ( info->hwnd == m_canvas->GetHWND() )
+ if ( info->hwnd == m_pCanvas->GetHWND() )
{
if ( index )
*index = n;