]>
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 | |
65571936 | 7 | // Licence: wxWindows licence |
c801d85f KB |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
c801d85f KB |
10 | #ifndef __GTKDCCLIENTH__ |
11 | #define __GTKDCCLIENTH__ | |
12 | ||
c801d85f | 13 | #include "wx/dc.h" |
772b3767 | 14 | #include "wx/region.h" |
c801d85f | 15 | |
772b3767 | 16 | class WXDLLIMPEXP_CORE wxWindow; |
c801d85f KB |
17 | |
18 | //----------------------------------------------------------------------------- | |
ec758a20 | 19 | // wxWindowDC |
c801d85f KB |
20 | //----------------------------------------------------------------------------- |
21 | ||
20123d49 | 22 | class WXDLLIMPEXP_CORE wxWindowDC : public wxDC |
c801d85f | 23 | { |
ec758a20 | 24 | public: |
b0e0d661 VZ |
25 | wxWindowDC(); |
26 | wxWindowDC( wxWindow *win ); | |
27 | ||
4f55a07f | 28 | virtual ~wxWindowDC(); |
b0e0d661 | 29 | |
b1263dcf WS |
30 | virtual bool CanDrawBitmap() const { return true; } |
31 | virtual bool CanGetTextExtent() const { return true; } | |
b0e0d661 | 32 | |
376aa62a VZ |
33 | protected: |
34 | virtual void DoGetSize(int *width, int *height) const; | |
387ebd3e | 35 | virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE ); |
72cdf4c9 VZ |
36 | virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const; |
37 | ||
38 | virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ); | |
39 | virtual void DoCrossHair( wxCoord x, wxCoord y ); | |
40 | virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, | |
41 | wxCoord xc, wxCoord yc ); | |
42 | virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height, | |
b0e0d661 | 43 | double sa, double ea ); |
72cdf4c9 | 44 | virtual void DoDrawPoint( wxCoord x, wxCoord y ); |
b0e0d661 VZ |
45 | |
46 | virtual void DoDrawLines(int n, wxPoint points[], | |
72cdf4c9 | 47 | wxCoord xoffset, wxCoord yoffset); |
b0e0d661 | 48 | virtual void DoDrawPolygon(int n, wxPoint points[], |
72cdf4c9 | 49 | wxCoord xoffset, wxCoord yoffset, |
b0e0d661 VZ |
50 | int fillStyle = wxODDEVEN_RULE); |
51 | ||
72cdf4c9 VZ |
52 | virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); |
53 | virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 ); | |
54 | virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); | |
b0e0d661 | 55 | |
72cdf4c9 VZ |
56 | virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); |
57 | virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, | |
b1263dcf | 58 | bool useMask = false ); |
b0e0d661 | 59 | |
72cdf4c9 VZ |
60 | virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, |
61 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
b1263dcf | 62 | int logical_func = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ); |
b0e0d661 | 63 | |
72cdf4c9 | 64 | virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ); |
95724b1a VZ |
65 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, |
66 | double angle); | |
72cdf4c9 VZ |
67 | virtual void DoGetTextExtent( const wxString &string, |
68 | wxCoord *width, wxCoord *height, | |
69 | wxCoord *descent = (wxCoord *) NULL, | |
70 | wxCoord *externalLeading = (wxCoord *) NULL, | |
b0e0d661 | 71 | wxFont *theFont = (wxFont *) NULL) const; |
6f02a879 VZ |
72 | virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); |
73 | virtual void DoSetClippingRegionAsRegion( const wxRegion ®ion ); | |
376aa62a | 74 | |
847dfdb4 | 75 | |
376aa62a | 76 | public: |
72cdf4c9 VZ |
77 | virtual wxCoord GetCharWidth() const; |
78 | virtual wxCoord GetCharHeight() const; | |
b0e0d661 VZ |
79 | |
80 | virtual void Clear(); | |
81 | ||
82 | virtual void SetFont( const wxFont &font ); | |
83 | virtual void SetPen( const wxPen &pen ); | |
84 | virtual void SetBrush( const wxBrush &brush ); | |
85 | virtual void SetBackground( const wxBrush &brush ); | |
86 | virtual void SetLogicalFunction( int function ); | |
87 | virtual void SetTextForeground( const wxColour &col ); | |
88 | virtual void SetTextBackground( const wxColour &col ); | |
89 | virtual void SetBackgroundMode( int mode ); | |
90 | virtual void SetPalette( const wxPalette& palette ); | |
91 | ||
b0e0d661 | 92 | virtual void DestroyClippingRegion(); |
b0e0d661 | 93 | |
b0e0d661 VZ |
94 | // Resolution in pixels per logical inch |
95 | virtual wxSize GetPPI() const; | |
96 | virtual int GetDepth() const; | |
97 | ||
847dfdb4 RR |
98 | // overrriden here for RTL |
99 | virtual void SetDeviceOrigin( wxCoord x, wxCoord y ); | |
100 | virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); | |
101 | ||
f6f1f4ad | 102 | // protected: |
b0e0d661 VZ |
103 | // implementation |
104 | // -------------- | |
105 | ||
106 | GdkWindow *m_window; | |
107 | GdkGC *m_penGC; | |
108 | GdkGC *m_brushGC; | |
109 | GdkGC *m_textGC; | |
110 | GdkGC *m_bgGC; | |
111 | GdkColormap *m_cmap; | |
112 | bool m_isMemDC; | |
e1208c31 | 113 | bool m_isScreenDC; |
b0e0d661 | 114 | wxWindow *m_owner; |
3d2d8da1 RR |
115 | wxRegion m_currentClippingRegion; |
116 | wxRegion m_paintClippingRegion; | |
b1263dcf | 117 | |
2b5f62a0 | 118 | // PangoContext stuff for GTK 2.0 |
8943b403 | 119 | PangoContext *m_context; |
138618ac | 120 | PangoLayout *m_layout; |
8943b403 | 121 | PangoFontDescription *m_fontdesc; |
b0e0d661 VZ |
122 | |
123 | void SetUpDC(); | |
124 | void Destroy(); | |
f6f1f4ad RR |
125 | |
126 | protected: | |
b1263dcf | 127 | virtual void ComputeScaleAndOrigin(); |
238d735d | 128 | |
b0e0d661 | 129 | GdkWindow *GetWindow() { return m_window; } |
cd9da200 | 130 | |
20e05ffb RR |
131 | private: |
132 | DECLARE_DYNAMIC_CLASS(wxWindowDC) | |
ec758a20 RR |
133 | }; |
134 | ||
135 | //----------------------------------------------------------------------------- | |
376aa62a | 136 | // wxClientDC |
ec758a20 RR |
137 | //----------------------------------------------------------------------------- |
138 | ||
20123d49 | 139 | class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC |
ec758a20 | 140 | { |
ec758a20 | 141 | public: |
4f55a07f | 142 | wxClientDC() { } |
376aa62a | 143 | wxClientDC( wxWindow *win ); |
cd9da200 | 144 | |
7b30ac82 VZ |
145 | protected: |
146 | virtual void DoGetSize(int *width, int *height) const; | |
147 | ||
20e05ffb | 148 | private: |
376aa62a | 149 | DECLARE_DYNAMIC_CLASS(wxClientDC) |
c801d85f KB |
150 | }; |
151 | ||
ec758a20 | 152 | //----------------------------------------------------------------------------- |
376aa62a | 153 | // wxPaintDC |
ec758a20 RR |
154 | //----------------------------------------------------------------------------- |
155 | ||
20123d49 | 156 | class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC |
ec758a20 | 157 | { |
ec758a20 | 158 | public: |
376aa62a VZ |
159 | wxPaintDC() { } |
160 | wxPaintDC( wxWindow *win ); | |
cd9da200 | 161 | |
20e05ffb | 162 | private: |
376aa62a | 163 | DECLARE_DYNAMIC_CLASS(wxPaintDC) |
ec758a20 RR |
164 | }; |
165 | ||
c801d85f | 166 | #endif // __GTKDCCLIENTH__ |