]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk1/dc.h
Map illegal UTF-8 sequences to a range in Unicode's private use area as
[wxWidgets.git] / include / wx / gtk1 / dc.h
CommitLineData
c801d85f 1/////////////////////////////////////////////////////////////////////////////
8ef94bfc 2// Name: wx/gtk1/dc.h
c801d85f
KB
3// Purpose:
4// Author: Robert Roebling
dbf858b5
RR
5// Id: $Id$
6// Copyright: (c) 1998 Robert Roebling
65571936 7// Licence: wxWindows licence
c801d85f
KB
8/////////////////////////////////////////////////////////////////////////////
9
c801d85f
KB
10#ifndef __GTKDCH__
11#define __GTKDCH__
12
c801d85f
KB
13//-----------------------------------------------------------------------------
14// classes
15//-----------------------------------------------------------------------------
16
20123d49 17class WXDLLIMPEXP_CORE wxDC;
c801d85f
KB
18
19//-----------------------------------------------------------------------------
20// constants
21//-----------------------------------------------------------------------------
22
d2b1753d 23#ifndef MM_TEXT
a23fd0e1 24#define MM_TEXT 0
8bbe427f 25#define MM_ISOTROPIC 1
a23fd0e1
VZ
26#define MM_ANISOTROPIC 2
27#define MM_LOMETRIC 3
28#define MM_HIMETRIC 4
29#define MM_TWIPS 5
30#define MM_POINTS 6
31#define MM_METRIC 7
d2b1753d 32#endif
c801d85f
KB
33
34//-----------------------------------------------------------------------------
35// wxDC
36//-----------------------------------------------------------------------------
37
20123d49 38class WXDLLIMPEXP_CORE wxDC : public wxDCBase
c801d85f 39{
463c1fa1 40public:
a23fd0e1 41 wxDC();
d3c7fc99 42 virtual ~wxDC() { }
c801d85f 43
0b04c4e0 44#if wxUSE_PALETTE
a23fd0e1 45 void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
0b04c4e0 46#endif // wxUSE_PALETTE
8bbe427f 47
a23fd0e1
VZ
48 // Resolution in pixels per logical inch
49 virtual wxSize GetPPI() const;
c801d85f 50
b1263dcf 51 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; }
a23fd0e1
VZ
52 virtual void EndDoc() { }
53 virtual void StartPage() { }
54 virtual void EndPage() { }
8bbe427f 55
a23fd0e1
VZ
56 virtual void SetMapMode( int mode );
57 virtual void SetUserScale( double x, double y );
58 virtual void SetLogicalScale( double x, double y );
72cdf4c9
VZ
59 virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
60 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
8bbe427f 61
a23fd0e1 62 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
c801d85f 63
a23fd0e1
VZ
64 // implementation
65 // --------------
8bbe427f 66
238d735d 67 virtual void ComputeScaleAndOrigin();
8bbe427f 68
2e992e06
VZ
69 virtual GdkWindow* GetGDKWindow() const { return NULL; }
70
72cdf4c9 71 wxCoord XDEV2LOG(wxCoord x) const
a23fd0e1 72 {
5a70d3f5 73 return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
a23fd0e1 74 }
72cdf4c9 75 wxCoord XDEV2LOGREL(wxCoord x) const
a23fd0e1 76 {
5a70d3f5 77 return wxRound((double)(x) / m_scaleX);
a23fd0e1 78 }
72cdf4c9 79 wxCoord YDEV2LOG(wxCoord y) const
a23fd0e1 80 {
5a70d3f5 81 return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
a23fd0e1 82 }
72cdf4c9 83 wxCoord YDEV2LOGREL(wxCoord y) const
a23fd0e1 84 {
5a70d3f5 85 return wxRound((double)(y) / m_scaleY);
a23fd0e1 86 }
72cdf4c9 87 wxCoord XLOG2DEV(wxCoord x) const
a23fd0e1 88 {
5a70d3f5 89 return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
a23fd0e1 90 }
72cdf4c9 91 wxCoord XLOG2DEVREL(wxCoord x) const
a23fd0e1 92 {
5a70d3f5 93 return wxRound((double)(x) * m_scaleX);
a23fd0e1 94 }
72cdf4c9 95 wxCoord YLOG2DEV(wxCoord y) const
a23fd0e1 96 {
5a70d3f5 97 return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
a23fd0e1 98 }
72cdf4c9 99 wxCoord YLOG2DEVREL(wxCoord y) const
a23fd0e1 100 {
5a70d3f5 101 return wxRound((double)(y) * m_scaleY);
a23fd0e1
VZ
102 }
103
104protected:
105 // base class pure virtuals implemented here
72cdf4c9 106 virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
a23fd0e1 107 virtual void DoGetSizeMM(int* width, int* height) const;
8bbe427f 108
a23fd0e1
VZ
109public:
110 // GTK-specific member variables
8bbe427f 111
a23fd0e1
VZ
112 // not sure what for, but what is a mm on a screen you don't know the size
113 // of?
114 double m_mm_to_pix_x,
115 m_mm_to_pix_y;
8bbe427f 116
a23fd0e1
VZ
117 bool m_needComputeScaleX,
118 m_needComputeScaleY; // not yet used
8bbe427f 119
c3e44503 120
20e05ffb
RR
121private:
122 DECLARE_ABSTRACT_CLASS(wxDC)
c801d85f
KB
123};
124
c3e44503
VZ
125// this must be defined when wxDC::Blit() honours the DC origian and needed to
126// allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
127// 2.3.[23]
128#ifndef wxHAS_WORKING_GTK_DC_BLIT
129 #define wxHAS_WORKING_GTK_DC_BLIT
130#endif
131
c801d85f 132#endif // __GTKDCH__