]> git.saurik.com Git - wxWidgets.git/blob - src/x11/dc.cpp
Don't crash when laying out wxGridBagSizer with only hidden elements.
[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 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 // for compilers that support precompilation, includes "wx.h".
12 #include "wx/wxprec.h"
13
14 #include "wx/dc.h"
15 #include "wx/x11/dc.h"
16
17 #ifndef WX_PRECOMP
18 #include "wx/dcmemory.h"
19 #endif
20
21 IMPLEMENT_ABSTRACT_CLASS(wxX11DCImpl, wxDCImpl)
22
23 //-----------------------------------------------------------------------------
24 // wxDC
25 //-----------------------------------------------------------------------------
26
27 wxX11DCImpl::wxX11DCImpl( wxDC *owner ) :
28 wxDCImpl( owner )
29 {
30 m_ok = false;
31
32 m_pen = *wxBLACK_PEN;
33 m_font = *wxNORMAL_FONT;
34 m_brush = *wxWHITE_BRUSH;
35
36 m_backgroundMode = wxTRANSPARENT;
37 }
38
39 void wxX11DCImpl::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
40 {
41 m_clipping = true;
42 m_clipX1 = x;
43 m_clipY1 = y;
44 m_clipX2 = x + width;
45 m_clipY2 = y + height;
46 }
47
48 void wxX11DCImpl::DoGetSizeMM( int* width, int* height ) const
49 {
50 int w, h;
51 DoGetSize( &w, &h );
52
53 if ( width )
54 *width = int( double(w) / (m_scaleX*m_mm_to_pix_x) );
55 if ( height )
56 *height = int( double(h) / (m_scaleY*m_mm_to_pix_y) );
57 }
58
59 // Resolution in pixels per logical inch
60 wxSize wxX11DCImpl::GetPPI() const
61 {
62 // TODO (should probably be pure virtual)
63 return wxSize(0, 0);
64 }