}
}
+// We need this for borderless windows, i.e. shaped windows or windows without
+// a title bar. For more info, see:
+// http://lists.apple.com/archives/cocoa-dev/2008/May/msg02091.html
+- (BOOL)canBecomeKeyWindow
+{
+ return YES;
+}
+
@end
@interface wxNSPanel : NSPanel
// controller
//
-@interface wxNonOwnedWindowController : NSObject
+@interface wxNonOwnedWindowController : NSObject wxOSX_10_6_AND_LATER(<NSWindowDelegate>)
{
}
[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,
NSRect r = wxToNSRect( NULL, wxRect( pos, size) );
[m_macWindow setImplementation:this];
+ r = [NSWindow contentRectForFrameRect:r styleMask:windowstyle];
[m_macWindow initWithContentRect:r
styleMask:windowstyle
void wxNonOwnedWindowCocoaImpl::ShowWithoutActivating()
{
- [[m_macWindow contentView] setNeedsDisplay:YES];
+ [m_macWindow orderFront:nil];
+ [[m_macWindow contentView] setNeedsDisplay: YES];
}
bool wxNonOwnedWindowCocoaImpl::Show(bool show)
[m_macWindow makeKeyAndOrderFront:nil];
else
[m_macWindow orderFront:nil];
- ShowWithoutActivating();
+ [[m_macWindow contentView] setNeedsDisplay: YES];
}
else
[m_macWindow orderOut:nil];
}
}
-bool wxNonOwnedWindowCocoaImpl::SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style))
+bool wxNonOwnedWindowCocoaImpl::SetBackgroundStyle(wxBackgroundStyle style)
{
+ if ( style == wxBG_STYLE_TRANSPARENT )
+ {
+ [m_macWindow setOpaque:NO];
+ [m_macWindow setBackgroundColor:[NSColor clearColor]];
+ }
+
return true;
}
bool wxNonOwnedWindowCocoaImpl::SetShape(const wxRegion& WXUNUSED(region))
{
- return false;
+ [m_macWindow setOpaque:NO];
+ [m_macWindow setBackgroundColor:[NSColor clearColor]];
+
+ return true;
}
void wxNonOwnedWindowCocoaImpl::SetTitle( const wxString& title, wxFontEncoding encoding )
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 )
{