X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a029e98a41820c2c1cd92e1e4bbff30c49f1c168..779a4d41ef6d606d39b03b4a7fa5fe27565bb66c:/src/osx/cocoa/nonownedwnd.mm?ds=sidebyside diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index d17540c296..2cd07f9ef2 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -194,7 +194,7 @@ typedef void (*wxOSX_NoResponderHandlerPtr)(NSView* self, SEL _cmd, SEL selector // controller // -@interface wxNonOwnedWindowController : NSObject +@interface wxNonOwnedWindowController : NSObject wxOSX_10_6_AND_LATER() { } @@ -204,6 +204,7 @@ typedef void (*wxOSX_NoResponderHandlerPtr)(NSView* self, SEL _cmd, SEL selector - (void)windowDidBecomeKey:(NSNotification *)notification; - (void)windowDidMove:(NSNotification *)notification; - (BOOL)windowShouldClose:(id)window; +- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame; @end @@ -327,6 +328,19 @@ typedef void (*wxOSX_NoResponderHandlerPtr)(NSView* self, SEL _cmd, SEL selector return nil; } +- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame +{ + wxNonOwnedWindowCocoaImpl* windowimpl = [(wxNSWindow*)window implementation]; + if ( windowimpl ) + { + wxNonOwnedWindow* wxpeer = windowimpl->GetWXPeer(); + wxMaximizeEvent event(wxpeer->GetId()); + event.SetEventObject(wxpeer); + return !wxpeer->HandleWindowEvent(event); + } + return true; +} + @end IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowCocoaImpl , wxNonOwnedWindowImpl ) @@ -351,9 +365,9 @@ wxNonOwnedWindowCocoaImpl::~wxNonOwnedWindowCocoaImpl() [m_macWindow release]; } -void wxNonOwnedWindowCocoaImpl::Destroy() +void wxNonOwnedWindowCocoaImpl::WillBeDestroyed() { - wxPendingDelete.Append( new wxDeferredObjectDeleter( this ) ); + [m_macWindow setDelegate:nil]; } void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), const wxPoint& pos, const wxSize& size, @@ -692,8 +706,25 @@ bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style)) return true; } -void wxNonOwnedWindowCocoaImpl::RequestUserAttention(int WXUNUSED(flags)) +void wxNonOwnedWindowCocoaImpl::RequestUserAttention(int flagsWX) { + NSRequestUserAttentionType flagsOSX; + switch ( flagsWX ) + { + case wxUSER_ATTENTION_INFO: + flagsOSX = NSInformationalRequest; + break; + + case wxUSER_ATTENTION_ERROR: + flagsOSX = NSCriticalRequest; + break; + + default: + wxFAIL_MSG( "invalid RequestUserAttention() flags" ); + return; + } + + [NSApp requestUserAttention:flagsOSX]; } void wxNonOwnedWindowCocoaImpl::ScreenToWindow( int *x, int *y ) @@ -727,6 +758,16 @@ bool wxNonOwnedWindowCocoaImpl::IsActive() return [m_macWindow isKeyWindow]; } +void wxNonOwnedWindowCocoaImpl::SetModified(bool modified) +{ + [m_macWindow setDocumentEdited:modified]; +} + +bool wxNonOwnedWindowCocoaImpl::IsModified() const +{ + return [m_macWindow isDocumentEdited]; +} + wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, long style, long extraStyle, const wxString& name ) {