]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/dc.h
added missing header to fix !USE_PCH compilation
[wxWidgets.git] / include / wx / x11 / dc.h
CommitLineData
83df96d6
JS
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
65571936 9// Licence: wxWindows licence
83df96d6
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_DC_H_
13#define _WX_DC_H_
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
83df96d6
JS
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
44class WXDLLEXPORT wxDC : public wxDCBase
45{
83df96d6
JS
46public:
47 wxDC();
48 ~wxDC() { }
d16b634f 49
83df96d6
JS
50 // implement base class pure virtuals
51 // ----------------------------------
d16b634f 52
83df96d6 53 virtual wxSize GetPPI() const;
d16b634f 54
83df96d6
JS
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);
d16b634f 61
83df96d6 62protected:
83df96d6
JS
63 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
64 wxCoord width, wxCoord height);
83df96d6 65 virtual void DoGetSizeMM(int* width, int* height) const;
d16b634f 66
83df96d6
JS
67public:
68 void ComputeScaleAndOrigin();
d16b634f 69
83df96d6
JS
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 }
83df96d6
JS
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 }
83df96d6
JS
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 }
d16b634f 130
83df96d6
JS
131public:
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;
d16b634f 134
83df96d6
JS
135 // recompute scale?
136 bool m_needComputeScaleX, m_needComputeScaleY;
d16b634f 137
3cd0b8c5
RR
138
139private:
140 DECLARE_ABSTRACT_CLASS(wxDC)
83df96d6
JS
141};
142
143#endif
144// _WX_DC_H_