bool shouldHandleSelector(SEL selector)
{
- if (selector == @selector(noop:)
+ if (selector == @selector(noop:)
|| selector == @selector(complete:)
|| selector == @selector(deleteBackward:)
|| selector == @selector(deleteForward:)
|| selector == @selector(scrollToBeginningOfDocument:)
|| selector == @selector(scrollToEndOfDocument:))
return false;
-
+
return true;
}
- (void)doCommandBySelector:(SEL)selector
{
- if (shouldHandleSelector(selector) &&
+ if (shouldHandleSelector(selector) &&
!(selector == @selector(cancel:) || selector == @selector(cancelOperation:)) )
[super doCommandBySelector:selector];
}
- (void)noResponderFor: (SEL) selector;
@end
-@implementation wxNSPanel
+@implementation wxNSPanel
- (void)setImplementation: (wxNonOwnedWindowCocoaImpl *) theImplementation
{
if ( wxpeer )
{
wxpeer->HandleActivated(0, false);
- // Needed for popup window since the firstResponder
- // (focus in wx) doesn't change when this
+ // Needed for popup window since the firstResponder
+ // (focus in wx) doesn't change when this
// TLW becomes inactive.
wxFocusEvent event( wxEVT_KILL_FOCUS, wxpeer->GetId());
event.SetEventObject(wxpeer);
IMPLEMENT_DYNAMIC_CLASS( wxNonOwnedWindowCocoaImpl , wxNonOwnedWindowImpl )
-wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonownedwnd) :
+wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl( wxNonOwnedWindow* nonownedwnd) :
wxNonOwnedWindowImpl(nonownedwnd)
{
m_macWindow = NULL;
m_macFullScreenData = NULL;
}
-
-wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl()
+
+wxNonOwnedWindowCocoaImpl::wxNonOwnedWindowCocoaImpl()
{
m_macWindow = NULL;
m_macFullScreenData = NULL;
}
-
+
wxNonOwnedWindowCocoaImpl::~wxNonOwnedWindowCocoaImpl()
{
[m_macWindow setImplementation:nil];
long style, long extraStyle, const wxString& WXUNUSED(name) )
{
static wxNonOwnedWindowController* controller = NULL;
-
+
if ( !controller )
controller =[[wxNonOwnedWindowController alloc] init];
int windowstyle = NSBorderlessWindowMask;
-
- if ( style & wxFRAME_TOOL_WINDOW || ( style & wxPOPUP_WINDOW ) ||
+
+ if ( style & wxFRAME_TOOL_WINDOW || ( style & wxPOPUP_WINDOW ) ||
GetWXPeer()->GetExtraStyle() & wxTOPLEVEL_EX_DIALOG )
{
m_macWindow = [wxNSPanel alloc];
}
else
m_macWindow = [wxNSWindow alloc];
-
+
CGWindowLevel level = kCGNormalWindowLevel;
-
+
if ( style & wxFRAME_TOOL_WINDOW )
{
windowstyle |= NSUtilityWindowMask;
if ( ( style & wxSTAY_ON_TOP ) )
level = kCGUtilityWindowLevel;
-
+
NSRect r = wxToNSRect( NULL, wxRect( pos, size) );
-
+
[m_macWindow setImplementation:this];
-
+
[m_macWindow initWithContentRect:r
styleMask:windowstyle
backing:NSBackingStoreBuffered
- defer:NO
+ defer:NO
];
-
+
[m_macWindow setLevel:level];
[m_macWindow setDelegate:controller];
-
+
[m_macWindow setAcceptsMouseMovedEvents: YES];
}
{
[m_macWindow orderWindow:NSWindowAbove relativeTo:0];
}
-
+
void wxNonOwnedWindowCocoaImpl::Lower()
{
[m_macWindow orderWindow:NSWindowBelow relativeTo:0];
{
if ( show )
{
- [m_macWindow makeKeyAndOrderFront:nil];
+ wxNonOwnedWindow* wxpeer = GetWXPeer();
+ if (wxpeer && !(wxpeer->GetWindowStyle() & wxFRAME_TOOL_WINDOW))
+ [m_macWindow makeKeyAndOrderFront:nil];
+ else
+ [m_macWindow orderFront:nil];
+
[[m_macWindow contentView] setNeedsDisplay:YES];
}
- else
+ else
[m_macWindow orderOut:nil];
return true;
}
-
+
bool wxNonOwnedWindowCocoaImpl::ShowWithEffect(bool show, wxShowEffect WXUNUSED(effect), unsigned WXUNUSED(timeout))
{
return Show(show);
int windowStyle = [ m_macWindow styleMask];
if ( metal && !(windowStyle & NSTexturedBackgroundWindowMask) )
{
- wxFAIL_MSG( _T("Metal Style cannot be changed after creation") );
+ wxFAIL_MSG( wxT("Metal Style cannot be changed after creation") );
}
else if ( !metal && (windowStyle & NSTexturedBackgroundWindowMask ) )
{
- wxFAIL_MSG( _T("Metal Style cannot be changed after creation") );
- }
+ wxFAIL_MSG( wxT("Metal Style cannot be changed after creation") );
+ }
}
}
-
+
bool wxNonOwnedWindowCocoaImpl::SetBackgroundStyle(wxBackgroundStyle WXUNUSED(style))
{
return true;
}
-
+
bool wxNonOwnedWindowCocoaImpl::CanSetTransparent()
{
return true;
width = (int)rect.size.width;
height = (int)rect.size.height;
}
-
+
bool wxNonOwnedWindowCocoaImpl::SetShape(const wxRegion& WXUNUSED(region))
{
return false;
}
-void wxNonOwnedWindowCocoaImpl::SetTitle( const wxString& title, wxFontEncoding encoding )
+void wxNonOwnedWindowCocoaImpl::SetTitle( const wxString& title, wxFontEncoding encoding )
{
[m_macWindow setTitle:wxCFStringRef( title , encoding ).AsNSString()];
}
-
+
bool wxNonOwnedWindowCocoaImpl::IsMaximized() const
{
return [m_macWindow isZoomed];
}
-
+
bool wxNonOwnedWindowCocoaImpl::IsIconized() const
{
return [m_macWindow isMiniaturized];
}
-
+
void wxNonOwnedWindowCocoaImpl::Iconize( bool iconize )
{
if ( iconize )
else
[m_macWindow deminiaturize:nil];
}
-
+
void wxNonOwnedWindowCocoaImpl::Maximize(bool WXUNUSED(maximize))
{
[m_macWindow zoom:nil];
}
-
+
// http://cocoadevcentral.com/articles/000028.php
{
return m_macFullScreenData != NULL ;
}
-
+
bool wxNonOwnedWindowCocoaImpl::ShowFullScreen(bool show, long WXUNUSED(style))
{
if ( show )
delete data ;
m_macFullScreenData = NULL ;
}
-
+
return true;
}
nspt = [[m_macWindow contentView] convertPoint:nspt fromView:nil];
p = wxFromNSPoint([m_macWindow contentView], nspt);
if ( x )
- *x = p.x;
+ *x = p.x;
if ( y )
*y = p.y;
}