]>
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 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
);
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
);
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;
79 void ComputeScaleAndOrigin();
81 long XDEV2LOG(long x
) const
83 long new_x
= x
- m_deviceOriginX
;
85 return (long)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
87 return (long)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
89 long XDEV2LOGREL(long x
) const
92 return (long)((double)(x
) / m_scaleX
+ 0.5);
94 return (long)((double)(x
) / m_scaleX
- 0.5);
96 long YDEV2LOG(long y
) const
98 long new_y
= y
- m_deviceOriginY
;
100 return (long)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
102 return (long)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
104 long YDEV2LOGREL(long y
) const
107 return (long)((double)(y
) / m_scaleY
+ 0.5);
109 return (long)((double)(y
) / m_scaleY
- 0.5);
111 long XLOG2DEV(long x
) const
113 long new_x
= x
- m_logicalOriginX
;
115 return (long)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
117 return (long)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
119 // Without device translation, for backing pixmap purposes
120 long XLOG2DEV_2(long x
) const
122 long new_x
= x
- m_logicalOriginX
;
124 return (long)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
;
126 return (long)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
;
128 long XLOG2DEVREL(long x
) const
131 return (long)((double)(x
) * m_scaleX
+ 0.5);
133 return (long)((double)(x
) * m_scaleX
- 0.5);
135 long YLOG2DEV(long y
) const
137 long new_y
= y
- m_logicalOriginY
;
139 return (long)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
141 return (long)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
143 // Without device translation, for backing pixmap purposes
144 long YLOG2DEV_2(long y
) const
146 long new_y
= y
- m_logicalOriginY
;
148 return (long)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
;
150 return (long)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
;
152 long YLOG2DEVREL(long y
) const
155 return (long)((double)(y
) * m_scaleY
+ 0.5);
157 return (long)((double)(y
) * m_scaleY
- 0.5);
160 void SetInternalDeviceOrigin( long x
, long y
);
161 void GetInternalDeviceOrigin( long *x
, long *y
);
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
;
167 // If un-scrolled is non-zero or d.o. changes with scrolling. Set using
168 // SetInternalDeviceOrigin().
169 long m_internalDeviceOriginX
,m_internalDeviceOriginY
;
171 // To be set by external classes such as wxScrolledWindow using
173 long m_externalDeviceOriginX
,m_externalDeviceOriginY
;
176 bool m_needComputeScaleX
, m_needComputeScaleY
;
178 // wxPSDC wants to have this. Will disappear.