]>
Commit | Line | Data |
---|---|---|
c801d85f KB |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: dcclient.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
dbf858b5 RR |
5 | // Id: $Id$ |
6 | // Copyright: (c) 1998 Robert Roebling | |
8bbe427f | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
c801d85f KB |
10 | #ifndef __GTKDCCLIENTH__ |
11 | #define __GTKDCCLIENTH__ | |
12 | ||
12028905 | 13 | #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) |
c801d85f KB |
14 | #pragma interface |
15 | #endif | |
16 | ||
17 | #include "wx/dc.h" | |
18 | #include "wx/window.h" | |
19 | ||
20 | //----------------------------------------------------------------------------- | |
21 | // classes | |
22 | //----------------------------------------------------------------------------- | |
23 | ||
ec758a20 | 24 | class wxWindowDC; |
c801d85f | 25 | class wxPaintDC; |
ec758a20 | 26 | class wxClientDC; |
c801d85f KB |
27 | |
28 | //----------------------------------------------------------------------------- | |
ec758a20 | 29 | // wxWindowDC |
c801d85f KB |
30 | //----------------------------------------------------------------------------- |
31 | ||
b0e0d661 | 32 | class wxWindowDC : public wxDC |
c801d85f | 33 | { |
ec758a20 | 34 | public: |
b0e0d661 VZ |
35 | wxWindowDC(); |
36 | wxWindowDC( wxWindow *win ); | |
37 | ||
4f55a07f | 38 | virtual ~wxWindowDC(); |
b0e0d661 VZ |
39 | |
40 | virtual bool CanDrawBitmap() const { return TRUE; } | |
41 | virtual bool CanGetTextExtent() const { return TRUE; } | |
42 | ||
376aa62a VZ |
43 | protected: |
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 ); |
72cdf4c9 VZ |
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, | |
b0e0d661 | 53 | double sa, double ea ); |
72cdf4c9 | 54 | virtual void DoDrawPoint( wxCoord x, wxCoord y ); |
b0e0d661 VZ |
55 | |
56 | virtual void DoDrawLines(int n, wxPoint points[], | |
72cdf4c9 | 57 | wxCoord xoffset, wxCoord yoffset); |
b0e0d661 | 58 | virtual void DoDrawPolygon(int n, wxPoint points[], |
72cdf4c9 | 59 | wxCoord xoffset, wxCoord yoffset, |
b0e0d661 VZ |
60 | int fillStyle = wxODDEVEN_RULE); |
61 | ||
72cdf4c9 VZ |
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 ); | |
b0e0d661 | 65 | |
72cdf4c9 VZ |
66 | virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); |
67 | virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, | |
b0e0d661 VZ |
68 | bool useMask = FALSE ); |
69 | ||
72cdf4c9 VZ |
70 | virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, |
71 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
0cbff120 | 72 | int logical_func = wxCOPY, bool useMask = FALSE, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ); |
b0e0d661 | 73 | |
72cdf4c9 | 74 | virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ); |
95724b1a VZ |
75 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, |
76 | double angle); | |
72cdf4c9 VZ |
77 | virtual void DoGetTextExtent( const wxString &string, |
78 | wxCoord *width, wxCoord *height, | |
79 | wxCoord *descent = (wxCoord *) NULL, | |
80 | wxCoord *externalLeading = (wxCoord *) NULL, | |
b0e0d661 | 81 | wxFont *theFont = (wxFont *) NULL) const; |
376aa62a VZ |
82 | |
83 | public: | |
72cdf4c9 VZ |
84 | virtual wxCoord GetCharWidth() const; |
85 | virtual wxCoord GetCharHeight() const; | |
b0e0d661 VZ |
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 | ||
72cdf4c9 | 99 | virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); |
b0e0d661 VZ |
100 | virtual void DestroyClippingRegion(); |
101 | virtual void DoSetClippingRegionAsRegion( const wxRegion ®ion ); | |
102 | ||
b0e0d661 VZ |
103 | // Resolution in pixels per logical inch |
104 | virtual wxSize GetPPI() const; | |
105 | virtual int GetDepth() const; | |
106 | ||
107 | // implementation | |
108 | // -------------- | |
109 | ||
110 | GdkWindow *m_window; | |
111 | GdkGC *m_penGC; | |
112 | GdkGC *m_brushGC; | |
113 | GdkGC *m_textGC; | |
114 | GdkGC *m_bgGC; | |
115 | GdkColormap *m_cmap; | |
116 | bool m_isMemDC; | |
e1208c31 | 117 | bool m_isScreenDC; |
b0e0d661 | 118 | wxWindow *m_owner; |
3d2d8da1 RR |
119 | wxRegion m_currentClippingRegion; |
120 | wxRegion m_paintClippingRegion; | |
2b5f62a0 VZ |
121 | |
122 | // PangoContext stuff for GTK 2.0 | |
8943b403 OK |
123 | #ifdef __WXGTK20__ |
124 | PangoContext *m_context; | |
138618ac | 125 | PangoLayout *m_layout; |
8943b403 OK |
126 | PangoFontDescription *m_fontdesc; |
127 | #endif | |
b0e0d661 VZ |
128 | |
129 | void SetUpDC(); | |
130 | void Destroy(); | |
238d735d RR |
131 | void ComputeScaleAndOrigin(); |
132 | ||
b0e0d661 | 133 | GdkWindow *GetWindow() { return m_window; } |
cd9da200 | 134 | |
20e05ffb RR |
135 | private: |
136 | DECLARE_DYNAMIC_CLASS(wxWindowDC) | |
ec758a20 RR |
137 | }; |
138 | ||
139 | //----------------------------------------------------------------------------- | |
376aa62a | 140 | // wxClientDC |
ec758a20 RR |
141 | //----------------------------------------------------------------------------- |
142 | ||
376aa62a | 143 | class wxClientDC : public wxWindowDC |
ec758a20 | 144 | { |
ec758a20 | 145 | public: |
4f55a07f | 146 | wxClientDC() { } |
376aa62a | 147 | wxClientDC( wxWindow *win ); |
cd9da200 | 148 | |
7b30ac82 VZ |
149 | protected: |
150 | virtual void DoGetSize(int *width, int *height) const; | |
151 | ||
20e05ffb | 152 | private: |
376aa62a | 153 | DECLARE_DYNAMIC_CLASS(wxClientDC) |
c801d85f KB |
154 | }; |
155 | ||
ec758a20 | 156 | //----------------------------------------------------------------------------- |
376aa62a | 157 | // wxPaintDC |
ec758a20 RR |
158 | //----------------------------------------------------------------------------- |
159 | ||
376aa62a | 160 | class wxPaintDC : public wxClientDC |
ec758a20 | 161 | { |
ec758a20 | 162 | public: |
376aa62a VZ |
163 | wxPaintDC() { } |
164 | wxPaintDC( wxWindow *win ); | |
cd9da200 | 165 | |
20e05ffb | 166 | private: |
376aa62a | 167 | DECLARE_DYNAMIC_CLASS(wxPaintDC) |
ec758a20 RR |
168 | }; |
169 | ||
c801d85f | 170 | #endif // __GTKDCCLIENTH__ |