]> git.sesse.net Git - vlc/blob - modules/gui/macosx/SideBarItem.m
macosx: re-implement macosx-background
[vlc] / modules / gui / macosx / SideBarItem.m
1 //
2 //  SideBarItem.m
3 //  PXSourceList
4 //
5 //  Created by Alex Rozanski on 08/01/2010.
6 //  Copyright 2010 Alex Rozanski http://perspx.com
7 //
8 //  GC-enabled code revised by Stefan Vogt http://byteproject.net
9 //
10 //  Adapted to VLC media player by Felix Paul Kühne
11
12
13 #import "SideBarItem.h"
14
15
16 @implementation SideBarItem
17
18 @synthesize title;
19 @synthesize untranslatedTitle;
20 @synthesize identifier;
21 @synthesize icon;
22 @synthesize badgeValue;
23 @synthesize children;
24 @synthesize sdtype;
25
26 #pragma mark -
27 #pragma mark Init/Dealloc/Finalize
28
29 - (id)init
30 {
31     if(self=[super init])
32     {
33         badgeValue = -1; //We don't want a badge value by default
34         sdtype = -1; //no sd type set
35     }
36
37     return self;
38 }
39
40
41 + (id)itemWithTitle:(NSString*)aTitle identifier:(NSString*)anIdentifier
42 {
43     SideBarItem *item = [SideBarItem itemWithTitle:aTitle identifier:anIdentifier icon:nil];
44
45     return item;
46 }
47
48
49 + (id)itemWithTitle:(NSString*)aTitle identifier:(NSString*)anIdentifier icon:(NSImage*)anIcon
50 {
51
52     SideBarItem *item = [[[SideBarItem alloc] init] autorelease];
53
54     [item setTitle:aTitle];
55     [item setIdentifier:anIdentifier];
56     [item setIcon:anIcon];
57
58     return item;
59 }
60
61 - (void)dealloc
62 {
63     [title release];
64     [identifier release];
65     [icon release];
66     [children release];
67
68     [super dealloc];
69 }
70
71 - (void)finalize
72 {
73     title = nil;
74     identifier = nil;
75     icon = nil;
76     children = nil;
77
78     [super finalize];
79 }
80
81 #pragma mark -
82 #pragma mark Custom Accessors
83
84 - (BOOL)hasBadge
85 {
86     return badgeValue!=-1;
87 }
88
89 - (BOOL)hasChildren
90 {
91     return [children count]>0;
92 }
93
94 - (BOOL)hasIcon
95 {
96     return icon!=nil;
97 }
98
99 @end