]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/dcclient.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Vaclav Slavik
6 // Copyright: (c) 2001 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
11 #pragma implementation "dcclient.h"
14 // For compilers that support precompilation, includes "wx.h".
15 #include "wx/wxprec.h"
22 #include "wx/dcclient.h"
23 #include "wx/window.h"
28 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC
, wxDC
)
29 IMPLEMENT_DYNAMIC_CLASS(wxClientDC
,wxWindowDC
)
30 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC
, wxClientDC
)
32 wxWindowDC::wxWindowDC(wxWindow
*win
) : m_wnd(win
)
34 MGLDevCtx
*dc
= win
->GetPaintMGLDC();
37 m_inPaintHandler
= TRUE
;
42 m_inPaintHandler
= FALSE
;
43 SetMGLDC(new MGLDevCtx(MGL_wmBeginPaint(m_wnd
->GetHandle())), TRUE
);
44 // TRUE means that dtor will delete MGLDevCtx object
45 // but it won't destroy MGLDC returned by MGL_wmBeginPaint because
46 // ~MGLDevCtx() doesn't call destroy()
50 wxWindowDC::~wxWindowDC()
52 if ( m_inPaintHandler
)
54 // This is neccessary so that subsequently created wxPaintDCs won't get
55 // confused about clipping. Another reason is that the same MGL dc is reused
56 // for wxEraseEvent, wxNcPaintEvent and wxPaintEvent
57 DestroyClippingRegion();
61 GetMGLDC()->setDC(NULL
);
62 MGL_wmEndPaint(m_wnd
->GetHandle());
66 wxClientDC::wxClientDC(wxWindow
*win
) : wxWindowDC(win
)
68 wxRect r
= m_wnd
->GetClientRect();
70 SetDeviceOrigin(r
.x
, r
.y
);