]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dcclient.h
fixed previous commit (no changes)
[wxWidgets.git] / include / wx / gtk / dcclient.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: dcclient.h
3 // Purpose:
4 // Author: Robert Roebling
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef __GTKDCCLIENTH__
11 #define __GTKDCCLIENTH__
12
13 #ifdef __GNUG__
14 #pragma interface
15 #endif
16
17 #include "wx/dc.h"
18 #include "wx/window.h"
19
20 //-----------------------------------------------------------------------------
21 // classes
22 //-----------------------------------------------------------------------------
23
24 class wxWindowDC;
25 class wxPaintDC;
26 class wxClientDC;
27
28 //-----------------------------------------------------------------------------
29 // wxWindowDC
30 //-----------------------------------------------------------------------------
31
32 class wxWindowDC : public wxDC
33 {
34 public:
35 wxWindowDC();
36 wxWindowDC( wxWindow *win );
37
38 ~wxWindowDC();
39
40 virtual bool CanDrawBitmap() const { return TRUE; }
41 virtual bool CanGetTextExtent() const { return TRUE; }
42
43 protected:
44 virtual void DoGetSize(int *width, int *height) const;
45 virtual void DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE );
46 virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const;
47
48 virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 );
49 virtual void DoCrossHair( wxCoord x, wxCoord y );
50 virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
51 wxCoord xc, wxCoord yc );
52 virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height,
53 double sa, double ea );
54 virtual void DoDrawPoint( wxCoord x, wxCoord y );
55
56 virtual void DoDrawLines(int n, wxPoint points[],
57 wxCoord xoffset, wxCoord yoffset);
58 virtual void DoDrawPolygon(int n, wxPoint points[],
59 wxCoord xoffset, wxCoord yoffset,
60 int fillStyle = wxODDEVEN_RULE);
61
62 virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
63 virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 );
64 virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
65
66 virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
67 virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
68 bool useMask = FALSE );
69
70 virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
71 wxDC *source, wxCoord xsrc, wxCoord ysrc,
72 int logical_func = wxCOPY, bool useMask = FALSE );
73
74 virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y );
75 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
76 double angle);
77 virtual void DoGetTextExtent( const wxString &string,
78 wxCoord *width, wxCoord *height,
79 wxCoord *descent = (wxCoord *) NULL,
80 wxCoord *externalLeading = (wxCoord *) NULL,
81 wxFont *theFont = (wxFont *) NULL) const;
82
83 public:
84 virtual wxCoord GetCharWidth() const;
85 virtual wxCoord GetCharHeight() const;
86
87 virtual void Clear();
88
89 virtual void SetFont( const wxFont &font );
90 virtual void SetPen( const wxPen &pen );
91 virtual void SetBrush( const wxBrush &brush );
92 virtual void SetBackground( const wxBrush &brush );
93 virtual void SetLogicalFunction( int function );
94 virtual void SetTextForeground( const wxColour &col );
95 virtual void SetTextBackground( const wxColour &col );
96 virtual void SetBackgroundMode( int mode );
97 virtual void SetPalette( const wxPalette& palette );
98
99 virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
100 virtual void DestroyClippingRegion();
101 virtual void DoSetClippingRegionAsRegion( const wxRegion &region );
102
103 #if wxUSE_SPLINES
104 virtual void DoDrawSpline( wxList *points );
105 #endif
106
107 // Resolution in pixels per logical inch
108 virtual wxSize GetPPI() const;
109 virtual int GetDepth() const;
110
111 // implementation
112 // --------------
113
114 GdkWindow *m_window;
115 GdkGC *m_penGC;
116 GdkGC *m_brushGC;
117 GdkGC *m_textGC;
118 GdkGC *m_bgGC;
119 GdkColormap *m_cmap;
120 bool m_isMemDC;
121 bool m_isScreenDC;
122 wxWindow *m_owner;
123 wxRegion m_currentClippingRegion;
124 wxRegion m_paintClippingRegion;
125 #ifdef __WXGTK20__
126 PangoContext *m_context;
127 PangoFontDescription *m_fontdesc;
128 #endif
129
130 void SetUpDC();
131 void Destroy();
132 void ComputeScaleAndOrigin();
133
134 GdkWindow *GetWindow() { return m_window; }
135
136 private:
137 DECLARE_DYNAMIC_CLASS(wxWindowDC)
138 };
139
140 //-----------------------------------------------------------------------------
141 // wxClientDC
142 //-----------------------------------------------------------------------------
143
144 class wxClientDC : public wxWindowDC
145 {
146 public:
147 wxClientDC() { }
148 wxClientDC( wxWindow *win );
149
150 protected:
151 virtual void DoGetSize(int *width, int *height) const;
152
153 private:
154 DECLARE_DYNAMIC_CLASS(wxClientDC)
155 };
156
157 //-----------------------------------------------------------------------------
158 // wxPaintDC
159 //-----------------------------------------------------------------------------
160
161 class wxPaintDC : public wxClientDC
162 {
163 public:
164 wxPaintDC() { }
165 wxPaintDC( wxWindow *win );
166
167 private:
168 DECLARE_DYNAMIC_CLASS(wxPaintDC)
169 };
170
171 #endif // __GTKDCCLIENTH__