]>
git.saurik.com Git - wxWidgets.git/blob - src/mgl/dcclient.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/mgl/dcclient.cpp
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"
17 #include "wx/dcclient.h"
20 #include "wx/window.h"
25 IMPLEMENT_DYNAMIC_CLASS(wxWindowDC
, wxDC
)
26 IMPLEMENT_DYNAMIC_CLASS(wxClientDC
,wxWindowDC
)
27 IMPLEMENT_DYNAMIC_CLASS(wxPaintDC
, wxClientDC
)
29 wxWindowDC::wxWindowDC(wxWindow
*win
) : m_wnd(win
)
31 MGLDevCtx
*dc
= win
->GetPaintMGLDC();
35 m_inPaintHandler
= TRUE
;
37 m_globalClippingRegion
= win
->GetUpdateRegion();
42 m_inPaintHandler
= FALSE
;
44 dc
= new MGLDevCtx(MGL_wmBeginPaint(win
->GetHandle()));
47 dc
->getClipRegion(clip
);
48 m_globalClippingRegion
= wxRegion(clip
);
50 // TRUE means that dtor will delete MGLDevCtx object
51 // but it won't destroy MGLDC returned by MGL_wmBeginPaint because
52 // ~MGLDevCtx() doesn't call destroy()
56 wxWindowDC::~wxWindowDC()
58 if ( !m_inPaintHandler
)
60 GetMGLDC()->setDC(NULL
);
61 MGL_wmEndPaint(m_wnd
->GetHandle());
65 wxClientDC::wxClientDC(wxWindow
*win
) : wxWindowDC(win
)
67 wxRect r
= m_wnd
->GetClientRect();
68 m_globalClippingRegion
.Intersect(r
);
69 SetClippingRegion(m_globalClippingRegion
);
70 SetDeviceOrigin(r
.x
, r
.y
);