]> git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/dcclient.h
Cache HDC used for painting for the entire duration of WM_PAINT processing.
[wxWidgets.git] / include / wx / msw / dcclient.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/msw/dcclient.h
3 // Purpose: wxClientDC class
4 // Author: Julian Smart
5 // Modified by:
6 // Created: 01/02/97
7 // RCS-ID: $Id$
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
11
12 #ifndef _WX_DCCLIENT_H_
13 #define _WX_DCCLIENT_H_
14
15 // ----------------------------------------------------------------------------
16 // headers
17 // ----------------------------------------------------------------------------
18
19 #include "wx/dc.h"
20 #include "wx/msw/dc.h"
21 #include "wx/dcclient.h"
22
23 class wxPaintDCInfo;
24
25 // ----------------------------------------------------------------------------
26 // DC classes
27 // ----------------------------------------------------------------------------
28
29 class WXDLLIMPEXP_CORE wxWindowDCImpl : public wxMSWDCImpl
30 {
31 public:
32 // default ctor
33 wxWindowDCImpl( wxDC *owner );
34
35 // Create a DC corresponding to the whole window
36 wxWindowDCImpl( wxDC *owner, wxWindow *win );
37
38 virtual void DoGetSize(int *width, int *height) const;
39
40 protected:
41 // initialize the newly created DC
42 void InitDC();
43
44 DECLARE_CLASS(wxWindowDCImpl)
45 wxDECLARE_NO_COPY_CLASS(wxWindowDCImpl);
46 };
47
48 class WXDLLIMPEXP_CORE wxClientDCImpl : public wxWindowDCImpl
49 {
50 public:
51 // default ctor
52 wxClientDCImpl( wxDC *owner );
53
54 // Create a DC corresponding to the client area of the window
55 wxClientDCImpl( wxDC *owner, wxWindow *win );
56
57 virtual ~wxClientDCImpl();
58
59 virtual void DoGetSize(int *width, int *height) const;
60
61 protected:
62 void InitDC();
63
64 DECLARE_CLASS(wxClientDCImpl)
65 wxDECLARE_NO_COPY_CLASS(wxClientDCImpl);
66 };
67
68 class WXDLLIMPEXP_CORE wxPaintDCImpl : public wxClientDCImpl
69 {
70 public:
71 wxPaintDCImpl( wxDC *owner );
72
73 // Create a DC corresponding for painting the window in OnPaint()
74 wxPaintDCImpl( wxDC *owner, wxWindow *win );
75
76 virtual ~wxPaintDCImpl();
77
78 // find the entry for this DC in the cache (keyed by the window)
79 static WXHDC FindDCInCache(wxWindow* win);
80
81 // This must be called by the code handling WM_PAINT to remove the DC
82 // cached for this window for the duration of this message processing.
83 static void EndPaint(wxWindow *win);
84
85 protected:
86 // Find the DC for this window in the cache, return NULL if not found.
87 static wxPaintDCInfo *FindInCache(wxWindow* win);
88
89 DECLARE_CLASS(wxPaintDCImpl)
90 wxDECLARE_NO_COPY_CLASS(wxPaintDCImpl);
91 };
92
93 /*
94 * wxPaintDCEx
95 * This class is used when an application sends an HDC with the WM_PAINT
96 * message. It is used in HandlePaint and need not be used by an application.
97 */
98
99 class WXDLLIMPEXP_CORE wxPaintDCEx : public wxPaintDC
100 {
101 public:
102 wxPaintDCEx(wxWindow *canvas, WXHDC dc);
103
104 DECLARE_CLASS(wxPaintDCEx)
105 wxDECLARE_NO_COPY_CLASS(wxPaintDCEx);
106 };
107
108 #endif
109 // _WX_DCCLIENT_H_