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