]> err.no Git - sope/blob - libFoundation/Foundation/NSNotification.h
fixed some NGMail framework build issue
[sope] / libFoundation / Foundation / NSNotification.h
1 /* 
2    NSNotification.h
3
4    Copyright (C) 1995, 1996 Ovidiu Predescu and Mircea Oancea.
5    All rights reserved.
6
7    Author: Mircea Oancea <mircea@jupiter.elcom.pub.ro>
8
9    This file is part of libFoundation.
10
11    Permission to use, copy, modify, and distribute this software and its
12    documentation for any purpose and without fee is hereby granted, provided
13    that the above copyright notice appear in all copies and that both that
14    copyright notice and this permission notice appear in supporting
15    documentation.
16
17    We disclaim all warranties with regard to this software, including all
18    implied warranties of merchantability and fitness, in no event shall
19    we be liable for any special, indirect or consequential damages or any
20    damages whatsoever resulting from loss of use, data or profits, whether in
21    an action of contract, negligence or other tortious action, arising out of
22    or in connection with the use or performance of this software.
23 */
24
25 #ifndef __NSNotification_h__
26 #define __NSNotification_h__
27
28 #include <Foundation/NSObject.h>
29 #include <Foundation/NSUtilities.h>
30 #include <Foundation/NSMapTable.h>
31
32 @class NSMutableDictionary;
33 @class NSDictionary;
34 @class NSMutableArray;
35 @class NSArray;
36
37 /*
38  * NSNotification       
39  */
40
41 @interface NSNotification : NSObject <NSCoding>
42
43 + (NSNotification*)notificationWithName:(NSString *)name object:object;
44 + (NSNotification*)notificationWithName:(NSString *)aName
45   object:(id)anObject userInfo:(NSDictionary *)userInfo;
46
47 - (id)initWithName:(NSString *)aName object:(id)anObject 
48   userInfo:(NSDictionary *)anUserInfo;
49
50 - (NSString *)notificationName;    
51 - (NSString *)name;    
52 - (id)notificationObject;
53 - (id)object;
54 - (NSDictionary *)userInfo;
55
56 @end
57
58 /*
59  * NSNotificationCenter 
60  */
61
62 struct _NSNotificationRegistrationList;
63
64 @interface NSNotificationCenter : NSObject 
65 {
66     NSMapTable *nameToObjects;
67     id         nullNameToObjects;
68 }
69
70 + (NSNotificationCenter *)defaultCenter;
71
72 // Posting Notifications
73 - (void)postNotification:(NSNotification *)notification;
74 - (void)postNotificationName:(NSString *)notificationName object:(id)object;
75 - (void)postNotificationName:(NSString *)notificationName object:(id)object
76   userInfo:(NSDictionary *)userInfo;
77
78 // Adding and Removing Observers
79
80 - (void)addObserver:(id)observer selector:(SEL)selector 
81   name:(NSString *)name object:object;
82 - (void)removeObserver:(id)observer 
83   name:(NSString *)name object:(id)object;
84 - (void)removeObserver:(id)observer;
85
86 @end
87
88 #endif /* __NSNotification_h__ */
89
90 /*
91   Local Variables:
92   c-basic-offset: 4
93   tab-width: 8
94   End:
95 */