PageRenderTime 7ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/Tests/Manual/CPTabViewNib/AppController.j

http://github.com/cacaodev/cappuccino
Unknown | 50 lines | 39 code | 11 blank | 0 comment | 0 complexity | 4577efb5973b39e93935594f3d30981e MD5 | raw file
 1/*
 2 * AppController.j
 3 * CPTabViewNib
 4 *
 5 * Created by Alexander Ljungberg on November 5, 2010.
 6 * Copyright 2010, WireLoad, LLC All rights reserved.
 7 */
 8
 9@import <Foundation/CPObject.j>
10
11@implementation AppController : CPObject
12{
13    CPWindow    theWindow; //this "outlet" is connected automatically by the Cib
14    @outlet     CPTabView nibTabView;
15    @outlet     CPTabView nibTabViewEmpty;
16}
17
18- (IBAction)changeView:(id)sender
19{
20    var item = [nibTabView selectedTabViewItem],
21        view = [[CPView alloc] initWithFrame:CGRectMakeZero()];
22
23    [view setBackgroundColor:[CPColor redColor]];
24    [item setView:view];
25}
26
27- (void)awakeFromCib
28{
29    var item = [[CPTabViewItem alloc] initWithIdentifier:@"item"],
30        view = [[CPView alloc] initWithFrame:CGRectMakeZero()];
31
32    [item setView:view];
33    [item setLabel:@"item"];
34
35    [nibTabViewEmpty addTabViewItem:item];
36
37    [theWindow setFullPlatformWindow:YES];
38}
39
40- (void)tabView:(CPTabView)aTabView didSelectTabViewItem:(CPTabViewItem)tabViewItem
41{
42    CPLogConsole(_cmd + [tabViewItem label]);
43}
44
45- (void)tabView:(CPTabView)aTabView shouldSelectTabViewItem:(CPTabViewItem)tabViewItem
46{
47    return [tabViewItem identifier] != @"unselectable";
48}
49
50@end