]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/dc.h
fixed gcc warnings about not calling base class ctor explicitly in copy ctors (patch...
[wxWidgets.git] / include / wx / gtk1 / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dc.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10
11 #ifndef __GTKDCH__
12 #define __GTKDCH__
13
14 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
15 #pragma interface
16 #endif
17
18 //-----------------------------------------------------------------------------
19 // classes
20 //-----------------------------------------------------------------------------
21
22 class wxDC;
23
24 //-----------------------------------------------------------------------------
25 // constants
26 //-----------------------------------------------------------------------------
27
28 #define MM_TEXT 0
29 #define MM_ISOTROPIC 1
30 #define MM_ANISOTROPIC 2
31 #define MM_LOMETRIC 3
32 #define MM_HIMETRIC 4
33 #define MM_TWIPS 5
34 #define MM_POINTS 6
35 #define MM_METRIC 7
36
37 //-----------------------------------------------------------------------------
38 // wxDC
39 //-----------------------------------------------------------------------------
40
41 class wxDC : public wxDCBase
42 {
43 public:
44 wxDC();
45 ~wxDC() { }
46
47 void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
48
49 // Resolution in pixels per logical inch
50 virtual wxSize GetPPI() const;
51
52 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
53 virtual void EndDoc() { }
54 virtual void StartPage() { }
55 virtual void EndPage() { }
56
57 virtual void SetMapMode( int mode );
58 virtual void SetUserScale( double x, double y );
59 virtual void SetLogicalScale( double x, double y );
60 virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
61 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
62
63 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
64
65 // implementation
66 // --------------
67
68 virtual void ComputeScaleAndOrigin();
69
70 wxCoord XDEV2LOG(wxCoord x) const
71 {
72 wxCoord new_x = x - m_deviceOriginX;
73 if (new_x > 0)
74 return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
75 else
76 return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
77 }
78 wxCoord XDEV2LOGREL(wxCoord x) const
79 {
80 if (x > 0)
81 return (wxCoord)((double)(x) / m_scaleX + 0.5);
82 else
83 return (wxCoord)((double)(x) / m_scaleX - 0.5);
84 }
85 wxCoord YDEV2LOG(wxCoord y) const
86 {
87 wxCoord new_y = y - m_deviceOriginY;
88 if (new_y > 0)
89 return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
90 else
91 return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
92 }
93 wxCoord YDEV2LOGREL(wxCoord y) const
94 {
95 if (y > 0)
96 return (wxCoord)((double)(y) / m_scaleY + 0.5);
97 else
98 return (wxCoord)((double)(y) / m_scaleY - 0.5);
99 }
100 wxCoord XLOG2DEV(wxCoord x) const
101 {
102 wxCoord new_x = x - m_logicalOriginX;
103 if (new_x > 0)
104 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
105 else
106 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
107 }
108 wxCoord XLOG2DEVREL(wxCoord x) const
109 {
110 if (x > 0)
111 return (wxCoord)((double)(x) * m_scaleX + 0.5);
112 else
113 return (wxCoord)((double)(x) * m_scaleX - 0.5);
114 }
115 wxCoord YLOG2DEV(wxCoord y) const
116 {
117 wxCoord new_y = y - m_logicalOriginY;
118 if (new_y > 0)
119 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
120 else
121 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
122 }
123 wxCoord YLOG2DEVREL(wxCoord y) const
124 {
125 if (y > 0)
126 return (wxCoord)((double)(y) * m_scaleY + 0.5);
127 else
128 return (wxCoord)((double)(y) * m_scaleY - 0.5);
129 }
130
131 protected:
132 // base class pure virtuals implemented here
133 virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
134 virtual void DoGetSizeMM(int* width, int* height) const;
135
136 public:
137 // GTK-specific member variables
138
139 // not sure what for, but what is a mm on a screen you don't know the size
140 // of?
141 double m_mm_to_pix_x,
142 m_mm_to_pix_y;
143
144 bool m_needComputeScaleX,
145 m_needComputeScaleY; // not yet used
146
147
148 private:
149 DECLARE_ABSTRACT_CLASS(wxDC)
150 };
151
152 // this must be defined when wxDC::Blit() honours the DC origian and needed to
153 // allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
154 // 2.3.[23]
155 #ifndef wxHAS_WORKING_GTK_DC_BLIT
156 #define wxHAS_WORKING_GTK_DC_BLIT
157 #endif
158
159 #endif // __GTKDCH__