]> git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/dc.h
hide the MDI parent frame instead of just moving it away (why didn't I do it like...
[wxWidgets.git] / include / wx / motif / 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 DECLARE_DYNAMIC_CLASS(wxDC)
47
48 public:
49 wxDC();
50 ~wxDC() { }
51
52 // implement base class pure virtuals
53 // ----------------------------------
54
55 virtual wxSize GetPPI() const;
56
57 virtual void SetMapMode(int mode);
58 virtual void SetUserScale(double x, double y);
59 virtual void SetLogicalScale(double x, double y);
60 virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
61 virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
62 virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
63
64 protected:
65 virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
66 virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
67 bool useMask = false);
68
69 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
70 wxCoord width, wxCoord height);
71 virtual void DoGetSize(int *width, int *height) const;
72 virtual void DoGetSizeMM(int* width, int* height) const;
73
74 public:
75 virtual void ComputeScaleAndOrigin();
76
77 wxCoord XDEV2LOG(wxCoord x) const
78 {
79 wxCoord new_x = x - m_deviceOriginX;
80 if (new_x > 0)
81 return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
82 else
83 return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
84 }
85 wxCoord XDEV2LOGREL(wxCoord x) const
86 {
87 if (x > 0)
88 return (wxCoord)((double)(x) / m_scaleX + 0.5);
89 else
90 return (wxCoord)((double)(x) / m_scaleX - 0.5);
91 }
92 wxCoord YDEV2LOG(wxCoord y) const
93 {
94 wxCoord new_y = y - m_deviceOriginY;
95 if (new_y > 0)
96 return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
97 else
98 return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
99 }
100 wxCoord YDEV2LOGREL(wxCoord y) const
101 {
102 if (y > 0)
103 return (wxCoord)((double)(y) / m_scaleY + 0.5);
104 else
105 return (wxCoord)((double)(y) / m_scaleY - 0.5);
106 }
107 wxCoord XLOG2DEV(wxCoord x) const
108 {
109 wxCoord new_x = x - m_logicalOriginX;
110 if (new_x > 0)
111 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
112 else
113 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
114 }
115 // Without device translation, for backing pixmap purposes
116 wxCoord XLOG2DEV_2(wxCoord x) const
117 {
118 wxCoord new_x = x - m_logicalOriginX;
119 if (new_x > 0)
120 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX;
121 else
122 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX;
123 }
124 wxCoord XLOG2DEVREL(wxCoord x) const
125 {
126 if (x > 0)
127 return (wxCoord)((double)(x) * m_scaleX + 0.5);
128 else
129 return (wxCoord)((double)(x) * m_scaleX - 0.5);
130 }
131 wxCoord YLOG2DEV(wxCoord y) const
132 {
133 wxCoord new_y = y - m_logicalOriginY;
134 if (new_y > 0)
135 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
136 else
137 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
138 }
139 // Without device translation, for backing pixmap purposes
140 wxCoord YLOG2DEV_2(wxCoord y) const
141 {
142 wxCoord new_y = y - m_logicalOriginY;
143 if (new_y > 0)
144 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY;
145 else
146 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY;
147 }
148 wxCoord YLOG2DEVREL(wxCoord y) const
149 {
150 if (y > 0)
151 return (wxCoord)((double)(y) * m_scaleY + 0.5);
152 else
153 return (wxCoord)((double)(y) * m_scaleY - 0.5);
154 }
155
156 public:
157 // not sure what for, but what is a mm on a screen you don't know the size of?
158 double m_mm_to_pix_x,m_mm_to_pix_y;
159
160 // recompute scale?
161 bool m_needComputeScaleX, m_needComputeScaleY;
162
163 };
164
165 #endif
166 // _WX_DC_H_