Made device to logical and vv conversion methods
[wxWidgets.git] / include / wx / gtk / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/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 // constants
15 //-----------------------------------------------------------------------------
16
17 #ifndef MM_TEXT
18 #define MM_TEXT 0
19 #define MM_ISOTROPIC 1
20 #define MM_ANISOTROPIC 2
21 #define MM_LOMETRIC 3
22 #define MM_HIMETRIC 4
23 #define MM_TWIPS 5
24 #define MM_POINTS 6
25 #define MM_METRIC 7
26 #endif
27
28 //-----------------------------------------------------------------------------
29 // wxDC
30 //-----------------------------------------------------------------------------
31
32 class WXDLLIMPEXP_CORE wxDC : public wxDCBase
33 {
34 public:
35 wxDC();
36 virtual ~wxDC() { }
37
38 #if wxUSE_PALETTE
39 void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
40 #endif // wxUSE_PALETTE
41
42 // Resolution in pixels per logical inch
43 virtual wxSize GetPPI() const;
44
45 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; }
46 virtual void EndDoc() { }
47 virtual void StartPage() { }
48 virtual void EndPage() { }
49
50 virtual wxCoord DeviceToLogicalX(wxCoord x) const;
51 virtual wxCoord DeviceToLogicalY(wxCoord y) const;
52 virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
53 virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
54 virtual wxCoord LogicalToDeviceX(wxCoord x) const;
55 virtual wxCoord LogicalToDeviceY(wxCoord y) const;
56 virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
57 virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
58
59 virtual void SetMapMode( int mode );
60 virtual void SetUserScale( double x, double y );
61 virtual void SetLogicalScale( double x, double y );
62 virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
63 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
64
65 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
66
67 virtual void ComputeScaleAndOrigin();
68
69 virtual GdkWindow* GetGDKWindow() const { return NULL; }
70
71 protected:
72 // implementation
73 // --------------
74
75 wxCoord XDEV2LOG(wxCoord x) const
76 {
77 return DeviceToLogicalX(x);
78 }
79 wxCoord XDEV2LOGREL(wxCoord x) const
80 {
81 return DeviceToLogicalXRel(x);
82 }
83 wxCoord YDEV2LOG(wxCoord y) const
84 {
85 return DeviceToLogicalY(y);
86 }
87 wxCoord YDEV2LOGREL(wxCoord y) const
88 {
89 return DeviceToLogicalYRel(y);
90 }
91 wxCoord XLOG2DEV(wxCoord x) const
92 {
93 return LogicalToDeviceX(x);
94 }
95 wxCoord XLOG2DEVREL(wxCoord x) const
96 {
97 return LogicalToDeviceXRel(x);
98 }
99 wxCoord YLOG2DEV(wxCoord y) const
100 {
101 return LogicalToDeviceY(y);
102 }
103 wxCoord YLOG2DEVREL(wxCoord y) const
104 {
105 return LogicalToDeviceYRel(y);
106 }
107
108 // base class pure virtuals implemented here
109 virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
110 virtual void DoGetSizeMM(int* width, int* height) const;
111
112 public:
113 // GTK-specific member variables
114
115 // not sure what for, but what is a mm on a screen you don't know the size
116 // of?
117 double m_mm_to_pix_x,
118 m_mm_to_pix_y;
119
120 bool m_needComputeScaleX,
121 m_needComputeScaleY; // not yet used
122
123
124 private:
125 DECLARE_ABSTRACT_CLASS(wxDC)
126 };
127
128 // this must be defined when wxDC::Blit() honours the DC origian and needed to
129 // allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
130 // 2.3.[23]
131 #ifndef wxHAS_WORKING_GTK_DC_BLIT
132 #define wxHAS_WORKING_GTK_DC_BLIT
133 #endif
134
135 #endif // __GTKDCH__