]>
Commit | Line | Data |
---|---|---|
30c841c8 VS |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: wx/overlay.h | |
3 | // Purpose: wxOverlay class | |
4 | // Author: Stefan Csomor | |
5 | // Modified by: | |
6 | // Created: 2006-10-20 | |
30c841c8 VS |
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 | ||
da712b51 | 16 | #if defined(__WXMAC__) && wxOSX_USE_CARBON |
69a5bc23 VS |
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 | |
30c841c8 VS |
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 | ||
b5dbe15d | 30 | class WXDLLIMPEXP_FWD_CORE wxOverlayImpl; |
30d54e27 | 31 | class WXDLLIMPEXP_FWD_CORE wxDC; |
30c841c8 | 32 | |
53a2db12 | 33 | class WXDLLIMPEXP_CORE wxOverlay |
30c841c8 VS |
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: | |
b5dbe15d | 47 | friend class WXDLLIMPEXP_FWD_CORE wxDCOverlay; |
30c841c8 VS |
48 | |
49 | // returns true if it has been setup | |
50 | bool IsOk(); | |
51 | ||
30d54e27 | 52 | void Init(wxDC* dc, int x , int y , int width , int height); |
30c841c8 | 53 | |
30d54e27 | 54 | void BeginDrawing(wxDC* dc); |
30c841c8 | 55 | |
30d54e27 | 56 | void EndDrawing(wxDC* dc); |
30c841c8 | 57 | |
30d54e27 | 58 | void Clear(wxDC* dc); |
30c841c8 VS |
59 | |
60 | wxOverlayImpl* m_impl; | |
61 | ||
62 | bool m_inDrawing; | |
63 | ||
64 | ||
c0c133e1 | 65 | wxDECLARE_NO_COPY_CLASS(wxOverlay); |
30c841c8 VS |
66 | }; |
67 | ||
68 | ||
53a2db12 | 69 | class WXDLLIMPEXP_CORE wxDCOverlay |
30c841c8 VS |
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 | |
30d54e27 | 74 | wxDCOverlay(wxOverlay &overlay, wxDC *dc, int x , int y , int width , int height); |
30c841c8 VS |
75 | |
76 | // convenience wrapper that behaves the same using the entire area of the dc | |
30d54e27 | 77 | wxDCOverlay(wxOverlay &overlay, wxDC *dc); |
30c841c8 VS |
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: | |
30d54e27 | 86 | void Init(wxDC *dc, int x , int y , int width , int height); |
30c841c8 VS |
87 | |
88 | wxOverlay& m_overlay; | |
89 | ||
30d54e27 | 90 | wxDC* m_dc; |
30c841c8 VS |
91 | |
92 | ||
c0c133e1 | 93 | wxDECLARE_NO_COPY_CLASS(wxDCOverlay); |
30c841c8 VS |
94 | }; |
95 | ||
96 | #endif // _WX_OVERLAY_H_ |