-
Notifications
You must be signed in to change notification settings - Fork 2
/
TNiTunesTabViewItem.j
119 lines (100 loc) · 3.42 KB
/
TNiTunesTabViewItem.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
/*
* TNiTunesTabViewItem.j
* AppKit
*
* Created by Francisco Tolmasky.
* Copyright 2008, 280 North, Inc.
*
* Modified by Antoine Mercadal for the needs of Archipel Project
* Copyright 2010 Antoine Mercadal
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import <Foundation/CPObject.j>
@import <AppKit/CPView.j>
/*
The tab is currently selected.
@global
@group CPTabState
*/
TNSelectedTab = 0;
/*
The tab is currently in the background (not selected).
@global
@group CPTabState
*/
TNBackgroundTab = 1;
/*
The tab of this item is currently being pressed by the user.
@global
@group CPTabState
*/
TNPressedTab = 2;
/*!
@ingroup appkit
@class TNiTunesTabViewItem
The class representation of an item in a TNiTunesTabView. One tab view item
can be shown at a time in a TNiTunesTabView.
*/
@implementation TNiTunesTabViewItem : CPObject
{
CPString _label @accessors(property=label);
CPView _auxiliaryView @accessors(property=auxiliaryView);
CPView _view @accessors(property=view);
id _identifier @accessors(property=identifier);
int _tabState @accessors(getter=tabState);
TNiTunesTabView _tabView @accessors(property=tabView);
}
- (id)init
{
return [self initWithIdentifier:@""];
}
/*!
Initializes the tab view item with the specified identifier.
@return the initialized TNiTunesTabViewItem
*/
- (id)initWithIdentifier:(id)anIdentifier
{
self = [super init];
if (self)
_identifier = anIdentifier;
return self;
}
@end
var TNiTunesTabViewItemIdentifierKey = "TNiTunesTabViewItemIdentifierKey",
TNiTunesTabViewItemLabelKey = "TNiTunesTabViewItemLabelKey",
TNiTunesTabViewItemViewKey = "TNiTunesTabViewItemViewKey",
TNiTunesTabViewItemAuxViewKey = "TNiTunesTabViewItemAuxViewKey";
@implementation TNiTunesTabViewItem (CPCoding)
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super init];
if (self)
{
_identifier = [aCoder decodeObjectForKey:TNiTunesTabViewItemIdentifierKey];
_label = [aCoder decodeObjectForKey:TNiTunesTabViewItemLabelKey];
_view = [aCoder decodeObjectForKey:TNiTunesTabViewItemViewKey];
_auxiliaryView = [aCoder decodeObjectForKey:TNiTunesTabViewItemAuxViewKey];
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeObject:_identifier forKey:TNiTunesTabViewItemIdentifierKey];
[aCoder encodeObject:_label forKey:TNiTunesTabViewItemLabelKey];
[aCoder encodeObject:_view forKey:TNiTunesTabViewItemViewKey];
[aCoder encodeObject:_auxiliaryView forKey:TNiTunesTabViewItemAuxViewKey];
}
@end