root/lang/cplusplus/i3/trunk/src/gui-gnustep/InputWindowPlatform.cpp @ 30458

Revision 30458, 1.7 kB (checked in by saturday06, 4 years ago)

iroiroda!

Line 
1#include <PrecompiledHeaders.h>
2#include "Mediator.h"
3#include "InputWindowPlatform.h"
4#include "InputWindow.h"
5
6@interface MyDelegate : NSObject
7{
8    NSWindow *myWindow;
9}
10- (void) createMenu;
11- (void) createWindow;
12- (void) applicationWillFinishLaunching: (NSNotification *)not;
13- (void) applicationDidFinishLaunching: (NSNotification *)not;
14@end
15
16@implementation MyDelegate : NSObject
17- (void) dealloc
18{
19    RELEASE (myWindow);
20}
21
22- (void) createWindow
23{
24    NSRect rect = NSMakeRect (100, 100, 200, 200);
25    unsigned int styleMask = NSTitledWindowMask
26        | NSMiniaturizableWindowMask;
27
28
29    myWindow = [NSWindow alloc];
30    myWindow = [myWindow initWithContentRect: rect
31                         styleMask: styleMask
32                         backing: NSBackingStoreBuffered
33                         defer: NO];
34    [myWindow setTitle: @"This is a test window"];
35}
36
37- (void) applicationWillFinishLaunching: (NSNotification *)not
38{
39    [self createWindow];
40}
41
42- (void) applicationDidFinishLaunching: (NSNotification *)not;
43{
44    [myWindow makeKeyAndOrderFront: nil];
45}
46@end
47
48namespace i3
49{
50using namespace mol;
51
52
53template <>
54InputWindowPlatform<InputWindow>::InputWindowPlatform(Mediator& mediator) : mediator(mediator)
55{
56}
57
58template <>
59InputWindowPlatform<InputWindow>::~InputWindowPlatform()
60{
61}
62
63template <>
64void InputWindowPlatform<InputWindow>::createUI()
65{
66    [NSApplication sharedApplication];
67    [NSApp setDelegate: [MyDelegate new]];
68    [NSApp run];
69}
70
71template <>
72void InputWindowPlatform<InputWindow>::destroy()
73{
74}
75
76template <>
77void InputWindowPlatform<InputWindow>::run()
78{
79    createUI();
80    loop();
81}
82}
Note: See TracBrowser for help on using the browser.