]> git.saurik.com Git - wxWidgets.git/blame - include/wx/gtk/dc.h
respect GTK+'s theme tooltip colour settings
[wxWidgets.git] / include / wx / gtk / dc.h
CommitLineData
c801d85f
KB
1/////////////////////////////////////////////////////////////////////////////
2// Name: dc.h
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
10
11#ifndef __GTKDCH__
12#define __GTKDCH__
13
12028905 14#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
c801d85f
KB
15#pragma interface
16#endif
17
c801d85f
KB
18//-----------------------------------------------------------------------------
19// classes
20//-----------------------------------------------------------------------------
21
22class wxDC;
23
24//-----------------------------------------------------------------------------
25// constants
26//-----------------------------------------------------------------------------
27
a23fd0e1 28#define MM_TEXT 0
8bbe427f 29#define MM_ISOTROPIC 1
a23fd0e1
VZ
30#define MM_ANISOTROPIC 2
31#define MM_LOMETRIC 3
32#define MM_HIMETRIC 4
33#define MM_TWIPS 5
34#define MM_POINTS 6
35#define MM_METRIC 7
c801d85f
KB
36
37//-----------------------------------------------------------------------------
38// wxDC
39//-----------------------------------------------------------------------------
40
a23fd0e1 41class wxDC : public wxDCBase
c801d85f 42{
463c1fa1 43public:
a23fd0e1
VZ
44 wxDC();
45 ~wxDC() { }
c801d85f 46
a23fd0e1 47 void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
8bbe427f 48
a23fd0e1
VZ
49 // Resolution in pixels per logical inch
50 virtual wxSize GetPPI() const;
c801d85f 51
a23fd0e1
VZ
52 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return TRUE; }
53 virtual void EndDoc() { }
54 virtual void StartPage() { }
55 virtual void EndPage() { }
8bbe427f 56
a23fd0e1
VZ
57 virtual void SetMapMode( int mode );
58 virtual void SetUserScale( double x, double y );
59 virtual void SetLogicalScale( double x, double y );
72cdf4c9
VZ
60 virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
61 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
8bbe427f 62
a23fd0e1 63 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
c801d85f 64
a23fd0e1
VZ
65 // implementation
66 // --------------
8bbe427f 67
238d735d 68 virtual void ComputeScaleAndOrigin();
8bbe427f 69
72cdf4c9 70 wxCoord XDEV2LOG(wxCoord x) const
a23fd0e1 71 {
72cdf4c9 72 wxCoord new_x = x - m_deviceOriginX;
a23fd0e1 73 if (new_x > 0)
72cdf4c9 74 return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
a23fd0e1 75 else
72cdf4c9 76 return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
a23fd0e1 77 }
72cdf4c9 78 wxCoord XDEV2LOGREL(wxCoord x) const
a23fd0e1
VZ
79 {
80 if (x > 0)
72cdf4c9 81 return (wxCoord)((double)(x) / m_scaleX + 0.5);
a23fd0e1 82 else
72cdf4c9 83 return (wxCoord)((double)(x) / m_scaleX - 0.5);
a23fd0e1 84 }
72cdf4c9 85 wxCoord YDEV2LOG(wxCoord y) const
a23fd0e1 86 {
72cdf4c9 87 wxCoord new_y = y - m_deviceOriginY;
a23fd0e1 88 if (new_y > 0)
72cdf4c9 89 return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
a23fd0e1 90 else
72cdf4c9 91 return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
a23fd0e1 92 }
72cdf4c9 93 wxCoord YDEV2LOGREL(wxCoord y) const
a23fd0e1
VZ
94 {
95 if (y > 0)
72cdf4c9 96 return (wxCoord)((double)(y) / m_scaleY + 0.5);
a23fd0e1 97 else
72cdf4c9 98 return (wxCoord)((double)(y) / m_scaleY - 0.5);
a23fd0e1 99 }
72cdf4c9 100 wxCoord XLOG2DEV(wxCoord x) const
a23fd0e1 101 {
72cdf4c9 102 wxCoord new_x = x - m_logicalOriginX;
a23fd0e1 103 if (new_x > 0)
72cdf4c9 104 return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
a23fd0e1 105 else
72cdf4c9 106 return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
a23fd0e1 107 }
72cdf4c9 108 wxCoord XLOG2DEVREL(wxCoord x) const
a23fd0e1
VZ
109 {
110 if (x > 0)
72cdf4c9 111 return (wxCoord)((double)(x) * m_scaleX + 0.5);
a23fd0e1 112 else
72cdf4c9 113 return (wxCoord)((double)(x) * m_scaleX - 0.5);
a23fd0e1 114 }
72cdf4c9 115 wxCoord YLOG2DEV(wxCoord y) const
a23fd0e1 116 {
72cdf4c9 117 wxCoord new_y = y - m_logicalOriginY;
a23fd0e1 118 if (new_y > 0)
72cdf4c9 119 return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
a23fd0e1 120 else
72cdf4c9 121 return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
a23fd0e1 122 }
72cdf4c9 123 wxCoord YLOG2DEVREL(wxCoord y) const
a23fd0e1
VZ
124 {
125 if (y > 0)
72cdf4c9 126 return (wxCoord)((double)(y) * m_scaleY + 0.5);
a23fd0e1 127 else
72cdf4c9 128 return (wxCoord)((double)(y) * m_scaleY - 0.5);
a23fd0e1
VZ
129 }
130
131protected:
132 // base class pure virtuals implemented here
72cdf4c9 133 virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
a23fd0e1 134 virtual void DoGetSizeMM(int* width, int* height) const;
8bbe427f 135
a23fd0e1
VZ
136public:
137 // GTK-specific member variables
8bbe427f 138
a23fd0e1
VZ
139 // not sure what for, but what is a mm on a screen you don't know the size
140 // of?
141 double m_mm_to_pix_x,
142 m_mm_to_pix_y;
8bbe427f 143
a23fd0e1
VZ
144 bool m_needComputeScaleX,
145 m_needComputeScaleY; // not yet used
8bbe427f 146
c3e44503 147
20e05ffb
RR
148private:
149 DECLARE_ABSTRACT_CLASS(wxDC)
c801d85f
KB
150};
151
c3e44503
VZ
152// this must be defined when wxDC::Blit() honours the DC origian and needed to
153// allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
154// 2.3.[23]
155#ifndef wxHAS_WORKING_GTK_DC_BLIT
156 #define wxHAS_WORKING_GTK_DC_BLIT
157#endif
158
c801d85f 159#endif // __GTKDCH__