blob: 82b48899ea056906957cd261450a6e4055f61068 (
plain)
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
|
//
// PropertyHolder.m
// TikZiT
//
// Copyright 2011 Aleks Kissinger. All rights reserved.
//
//
// This file is part of TikZiT.
//
// TikZiT is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// TikZiT 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 General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with TikZiT. If not, see <http://www.gnu.org/licenses/>.
//
#import "PropertyHolder.h"
@implementation PropertyHolder
- (id)init {
[super init];
notificationName = @"UnknownPropertyChanged";
return self;
}
- (id)initWithNotificationName:(NSString*)n {
[super init];
notificationName = [n copy];
return self;
}
- (void)postPropertyChanged:(NSString*)property oldValue:(id)value {
NSDictionary *userInfo;
if (value != nil) {
userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
property, @"propertyName",
value, @"oldValue",
nil];
} else {
userInfo = [NSDictionary dictionaryWithObject:property
forKey:@"propertyName"];
}
[[NSNotificationCenter defaultCenter] postNotificationName:notificationName
object:self
userInfo:userInfo];
}
- (void)postPropertyChanged:(NSString*)property {
[self postPropertyChanged:property oldValue:nil];
}
- (void)dealloc {
[notificationName release];
[super dealloc];
}
@end
// vi:ft=objc:ts=4:noet:sts=4:sw=4
|