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