wilkes (owner)

Revisions

gist: 224226 Download_button fork
public
Public Clone URL: git://gist.github.com/224226.git
Embed All Files: show embed
AppController.j #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
* AppController.j
* scrollview
*
* Created by You on November 2, 2009.
* Copyright 2009, Your Company All rights reserved.
*/
 
@import <Foundation/CPObject.j>
 
 
@implementation AppController : CPObject
{
}
 
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
    var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(40, 40, 400,200)
                                                styleMask:CPResizableWindowMask | CPTitledWindowMask | CPClosableWindowMask | CPMiniaturizableWindowMask],
        contentView = [theWindow contentView];
 
    [contentView setBackgroundColor: [CPColor yellowColor]];
    
    var scrollView = [[CPScrollView alloc] initWithFrame:[contentView bounds]];
    [scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
    [contentView addSubview:scrollView];
    [scrollView setBackgroundColor: [CPColor greenColor]];
 
    var label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
 
    [label setStringValue:@"Hello World!"];
    [label setFont:[CPFont boldSystemFontOfSize:24.0]];
    [label setBackgroundColor: [CPColor redColor]];
    [label sizeToFit];
 
    [label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
    [label setCenter:[scrollView center]];
 
    [scrollView addSubview:label];
 
    [theWindow orderFront:self];
}
 
@end