1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/osx/cocoa/nonownedwnd.mm
3 // Purpose: non owned window for cocoa
4 // Author: DavidStefan Csomor
7 // RCS-ID: $Id: nonownedwnd.mm 48805 2007-09-19 14:52:25Z SC $
8 // Copyright: (c) Stefan Csomor
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #include "wx/nonownedwnd.h"
17 #include "wx/dialog.h"
20 #include "wx/osx/private.h"
22 NSRect wxToNSRect( NSView* parent, const wxRect& r )
24 NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame];
27 if ( parent == NULL || ![ parent isFlipped ] )
28 y = (int)(frame.size.height - ( r.y + r.height ));
29 return NSMakeRect(x, y, r.width , r.height);
32 wxRect wxFromNSRect( NSView* parent, const NSRect& rect )
34 NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame];
35 int y = (int)rect.origin.y;
36 int x = (int)rect.origin.x;
37 if ( parent == NULL || ![ parent isFlipped ] )
38 y = (int)(frame.size.height - (rect.origin.y + rect.size.height));
39 return wxRect( x, y, (int)rect.size.width, (int)rect.size.height );
42 NSPoint wxToNSPoint( NSView* parent, const wxPoint& p )
44 NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame];
47 if ( parent == NULL || ![ parent isFlipped ] )
48 y = (int)(frame.size.height - ( p.y ));
49 return NSMakePoint(x, y);
52 wxPoint wxFromNSPoint( NSView* parent, const NSPoint& p )
54 NSRect frame = parent ? [parent bounds] : [[NSScreen mainScreen] frame];
57 if ( parent == NULL || ![ parent isFlipped ] )
58 y = (int)(frame.size.height - ( p.y ));
59 return wxPoint( x, y);
62 bool shouldHandleSelector(SEL selector)
64 if (selector == @selector(noop:)
65 || selector == @selector(complete:)
66 || selector == @selector(deleteBackward:)
67 || selector == @selector(deleteForward:)
68 || selector == @selector(insertNewline:)
69 || selector == @selector(insertTab:)
70 || selector == @selector(keyDown:)
71 || selector == @selector(keyUp:)
72 || selector == @selector(scrollPageUp:)
73 || selector == @selector(scrollPageDown:)
74 || selector == @selector(scrollToBeginningOfDocument:)
75 || selector == @selector(scrollToEndOfDocument:))
83 // wx category for NSWindow (our own and wrapped instances)
86 @interface NSWindow (wxNSWindowSupport)
88 - (wxNonOwnedWindowCocoaImpl*) WX_implementation;
90 - (bool) WX_filterSendEvent:(NSEvent *) event;
94 @implementation NSWindow (wxNSWindowSupport)
96 - (wxNonOwnedWindowCocoaImpl*) WX_implementation
98 return (wxNonOwnedWindowCocoaImpl*) wxNonOwnedWindowImpl::FindFromWXWindow( self );
101 // TODO in cocoa everything during a drag is sent to the NSWindow the mouse down occured,
102 // this does not conform to the wx behaviour if the window is not captured, so try to resend
103 // or capture all wx mouse event handling at the tlw as we did for carbon
105 - (bool) WX_filterSendEvent:(NSEvent *) event
107 bool handled = false;
108 if ( ([event type] >= NSLeftMouseDown) && ([event type] <= NSMouseExited) )
110 wxWindow* cw = wxWindow::GetCapture();
113 ((wxWidgetCocoaImpl*)cw->GetPeer())->DoHandleMouseEvent( event);
122 // wx native implementation
125 @interface wxNSWindow : NSWindow
129 - (void) sendEvent:(NSEvent *)event;
130 - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen;
131 - (void)noResponderFor: (SEL) selector;
134 @implementation wxNSWindow
136 - (void)sendEvent:(NSEvent *) event
138 if ( ![self WX_filterSendEvent: event] )
140 WXEVENTREF formerEvent = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEvent();
141 WXEVENTHANDLERCALLREF formerHandler = wxTheApp == NULL ? NULL : wxTheApp->MacGetCurrentEventHandlerCallRef();
144 wxTheApp->MacSetCurrentEvent(event, NULL);
146 [super sendEvent: event];
149 wxTheApp->MacSetCurrentEvent(formerEvent , formerHandler);
153 // The default implementation always moves the window back onto the screen,
154 // even when the programmer explicitly wants to hide it.
155 - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
161 - (void)doCommandBySelector:(SEL)selector
163 if (shouldHandleSelector(selector) &&
164 !(selector == @selector(cancel:) || selector == @selector(cancelOperation:)) )
165 [super doCommandBySelector:selector];
169 // NB: if we don't do this, all key downs that get handled lead to a NSBeep
170 - (void)noResponderFor: (SEL) selector
172 if (selector != @selector(keyDown:) && selector != @selector(keyUp:))
174 [super noResponderFor:selector];
178 // We need this for borderless windows, i.e. shaped windows or windows without
179 // a title bar. For more info, see:
180 // http://lists.apple.com/archives/cocoa-dev/2008/May/msg02091.html
181 - (BOOL)canBecomeKeyWindow
188 @interface wxNSPanel : NSPanel
192 - (void)noResponderFor: (SEL) selector;
193 - (void)sendEvent:(NSEvent *)event;
196 @implementation wxNSPanel
198 - (BOOL)canBecomeKeyWindow
203 - (void)doCommandBySelector:(SEL)selector
205 if (shouldHandleSelector(selector))
206 [super doCommandBySelector:selector];
209 // NB: if we don't do this, it seems that all events that end here lead to a NSBeep
210 - (void)noResponderFor: (SEL) selector
212 if (selector != @selector(keyDown:) && selector != @selector(keyUp:))
214 [super noResponderFor:selector];
218 - (void)sendEvent:(NSEvent *) event
220 if ( ![self WX_filterSendEvent: event] )
221 [super sendEvent: event];
231 @interface wxNonOwnedWindowController : NSObject wxOSX_10_6_AND_LATER(<NSWindowDelegate>)
235 - (void)windowDidResize:(NSNotification *)notification;
236 - (NSSize)windowWillResize:(NSWindow *)window toSize:(NSSize)proposedFrameSize;
237 - (void)windowDidResignKey:(NSNotification *)notification;
238 - (void)windowDidBecomeKey:(NSNotification *)notification;
239 - (void)windowDidMove:(NSNotification *)notification;
240 - (BOOL)windowShouldClose:(id)window;
241 - (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
245 @implementation wxNonOwnedWindowController
253 - (BOOL)windowShouldClose:(id)nwindow
255 wxNonOwnedWindowCocoaImpl* windowimpl = [(NSWindow*) nwindow WX_implementation];
258 wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer();
265 - (NSSize)windowWillResize:(NSWindow *)window
266 toSize:(NSSize)proposedFrameSize
268 NSRect frame = [window frame];
269 wxRect wxframe = wxFromNSRect( NULL, frame );
270 wxframe.SetWidth( (int)proposedFrameSize.width );
271 wxframe.SetHeight( (int)proposedFrameSize.height );
273 wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation];
276 wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer();
279 wxpeer->HandleResizing( 0, &wxframe );
280 NSSize newSize = NSMakeSize(wxframe.GetWidth(), wxframe.GetHeight());
285 return proposedFrameSize;
288 - (void)windowDidResize:(NSNotification *)notification
290 NSWindow* window = (NSWindow*) [notification object];
291 wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation];
294 wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer();
296 wxpeer->HandleResized(0);
300 - (void)windowDidMove:(NSNotification *)notification
302 wxNSWindow* window = (wxNSWindow*) [notification object];
303 wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation];
306 wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer();
308 wxpeer->HandleMoved(0);
312 - (void)windowDidBecomeKey:(NSNotification *)notification
314 NSWindow* window = (NSWindow*) [notification object];
315 wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation];
318 wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer();
320 wxpeer->HandleActivated(0, true);
324 - (void)windowDidResignKey:(NSNotification *)notification
326 NSWindow* window = (NSWindow*) [notification object];
327 wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation];
330 wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer();
333 wxpeer->HandleActivated(0, false);
334 // Needed for popup window since the firstResponder
335 // (focus in wx) doesn't change when this
336 // TLW becomes inactive.
337 wxFocusEvent event( wxEVT_KILL_FOCUS, wxpeer->GetId());
338 event.SetEventObject(wxpeer);
339 wxpeer->HandleWindowEvent(event);
344 - (id)windowWillReturnFieldEditor:(NSWindow *)sender toObject:(id)anObject
348 if ([anObject isKindOfClass:[wxNSTextField class]])
350 wxNSTextField* tf = (wxNSTextField*) anObject;
351 wxNSTextFieldEditor* editor = [tf fieldEditor];
354 editor = [[wxNSTextFieldEditor alloc] init];
355 [editor setFieldEditor:YES];
356 [tf setFieldEditor:editor];
364 - (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame
366 wxUnusedVar(newFrame);
367 wxNonOwnedWindowCocoaImpl* windowimpl = [window WX_implementation];
370 wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer();
371 wxMaximizeEvent event(wxpeer->GetId());
372 event.SetEventObject(wxpeer);
373 return !wxpeer->HandleWindowEvent(event);
380 IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowCocoaImpl , wxNonOwnedWindowImpl )
382 wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonownedwnd) :
383 wxNonOwnedWindowImpl(nonownedwnd)
386 m_macFullScreenData = NULL;
389 wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl()
392 m_macFullScreenData = NULL;
395 wxNonOwnedWindowCocoaImpl::~wxNonOwnedWindowCocoaImpl()
397 if ( !m_wxPeer->IsNativeWindowWrapper() )
399 [m_macWindow setDelegate:nil];
400 [m_macWindow release];
404 void wxNonOwnedWindowCocoaImpl::WillBeDestroyed()
406 if ( !m_wxPeer->IsNativeWindowWrapper() )
408 [m_macWindow setDelegate:nil];
412 void wxNonOwnedWindowCocoaImpl::Create( wxWindow* parent, const wxPoint& pos, const wxSize& size,
413 long style, long extraStyle, const wxString& WXUNUSED(name) )
415 static wxNonOwnedWindowController* controller = NULL;
418 controller =[[wxNonOwnedWindowController alloc] init];
421 int windowstyle = NSBorderlessWindowMask;
423 if ( style & wxFRAME_TOOL_WINDOW || ( style & wxPOPUP_WINDOW ) ||
424 GetWXPeer()->GetExtraStyle() & wxTOPLEVEL_EX_DIALOG )
426 m_macWindow = [wxNSPanel alloc];
429 m_macWindow = [wxNSWindow alloc];
431 CGWindowLevel level = kCGNormalWindowLevel;
433 if ( style & wxFRAME_TOOL_WINDOW )
435 windowstyle |= NSUtilityWindowMask;
436 if ( ( style & wxMINIMIZE_BOX ) || ( style & wxMAXIMIZE_BOX ) ||
437 ( style & wxCLOSE_BOX ) || ( style & wxSYSTEM_MENU ) )
439 windowstyle |= NSTitledWindowMask ;
442 else if ( ( style & wxPOPUP_WINDOW ) )
444 level = kCGPopUpMenuWindowLevel;
446 if ( ( style & wxBORDER_NONE ) )
448 wclass = kHelpWindowClass ; // has no border
449 attr |= kWindowNoShadowAttribute;
453 wclass = kPlainWindowClass ; // has a single line border, it will have to do for now
457 else if ( ( style & wxCAPTION ) )
459 windowstyle |= NSTitledWindowMask ;
461 else if ( ( style & wxFRAME_DRAWER ) )
464 wclass = kDrawerWindowClass;
469 // set these even if we have no title, otherwise the controls won't be visible
470 if ( ( style & wxMINIMIZE_BOX ) || ( style & wxMAXIMIZE_BOX ) ||
471 ( style & wxCLOSE_BOX ) || ( style & wxSYSTEM_MENU ) )
473 windowstyle |= NSTitledWindowMask ;
476 else if ( ( style & wxNO_BORDER ) )
478 wclass = kSimpleWindowClass ;
482 wclass = kPlainWindowClass ;
487 if ( windowstyle & NSTitledWindowMask )
489 if ( ( style & wxMINIMIZE_BOX ) )
490 windowstyle |= NSMiniaturizableWindowMask ;
492 if ( ( style & wxMAXIMIZE_BOX ) )
493 windowstyle |= NSResizableWindowMask ; // TODO showing ZOOM ?
495 if ( ( style & wxRESIZE_BORDER ) )
496 windowstyle |= NSResizableWindowMask ;
498 if ( ( style & wxCLOSE_BOX) )
499 windowstyle |= NSClosableWindowMask ;
501 if ( extraStyle & wxFRAME_EX_METAL)
502 windowstyle |= NSTexturedBackgroundWindowMask;
504 if ( ( style & wxFRAME_FLOAT_ON_PARENT ) || ( style & wxFRAME_TOOL_WINDOW ) )
505 level = kCGFloatingWindowLevel;
507 if ( ( style & wxSTAY_ON_TOP ) )
508 level = kCGUtilityWindowLevel;
510 NSRect r = wxToNSRect( NULL, wxRect( pos, size) );
512 r = [NSWindow contentRectForFrameRect:r styleMask:windowstyle];
514 [m_macWindow initWithContentRect:r
515 styleMask:windowstyle
516 backing:NSBackingStoreBuffered
520 // If the parent is modal, windows with wxFRAME_FLOAT_ON_PARENT style need
521 // to be in kCGUtilityWindowLevel and not kCGFloatingWindowLevel to stay
523 wxDialog * const parentDialog = wxDynamicCast(parent, wxDialog);
524 if (parentDialog && parentDialog->IsModal())
526 if (level == kCGFloatingWindowLevel)
528 level = kCGUtilityWindowLevel;
531 // Cocoa's modal loop does not process other windows by default, but
532 // don't call this on normal window levels so nested modal dialogs will
533 // still behave modally.
534 if (level != kCGNormalWindowLevel)
536 if ([m_macWindow isKindOfClass:[NSPanel class]])
538 [(NSPanel*)m_macWindow setWorksWhenModal:YES];
543 [m_macWindow setLevel:level];
545 [m_macWindow setDelegate:controller];
547 [m_macWindow setAcceptsMouseMovedEvents: YES];
549 if ( ( style & wxFRAME_SHAPED) )
551 [m_macWindow setOpaque:NO];
552 [m_macWindow setAlphaValue:1.0];
555 if ( !(style & wxFRAME_TOOL_WINDOW) )
556 [m_macWindow setHidesOnDeactivate:NO];
559 void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), WXWindow nativeWindow )
561 m_macWindow = nativeWindow;
564 WXWindow wxNonOwnedWindowCocoaImpl::GetWXWindow() const
569 void wxNonOwnedWindowCocoaImpl::Raise()
571 [m_macWindow orderWindow:NSWindowAbove relativeTo:0];
574 void wxNonOwnedWindowCocoaImpl::Lower()
576 [m_macWindow orderWindow:NSWindowBelow relativeTo:0];
579 void wxNonOwnedWindowCocoaImpl::ShowWithoutActivating()
581 [m_macWindow orderFront:nil];
582 [[m_macWindow contentView] setNeedsDisplay: YES];
585 bool wxNonOwnedWindowCocoaImpl::Show(bool show)
589 wxNonOwnedWindow* wxpeer = GetWXPeer();
590 if (wxpeer && !(wxpeer->GetWindowStyle() & wxFRAME_TOOL_WINDOW))
591 [m_macWindow makeKeyAndOrderFront:nil];
593 [m_macWindow orderFront:nil];
594 [[m_macWindow contentView] setNeedsDisplay: YES];
597 [m_macWindow orderOut:nil];
601 bool wxNonOwnedWindowCocoaImpl::ShowWithEffect(bool show,
605 return wxWidgetCocoaImpl::
606 ShowViewOrWindowWithEffect(m_wxPeer, show, effect, timeout);
609 void wxNonOwnedWindowCocoaImpl::Update()
611 [m_macWindow displayIfNeeded];
614 bool wxNonOwnedWindowCocoaImpl::SetTransparent(wxByte alpha)
616 [m_macWindow setAlphaValue:(CGFloat) alpha/255.0];
620 bool wxNonOwnedWindowCocoaImpl::SetBackgroundColour(const wxColour& WXUNUSED(col) )
625 void wxNonOwnedWindowCocoaImpl::SetExtraStyle( long exStyle )
629 bool metal = exStyle & wxFRAME_EX_METAL ;
630 int windowStyle = [ m_macWindow styleMask];
631 if ( metal && !(windowStyle & NSTexturedBackgroundWindowMask) )
633 wxFAIL_MSG( wxT("Metal Style cannot be changed after creation") );
635 else if ( !metal && (windowStyle & NSTexturedBackgroundWindowMask ) )
637 wxFAIL_MSG( wxT("Metal Style cannot be changed after creation") );
642 void wxNonOwnedWindowCocoaImpl::SetWindowStyleFlag( long style )
646 CGWindowLevel level = kCGNormalWindowLevel;
648 if (style & wxSTAY_ON_TOP)
649 level = kCGUtilityWindowLevel;
650 else if (( style & wxFRAME_FLOAT_ON_PARENT ) || ( style & wxFRAME_TOOL_WINDOW ))
651 level = kCGFloatingWindowLevel;
653 [m_macWindow setLevel: level];
657 bool wxNonOwnedWindowCocoaImpl::SetBackgroundStyle(wxBackgroundStyle style)
659 if ( style == wxBG_STYLE_TRANSPARENT )
661 [m_macWindow setOpaque:NO];
662 [m_macWindow setBackgroundColor:[NSColor clearColor]];
668 bool wxNonOwnedWindowCocoaImpl::CanSetTransparent()
673 void wxNonOwnedWindowCocoaImpl::MoveWindow(int x, int y, int width, int height)
675 NSRect r = wxToNSRect( NULL, wxRect(x,y,width, height) );
676 // do not trigger refreshes upon invisible and possible partly created objects
677 [m_macWindow setFrame:r display:GetWXPeer()->IsShownOnScreen()];
680 void wxNonOwnedWindowCocoaImpl::GetPosition( int &x, int &y ) const
682 wxRect r = wxFromNSRect( NULL, [m_macWindow frame] );
687 void wxNonOwnedWindowCocoaImpl::GetSize( int &width, int &height ) const
689 NSRect rect = [m_macWindow frame];
690 width = (int)rect.size.width;
691 height = (int)rect.size.height;
694 void wxNonOwnedWindowCocoaImpl::GetContentArea( int& left, int &top, int &width, int &height ) const
696 NSRect outer = NSMakeRect(100,100,100,100);
697 NSRect content = [NSWindow contentRectForFrameRect:outer styleMask:[m_macWindow styleMask] ];
698 NSRect rect = [[m_macWindow contentView] frame];
699 left = (int)rect.origin.x;
700 top = (int)rect.origin.y;
701 width = (int)rect.size.width;
702 height = (int)rect.size.height;
705 bool wxNonOwnedWindowCocoaImpl::SetShape(const wxRegion& WXUNUSED(region))
707 [m_macWindow setOpaque:NO];
708 [m_macWindow setBackgroundColor:[NSColor clearColor]];
713 void wxNonOwnedWindowCocoaImpl::SetTitle( const wxString& title, wxFontEncoding encoding )
715 [m_macWindow setTitle:wxCFStringRef( title , encoding ).AsNSString()];
718 bool wxNonOwnedWindowCocoaImpl::IsMaximized() const
720 if (([m_macWindow styleMask] & NSResizableWindowMask) != 0)
722 return [m_macWindow isZoomed];
726 NSRect rectScreen = [[NSScreen mainScreen] visibleFrame];
727 NSRect rectWindow = [m_macWindow frame];
728 return (rectScreen.origin.x == rectWindow.origin.x &&
729 rectScreen.origin.y == rectWindow.origin.y &&
730 rectScreen.size.width == rectWindow.size.width &&
731 rectScreen.size.height == rectWindow.size.height);
735 bool wxNonOwnedWindowCocoaImpl::IsIconized() const
737 return [m_macWindow isMiniaturized];
740 void wxNonOwnedWindowCocoaImpl::Iconize( bool iconize )
743 [m_macWindow miniaturize:nil];
745 [m_macWindow deminiaturize:nil];
748 void wxNonOwnedWindowCocoaImpl::Maximize(bool WXUNUSED(maximize))
750 [m_macWindow zoom:nil];
754 // http://cocoadevcentral.com/articles/000028.php
759 NSRect m_formerFrame;
762 bool wxNonOwnedWindowCocoaImpl::IsFullScreen() const
764 return m_macFullScreenData != NULL ;
767 bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style))
771 FullScreenData *data = (FullScreenData *)m_macFullScreenData ;
773 data = new FullScreenData();
775 m_macFullScreenData = data ;
776 data->m_formerLevel = [m_macWindow level];
777 data->m_formerFrame = [m_macWindow frame];
778 CGDisplayCapture( kCGDirectMainDisplay );
779 [m_macWindow setLevel:CGShieldingWindowLevel()];
780 [m_macWindow setFrame:[[NSScreen mainScreen] frame] display:YES];
782 else if ( m_macFullScreenData != NULL )
784 FullScreenData *data = (FullScreenData *) m_macFullScreenData ;
785 CGDisplayRelease( kCGDirectMainDisplay );
786 [m_macWindow setLevel:data->m_formerLevel];
787 [m_macWindow setFrame:data->m_formerFrame display:YES];
789 m_macFullScreenData = NULL ;
795 void wxNonOwnedWindowCocoaImpl::RequestUserAttention(int flagsWX)
797 NSRequestUserAttentionType flagsOSX;
800 case wxUSER_ATTENTION_INFO:
801 flagsOSX = NSInformationalRequest;
804 case wxUSER_ATTENTION_ERROR:
805 flagsOSX = NSCriticalRequest;
809 wxFAIL_MSG( "invalid RequestUserAttention() flags" );
813 [NSApp requestUserAttention:flagsOSX];
816 void wxNonOwnedWindowCocoaImpl::ScreenToWindow( int *x, int *y )
818 wxPoint p((x ? *x : 0), (y ? *y : 0) );
819 NSPoint nspt = wxToNSPoint( NULL, p );
820 nspt = [m_macWindow convertScreenToBase:nspt];
821 nspt = [[m_macWindow contentView] convertPoint:nspt fromView:nil];
822 p = wxFromNSPoint([m_macWindow contentView], nspt);
829 void wxNonOwnedWindowCocoaImpl::WindowToScreen( int *x, int *y )
831 wxPoint p((x ? *x : 0), (y ? *y : 0) );
832 NSPoint nspt = wxToNSPoint( [m_macWindow contentView], p );
833 nspt = [[m_macWindow contentView] convertPoint:nspt toView:nil];
834 nspt = [m_macWindow convertBaseToScreen:nspt];
835 p = wxFromNSPoint( NULL, nspt);
842 bool wxNonOwnedWindowCocoaImpl::IsActive()
844 return [m_macWindow isKeyWindow];
847 void wxNonOwnedWindowCocoaImpl::SetModified(bool modified)
849 [m_macWindow setDocumentEdited:modified];
852 bool wxNonOwnedWindowCocoaImpl::IsModified() const
854 return [m_macWindow isDocumentEdited];
857 wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow nativeWindow)
859 wxNonOwnedWindowCocoaImpl* now = new wxNonOwnedWindowCocoaImpl( wxpeer );
860 now->Create( parent, nativeWindow );
864 wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size,
865 long style, long extraStyle, const wxString& name )
867 wxNonOwnedWindowImpl* now = new wxNonOwnedWindowCocoaImpl( wxpeer );
868 now->Create( parent, pos, size, style , extraStyle, name );