]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/dc.h
Prevent seg fault for older GTK+
[wxWidgets.git] / include / wx / gtk1 / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/dc.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKDCH__
11 #define __GTKDCH__
12
13 //-----------------------------------------------------------------------------
14 // classes
15 //-----------------------------------------------------------------------------
16
17 class WXDLLIMPEXP_CORE wxDC;
18
19 //-----------------------------------------------------------------------------
20 // wxDC
21 //-----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_CORE wxDC : public wxDCBase
24 {
25 public:
26 wxDC();
27 virtual ~wxDC() { }
28
29 #if wxUSE_PALETTE
30 void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
31 #endif // wxUSE_PALETTE
32
33 // Resolution in pixels per logical inch
34 virtual wxSize GetPPI() const;
35
36 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; }
37 virtual void EndDoc() { }
38 virtual void StartPage() { }
39 virtual void EndPage() { }
40
41 virtual GdkWindow* GetGDKWindow() const { return NULL; }
42
43 public:
44 // implementation
45 wxCoord XDEV2LOG(wxCoord x) const { return DeviceToLogicalX(x); }
46 wxCoord XDEV2LOGREL(wxCoord x) const { return DeviceToLogicalXRel(x); }
47 wxCoord YDEV2LOG(wxCoord y) const { return DeviceToLogicalY(y); }
48 wxCoord YDEV2LOGREL(wxCoord y) const { return DeviceToLogicalYRel(y); }
49 wxCoord XLOG2DEV(wxCoord x) const { return LogicalToDeviceX(x); }
50 wxCoord XLOG2DEVREL(wxCoord x) const { return LogicalToDeviceXRel(x); }
51 wxCoord YLOG2DEV(wxCoord y) const { return LogicalToDeviceY(y); }
52 wxCoord YLOG2DEVREL(wxCoord y) const { return LogicalToDeviceYRel(y); }
53
54 // base class pure virtuals implemented here
55 virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
56 virtual void DoGetSizeMM(int* width, int* height) const;
57
58 private:
59 DECLARE_ABSTRACT_CLASS(wxDC)
60 };
61
62 // this must be defined when wxDC::Blit() honours the DC origian and needed to
63 // allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
64 // 2.3.[23]
65 #ifndef wxHAS_WORKING_GTK_DC_BLIT
66 #define wxHAS_WORKING_GTK_DC_BLIT
67 #endif
68
69 #endif // __GTKDCH__