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
|
//
// SideBarItem.m
// PXSourceList
//
// Created by Alex Rozanski on 08/01/2010.
// Copyright 2010 Alex Rozanski http://perspx.com
//
// GC-enabled code revised by Stefan Vogt http://byteproject.net
//
// Adapted to VLC media player by Felix Paul Kühne
#import "SideBarItem.h"
@implementation SideBarItem
@synthesize title;
@synthesize untranslatedTitle;
@synthesize identifier;
@synthesize icon;
@synthesize badgeValue;
@synthesize children;
@synthesize sdtype;
#pragma mark -
#pragma mark Init/Dealloc/Finalize
- (id)init
{
if(self=[super init])
{
badgeValue = -1; //We don't want a badge value by default
sdtype = -1; //no sd type set
}
return self;
}
+ (id)itemWithTitle:(NSString*)aTitle identifier:(NSString*)anIdentifier
{
SideBarItem *item = [SideBarItem itemWithTitle:aTitle identifier:anIdentifier icon:nil];
return item;
}
+ (id)itemWithTitle:(NSString*)aTitle identifier:(NSString*)anIdentifier icon:(NSImage*)anIcon
{
SideBarItem *item = [[[SideBarItem alloc] init] autorelease];
[item setTitle:aTitle];
[item setIdentifier:anIdentifier];
[item setIcon:anIcon];
return item;
}
- (void)dealloc
{
[title release];
[identifier release];
[icon release];
[children release];
[super dealloc];
}
- (void)finalize
{
title = nil;
identifier = nil;
icon = nil;
children = nil;
[super finalize];
}
#pragma mark -
#pragma mark Custom Accessors
- (BOOL)hasBadge
{
return badgeValue!=-1;
}
- (BOOL)hasChildren
{
return [children count]>0;
}
- (BOOL)hasIcon
{
return icon!=nil;
}
@end
|