]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/motif/dc.h
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
16 #pragma interface "dc.h"
23 #include "wx/gdicmn.h"
25 //-----------------------------------------------------------------------------
27 //-----------------------------------------------------------------------------
31 #define MM_ISOTROPIC 1
32 #define MM_ANISOTROPIC 2
40 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
44 class WXDLLEXPORT wxDC
: public wxDCBase
46 DECLARE_DYNAMIC_CLASS(wxDC
)
52 // implement base class pure virtuals
53 // ----------------------------------
55 virtual void DestroyClippingRegion();
57 virtual wxSize
GetPPI() const;
59 virtual void SetMapMode(int mode
);
60 virtual void SetUserScale(double x
, double y
);
61 virtual void SetLogicalScale(double x
, double y
);
62 virtual void SetLogicalOrigin(long x
, long y
);
63 virtual void SetDeviceOrigin(long x
, long y
);
64 virtual void SetAxisOrientation(bool xLeftRight
, bool yBottomUp
);
67 virtual void DoDrawIcon(const wxIcon
& icon
, long x
, long y
);
68 virtual void DoDrawBitmap(const wxBitmap
&bmp
, long x
, long y
,
69 bool useMask
= FALSE
);
71 virtual void DoSetClippingRegion(long x
, long y
,
72 long width
, long height
);
73 virtual void DoGetSize(int *width
, int *height
) const;
74 virtual void DoGetSizeMM(int* width
, int* height
) const;
77 void ComputeScaleAndOrigin();
79 long XDEV2LOG(long x
) const
81 long new_x
= x
- m_deviceOriginX
;
83 return (long)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
85 return (long)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
87 long XDEV2LOGREL(long x
) const
90 return (long)((double)(x
) / m_scaleX
+ 0.5);
92 return (long)((double)(x
) / m_scaleX
- 0.5);
94 long YDEV2LOG(long y
) const
96 long new_y
= y
- m_deviceOriginY
;
98 return (long)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
100 return (long)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
102 long YDEV2LOGREL(long y
) const
105 return (long)((double)(y
) / m_scaleY
+ 0.5);
107 return (long)((double)(y
) / m_scaleY
- 0.5);
109 long XLOG2DEV(long x
) const
111 long new_x
= x
- m_logicalOriginX
;
113 return (long)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
115 return (long)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
117 // Without device translation, for backing pixmap purposes
118 long XLOG2DEV_2(long x
) const
120 long new_x
= x
- m_logicalOriginX
;
122 return (long)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
;
124 return (long)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
;
126 long XLOG2DEVREL(long x
) const
129 return (long)((double)(x
) * m_scaleX
+ 0.5);
131 return (long)((double)(x
) * m_scaleX
- 0.5);
133 long YLOG2DEV(long y
) const
135 long new_y
= y
- m_logicalOriginY
;
137 return (long)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
139 return (long)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
141 // Without device translation, for backing pixmap purposes
142 long YLOG2DEV_2(long y
) const
144 long new_y
= y
- m_logicalOriginY
;
146 return (long)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
;
148 return (long)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
;
150 long YLOG2DEVREL(long y
) const
153 return (long)((double)(y
) * m_scaleY
+ 0.5);
155 return (long)((double)(y
) * m_scaleY
- 0.5);
158 void SetInternalDeviceOrigin( long x
, long y
);
159 void GetInternalDeviceOrigin( long *x
, long *y
);
162 // not sure what for, but what is a mm on a screen you don't know the size of?
163 double m_mm_to_pix_x
,m_mm_to_pix_y
;
165 // If un-scrolled is non-zero or d.o. changes with scrolling. Set using
166 // SetInternalDeviceOrigin().
167 long m_internalDeviceOriginX
,m_internalDeviceOriginY
;
169 // To be set by external classes such as wxScrolledWindow using
171 long m_externalDeviceOriginX
,m_externalDeviceOriginY
;
174 bool m_needComputeScaleX
, m_needComputeScaleY
;
176 // wxPSDC wants to have this. Will disappear.