1 /** Interface for NSNotification and NSNotificationCenter for GNUstep
2    Copyright (C) 1996,1999 Free Software Foundation, Inc.
3 
4    Written by:  Andrew Kachites McCallum <mccallum@gnu.ai.mit.edu>
5    Rewrite by:  Richard Frith-Macdonald <rfm@gnu.org>
6    Created: March 1996
7 
8    This file is part of the GNUstep Base Library.
9 
10    This library is free software; you can redistribute it and/or
11    modify it under the terms of the GNU Lesser General Public
12    License as published by the Free Software Foundation; either
13    version 2 of the License, or (at your option) any later version.
14 
15    This library is distributed in the hope that it will be useful,
16    but WITHOUT ANY WARRANTY; without even the implied warranty of
17    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18    Lesser General Public License for more details.
19 
20    You should have received a copy of the GNU Lesser General Public
21    License along with this library; if not, write to the Free
22    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
23    Boston, MA 02110 USA.
24 
25   AutogsdocSource: NSNotification.m
26   AutogsdocSource: NSNotificationCenter.m
27 */
28 
29 #ifndef __NSNotification_h_GNUSTEP_BASE_INCLUDE
30 #define __NSNotification_h_GNUSTEP_BASE_INCLUDE
31 #import	<GNUstepBase/GSVersionMacros.h>
32 
33 #import	<Foundation/NSObject.h>
34 #import	<Foundation/NSMapTable.h>
35 #import <GNUstepBase/GSBlocks.h>
36 
37 #if	defined(__cplusplus)
38 extern "C" {
39 #endif
40 
41 @class NSString;
42 @class NSDictionary;
43 @class NSLock;
44 @class NSOperationQueue;
45 
46 @interface NSNotification : NSObject <NSCopying, NSCoding>
47 
48 /* Creating a Notification Object */
49 + (NSNotification*) notificationWithName: (NSString*)name
50 				  object: (id)object;
51 
52 + (NSNotification*) notificationWithName: (NSString*)name
53 				  object: (id)object
54 			        userInfo: (NSDictionary*)info;
55 
56 /* Querying a Notification Object */
57 
58 - (NSString*) name;
59 - (id) object;
60 - (NSDictionary*) userInfo;
61 
62 @end
63 
64 
65 #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
66 DEFINE_BLOCK_TYPE(GSNotificationBlock, void, NSNotification *);
67 #endif
68 
69 @interface NSNotificationCenter : NSObject
70 {
71 #if	GS_EXPOSE(NSNotificationCenter)
72 @private
73   void	*_table;
74 #endif
75 }
76 
77 + (NSNotificationCenter*) defaultCenter;
78 
79 - (void) addObserver: (id)observer
80             selector: (SEL)selector
81                 name: (NSString*)name
82               object: (id)object;
83 #if OS_API_VERSION(MAC_OS_X_VERSION_10_6, GS_API_LATEST)
84 - (id) addObserverForName: (NSString *)name
85                    object: (id)object
86                     queue: (NSOperationQueue *)queue
87                usingBlock: (GSNotificationBlock)block;
88 #endif
89 
90 - (void) removeObserver: (id)observer;
91 - (void) removeObserver: (id)observer
92                    name: (NSString*)name
93                  object: (id)object;
94 
95 - (void) postNotification: (NSNotification*)notification;
96 - (void) postNotificationName: (NSString*)name
97                        object: (id)object;
98 - (void) postNotificationName: (NSString*)name
99                        object: (id)object
100                      userInfo: (NSDictionary*)info;
101 
102 @end
103 
104 #if	defined(__cplusplus)
105 }
106 #endif
107 
108 #endif /*__NSNotification_h_GNUSTEP_BASE_INCLUDE */
109