]> git.sesse.net Git - vlc/blob - modules/gui/macosx/SideBarItem.m
ASF: help stupid compiler
[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 identifier;
20 @synthesize icon;
21 @synthesize badgeValue;
22 @synthesize children;
23
24 #pragma mark -
25 #pragma mark Init/Dealloc/Finalize
26
27 - (id)init
28 {
29         if(self=[super init])
30         {
31                 badgeValue = -1;        //We don't want a badge value by default
32         }
33
34         return self;
35 }
36
37
38 + (id)itemWithTitle:(NSString*)aTitle identifier:(NSString*)anIdentifier
39 {
40         SideBarItem *item = [SideBarItem itemWithTitle:aTitle identifier:anIdentifier icon:nil];
41
42         return item;
43 }
44
45
46 + (id)itemWithTitle:(NSString*)aTitle identifier:(NSString*)anIdentifier icon:(NSImage*)anIcon
47 {
48         SideBarItem *item = [[[SideBarItem alloc] init] autorelease];
49
50         [item setTitle:aTitle];
51         [item setIdentifier:anIdentifier];
52         [item setIcon:anIcon];
53
54         return item;
55 }
56
57 - (void)dealloc
58 {
59         [title release];
60         [identifier release];
61         [icon release];
62         [children release];
63
64         [super dealloc];
65 }
66
67 - (void)finalize
68 {
69         title = nil;
70         identifier = nil;
71         icon = nil;
72         children = nil;
73
74         [super finalize];
75 }
76
77 #pragma mark -
78 #pragma mark Custom Accessors
79
80 - (BOOL)hasBadge
81 {
82         return badgeValue!=-1;
83 }
84
85 - (BOOL)hasChildren
86 {
87         return [children count]>0;
88 }
89
90 - (BOOL)hasIcon
91 {
92         return icon!=nil;
93 }
94
95 @end