]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk1/dc.h
remove miniframe stuff from GtkOnSize(), it's handled by wxFrame
[wxWidgets.git] / include / wx / gtk1 / dc.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk1/dc.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKDCH__
11 #define __GTKDCH__
12
13 //-----------------------------------------------------------------------------
14 // classes
15 //-----------------------------------------------------------------------------
16
17 class WXDLLIMPEXP_CORE wxDC;
18
19 //-----------------------------------------------------------------------------
20 // constants
21 //-----------------------------------------------------------------------------
22
23 #ifndef MM_TEXT
24 #define MM_TEXT 0
25 #define MM_ISOTROPIC 1
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
32 #endif
33
34 //-----------------------------------------------------------------------------
35 // wxDC
36 //-----------------------------------------------------------------------------
37
38 class WXDLLIMPEXP_CORE wxDC : public wxDCBase
39 {
40 public:
41 wxDC();
42 virtual ~wxDC() { }
43
44 #if wxUSE_PALETTE
45 void SetColourMap( const wxPalette& palette ) { SetPalette(palette); };
46 #endif // wxUSE_PALETTE
47
48 // Resolution in pixels per logical inch
49 virtual wxSize GetPPI() const;
50
51 virtual bool StartDoc( const wxString& WXUNUSED(message) ) { return true; }
52 virtual void EndDoc() { }
53 virtual void StartPage() { }
54 virtual void EndPage() { }
55
56 virtual wxCoord DeviceToLogicalX(wxCoord x) const;
57 virtual wxCoord DeviceToLogicalY(wxCoord y) const;
58 virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
59 virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
60 virtual wxCoord LogicalToDeviceX(wxCoord x) const;
61 virtual wxCoord LogicalToDeviceY(wxCoord y) const;
62 virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
63 virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
64
65 virtual void SetMapMode( int mode );
66 virtual void SetUserScale( double x, double y );
67 virtual void SetLogicalScale( double x, double y );
68 virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
69 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
70
71 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
72
73 // implementation
74 // --------------
75
76 virtual void ComputeScaleAndOrigin();
77
78 virtual GdkWindow* GetGDKWindow() const { return NULL; }
79
80 wxCoord XDEV2LOG(wxCoord x) const
81 {
82 return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
83 }
84 wxCoord XDEV2LOGREL(wxCoord x) const
85 {
86 return wxRound((double)(x) / m_scaleX);
87 }
88 wxCoord YDEV2LOG(wxCoord y) const
89 {
90 return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
91 }
92 wxCoord YDEV2LOGREL(wxCoord y) const
93 {
94 return wxRound((double)(y) / m_scaleY);
95 }
96 wxCoord XLOG2DEV(wxCoord x) const
97 {
98 return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
99 }
100 wxCoord XLOG2DEVREL(wxCoord x) const
101 {
102 return wxRound((double)(x) * m_scaleX);
103 }
104 wxCoord YLOG2DEV(wxCoord y) const
105 {
106 return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
107 }
108 wxCoord YLOG2DEVREL(wxCoord y) const
109 {
110 return wxRound((double)(y) * m_scaleY);
111 }
112
113 protected:
114 // base class pure virtuals implemented here
115 virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
116 virtual void DoGetSizeMM(int* width, int* height) const;
117
118 public:
119 // GTK-specific member variables
120
121 // not sure what for, but what is a mm on a screen you don't know the size
122 // of?
123 double m_mm_to_pix_x,
124 m_mm_to_pix_y;
125
126 bool m_needComputeScaleX,
127 m_needComputeScaleY; // not yet used
128
129
130 private:
131 DECLARE_ABSTRACT_CLASS(wxDC)
132 };
133
134 // this must be defined when wxDC::Blit() honours the DC origian and needed to
135 // allow wxUniv code in univ/winuniv.cpp to work with versions of wxGTK
136 // 2.3.[23]
137 #ifndef wxHAS_WORKING_GTK_DC_BLIT
138 #define wxHAS_WORKING_GTK_DC_BLIT
139 #endif
140
141 #endif // __GTKDCH__