]> git.saurik.com Git - wxWidgets.git/blame - include/wx/x11/dcclient.h
adding measuring contexts, streamlining printing code
[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"
3cd0b8c5 16#include "wx/region.h"
83df96d6
JS
17
18// -----------------------------------------------------------------------------
19// fwd declarations
20// -----------------------------------------------------------------------------
21
968eb2ef 22class WXDLLIMPEXP_CORE wxWindow;
83df96d6 23
968eb2ef
MW
24class WXDLLIMPEXP_CORE wxWindowDC;
25class WXDLLIMPEXP_CORE wxPaintDC;
26class WXDLLIMPEXP_CORE wxClientDC;
83df96d6
JS
27
28//-----------------------------------------------------------------------------
29// wxWindowDC
30//-----------------------------------------------------------------------------
31
968eb2ef 32class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
83df96d6 33{
83df96d6 34public:
5c9d9745 35 wxWindowDC() { Init(); }
83df96d6 36 wxWindowDC( wxWindow *win );
b1263dcf 37
d3c7fc99 38 virtual ~wxWindowDC();
b1263dcf
WS
39
40 virtual bool CanDrawBitmap() const { return true; }
41 virtual bool CanGetTextExtent() const { return true; }
3cd0b8c5 42
83df96d6 43protected:
3cd0b8c5 44 virtual void DoGetSize(int *width, int *height) const;
387ebd3e 45 virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style = wxFLOOD_SURFACE );
3cd0b8c5 46 virtual bool DoGetPixel( wxCoord x, wxCoord y, wxColour *col ) const;
b1263dcf 47
83df96d6
JS
48 virtual void DoDrawPoint(wxCoord x, wxCoord y);
49 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
b1263dcf 50
3cd0b8c5
RR
51 virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
52 virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
b1263dcf 53 bool useMask = false );
3cd0b8c5 54
83df96d6
JS
55 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
56 wxCoord x2, wxCoord y2,
57 wxCoord xc, wxCoord yc);
58 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
59 double sa, double ea);
b1263dcf 60
83df96d6
JS
61 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
62 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
63 wxCoord width, wxCoord height,
64 double radius);
65 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
b1263dcf 66
83df96d6 67 virtual void DoCrossHair(wxCoord x, wxCoord y);
b1263dcf 68
83df96d6
JS
69 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
70 virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle);
b1263dcf 71
83df96d6
JS
72 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
73 wxDC *source, wxCoord xsrc, wxCoord ysrc,
b1263dcf
WS
74 int rop = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
75
83df96d6
JS
76 virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
77 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
78 wxCoord width, wxCoord height);
b1263dcf 79
83df96d6
JS
80 virtual void DoDrawLines(int n, wxPoint points[],
81 wxCoord xoffset, wxCoord yoffset);
82 virtual void DoDrawPolygon(int n, wxPoint points[],
83 wxCoord xoffset, wxCoord yoffset,
84 int fillStyle = wxODDEVEN_RULE);
3cd0b8c5
RR
85
86
87public:
88 virtual void Clear();
b1263dcf 89
3cd0b8c5
RR
90 virtual void SetFont(const wxFont& font);
91 virtual void SetPen(const wxPen& pen);
92 virtual void SetBrush(const wxBrush& brush);
93 virtual void SetBackground(const wxBrush& brush);
94 virtual void SetBackgroundMode(int mode);
95 virtual void SetPalette(const wxPalette& palette);
96 virtual void SetLogicalFunction( int function );
b1263dcf 97
3cd0b8c5
RR
98 virtual void SetTextForeground(const wxColour& colour);
99 virtual void SetTextBackground(const wxColour& colour);
b1263dcf 100
3cd0b8c5
RR
101 virtual wxCoord GetCharHeight() const;
102 virtual wxCoord GetCharWidth() const;
b1263dcf 103
3cd0b8c5
RR
104 virtual int GetDepth() const;
105 virtual wxSize GetPPI() const;
b1263dcf 106
3cd0b8c5 107 virtual void DestroyClippingRegion();
32f8e363 108 WXWindow GetWindow() const { return m_window; }
3cd0b8c5 109
6f02a879
VZ
110 virtual void ComputeScaleAndOrigin();
111
b1263dcf 112protected:
3cd0b8c5
RR
113 // implementation
114 // --------------
6f02a879
VZ
115 virtual void DoGetTextExtent(const wxString& string,
116 wxCoord *x, wxCoord *y,
117 wxCoord *descent = NULL,
118 wxCoord *externalLeading = NULL,
119 wxFont *theFont = NULL) const;
3cd0b8c5 120
5c9d9745
VZ
121 void Init();
122
3cd0b8c5
RR
123 WXDisplay *m_display;
124 WXWindow m_window;
125 WXGC m_penGC;
126 WXGC m_brushGC;
127 WXGC m_textGC;
128 WXGC m_bgGC;
129 WXColormap m_cmap;
130 bool m_isMemDC;
131 bool m_isScreenDC;
132 wxWindow *m_owner;
133 wxRegion m_currentClippingRegion;
134 wxRegion m_paintClippingRegion;
135
2b5f62a0
VZ
136#if wxUSE_UNICODE
137 PangoContext *m_context;
138 PangoFontDescription *m_fontdesc;
139#endif
140
3cd0b8c5
RR
141 void SetUpDC();
142 void Destroy();
3cd0b8c5
RR
143
144private:
145 DECLARE_DYNAMIC_CLASS(wxWindowDC)
83df96d6
JS
146};
147
3cd0b8c5
RR
148//-----------------------------------------------------------------------------
149// wxClientDC
150//-----------------------------------------------------------------------------
151
968eb2ef 152class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
83df96d6 153{
83df96d6 154public:
3cd0b8c5
RR
155 wxClientDC() { }
156 wxClientDC( wxWindow *win );
157
158protected:
159 virtual void DoGetSize(int *width, int *height) const;
160
161private:
162 DECLARE_DYNAMIC_CLASS(wxClientDC)
83df96d6
JS
163};
164
3cd0b8c5
RR
165//-----------------------------------------------------------------------------
166// wxPaintDC
167//-----------------------------------------------------------------------------
168
968eb2ef 169class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
83df96d6 170{
83df96d6 171public:
3cd0b8c5
RR
172 wxPaintDC() { }
173 wxPaintDC( wxWindow *win );
174
175private:
176 DECLARE_DYNAMIC_CLASS(wxPaintDC)
83df96d6
JS
177};
178
179#endif
180// _WX_DCCLIENT_H_