]> git.saurik.com Git - wxWidgets.git/blame - include/wx/motif/dcclient.h
Header Cosmetics
[wxWidgets.git] / include / wx / motif / dcclient.h
CommitLineData
9b6dbb09
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
af0bb3b1 9// Licence: wxWindows licence
9b6dbb09
JS
10/////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_DCCLIENT_H_
13#define _WX_DCCLIENT_H_
14
12028905 15#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
83df96d6 16#pragma interface "dcclient.h"
9b6dbb09
JS
17#endif
18
19#include "wx/dc.h"
20
76208c7e 21// ----------------------------------------------------------------------------
af0bb3b1 22// fwd declarations
76208c7e 23// ----------------------------------------------------------------------------
9b6dbb09 24
dfc54541 25class WXDLLEXPORT wxWindowDC;
9b6dbb09
JS
26class WXDLLEXPORT wxWindow;
27
af0bb3b1
VZ
28// Under Windows, wxClientDC, wxPaintDC and wxWindowDC are implemented
29// differently. On many platforms, however, they will be the same.
9b6dbb09 30
9b6dbb09 31//-----------------------------------------------------------------------------
dfc54541 32// wxWindowDC
9b6dbb09
JS
33//-----------------------------------------------------------------------------
34
af0bb3b1 35class WXDLLEXPORT wxWindowDC : public wxDC
9b6dbb09 36{
af0bb3b1 37 DECLARE_DYNAMIC_CLASS(wxWindowDC)
83df96d6 38
af0bb3b1
VZ
39public:
40 wxWindowDC();
dfc54541 41 wxWindowDC( wxWindow *win );
83df96d6 42
af0bb3b1 43 ~wxWindowDC();
83df96d6 44
af0bb3b1
VZ
45 // TODO this function is Motif-only for now - should it go into base class?
46 void Clear(const wxRect& rect);
83df96d6 47
af0bb3b1
VZ
48 // implement base class pure virtuals
49 // ----------------------------------
83df96d6 50
af0bb3b1 51 virtual void Clear();
83df96d6 52
af0bb3b1
VZ
53 virtual void SetFont(const wxFont& font);
54 virtual void SetPen(const wxPen& pen);
55 virtual void SetBrush(const wxBrush& brush);
56 virtual void SetBackground(const wxBrush& brush);
57 virtual void SetBackgroundMode(int mode);
58 virtual void SetPalette(const wxPalette& palette);
9b6dbb09 59 virtual void SetLogicalFunction( int function );
83df96d6 60
af0bb3b1
VZ
61 virtual void SetTextForeground(const wxColour& colour);
62 virtual void SetTextBackground(const wxColour& colour);
83df96d6 63
7b65ea1a
MB
64 virtual wxCoord GetCharHeight() const;
65 virtual wxCoord GetCharWidth() const;
66 virtual void DoGetTextExtent(const wxString& string,
83df96d6
JS
67 wxCoord *x, wxCoord *y,
68 wxCoord *descent = NULL,
69 wxCoord *externalLeading = NULL,
70 wxFont *theFont = NULL) const;
71
af0bb3b1
VZ
72 virtual bool CanDrawBitmap() const;
73 virtual bool CanGetTextExtent() const;
83df96d6 74
af0bb3b1
VZ
75 virtual int GetDepth() const;
76 virtual wxSize GetPPI() const;
83df96d6 77
af0bb3b1 78 virtual void DestroyClippingRegion();
83df96d6 79
af0bb3b1 80 // Helper function for setting clipping
148b44a1 81 void SetDCClipping(WXRegion region);
83df96d6 82
af0bb3b1
VZ
83 // implementation from now on
84 // --------------------------
83df96d6 85
af0bb3b1
VZ
86 WXGC GetGC() const { return m_gc; }
87 WXGC GetBackingGC() const { return m_gcBacking; }
88 WXDisplay* GetDisplay() const { return m_display; }
89 bool GetAutoSetting() const { return m_autoSetting; }
90 void SetAutoSetting(bool flag) { m_autoSetting = flag; }
83df96d6 91
dfc54541 92protected:
395539f9
MB
93 // note that this function will call colour.SetPixel,
94 // and will do one of curCol = colour, curCol = wxWHITE, curCol = wxBLACK
95 // roundToWhite has an effect for monochrome display only
96 // if roundToWhite == TRUE then the colour will be set to white unless
97 // it is RGB 0x000000;if roundToWhite == FALSE the colour wull be set to
98 // black unless it id RGB 0xffffff
99 int CalculatePixel(wxColour& colour, wxColour& curCol,
100 bool roundToWhite) const;
101 // sets the foreground pixel taking into account the
102 // currently selected logical operation
103 void SetForegroundPixelWithLogicalFunction(int pixel);
104
387ebd3e 105 virtual bool DoFloodFill(wxCoord x, wxCoord y, const wxColour& col,
83df96d6
JS
106 int style = wxFLOOD_SURFACE);
107
7b65ea1a 108 virtual bool DoGetPixel(wxCoord x, wxCoord y, wxColour *col) const;
83df96d6 109
7b65ea1a
MB
110 virtual void DoDrawPoint(wxCoord x, wxCoord y);
111 virtual void DoDrawLine(wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2);
83df96d6 112
7b65ea1a 113 virtual void DoDrawArc(wxCoord x1, wxCoord y1,
83df96d6
JS
114 wxCoord x2, wxCoord y2,
115 wxCoord xc, wxCoord yc);
7b65ea1a 116 virtual void DoDrawEllipticArc(wxCoord x, wxCoord y, wxCoord w, wxCoord h,
83df96d6
JS
117 double sa, double ea);
118
7b65ea1a
MB
119 virtual void DoDrawRectangle(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
120 virtual void DoDrawRoundedRectangle(wxCoord x, wxCoord y,
83df96d6
JS
121 wxCoord width, wxCoord height,
122 double radius);
7b65ea1a 123 virtual void DoDrawEllipse(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
83df96d6 124
7b65ea1a 125 virtual void DoCrossHair(wxCoord x, wxCoord y);
83df96d6 126
7b65ea1a 127 virtual void DoDrawText(const wxString& text, wxCoord x, wxCoord y);
e4e901d1 128 virtual void DoDrawRotatedText(const wxString &text, wxCoord x, wxCoord y, double angle);
83df96d6 129
7b65ea1a 130 virtual bool DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
83df96d6
JS
131 wxDC *source, wxCoord xsrc, wxCoord ysrc,
132 int rop = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1);
133
af0bb3b1 134 virtual void DoSetClippingRegionAsRegion(const wxRegion& region);
7b65ea1a 135 virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
83df96d6
JS
136 wxCoord width, wxCoord height);
137
af0bb3b1 138 virtual void DoDrawLines(int n, wxPoint points[],
83df96d6 139 wxCoord xoffset, wxCoord yoffset);
af0bb3b1 140 virtual void DoDrawPolygon(int n, wxPoint points[],
83df96d6
JS
141 wxCoord xoffset, wxCoord yoffset,
142 int fillStyle = wxODDEVEN_RULE);
76208c7e
MB
143
144 void DoGetSize( int *width, int *height ) const;
145
146 // common part of constructors
147 void Init();
148
dfc54541
JS
149 WXGC m_gc;
150 WXGC m_gcBacking;
151 WXDisplay* m_display;
152 wxWindow* m_window;
148b44a1
MB
153 // Pixmap for drawing on
154 WXPixmap m_pixmap;
155 // Last clipping region set on th GC, this is the combination
156 // of paint clipping region and all user-defined clipping regions
157 WXRegion m_clipRegion;
158
dfc54541
JS
159 // Not sure if we'll need all of these
160 int m_backgroundPixel;
161 wxColour m_currentColour;
dfc54541
JS
162 int m_currentPenWidth ;
163 int m_currentPenJoin ;
164 int m_currentPenCap ;
165 int m_currentPenDashCount ;
69c44812 166 wxX11Dash* m_currentPenDash ;
dfc54541
JS
167 wxBitmap m_currentStipple ;
168 int m_currentStyle ;
169 int m_currentFill ;
16c1f7f3 170 int m_autoSetting ; // See comment in dcclient.cpp
e97f20a0 171 WXFont m_oldFont;
16c1f7f3
JS
172};
173
174class WXDLLEXPORT wxPaintDC: public wxWindowDC
175{
af0bb3b1 176 DECLARE_DYNAMIC_CLASS(wxPaintDC)
83df96d6 177
16c1f7f3 178public:
af0bb3b1
VZ
179 wxPaintDC() { }
180 wxPaintDC(wxWindow* win);
83df96d6 181
af0bb3b1 182 ~wxPaintDC();
16c1f7f3
JS
183};
184
185class WXDLLEXPORT wxClientDC: public wxWindowDC
186{
af0bb3b1 187 DECLARE_DYNAMIC_CLASS(wxClientDC)
83df96d6 188
16c1f7f3 189public:
af0bb3b1
VZ
190 wxClientDC() { }
191 wxClientDC(wxWindow* win) : wxWindowDC(win) { }
9b6dbb09
JS
192};
193
194#endif
83df96d6 195// _WX_DCCLIENT_H_