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