]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/dcclient.cpp
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Vaclav Slavik
6 // Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
18 #include "wx/dcclient.h"
19 #include "wx/window.h"
24 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC
, wxDC
)
25 IMPLEMENT_DYNAMIC_CLASS(wxClientDC
,wxWindowDC
)
26 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC
, wxClientDC
)
28 wxWindowDC::wxWindowDC(wxWindow
*win
) : m_wnd(win
)
30 MGLDevCtx
*dc
= win
->GetPaintMGLDC();
34 m_inPaintHandler
= TRUE
;
36 m_globalClippingRegion
= win
->GetUpdateRegion();
41 m_inPaintHandler
= FALSE
;
43 dc
= new MGLDevCtx(MGL_wmBeginPaint(win
->GetHandle()));
46 dc
->getClipRegion(clip
);
47 m_globalClippingRegion
= wxRegion(clip
);
49 // TRUE means that dtor will delete MGLDevCtx object
50 // but it won't destroy MGLDC returned by MGL_wmBeginPaint because
51 // ~MGLDevCtx() doesn't call destroy()
55 wxWindowDC::~wxWindowDC()
57 if ( !m_inPaintHandler
)
59 GetMGLDC()->setDC(NULL
);
60 MGL_wmEndPaint(m_wnd
->GetHandle());
64 wxClientDC::wxClientDC(wxWindow
*win
) : wxWindowDC(win
)
66 wxRect r
= m_wnd
->GetClientRect();
67 m_globalClippingRegion
.Intersect(r
);
68 SetClippingRegion(m_globalClippingRegion
);
69 SetDeviceOrigin(r
.x
, r
.y
);