]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/dc.h
Some #include and #if wxUSE_XX things
[wxWidgets.git] / include / wx / motif / dc.h
CommitLineData
9b6dbb09
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
af0bb3b1 9// Licence: wxWindows licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_DC_H_
13#define _WX_DC_H_
14
15#ifdef __GNUG__
af0bb3b1 16 #pragma interface "dc.h"
9b6dbb09
JS
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
af0bb3b1
VZ
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
9b6dbb09
JS
38#endif
39
9b6dbb09
JS
40//-----------------------------------------------------------------------------
41// wxDC
42//-----------------------------------------------------------------------------
43
af0bb3b1 44class WXDLLEXPORT wxDC : public wxDCBase
9b6dbb09 45{
af0bb3b1 46 DECLARE_DYNAMIC_CLASS(wxDC)
9b6dbb09 47
af0bb3b1
VZ
48public:
49 wxDC();
50 ~wxDC() { }
9b6dbb09 51
af0bb3b1
VZ
52 // implement base class pure virtuals
53 // ----------------------------------
9b6dbb09 54
af0bb3b1 55 virtual void DestroyClippingRegion();
9b6dbb09 56
af0bb3b1 57 virtual wxSize GetPPI() const;
9b6dbb09 58
af0bb3b1
VZ
59 virtual void SetMapMode(int mode);
60 virtual void SetUserScale(double x, double y);
61 virtual void SetSystemScale(double x, double y);
62 virtual void SetLogicalScale(double x, double y);
63 virtual void SetLogicalOrigin(long x, long y);
64 virtual void SetDeviceOrigin(long x, long y);
65 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
66 virtual void SetLogicalFunction(int function);
9b6dbb09 67
af0bb3b1
VZ
68protected:
69 virtual void DoDrawIcon(const wxIcon& icon, long x, long y);
70 virtual void DoDrawBitmap(const wxBitmap &bmp, long x, long y,
71 bool useMask = FALSE);
9b6dbb09 72
af0bb3b1
VZ
73 virtual void DoSetClippingRegion(long x, long y,
74 long width, long height);
75 virtual void DoGetSize(int *width, int *height) const;
76 virtual void DoGetSizeMM(int* width, int* height) const;
9b6dbb09 77
af0bb3b1
VZ
78public:
79 void ComputeScaleAndOrigin();
80
81 long XDEV2LOG(long x) const
9b6dbb09 82 {
af0bb3b1
VZ
83 long new_x = x - m_deviceOriginX;
84 if (new_x > 0)
85 return (long)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
86 else
87 return (long)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
9b6dbb09 88 }
af0bb3b1 89 long XDEV2LOGREL(long x) const
9b6dbb09 90 {
af0bb3b1
VZ
91 if (x > 0)
92 return (long)((double)(x) / m_scaleX + 0.5);
93 else
94 return (long)((double)(x) / m_scaleX - 0.5);
9b6dbb09 95 }
af0bb3b1 96 long YDEV2LOG(long y) const
9b6dbb09 97 {
af0bb3b1
VZ
98 long new_y = y - m_deviceOriginY;
99 if (new_y > 0)
100 return (long)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
101 else
102 return (long)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
9b6dbb09 103 }
af0bb3b1 104 long YDEV2LOGREL(long y) const
9b6dbb09 105 {
af0bb3b1
VZ
106 if (y > 0)
107 return (long)((double)(y) / m_scaleY + 0.5);
108 else
109 return (long)((double)(y) / m_scaleY - 0.5);
9b6dbb09 110 }
af0bb3b1 111 long XLOG2DEV(long x) const
9b6dbb09 112 {
af0bb3b1
VZ
113 long new_x = x - m_logicalOriginX;
114 if (new_x > 0)
115 return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
116 else
117 return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
9b6dbb09 118 }
af0bb3b1
VZ
119 // Without device translation, for backing pixmap purposes
120 long XLOG2DEV_2(long x) const
9b6dbb09 121 {
af0bb3b1
VZ
122 long new_x = x - m_logicalOriginX;
123 if (new_x > 0)
124 return (long)((double)(new_x) * m_scaleX + 0.5) * m_signX;
125 else
126 return (long)((double)(new_x) * m_scaleX - 0.5) * m_signX;
9b6dbb09 127 }
af0bb3b1 128 long XLOG2DEVREL(long x) const
9b6dbb09 129 {
af0bb3b1
VZ
130 if (x > 0)
131 return (long)((double)(x) * m_scaleX + 0.5);
132 else
133 return (long)((double)(x) * m_scaleX - 0.5);
9b6dbb09 134 }
af0bb3b1 135 long YLOG2DEV(long y) const
9b6dbb09 136 {
af0bb3b1
VZ
137 long new_y = y - m_logicalOriginY;
138 if (new_y > 0)
139 return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
140 else
141 return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
9b6dbb09 142 }
af0bb3b1
VZ
143 // Without device translation, for backing pixmap purposes
144 long YLOG2DEV_2(long y) const
9b6dbb09 145 {
af0bb3b1
VZ
146 long new_y = y - m_logicalOriginY;
147 if (new_y > 0)
148 return (long)((double)(new_y) * m_scaleY + 0.5) * m_signY;
149 else
150 return (long)((double)(new_y) * m_scaleY - 0.5) * m_signY;
9b6dbb09 151 }
af0bb3b1 152 long YLOG2DEVREL(long y) const
9b6dbb09 153 {
af0bb3b1
VZ
154 if (y > 0)
155 return (long)((double)(y) * m_scaleY + 0.5);
156 else
157 return (long)((double)(y) * m_scaleY - 0.5);
9b6dbb09
JS
158 }
159
af0bb3b1
VZ
160 void SetInternalDeviceOrigin( long x, long y );
161 void GetInternalDeviceOrigin( long *x, long *y );
9b6dbb09 162
af0bb3b1
VZ
163public:
164 // not sure what for, but what is a mm on a screen you don't know the size of?
165 double m_mm_to_pix_x,m_mm_to_pix_y;
9b6dbb09 166
af0bb3b1
VZ
167 // If un-scrolled is non-zero or d.o. changes with scrolling. Set using
168 // SetInternalDeviceOrigin().
169 long m_internalDeviceOriginX,m_internalDeviceOriginY;
9b6dbb09 170
af0bb3b1
VZ
171 // To be set by external classes such as wxScrolledWindow using
172 // SetDeviceOrigin()
173 long m_externalDeviceOriginX,m_externalDeviceOriginY;
7bcb11d3 174
af0bb3b1
VZ
175 // recompute scale?
176 bool m_needComputeScaleX, m_needComputeScaleY;
9b6dbb09 177
af0bb3b1
VZ
178 // wxPSDC wants to have this. Will disappear.
179 float m_scaleFactor;
9b6dbb09
JS
180};
181
182#endif
183 // _WX_DC_H_