Moved all the coordinate system calculation to wxDCBase
[wxWidgets.git] / src / x11 / dc.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/x11/dc.cpp
3 // Purpose: wxDC class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 // for compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
14
15 #include "wx/dc.h"
16
17 #ifndef WX_PRECOMP
18 #include "wx/dcmemory.h"
19 #endif
20
21 IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
22
23 //-----------------------------------------------------------------------------
24 // wxDC
25 //-----------------------------------------------------------------------------
26
27 wxDC::wxDC()
28 {
29 m_ok = false;
30
31 m_pen = *wxBLACK_PEN;
32 m_font = *wxNORMAL_FONT;
33 m_brush = *wxWHITE_BRUSH;
34
35 m_backgroundMode = wxTRANSPARENT;
36 }
37
38 void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
39 {
40 m_clipping = true;
41 m_clipX1 = x;
42 m_clipY1 = y;
43 m_clipX2 = x + width;
44 m_clipY2 = y + height;
45 }
46
47 void wxDC::DoGetSizeMM( int* width, int* height ) const
48 {
49 int w, h;
50 GetSize( &w, &h );
51
52 if ( width )
53 *width = int( double(w) / (m_scaleX*m_mm_to_pix_x) );
54 if ( height )
55 *height = int( double(h) / (m_scaleY*m_mm_to_pix_y) );
56 }
57
58 // Resolution in pixels per logical inch
59 wxSize wxDC::GetPPI() const
60 {
61 // TODO (should probably be pure virtual)
62 return wxSize(0, 0);
63 }