]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/dc.h
Bump subrelease number
[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 #include "wx/pen.h"
16 #include "wx/brush.h"
17 #include "wx/icon.h"
18 #include "wx/font.h"
19 #include "wx/gdicmn.h"
20
21 //-----------------------------------------------------------------------------
22 // constants
23 //-----------------------------------------------------------------------------
24
25 #ifndef MM_TEXT
26 #define MM_TEXT 0
27 #define MM_ISOTROPIC 1
28 #define MM_ANISOTROPIC 2
29 #define MM_LOMETRIC 3
30 #define MM_HIMETRIC 4
31 #define MM_TWIPS 5
32 #define MM_POINTS 6
33 #define MM_METRIC 7
34 #endif
35
36 //-----------------------------------------------------------------------------
37 // wxDC
38 //-----------------------------------------------------------------------------
39
40 class WXDLLEXPORT wxDC : public wxDCBase
41 {
42 public:
43 wxDC();
44 virtual ~wxDC() { }
45
46 // implement base class pure virtuals
47 // ----------------------------------
48
49 virtual wxSize GetPPI() const;
50
51 virtual void SetMapMode(int mode);
52 virtual void SetUserScale(double x, double y);
53 virtual void SetLogicalScale(double x, double y);
54 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
55 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
56 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
57
58 protected:
59 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
60 wxCoord width, wxCoord height);
61 virtual void DoGetSizeMM(int* width, int* height) const;
62
63 public:
64 virtual void ComputeScaleAndOrigin();
65
66 wxCoord XDEV2LOG(wxCoord x) const
67 {
68 return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
69 }
70 wxCoord XDEV2LOGREL(wxCoord x) const
71 {
72 return wxRound((double)(x) / m_scaleX);
73 }
74 wxCoord YDEV2LOG(wxCoord y) const
75 {
76 return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
77 }
78 wxCoord YDEV2LOGREL(wxCoord y) const
79 {
80 return wxRound((double)(y) / m_scaleY);
81 }
82 wxCoord XLOG2DEV(wxCoord x) const
83 {
84 return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
85 }
86 wxCoord XLOG2DEVREL(wxCoord x) const
87 {
88 return wxRound((double)(x) * m_scaleX);
89 }
90 wxCoord YLOG2DEV(wxCoord y) const
91 {
92 return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
93 }
94 wxCoord YLOG2DEVREL(wxCoord y) const
95 {
96 return wxRound((double)(y) * m_scaleY);
97 }
98
99 public:
100 // not sure what for, but what is a mm on a screen you don't know the size of?
101 double m_mm_to_pix_x,m_mm_to_pix_y;
102
103 // recompute scale?
104 bool m_needComputeScaleX, m_needComputeScaleY;
105
106
107 private:
108 DECLARE_ABSTRACT_CLASS(wxDC)
109 };
110
111 #endif
112 // _WX_DC_H_