]>
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 /////////////////////////////////////////////////////////////////////////////
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();
38 m_inPaintHandler
= TRUE
;
40 m_globalClippingRegion
= win
->GetUpdateRegion();
45 m_inPaintHandler
= FALSE
;
47 dc
= new MGLDevCtx(MGL_wmBeginPaint(win
->GetHandle()));
50 dc
->getClipRegion(clip
);
51 m_globalClippingRegion
= wxRegion(clip
);
53 // TRUE means that dtor will delete MGLDevCtx object
54 // but it won't destroy MGLDC returned by MGL_wmBeginPaint because
55 // ~MGLDevCtx() doesn't call destroy()
59 wxWindowDC::~wxWindowDC()
61 if ( !m_inPaintHandler
)
63 GetMGLDC()->setDC(NULL
);
64 MGL_wmEndPaint(m_wnd
->GetHandle());
68 wxClientDC::wxClientDC(wxWindow
*win
) : wxWindowDC(win
)
70 wxRect r
= m_wnd
->GetClientRect();
71 m_globalClippingRegion
.Intersect(r
);
72 SetClippingRegion(m_globalClippingRegion
);
73 SetDeviceOrigin(r
.x
, r
.y
);