Converted wxGTK's basic DC classes to new DC code
[wxWidgets.git] / src / gtk / dc.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dc.cpp
3 // Purpose:
4 // Author: Robert Roebling
5 // RCS-ID: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 // For compilers that support precompilation, includes "wx.h".
11 #include "wx/wxprec.h"
12
13 #include "wx/dc.h"
14
15
16 //-----------------------------------------------------------------------------
17 // wxDC
18 //-----------------------------------------------------------------------------
19
20 #if wxUSE_NEW_DC
21 IMPLEMENT_ABSTRACT_CLASS(wxGTKImplDC, wxImplDC)
22 #else
23 IMPLEMENT_ABSTRACT_CLASS(wxGTKImplDC, wxDCBase)
24 #endif
25
26 #if wxUSE_NEW_DC
27 wxGTKImplDC::wxGTKImplDC( wxDC *owner )
28 : wxImplDC( owner )
29 #else
30 wxDC::wxDC()
31 #endif
32 {
33 m_ok = FALSE;
34
35 m_pen = *wxBLACK_PEN;
36 m_font = *wxNORMAL_FONT;
37 m_brush = *wxWHITE_BRUSH;
38 }
39
40 wxGTKImplDC::~wxGTKImplDC()
41 {
42 }
43
44 void wxGTKImplDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
45 {
46 m_clipping = TRUE;
47 m_clipX1 = x;
48 m_clipY1 = y;
49 m_clipX2 = x + width;
50 m_clipY2 = y + height;
51 }
52
53 // ---------------------------------------------------------------------------
54 // get DC capabilities
55 // ---------------------------------------------------------------------------
56
57 void wxGTKImplDC::DoGetSizeMM( int* width, int* height ) const
58 {
59 int w = 0;
60 int h = 0;
61 GetOwner()->GetSize( &w, &h );
62 if (width) *width = int( double(w) / (m_userScaleX*m_mm_to_pix_x) );
63 if (height) *height = int( double(h) / (m_userScaleY*m_mm_to_pix_y) );
64 }
65
66 // Resolution in pixels per logical inch
67 wxSize wxGTKImplDC::GetPPI() const
68 {
69 // TODO (should probably be pure virtual)
70 return wxSize(0, 0);
71 }