]>
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
47 void SetColourMap( const wxPalette
& palette
) { SetPalette(palette
); };
49 // the first two must be overridden and called
50 virtual void DestroyClippingRegion();
52 // Resolution in pixels per logical inch
53 virtual wxSize
GetPPI() const;
55 virtual bool StartDoc( const wxString
& WXUNUSED(message
) ) { return TRUE
; }
56 virtual void EndDoc() { }
57 virtual void StartPage() { }
58 virtual void EndPage() { }
60 virtual void SetMapMode( int mode
);
61 virtual void SetUserScale( double x
, double y
);
62 virtual void SetLogicalScale( double x
, double y
);
63 virtual void SetLogicalOrigin( wxCoord x
, wxCoord y
);
64 virtual void SetDeviceOrigin( wxCoord x
, wxCoord y
);
66 virtual void SetAxisOrientation( bool xLeftRight
, bool yBottomUp
);
71 virtual void ComputeScaleAndOrigin();
73 wxCoord
XDEV2LOG(wxCoord x
) const
75 wxCoord new_x
= x
- m_deviceOriginX
;
77 return (wxCoord
)((double)(new_x
) / m_scaleX
+ 0.5) * m_signX
+ m_logicalOriginX
;
79 return (wxCoord
)((double)(new_x
) / m_scaleX
- 0.5) * m_signX
+ m_logicalOriginX
;
81 wxCoord
XDEV2LOGREL(wxCoord x
) const
84 return (wxCoord
)((double)(x
) / m_scaleX
+ 0.5);
86 return (wxCoord
)((double)(x
) / m_scaleX
- 0.5);
88 wxCoord
YDEV2LOG(wxCoord y
) const
90 wxCoord new_y
= y
- m_deviceOriginY
;
92 return (wxCoord
)((double)(new_y
) / m_scaleY
+ 0.5) * m_signY
+ m_logicalOriginY
;
94 return (wxCoord
)((double)(new_y
) / m_scaleY
- 0.5) * m_signY
+ m_logicalOriginY
;
96 wxCoord
YDEV2LOGREL(wxCoord y
) const
99 return (wxCoord
)((double)(y
) / m_scaleY
+ 0.5);
101 return (wxCoord
)((double)(y
) / m_scaleY
- 0.5);
103 wxCoord
XLOG2DEV(wxCoord x
) const
105 wxCoord new_x
= x
- m_logicalOriginX
;
107 return (wxCoord
)((double)(new_x
) * m_scaleX
+ 0.5) * m_signX
+ m_deviceOriginX
;
109 return (wxCoord
)((double)(new_x
) * m_scaleX
- 0.5) * m_signX
+ m_deviceOriginX
;
111 wxCoord
XLOG2DEVREL(wxCoord x
) const
114 return (wxCoord
)((double)(x
) * m_scaleX
+ 0.5);
116 return (wxCoord
)((double)(x
) * m_scaleX
- 0.5);
118 wxCoord
YLOG2DEV(wxCoord y
) const
120 wxCoord new_y
= y
- m_logicalOriginY
;
122 return (wxCoord
)((double)(new_y
) * m_scaleY
+ 0.5) * m_signY
+ m_deviceOriginY
;
124 return (wxCoord
)((double)(new_y
) * m_scaleY
- 0.5) * m_signY
+ m_deviceOriginY
;
126 wxCoord
YLOG2DEVREL(wxCoord y
) const
129 return (wxCoord
)((double)(y
) * m_scaleY
+ 0.5);
131 return (wxCoord
)((double)(y
) * m_scaleY
- 0.5);
135 // base class pure virtuals implemented here
136 virtual void DoSetClippingRegion(wxCoord x
, wxCoord y
, wxCoord width
, wxCoord height
);
137 virtual void DoGetSizeMM(int* width
, int* height
) const;
140 // GTK-specific member variables
142 // not sure what for, but what is a mm on a screen you don't know the size
144 double m_mm_to_pix_x
,
147 bool m_needComputeScaleX
,
148 m_needComputeScaleY
; // not yet used
152 DECLARE_ABSTRACT_CLASS(wxDC
)