Comment detail

ウィンドウの表示 (Nested Flatten)
・ソースファイルのエンコードはUTF-8にしてください。
・OSX上のCocoa環境とXP上のGNUstepで動作確認しています。
・GNUstepではうまく日本語が扱えないようなのでタイトルは英語です。
・AppKit.frameworkとFoundation.frameworkを使用します。
・GNUstep用のGNUmakefile
----------ここから----------
include $(GNUSTEP_MAKEFILES)/common.make

APP_NAME = HelloGUI
HelloGUI_OBJC_FILES = HelloGUI.m 

include $(GNUSTEP_MAKEFILES)/application.make
----------ここまで----------
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>

int main( int argc, const char** argv ) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
	
	[NSApplication sharedApplication];
	
	NSRect contentRect = NSMakeRect( 0, 0, 400, 300 );
	NSWindow* window = [[NSWindow alloc] initWithContentRect:contentRect
			styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO];
#ifdef GNUSTEP
	[window setTitle:@"Hello, GUI!"];
#else
	[window setTitle:[NSString stringWithUTF8String:"こんにちは、GUI!"]];
#endif
	[window center];
	[window makeKeyAndOrderFront:nil];
	
	[NSApp run];
	
    [pool release];
    return 0;
}

Index

Feed

Other

Link

Pathtraq

loading...