]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/dc.h
put GetEscapeId() inside #if wxABI_VERSION > 20601
[wxWidgets.git] / include / wx / x11 / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dc.h
3 // Purpose: wxDC class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DC_H_
13 #define _WX_DC_H_
14
15 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
16 #pragma interface "dc.h"
17 #endif
18
19 #include "wx/pen.h"
20 #include "wx/brush.h"
21 #include "wx/icon.h"
22 #include "wx/font.h"
23 #include "wx/gdicmn.h"
24
25 //-----------------------------------------------------------------------------
26 // constants
27 //-----------------------------------------------------------------------------
28
29 #ifndef MM_TEXT
30 #define MM_TEXT 0
31 #define MM_ISOTROPIC 1
32 #define MM_ANISOTROPIC 2
33 #define MM_LOMETRIC 3
34 #define MM_HIMETRIC 4
35 #define MM_TWIPS 5
36 #define MM_POINTS 6
37 #define MM_METRIC 7
38 #endif
39
40 //-----------------------------------------------------------------------------
41 // wxDC
42 //-----------------------------------------------------------------------------
43
44 class WXDLLEXPORT wxDC : public wxDCBase
45 {
46 public:
47 wxDC();
48 ~wxDC() { }
49
50 // implement base class pure virtuals
51 // ----------------------------------
52
53 virtual wxSize GetPPI() const;
54
55 virtual void SetMapMode(int mode);
56 virtual void SetUserScale(double x, double y);
57 virtual void SetLogicalScale(double x, double y);
58 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
59 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
60 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
61
62 protected:
63 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
64 wxCoord width, wxCoord height);
65 virtual void DoGetSizeMM(int* width, int* height) const;
66
67 public:
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 public:
132 // not sure what for, but what is a mm on a screen you don't know the size of?
133 double m_mm_to_pix_x,m_mm_to_pix_y;
134
135 // recompute scale?
136 bool m_needComputeScaleX, m_needComputeScaleY;
137
138
139 private:
140 DECLARE_ABSTRACT_CLASS(wxDC)
141 };
142
143 #endif
144 // _WX_DC_H_