-
Notifications
You must be signed in to change notification settings - Fork 0
/
WLPortalItem.m
76 lines (65 loc) · 1.34 KB
/
WLPortalItem.m
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
//
// WLPortalItem.m
// Welly
//
// Created by K.O.ed on 10-4-17.
// Copyright 2010 Welly Group. All rights reserved.
//
#import <Quartz/Quartz.h>
#import "WLPortalItem.h"
static NSImage *default_image;
@implementation WLPortalItem
@synthesize imageTitle = _title;
@synthesize image = _image;
#pragma mark -
#pragma mark Initialize
- (id)initWithTitle:(NSString *)title {
if (self = [super init]) {
_title = [title copy];
}
return self;
}
- (id)initWithImage:(NSImage *)theImage{
if (self = [super init]) {
_image = theImage;
}
return self;
}
- (id)initWithImage:(NSImage *)theImage
title:(NSString *)title {
if (self = [super init]) {
_image = theImage;
_title = [title copy];
}
return self;
}
- (void)dealloc {
[_image release];
[_title release];
[super dealloc];
}
#pragma mark -
#pragma mark IKImageBrowserItem protocol
- (NSString *)imageUID {
return _title;
}
- (NSString *)imageRepresentationType {
return IKImageBrowserNSImageRepresentationType;
}
- (id)imageRepresentation {
if (_image == nil) {
if (default_image == nil)
default_image = [NSImage imageNamed:@"default_site.png"];
return default_image;
}
return _image;
}
- (NSString*)imageTitle {
return _title;
}
#pragma mark -
#pragma mark WLPortalSource protocol
- (void)didSelect:(id)sender {
// DO NOTHING
}
@end