]> git.saurik.com Git - wxWidgets.git/blob - include/wx/overlay.h
Comment-only update
[wxWidgets.git] / include / wx / overlay.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/overlay.h
3 // Purpose: wxOverlay class
4 // Author: Stefan Csomor
5 // Modified by:
6 // Created: 2006-10-20
7 // Copyright: (c) wxWidgets team
8 // Licence: wxWindows licence
9 /////////////////////////////////////////////////////////////////////////////
10
11 #ifndef _WX_OVERLAY_H_
12 #define _WX_OVERLAY_H_
13
14 #include "wx/defs.h"
15
16 #if defined(__WXMAC__) && wxOSX_USE_CARBON
17 #define wxHAS_NATIVE_OVERLAY 1
18 #elif defined(__WXDFB__)
19 #define wxHAS_NATIVE_OVERLAY 1
20 #else
21 // don't define wxHAS_NATIVE_OVERLAY
22 #endif
23
24 // ----------------------------------------------------------------------------
25 // creates an overlay over an existing window, allowing for manipulations like
26 // rubberbanding etc. This API is not stable yet, not to be used outside wx
27 // internal code
28 // ----------------------------------------------------------------------------
29
30 class WXDLLIMPEXP_FWD_CORE wxOverlayImpl;
31 class WXDLLIMPEXP_FWD_CORE wxDC;
32
33 class WXDLLIMPEXP_CORE wxOverlay
34 {
35 public:
36 wxOverlay();
37 ~wxOverlay();
38
39 // clears the overlay without restoring the former state
40 // to be done eg when the window content has been changed and repainted
41 void Reset();
42
43 // returns (port-specific) implementation of the overlay
44 wxOverlayImpl *GetImpl() { return m_impl; }
45
46 private:
47 friend class WXDLLIMPEXP_FWD_CORE wxDCOverlay;
48
49 // returns true if it has been setup
50 bool IsOk();
51
52 void Init(wxDC* dc, int x , int y , int width , int height);
53
54 void BeginDrawing(wxDC* dc);
55
56 void EndDrawing(wxDC* dc);
57
58 void Clear(wxDC* dc);
59
60 wxOverlayImpl* m_impl;
61
62 bool m_inDrawing;
63
64
65 wxDECLARE_NO_COPY_CLASS(wxOverlay);
66 };
67
68
69 class WXDLLIMPEXP_CORE wxDCOverlay
70 {
71 public:
72 // connects this overlay to the corresponding drawing dc, if the overlay is
73 // not initialized yet this call will do so
74 wxDCOverlay(wxOverlay &overlay, wxDC *dc, int x , int y , int width , int height);
75
76 // convenience wrapper that behaves the same using the entire area of the dc
77 wxDCOverlay(wxOverlay &overlay, wxDC *dc);
78
79 // removes the connection between the overlay and the dc
80 virtual ~wxDCOverlay();
81
82 // clears the layer, restoring the state at the last init
83 void Clear();
84
85 private:
86 void Init(wxDC *dc, int x , int y , int width , int height);
87
88 wxOverlay& m_overlay;
89
90 wxDC* m_dc;
91
92
93 wxDECLARE_NO_COPY_CLASS(wxDCOverlay);
94 };
95
96 #endif // _WX_OVERLAY_H_