Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.

PortingJournal: main.d

File main.d, 1.1 kB (added by doob, 9 years ago)

Test of dwt-cocoa internals

Line 
1 /**
2  * Copyright: Copyright (c) 2008 Jacob Carlborg. All rights reserved.
3  * Authors: Jacob Carlborg
4  * Version: Initial created: Jul 29, 2008
5  * License: $(LINK2 http://opensource.org/licenses/bsd-license.php, BSD Style)
6  *
7  */
8 module main;
9
10 import tango.io.Stdout;
11 import tango.stdc.stringz;
12
13 import dwt.internal.cocoa.NSPoint;
14 import dwt.internal.cocoa.NSRect;
15 import dwt.internal.cocoa.NSSize;
16 import dwt.internal.cocoa.NSString;
17 import dwt.internal.cocoa.NSWindow;
18
19 extern (C) bool NSApplicationLoad();
20
21 void main ()
22 {
23     NSApplicationLoad();
24    
25     NSSize size = {800.0, 600.0};
26     NSPoint point = {0.0, 0.0};
27     NSRect rect = {point, size};
28    
29     NSWindow window = new NSWindow;
30     window = cast(NSWindow)window.alloc;
31     window.initWithContentRect_styleMask_backing_defer_(rect, NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask, NSBackingStoreBuffered, false);
32     window.setIsVisible(true);
33    
34     Stdout(window.isVisible).newline;
35    
36     NSString str = NSString.stringWith("asd");
37    
38     Stdout(fromStringz(str.UTF8String)).newline;
39    
40     for (;;) {}
41 }