#if wxUSE_GUI
-@interface wxNSAppController : NSObject wxOSX_10_6_AND_LATER(<NSApplicationDelegate>)
-{
-}
-
-- (void)applicationWillFinishLaunching:(NSApplication *)sender;
-
-- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename;
-- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender;
-- (BOOL)application:(NSApplication *)sender printFile:(NSString *)filename;
-- (void)handleGetURLEvent:(NSAppleEventDescriptor *)event
- withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
-
-- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender;
-- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender;
-- (void)applicationWillTerminate:(NSApplication *)sender;
-@end
-
@implementation wxNSAppController
-- (void)applicationWillFinishLaunching:(NSApplication *)application {
+- (void)applicationWillFinishLaunching:(NSNotification *)application {
wxUnusedVar(application);
}
-- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename;
+- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename
{
wxUnusedVar(sender);
wxCFStringRef cf(wxCFRetain(filename));
return YES;
}
-- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender;
+- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
{
wxUnusedVar(sender);
wxTheApp->MacNewFile() ;
return NSTerminateNow;
}
-- (void)applicationWillTerminate:(NSApplication *)application {
+- (void)applicationWillTerminate:(NSNotification *)application {
wxUnusedVar(application);
wxCloseEvent event;
event.SetCanVeto(false);
NSAppleEventManager *appleEventManager = [NSAppleEventManager sharedAppleEventManager];
[appleEventManager setEventHandler:controller andSelector:@selector(handleGetURLEvent:withReplyEvent:)
forEventClass:kInternetEventClass andEventID:kAEGetURL];
-
+
+ // calling finishLaunching so early before running the loop seems to trigger some 'MenuManager compatibility' which leads
+ // to the duplication of menus under 10.5 and a warning under 10.6
+#if 0
[NSApp finishLaunching];
+#endif
}
return true;
}
void wxClientDisplayRect(int *x, int *y, int *width, int *height)
{
- NSRect displayRect = [[NSScreen mainScreen] visibleFrame];
+ NSRect displayRect = [wxOSXGetMenuScreen() visibleFrame];
wxRect r = wxFromNSRect( NULL, displayRect );
if ( x )
*x = r.x;
{
if (gs_wxBusyCursorCount++ == 0)
{
+ NSEnumerator *enumerator = [[[NSApplication sharedApplication] windows] objectEnumerator];
+ id object;
+
+ while ((object = [enumerator nextObject])) {
+ [(NSWindow*) object disableCursorRects];
+ }
+
gMacStoredActiveCursor = gMacCurrentCursor;
cursor->MacInstall();
if (--gs_wxBusyCursorCount == 0)
{
- gMacStoredActiveCursor.MacInstall();
- gMacStoredActiveCursor = wxNullCursor;
+ NSEnumerator *enumerator = [[[NSApplication sharedApplication] windows] objectEnumerator];
+ id object;
+
+ while ((object = [enumerator nextObject])) {
+ [(NSWindow*) object enableCursorRects];
+ }
wxSetCursor(wxNullCursor);
+
+ gMacStoredActiveCursor.MacInstall();
+ gMacStoredActiveCursor = wxNullCursor;
}
}
wxSize sz = m_window->GetSize();
- int left = subrect != NULL ? subrect->x : 0 ;
- int top = subrect != NULL ? subrect->y : 0 ;
int width = subrect != NULL ? subrect->width : sz.x;
int height = subrect != NULL ? subrect->height : sz.y ;
- NSRect rect = NSMakeRect(left, top, width, height );
NSView* view = (NSView*) m_window->GetHandle();
[view lockFocus];
// we use this method as other methods force a repaint, and this method can be