]> git.saurik.com Git - wxWidgets.git/blob - include/wx/gtk/dcclient.h
reset g_SelectionBeforePopup sooner in gtk_popup_hide_callback() to ensure that GetSe...
[wxWidgets.git] / include / wx / gtk / dcclient.h
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/window.h"
15
16 //-----------------------------------------------------------------------------
17 // classes
18 //-----------------------------------------------------------------------------
19
20 class WXDLLIMPEXP_CORE wxWindowDC;
21 class WXDLLIMPEXP_CORE wxPaintDC;
22 class WXDLLIMPEXP_CORE wxClientDC;
23
24 //-----------------------------------------------------------------------------
25 // wxWindowDC
26 //-----------------------------------------------------------------------------
27
28 class WXDLLIMPEXP_CORE wxWindowDC : public wxDC
29 {
30 public:
31 wxWindowDC();
32 wxWindowDC( wxWindow *win );
33
34 virtual ~wxWindowDC();
35
36 virtual bool CanDrawBitmap() const { return true; }
37 virtual bool CanGetTextExtent() const { return true; }
38
39 protected:
40 virtual void DoGetSize(int *width, int *height) const;
41 virtual bool DoFloodFill( wxCoord x, wxCoord y, const wxColour& col, int style=wxFLOOD_SURFACE );
42 virtual bool DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const;
43
44 virtual void DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 );
45 virtual void DoCrossHair( wxCoord x, wxCoord y );
46 virtual void DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
47 wxCoord xc, wxCoord yc );
48 virtual void DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord height,
49 double sa, double ea );
50 virtual void DoDrawPoint( wxCoord x, wxCoord y );
51
52 virtual void DoDrawLines(int n, wxPoint points[],
53 wxCoord xoffset, wxCoord yoffset);
54 virtual void DoDrawPolygon(int n, wxPoint points[],
55 wxCoord xoffset, wxCoord yoffset,
56 int fillStyle = wxODDEVEN_RULE);
57
58 virtual void DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
59 virtual void DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius = 20.0 );
60 virtual void DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
61
62 virtual void DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y );
63 virtual void DoDrawBitmap( const wxBitmap &bitmap, wxCoord x, wxCoord y,
64 bool useMask = false );
65
66 virtual bool DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
67 wxDC *source, wxCoord xsrc, wxCoord ysrc,
68 int logical_func = wxCOPY, bool useMask = false, wxCoord xsrcMask = -1, wxCoord ysrcMask = -1 );
69
70 virtual void DoDrawText( const wxString &text, wxCoord x, wxCoord y );
71 virtual void DoDrawRotatedText(const wxString& text, wxCoord x, wxCoord y,
72 double angle);
73 virtual void DoGetTextExtent( const wxString &string,
74 wxCoord *width, wxCoord *height,
75 wxCoord *descent = (wxCoord *) NULL,
76 wxCoord *externalLeading = (wxCoord *) NULL,
77 wxFont *theFont = (wxFont *) NULL) const;
78
79 public:
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( int 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 DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
96 virtual void DestroyClippingRegion();
97 virtual void DoSetClippingRegionAsRegion( const wxRegion &region );
98
99 // Resolution in pixels per logical inch
100 virtual wxSize GetPPI() const;
101 virtual int GetDepth() const;
102
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 #ifdef __WXGTK20__
120 PangoContext *m_context;
121 PangoLayout *m_layout;
122 PangoFontDescription *m_fontdesc;
123 #endif
124
125 void SetUpDC();
126 void Destroy();
127 virtual void ComputeScaleAndOrigin();
128
129 GdkWindow *GetWindow() { return m_window; }
130
131 private:
132 DECLARE_DYNAMIC_CLASS(wxWindowDC)
133 };
134
135 //-----------------------------------------------------------------------------
136 // wxClientDC
137 //-----------------------------------------------------------------------------
138
139 class WXDLLIMPEXP_CORE wxClientDC : public wxWindowDC
140 {
141 public:
142 wxClientDC() { }
143 wxClientDC( wxWindow *win );
144
145 protected:
146 virtual void DoGetSize(int *width, int *height) const;
147
148 private:
149 DECLARE_DYNAMIC_CLASS(wxClientDC)
150 };
151
152 //-----------------------------------------------------------------------------
153 // wxPaintDC
154 //-----------------------------------------------------------------------------
155
156 class WXDLLIMPEXP_CORE wxPaintDC : public wxClientDC
157 {
158 public:
159 wxPaintDC() { }
160 wxPaintDC( wxWindow *win );
161
162 private:
163 DECLARE_DYNAMIC_CLASS(wxPaintDC)
164 };
165
166 #endif // __GTKDCCLIENTH__