// even when the programmer explicitly wants to hide it.
- (NSRect)constrainFrameRect:(NSRect)frameRect toScreen:(NSScreen *)screen
{
+ wxUnusedVar(screen);
return frameRect;
}
- (void)windowDidBecomeKey:(NSNotification *)notification;
- (void)windowDidMove:(NSNotification *)notification;
- (BOOL)windowShouldClose:(id)window;
+- (BOOL)windowShouldZoom:(NSWindow *)window toFrame:(NSRect)newFrame;
@end
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 )
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,
[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
{
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
void wxNonOwnedWindowCocoaImpl::RequestUserAttention(int flagsWX)
{
- int flagsOSX;
+ NSRequestUserAttentionType flagsOSX;
switch ( flagsWX )
{
case wxUSER_ATTENTION_INFO:
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 )
{