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