]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: dcclient.h | |
3 | // Purpose: | |
4 | // Author: Robert Roebling | |
5 | // Id: $Id$ | |
6 | // Copyright: (c) 1998 Robert Roebling | |
7 | // Licence: wxWindows licence | |
8 | ///////////////////////////////////////////////////////////////////////////// | |
9 | ||
10 | #ifndef __GTKDCCLIENTH__ | |
11 | #define __GTKDCCLIENTH__ | |
12 | ||
13 | #include "wx/dc.h" | |
14 | #include "wx/region.h" | |
15 | ||
16 | class WXDLLIMPEXP_CORE wxWindow; | |
17 | ||
18 | //----------------------------------------------------------------------------- | |
19 | // wxWindowDC | |
20 | //----------------------------------------------------------------------------- | |
21 | ||
22 | class WXDLLIMPEXP_CORE wxWindowDC : public wxDC | |
23 | { | |
24 | public: | |
25 | wxWindowDC(); | |
26 | wxWindowDC( wxWindow *win ); | |
27 | ||
28 | virtual ~wxWindowDC(); | |
29 | ||
30 | virtual bool CanDrawBitmap() const { return true; } | |
31 | virtual bool CanGetTextExtent() const { return true; } | |
32 | ||
33 | protected: | |
34 | virtual void DoGetSize(int *width, int *height) const; | |
35 | virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE ); | |
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, | |
43 | double sa, double ea ); | |
44 | virtual void DoDrawPoint( wxCoord x, wxCoord y ); | |
45 | ||
46 | virtual void DoDrawLines(int n, wxPoint points[], | |
47 | wxCoord xoffset, wxCoord yoffset); | |
48 | virtual void DoDrawPolygon(int n, wxPoint points[], | |
49 | wxCoord xoffset, wxCoord yoffset, | |
50 | int fillStyle = wxODDEVEN_RULE); | |
51 | ||
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 ); | |
55 | ||
56 | virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ); | |
57 | virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y, | |
58 | bool useMask = false ); | |
59 | ||
60 | virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, | |
61 | wxDC *source, wxCoord xsrc, wxCoord ysrc, | |
62 | int logical_func = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 ); | |
63 | ||
64 | virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y ); | |
65 | virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y, | |
66 | double angle); | |
67 | virtual void DoGetTextExtent( const wxString &string, | |
68 | wxCoord *width, wxCoord *height, | |
69 | wxCoord *descent = (wxCoord *) NULL, | |
70 | wxCoord *externalLeading = (wxCoord *) NULL, | |
71 | wxFont *theFont = (wxFont *) NULL) const; | |
72 | virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ); | |
73 | virtual void DoSetClippingRegionAsRegion( const wxRegion ®ion ); | |
74 | ||
75 | ||
76 | public: | |
77 | virtual wxCoord GetCharWidth() const; | |
78 | virtual wxCoord GetCharHeight() const; | |
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 | ||
92 | virtual void DestroyClippingRegion(); | |
93 | ||
94 | // Resolution in pixels per logical inch | |
95 | virtual wxSize GetPPI() const; | |
96 | virtual int GetDepth() const; | |
97 | ||
98 | // overrriden here for RTL | |
99 | virtual void SetDeviceOrigin( wxCoord x, wxCoord y ); | |
100 | virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp ); | |
101 | ||
102 | // protected: | |
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; | |
113 | bool m_isScreenDC; | |
114 | wxWindow *m_owner; | |
115 | wxRegion m_currentClippingRegion; | |
116 | wxRegion m_paintClippingRegion; | |
117 | ||
118 | // PangoContext stuff for GTK 2.0 | |
119 | PangoContext *m_context; | |
120 | PangoLayout *m_layout; | |
121 | PangoFontDescription *m_fontdesc; | |
122 | ||
123 | void SetUpDC(); | |
124 | void Destroy(); | |
125 | ||
126 | virtual void ComputeScaleAndOrigin(); | |
127 | ||
128 | virtual GdkWindow *GetGDKWindow() const { return m_window; } | |
129 | ||
130 | private: | |
131 | DECLARE_DYNAMIC_CLASS(wxWindowDC) | |
132 | }; | |
133 | ||
134 | //----------------------------------------------------------------------------- | |
135 | // wxClientDC | |
136 | //----------------------------------------------------------------------------- | |
137 | ||
138 | class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC | |
139 | { | |
140 | public: | |
141 | wxClientDC() { } | |
142 | wxClientDC( wxWindow *win ); | |
143 | ||
144 | protected: | |
145 | virtual void DoGetSize(int *width, int *height) const; | |
146 | ||
147 | private: | |
148 | DECLARE_DYNAMIC_CLASS(wxClientDC) | |
149 | }; | |
150 | ||
151 | //----------------------------------------------------------------------------- | |
152 | // wxPaintDC | |
153 | //----------------------------------------------------------------------------- | |
154 | ||
155 | class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC | |
156 | { | |
157 | public: | |
158 | wxPaintDC() { } | |
159 | wxPaintDC( wxWindow *win ); | |
160 | ||
161 | private: | |
162 | DECLARE_DYNAMIC_CLASS(wxPaintDC) | |
163 | }; | |
164 | ||
165 | #endif // __GTKDCCLIENTH__ |