1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
=== modified file 'Makefile.in'
--- Makefile.in 2014-06-11 15:08:00 +0000
+++ Makefile.in 2014-06-11 15:10:36 +0000
@@ -14601,7 +14601,7 @@
monodll_carbon_frame.o \
monodll_carbon_mdi.o \
monodll_carbon_metafile.o \
- monodll_carbon_overlay.o \
+ monodll_osx_cocoa_overlay.o \
monodll_carbon_popupwin.o \
monodll_carbon_renderer.o \
monodll_carbon_settings.o \
@@ -14748,7 +14748,7 @@
monolib_carbon_frame.o \
monolib_carbon_mdi.o \
monolib_carbon_metafile.o \
- monolib_carbon_overlay.o \
+ monolib_osx_cocoa_overlay.o \
monolib_carbon_popupwin.o \
monolib_carbon_renderer.o \
monolib_carbon_settings.o \
@@ -14895,7 +14895,7 @@
coredll_carbon_frame.o \
coredll_carbon_mdi.o \
coredll_carbon_metafile.o \
- coredll_carbon_overlay.o \
+ coredll_osx_cocoa_overlay.o \
coredll_carbon_popupwin.o \
coredll_carbon_renderer.o \
coredll_carbon_settings.o \
@@ -15027,7 +15027,7 @@
corelib_carbon_frame.o \
corelib_carbon_mdi.o \
corelib_carbon_metafile.o \
- corelib_carbon_overlay.o \
+ corelib_osx_cocoa_overlay.o \
corelib_carbon_popupwin.o \
corelib_carbon_renderer.o \
corelib_carbon_settings.o \
@@ -17774,6 +17774,9 @@
monodll_osx_cocoa_notebook.o: $(srcdir)/src/osx/cocoa/notebook.mm $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/notebook.mm
+monodll_osx_cocoa_overla.o: $(srcdir)/src/osx/cocoa/overlay.mm $(MONODLL_ODEP)
+ $(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/overlay.mm
+
monodll_osx_cocoa_radiobut.o: $(srcdir)/src/osx/cocoa/radiobut.mm $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/radiobut.mm
@@ -21683,8 +21686,8 @@
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_CARBON_USE_GUI_1_WXUNIV_0@monodll_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_CARBON_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(MONODLL_ODEP)
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@monodll_osx_cocoa_overlay.o: $(srcdir)/src/osx/cocoa/overlay.mm $(MONODLL_ODEP)
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/cocoa/overlay.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@monodll_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(MONODLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
@@ -23642,6 +23645,9 @@
monolib_osx_cocoa_notebook.o: $(srcdir)/src/osx/cocoa/notebook.mm $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/notebook.mm
+monolib_osx_cocoa_overlay.o: $(srcdir)/src/osx/cocoa/overlay.mm $(MONOLIB_ODEP)
+ $(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/overlay.mm
+
monolib_osx_cocoa_radiobut.o: $(srcdir)/src/osx/cocoa/radiobut.mm $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_OBJCXXFLAGS) $(srcdir)/src/osx/cocoa/radiobut.mm
@@ -33584,8 +33590,8 @@
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_CARBON_USE_GUI_1_WXUNIV_0@coredll_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_CARBON_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(COREDLL_ODEP)
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@coredll_osx_cocoa_overlay.o: $(srcdir)/src/osx/cocoa/overlay.mm $(COREDLL_ODEP)
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/cocoa/overlay.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@coredll_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(COREDLL_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
@@ -37961,8 +37967,8 @@
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_CARBON_USE_GUI_1_WXUNIV_0@corelib_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_CARBON_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(CORELIB_ODEP)
-@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@corelib_osx_cocoa_overlay.o: $(srcdir)/src/osx/cocoa/overlay.mm $(CORELIB_ODEP)
+@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_COCOA_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/cocoa/overlay.mm
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@corelib_carbon_overlay.o: $(srcdir)/src/osx/carbon/overlay.cpp $(CORELIB_ODEP)
@COND_PLATFORM_MACOSX_1_TOOLKIT_OSX_IPHONE_USE_GUI_1_WXUNIV_0@ $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/osx/carbon/overlay.cpp
=== modified file 'include/wx/overlay.h'
--- include/wx/overlay.h 2014-06-11 15:08:00 +0000
+++ include/wx/overlay.h 2014-06-11 15:10:36 +0000
@@ -13,7 +13,7 @@
#include "wx/defs.h"
-#if defined(__WXMAC__) && wxOSX_USE_CARBON
+#if defined(__WXMAC__) && wxOSX_USE_COCOA_OR_CARBON
#define wxHAS_NATIVE_OVERLAY 1
#elif defined(__WXDFB__)
#define wxHAS_NATIVE_OVERLAY 1
=== modified file 'include/wx/private/overlay.h'
--- include/wx/private/overlay.h 2014-06-11 15:08:00 +0000
+++ include/wx/private/overlay.h 2014-06-11 15:10:36 +0000
@@ -16,7 +16,11 @@
#ifdef wxHAS_NATIVE_OVERLAY
#if defined(__WXMAC__)
+#if wxOSX_USE_CARBON
#include "wx/osx/carbon/private/overlay.h"
+#else
+ #include "wx/osx/cocoa/private/overlay.h"
+#endif
#elif defined(__WXDFB__)
#include "wx/dfb/private/overlay.h"
#else
=== modified file 'src/osx/cocoa/overlay.mm'
--- src/osx/cocoa/overlay.mm 2014-06-11 15:08:00 +0000
+++ src/osx/cocoa/overlay.mm 2014-06-11 15:12:45 +0000
@@ -34,6 +34,7 @@
#include "wx/private/overlay.h"
#ifdef wxHAS_NATIVE_OVERLAY
+#import <Foundation/NSGeometry.h>
// ============================================================================
// implementation
@@ -58,48 +59,6 @@
void wxOverlayImpl::CreateOverlayWindow()
{
- if ( m_window )
- {
- m_overlayParentWindow = m_window->MacGetTopLevelWindowRef();
- [m_overlayParentWindow makeKeyAndOrderFront:nil];
-
- NSView* view = m_window->GetHandle();
-
- NSPoint viewOriginBase, viewOriginScreen;
- viewOriginBase = [view convertPoint:NSMakePoint(0, 0) toView:nil];
- viewOriginScreen = [m_overlayParentWindow convertBaseToScreen:viewOriginBase];
-
- NSSize viewSize = [view frame].size;
- if ( [view isFlipped] )
- viewOriginScreen.y -= viewSize.height;
-
- m_overlayWindow=[[NSWindow alloc] initWithContentRect:NSMakeRect(viewOriginScreen.x,viewOriginScreen.y,
- viewSize.width,
- viewSize.height)
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:YES];
-
- [m_overlayParentWindow addChildWindow:m_overlayWindow ordered:NSWindowAbove];
- }
- else
- {
- m_overlayParentWindow = NULL ;
- CGRect cgbounds ;
- cgbounds = CGDisplayBounds(CGMainDisplayID());
-
- m_overlayWindow=[[NSWindow alloc] initWithContentRect:NSMakeRect(cgbounds.origin.x,cgbounds.origin.y,
- cgbounds.size.width,
- cgbounds.size.height)
- styleMask:NSBorderlessWindowMask
- backing:NSBackingStoreBuffered
- defer:YES];
- }
- [m_overlayWindow setOpaque:NO];
- [m_overlayWindow setIgnoresMouseEvents:YES];
- [m_overlayWindow setAlphaValue:1.0];
-
- [m_overlayWindow orderFront:nil];
}
void wxOverlayImpl::Init( wxDC* dc, int x , int y , int width , int height )
@@ -107,84 +66,54 @@
wxASSERT_MSG( !IsOk() , _("You cannot Init an overlay twice") );
m_window = dc->GetWindow();
- m_x = x ;
- m_y = y ;
- if ( dc->IsKindOf( CLASSINFO( wxClientDC ) ))
- {
- wxPoint origin = m_window->GetClientAreaOrigin();
- m_x += origin.x;
- m_y += origin.y;
- }
- m_width = width ;
- m_height = height ;
-
- CreateOverlayWindow();
- wxASSERT_MSG( m_overlayWindow != NULL , _("Couldn't create the overlay window") );
- m_overlayContext = (CGContextRef) [[m_overlayWindow graphicsContext] graphicsPort];
- wxASSERT_MSG( m_overlayContext != NULL , _("Couldn't init the context on the overlay window") );
-
- int ySize = 0;
- if ( m_window )
- {
- NSView* view = m_window->GetHandle();
- NSSize viewSize = [view frame].size;
- ySize = viewSize.height;
- }
- else
- {
- CGRect cgbounds ;
- cgbounds = CGDisplayBounds(CGMainDisplayID());
- ySize = cgbounds.size.height;
-
-
-
- }
- CGContextTranslateCTM( m_overlayContext, 0, ySize );
- CGContextScaleCTM( m_overlayContext, 1, -1 );
- CGContextTranslateCTM( m_overlayContext, -m_x , -m_y );
+ m_overlayWindow = m_window->MacGetTopLevelWindowRef();
+
+ NSRect box = [m_overlayWindow frame];
+ box.origin.x = 0;
+ box.origin.y = 0;
+
+ if( [m_overlayWindow isVisible] )
+ {
+ [m_overlayWindow discardCachedImage];
+ [m_overlayWindow cacheImageInRect:box];
+ }
}
void wxOverlayImpl::BeginDrawing( wxDC* dc)
{
- wxDCImpl *impl = dc->GetImpl();
- wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl);
- if (win_impl)
- {
- win_impl->SetGraphicsContext( wxGraphicsContext::CreateFromNative( m_overlayContext ) );
- dc->SetClippingRegion( m_x , m_y , m_width , m_height ) ;
- }
+
}
void wxOverlayImpl::EndDrawing( wxDC* dc)
{
- wxDCImpl *impl = dc->GetImpl();
- wxGCDCImpl *win_impl = wxDynamicCast(impl,wxGCDCImpl);
- if (win_impl)
- win_impl->SetGraphicsContext(NULL);
-
- CGContextFlush( m_overlayContext );
}
void wxOverlayImpl::Clear(wxDC* WXUNUSED(dc))
{
wxASSERT_MSG( IsOk() , _("You cannot Clear an overlay that is not inited") );
- CGRect box = CGRectMake( m_x - 1, m_y - 1 , m_width + 2 , m_height + 2 );
- CGContextClearRect( m_overlayContext, box );
+ if( [m_overlayWindow isVisible] )
+ {
+ [m_overlayWindow restoreCachedImage];
+// [m_overlayWindow flushWindow];
+ }
}
void wxOverlayImpl::Reset()
{
- if ( m_overlayContext )
+ if ( m_overlayContext)
{
m_overlayContext = NULL ;
}
// todo : don't dispose, only hide and reposition on next run
- if (m_overlayWindow)
+ if (m_overlayWindow && [m_overlayWindow isVisible])
{
- [m_overlayParentWindow removeChildWindow:m_overlayWindow];
- [m_overlayWindow release];
- m_overlayWindow = NULL ;
+ NSRect box = [m_overlayWindow frame];
+ box.origin.x = 0;
+ box.origin.y = 0;
+
+ [m_overlayWindow discardCachedImage];
+ [m_overlayWindow cacheImageInRect:box];
}
}