]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dcclient.h
Added wxFilePickerCtrl::SetInitialDirectory().
[wxWidgets.git] / include / wx / gtk / dcclient.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/gtk/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 _WX_GTKDCCLIENT_H_
11 #define _WX_GTKDCCLIENT_H_
12
13 #include "wx/gtk/dc.h"
14 #include "wx/dcclient.h"
15 #include "wx/region.h"
16
17 class WXDLLIMPEXP_FWD_CORE wxWindow;
18
19 //-----------------------------------------------------------------------------
20 // wxWindowDCImpl
21 //-----------------------------------------------------------------------------
22
23 class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxGTKDCImpl
24 {
25 public:
26 wxWindowDCImpl( wxDC *owner );
27 wxWindowDCImpl( wxDC *owner, wxWindow *win );
28
29 virtual ~wxWindowDCImpl();
30
31 virtual bool CanDrawBitmap() const { return true; }
32 virtual bool CanGetTextExtent() const { return true; }
33
34 virtual void DoGetSize(int *width, int *height) const;
35 virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col,
36 wxFloodFillStyle style=wxFLOOD_SURFACE );
37 virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const;
38
39 virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 );
40 virtual void DoCrossHair( wxCoord x, wxCoord y );
41 virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
42 wxCoord xc, wxCoord yc );
43 virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height,
44 double sa, double ea );
45 virtual void DoDrawPoint( wxCoord x, wxCoord y );
46
47 virtual void DoDrawLines(int n, wxPoint points[],
48 wxCoord xoffset, wxCoord yoffset);
49 virtual void DoDrawPolygon(int n, wxPoint points[],
50 wxCoord xoffset, wxCoord yoffset,
51 wxPolygonFillMode fillStyle = wxODDEVEN_RULE);
52
53 virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
54 virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 );
55 virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
56
57 virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
58 virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
59 bool useMask = false );
60
61 virtual bool DoBlit( wxCoord xdest, wxCoord ydest,
62 wxCoord width, wxCoord height,
63 wxDC *source, wxCoord xsrc, wxCoord ysrc,
64 wxRasterOperationMode logical_func = wxCOPY,
65 bool useMask = false,
66 wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 );
67
68 virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y );
69 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
70 double angle);
71 virtual void DoGetTextExtent( const wxString &string,
72 wxCoord *width, wxCoord *height,
73 wxCoord *descent = NULL,
74 wxCoord *externalLeading = NULL,
75 const wxFont *theFont = NULL) const;
76 virtual bool DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) const;
77 virtual void DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
78 virtual void DoSetDeviceClippingRegion( const wxRegion &region );
79
80 virtual wxCoord GetCharWidth() const;
81 virtual wxCoord GetCharHeight() const;
82
83 virtual void Clear();
84
85 virtual void SetFont( const wxFont &font );
86 virtual void SetPen( const wxPen &pen );
87 virtual void SetBrush( const wxBrush &brush );
88 virtual void SetBackground( const wxBrush &brush );
89 virtual void SetLogicalFunction( wxRasterOperationMode function );
90 virtual void SetTextForeground( const wxColour &col );
91 virtual void SetTextBackground( const wxColour &col );
92 virtual void SetBackgroundMode( int mode );
93 virtual void SetPalette( const wxPalette& palette );
94
95 virtual void DestroyClippingRegion();
96
97 // Resolution in pixels per logical inch
98 virtual wxSize GetPPI() const;
99 virtual int GetDepth() const;
100
101 // overrriden here for RTL
102 virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
103 virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
104
105 // protected:
106 // implementation
107 // --------------
108
109 GdkWindow *m_gdkwindow;
110 GdkGC *m_penGC;
111 GdkGC *m_brushGC;
112 GdkGC *m_textGC;
113 GdkGC *m_bgGC;
114 GdkColormap *m_cmap;
115 bool m_isScreenDC;
116 wxRegion m_currentClippingRegion;
117 wxRegion m_paintClippingRegion;
118
119 // PangoContext stuff for GTK 2.0
120 PangoContext *m_context;
121 PangoLayout *m_layout;
122 PangoFontDescription *m_fontdesc;
123
124 void SetUpDC( bool ismem = false );
125 void Destroy();
126
127 virtual void ComputeScaleAndOrigin();
128
129 virtual GdkWindow *GetGDKWindow() const { return m_gdkwindow; }
130
131 private:
132 void DrawingSetup(GdkGC*& gc, bool& originChanged);
133 GdkPixmap* MonoToColor(GdkPixmap* monoPixmap, int x, int y, int w, int h) const;
134
135 DECLARE_ABSTRACT_CLASS(wxWindowDCImpl)
136 };
137
138 //-----------------------------------------------------------------------------
139 // wxClientDCImpl
140 //-----------------------------------------------------------------------------
141
142 class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
143 {
144 public:
145 wxClientDCImpl( wxDC *owner );
146 wxClientDCImpl( wxDC *owner, wxWindow *win );
147
148 virtual void DoGetSize(int *width, int *height) const;
149
150 DECLARE_ABSTRACT_CLASS(wxClientDCImpl)
151 };
152
153 //-----------------------------------------------------------------------------
154 // wxPaintDCImpl
155 //-----------------------------------------------------------------------------
156
157 class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
158 {
159 public:
160 wxPaintDCImpl( wxDC *owner );
161 wxPaintDCImpl( wxDC *owner, wxWindow *win );
162
163 DECLARE_ABSTRACT_CLASS(wxPaintDCImpl)
164 };
165
166 #endif // _WX_GTKDCCLIENT_H_