]> git.saurik.com Git - wxWidgets.git/blob - include/wx/x11/dcclient.h
The rounded corners look really dumb at this size.
[wxWidgets.git] / include / wx / x11 / dcclient.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/x11/dcclient.h
3 // Purpose: wxClientDC, wxPaintDC and wxWindowDC classes
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 17/09/98
7 // Copyright: (c) Julian Smart
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_DCCLIENT_H_
12 #define _WX_DCCLIENT_H_
13
14 #include "wx/dc.h"
15 #include "wx/dcclient.h"
16 #include "wx/x11/dc.h"
17 #include "wx/region.h"
18
19 // -----------------------------------------------------------------------------
20 // fwd declarations
21 // -----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_FWD_CORE wxWindow;
24
25 //-----------------------------------------------------------------------------
26 // wxWindowDCImpl
27 //-----------------------------------------------------------------------------
28
29 class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxX11DCImpl
30 {
31 public:
32 wxWindowDCImpl( wxDC *owner );
33 wxWindowDCImpl( wxDC *owner, wxWindow *win );
34
35 virtual ~wxWindowDCImpl();
36
37 virtual bool CanDrawBitmap() const { return true; }
38 virtual bool CanGetTextExtent() const { return true; }
39
40 protected:
41 virtual void DoGetSize(int *width, int *height) const;
42 virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col,
43 wxFloodFillStyle style = wxFLOOD_SURFACE );
44 virtual bool DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const;
45
46 virtual void DoDrawPoint(wxCoord x, wxCoord y);
47 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
48
49 virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
50 virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
51 bool useMask = false );
52
53 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
54 wxCoord x2, wxCoord y2,
55 wxCoord xc, wxCoord yc);
56 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
57 double sa, double ea);
58
59 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
60 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
61 wxCoord width, wxCoord height,
62 double radius);
63 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
64
65 virtual void DoCrossHair(wxCoord x, wxCoord y);
66
67 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
68 virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle);
69
70 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
71 wxDC *source, wxCoord xsrc, wxCoord ysrc,
72 wxRasterOperationMode rop = wxCOPY, bool useMask = false,
73 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
74
75 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
76 wxCoord width, wxCoord height);
77 virtual void DoSetDeviceClippingRegion(const wxRegion& region);
78
79 virtual void DoDrawLines(int n, const wxPoint points[],
80 wxCoord xoffset, wxCoord yoffset);
81 virtual void DoDrawPolygon(int n, const wxPoint points[],
82 wxCoord xoffset, wxCoord yoffset,
83 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
84
85
86 public:
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 SetBackgroundMode(int mode);
94 virtual void SetPalette(const wxPalette& palette);
95 virtual void SetLogicalFunction( wxRasterOperationMode function );
96
97 virtual void SetTextForeground(const wxColour& colour);
98 virtual void SetTextBackground(const wxColour& colour);
99
100 virtual wxCoord GetCharHeight() const;
101 virtual wxCoord GetCharWidth() const;
102
103 virtual int GetDepth() const;
104 virtual wxSize GetPPI() const;
105
106 virtual void DestroyClippingRegion();
107 WXWindow GetX11Window() const { return m_x11window; }
108
109 virtual void ComputeScaleAndOrigin();
110
111 protected:
112 // implementation
113 // --------------
114 virtual void DoGetTextExtent(const wxString& string,
115 wxCoord *x, wxCoord *y,
116 wxCoord *descent = NULL,
117 wxCoord *externalLeading = NULL,
118 const wxFont *theFont = NULL) const;
119
120 void Init();
121
122 WXDisplay *m_display;
123 WXWindow m_x11window;
124 WXGC m_penGC;
125 WXGC m_brushGC;
126 WXGC m_textGC;
127 WXGC m_bgGC;
128 WXColormap m_cmap;
129 bool m_isMemDC;
130 bool m_isScreenDC;
131 wxRegion m_currentClippingRegion;
132 wxRegion m_paintClippingRegion;
133
134 #if wxUSE_UNICODE
135 PangoContext *m_context;
136 PangoFontDescription *m_fontdesc;
137 #endif
138
139 void SetUpDC();
140 void Destroy();
141
142 private:
143 DECLARE_CLASS(wxWindowDCImpl)
144 };
145
146 //-----------------------------------------------------------------------------
147 // wxClientDC
148 //-----------------------------------------------------------------------------
149
150 class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
151 {
152 public:
153 wxClientDCImpl( wxDC *owner ) : wxWindowDCImpl( owner ) { }
154 wxClientDCImpl( wxDC *owner, wxWindow *win );
155
156 protected:
157 virtual void DoGetSize(int *width, int *height) const;
158
159 private:
160 DECLARE_CLASS(wxClientDCImpl)
161 };
162
163 //-----------------------------------------------------------------------------
164 // wxPaintDC
165 //-----------------------------------------------------------------------------
166
167 class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
168 {
169 public:
170 wxPaintDCImpl( wxDC *owner ) : wxClientDCImpl( owner ) { }
171 wxPaintDCImpl( wxDC *owner, wxWindow *win );
172
173 private:
174 DECLARE_CLASS(wxPaintDCImpl)
175 };
176
177 #endif
178 // _WX_DCCLIENT_H_