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