24 #import <Cocoa/Cocoa.h>
26 extern guintptr (*gCbgetWindowContentView)();
30 gboolean m_windowActive;
32 - (gboolean) isActive;
33 - (id) initializeWindow:(NSRect) cordinates;
37 static NSApplication* application;
41 - (id) initializeWindow:(NSRect)cordinates
43 self = [
super initWithContentRect: cordinates
44 styleMask: (NSWindowStyleMaskClosable | NSWindowStyleMaskTitled | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable)
45 backing: NSBackingStoreBuffered defer: NO screen: nil];
47 [application setDelegate:self];
48 [
self setReleasedWhenClosed:NO];
49 m_windowActive =
TRUE;
50 [
self setTitle:@"AAMP Test Player"];
54 - (BOOL) windowShouldClose:(
id)sender
56 m_windowActive = FALSE;
60 - (void) applicationDidFinishLaunching: (NSNotification *)note
62 [
self makeMainWindow];
64 [
self orderFront:self];
67 - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication {
73 return m_windowActive;
78 guintptr getWindowContentView()
80 return (guintptr)[gCocoaWindow contentView];
83 int createAndRunCocoaWindow()
85 NSRect windowCordinates;
86 windowCordinates.size.width = 640;
87 windowCordinates.size.height = 480;
88 windowCordinates.origin.x = 0;
89 windowCordinates.origin.y = 0;
91 application = [NSApplication sharedApplication];
92 [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
93 gCocoaWindow = [[
VideoWindow alloc] initializeWindow:windowCordinates];
95 [gCocoaWindow orderFront:nil];
96 [gCocoaWindow setLevel: NSNormalWindowLevel];
97 gCbgetWindowContentView = &getWindowContentView;
102 void setSimulatorWindowTitle(
const char *title )
106 NSString *nsTitle = [NSString stringWithUTF8String:title];
107 dispatch_async(dispatch_get_main_queue(), ^{
108 [gCocoaWindow setTitle:nsTitle];