changeset 0:9471bdf549f4

Origination.
author Atul Varma <avarma@mozilla.com>
date Sun, 11 Apr 2010 12:06:27 -0700
parents
children e12920ff751b
files Makefile MyApp.m
diffstat 2 files changed, 42 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Makefile	Sun Apr 11 12:06:27 2010 -0700
@@ -0,0 +1,2 @@
+all:
+	clang MyApp.m -oMyApp -framework AppKit
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MyApp.m	Sun Apr 11 12:06:27 2010 -0700
@@ -0,0 +1,40 @@
+#import <Foundation/NSAutoreleasePool.h>
+#import <AppKit/NSApplication.h>
+#import <AppKit/NSWindow.h>
+#import <AppKit/NSView.h>
+
+@interface MyView : NSView {
+}
+-(void)drawRect:(NSRect)dirtyRect;
+@end
+
+@implementation MyView
+-(void)drawRect:(NSRect)dirtyRect {
+  printf("OMG drawRect!\n");
+}
+@end
+
+int main(int argc, const char *argv[])
+{
+  NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+  [NSApplication sharedApplication];
+
+  NSRect rect = {{20, 20},
+                 {100, 100}};
+
+  NSWindow *window = [[NSWindow alloc] initWithContentRect: rect
+                                       styleMask: NSBorderlessWindowMask
+                                       backing: NSBackingStoreBuffered
+                                       defer: YES];
+
+  NSView *view = [[MyView alloc] init];
+
+  [window setContentView: view];
+  [window setLevel: NSScreenSaverWindowLevel];
+  [window makeKeyAndOrderFront: NSApp];
+
+  [NSApp run];
+
+  return 0;
+}