]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dc.h
1 /////////////////////////////////////////////////////////////////////////////
4 // Author: Robert Roebling
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
18 //-----------------------------------------------------------------------------
20 //-----------------------------------------------------------------------------
24 //-----------------------------------------------------------------------------
26 //-----------------------------------------------------------------------------
29 #define MM_ISOTROPIC 1
30 #define MM_ANISOTROPIC 2
37 //-----------------------------------------------------------------------------
39 //-----------------------------------------------------------------------------
41 class wxDC
: public wxDCBase
43 DECLARE_ABSTRACT_CLASS(wxDC
)
49 void SetColourMap( const wxPalette
& palette
) { SetPalette(palette
); };
51 // the first two must be overridden and called
52 virtual void DestroyClippingRegion();
54 // Resolution in pixels per logical inch
55 virtual wxSize
GetPPI() const;
57 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return TRUE
; }
58 virtual void EndDoc() { }
59 virtual void StartPage() { }
60 virtual void EndPage() { }
62 virtual void SetMapMode( int mode
);
63 virtual void SetUserScale( double x
, double y
);
64 virtual void SetLogicalScale( double x
, double y
);
65 virtual void SetLogicalOrigin( wxCoord x
, wxCoord y
);
66 virtual void SetDeviceOrigin( wxCoord x
, wxCoord y
);
68 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
73 virtual void ComputeScaleAndOrigin();
75 wxCoord
XDEV2LOG(wxCoord x
) const
77 wxCoord new_x
= x
- m_deviceOriginX
;
79 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
81 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
83 wxCoord
XDEV2LOGREL(wxCoord x
) const
86 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
88 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
90 wxCoord
YDEV2LOG(wxCoord y
) const
92 wxCoord new_y
= y
- m_deviceOriginY
;
94 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
96 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
98 wxCoord
YDEV2LOGREL(wxCoord y
) const
101 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
103 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
105 wxCoord
XLOG2DEV(wxCoord x
) const
107 wxCoord new_x
= x
- m_logicalOriginX
;
109 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
111 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
113 wxCoord
XLOG2DEVREL(wxCoord x
) const
116 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
118 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
120 wxCoord
YLOG2DEV(wxCoord y
) const
122 wxCoord new_y
= y
- m_logicalOriginY
;
124 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
126 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
128 wxCoord
YLOG2DEVREL(wxCoord y
) const
131 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
133 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
137 // base class pure virtuals implemented here
138 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
139 virtual void DoGetSize(int *width
, int *height
) const;
140 virtual void DoGetSizeMM(int* width
, int* height
) const;
143 // GTK-specific member variables
145 // not sure what for, but what is a mm on a screen you don't know the size
147 double m_mm_to_pix_x
,
150 bool m_needComputeScaleX
,
151 m_needComputeScaleY
; // not yet used
153 float m_scaleFactor
; // wxPSDC wants to have this. Will disappear.