yoga1290

NSWindow Programmatically (Invisible :D!!)

May 10th, 2011
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // main.m!!!
  2. #import <Cocoa/Cocoa.h>
  3. #import <Foundation/Foundation.h>
  4. int main(int argc, char *argv[])
  5. {
  6.     NSRect windowRect = NSMakeRect(10.0f, 10.0f, 800.0f, 600.0f);
  7.     NSWindow *window = [[NSWindow alloc] initWithContentRect:windowRect
  8.                                          styleMask:( NSResizableWindowMask | NSClosableWindowMask | NSTitledWindowMask)
  9.                                          backing:NSBackingStoreBuffered defer:NO];
  10.    
  11.    
  12.    
  13.     [window makeKeyAndOrderFront:nil];
  14.     [[window frame ]
  15. //  NSPoint x = (window.screen.frame.size.width - window.size.width) / 2;
  16. //  NSPoint y = (window.screen.frame.size.height - window.size.height) / 2;
  17.    
  18.     // Create a rect to send to the window
  19. //  NSRect newFrame = NSMakeRect(x, y, window.size.width, window.size.height);
  20.    
  21.     // Send message to the window to resize/relocate
  22. //  [window setFrame:windowRect display:YES animate:NO];
  23.     [window setTitle:@"Youssef Gamil"];
  24.     return NSApplicationMain(argc,  (const char **) argv);
  25. }
Advertisement
Add Comment
Please, Sign In to add comment