]> git.saurik.com Git - wxWidgets.git/blame - src/mgl/dcclient.cpp
Changed WidthDefault() and HeightDefault() to use 400,250. If there
[wxWidgets.git] / src / mgl / dcclient.cpp
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
8f7b34a8 2// Name: dcclient.cpp
32b8ec41 3// Purpose:
8f7b34a8 4// Author: Vaclav Slavik
32b8ec41 5// RCS-ID: $Id$
c41c20a5 6// Copyright: (c) 2001-2002 SciTech Software, Inc. (www.scitechsoft.com)
32b8ec41
VZ
7// Licence: wxWindows licence
8/////////////////////////////////////////////////////////////////////////////
9
14f355c2 10#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
32b8ec41
VZ
11#pragma implementation "dcclient.h"
12#endif
13
a4bbc9f7
VS
14// For compilers that support precompilation, includes "wx.h".
15#include "wx/wxprec.h"
16
17#ifdef __BORLANDC__
18 #pragma hdrstop
19#endif
20
21#ifndef WX_PRECOMP
22 #include "wx/dcclient.h"
23 #include "wx/window.h"
24#endif
25
26#include <mgraph.hpp>
32b8ec41
VZ
27
28IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
32b8ec41 29IMPLEMENT_DYNAMIC_CLASS(wxClientDC,wxWindowDC)
7bdc1879 30IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxClientDC)
a4bbc9f7
VS
31
32wxWindowDC::wxWindowDC(wxWindow *win) : m_wnd(win)
33{
7bdc1879 34 MGLDevCtx *dc = win->GetPaintMGLDC();
350d0064 35
7bdc1879
VS
36 if ( dc )
37 {
38 m_inPaintHandler = TRUE;
b8c0528d
VS
39
40 m_globalClippingRegion = win->GetUpdateRegion();
7bdc1879
VS
41 SetMGLDC(dc, FALSE);
42 }
43 else
44 {
45 m_inPaintHandler = FALSE;
350d0064 46
b8c0528d
VS
47 dc = new MGLDevCtx(MGL_wmBeginPaint(win->GetHandle()));
48
49 MGLRegion clip;
50 dc->getClipRegion(clip);
51 m_globalClippingRegion = wxRegion(clip);
52 SetMGLDC(dc, TRUE);
7bdc1879
VS
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()
56 }
a4bbc9f7
VS
57}
58
59wxWindowDC::~wxWindowDC()
60{
b8c0528d 61 if ( !m_inPaintHandler )
7bdc1879
VS
62 {
63 GetMGLDC()->setDC(NULL);
64 MGL_wmEndPaint(m_wnd->GetHandle());
65 }
a4bbc9f7
VS
66}
67
68wxClientDC::wxClientDC(wxWindow *win) : wxWindowDC(win)
69{
70 wxRect r = m_wnd->GetClientRect();
b8c0528d 71 m_globalClippingRegion.Intersect(r);
79954978 72 SetClippingRegion(m_globalClippingRegion);
a4bbc9f7
VS
73 SetDeviceOrigin(r.x, r.y);
74}