X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1232607d6db642f89a82840b277b53db5c10c84a..ea412ac4eb9f19e3c28dfa32aa9099a81ac7c74c:/src/osx/cocoa/nonownedwnd.mm diff --git a/src/osx/cocoa/nonownedwnd.mm b/src/osx/cocoa/nonownedwnd.mm index 2cd07f9ef2..ce605c4161 100644 --- a/src/osx/cocoa/nonownedwnd.mm +++ b/src/osx/cocoa/nonownedwnd.mm @@ -100,6 +100,7 @@ typedef void (*wxOSX_NoResponderHandlerPtr)(NSView* self, SEL _cmd, SEL selector // even when the programmer explicitly wants to hide it. - (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen { + wxUnusedVar(screen); return frameRect; } @@ -360,14 +361,20 @@ wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl() wxNonOwnedWindowCocoaImpl::~wxNonOwnedWindowCocoaImpl() { - [m_macWindow setImplementation:nil]; - [m_macWindow setDelegate:nil]; - [m_macWindow release]; + if ( !m_wxPeer->IsNativeWindowWrapper() ) + { + [m_macWindow setImplementation:nil]; + [m_macWindow setDelegate:nil]; + [m_macWindow release]; + } } void wxNonOwnedWindowCocoaImpl::WillBeDestroyed() { - [m_macWindow setDelegate:nil]; + if ( !m_wxPeer->IsNativeWindowWrapper() ) + { + [m_macWindow setDelegate:nil]; + } } void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), const wxPoint& pos, const wxSize& size, @@ -484,8 +491,18 @@ long style, long extraStyle, const wxString& WXUNUSED(name) ) [m_macWindow setDelegate:controller]; [m_macWindow setAcceptsMouseMovedEvents: YES]; + + if ( ( style & wxFRAME_SHAPED) ) + { + [m_macWindow setOpaque:NO]; + [m_macWindow setAlphaValue:1.0]; + } } +void wxNonOwnedWindowCocoaImpl::Create( wxWindow* WXUNUSED(parent), WXWindow nativeWindow ) +{ + m_macWindow = nativeWindow; +} WXWindow wxNonOwnedWindowCocoaImpl::GetWXWindow() const { @@ -643,7 +660,19 @@ void wxNonOwnedWindowCocoaImpl::SetTitle( const wxString& title, wxFontEncoding bool wxNonOwnedWindowCocoaImpl::IsMaximized() const { - return [m_macWindow isZoomed]; + if (([m_macWindow styleMask] & NSResizableWindowMask) != 0) + { + return [m_macWindow isZoomed]; + } + else + { + NSRect rectScreen = [[NSScreen mainScreen] visibleFrame]; + NSRect rectWindow = [m_macWindow frame]; + return (rectScreen.origin.x == rectWindow.origin.x && + rectScreen.origin.y == rectWindow.origin.y && + rectScreen.size.width == rectWindow.size.width && + rectScreen.size.height == rectWindow.size.height); + } } bool wxNonOwnedWindowCocoaImpl::IsIconized() const @@ -768,6 +797,13 @@ bool wxNonOwnedWindowCocoaImpl::IsModified() const return [m_macWindow isDocumentEdited]; } +wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, WXWindow nativeWindow) +{ + wxNonOwnedWindowCocoaImpl* now = new wxNonOwnedWindowCocoaImpl( wxpeer ); + now->Create( parent, nativeWindow ); + return now; +} + wxNonOwnedWindowImpl* wxNonOwnedWindowImpl::CreateNonOwnedWindow( wxNonOwnedWindow* wxpeer, wxWindow* parent, const wxPoint& pos, const wxSize& size, long style, long extraStyle, const wxString& name ) {