~ubuntu-branches/ubuntu/karmic/gnustep-base/karmic

« back to all changes in this revision

Viewing changes to Headers/gnustep/base/NSNotification.h

  • Committer: Bazaar Package Importer
  • Author(s): Eric Heintzmann
  • Date: 2005-04-17 00:14:38 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050417001438-enf0y07c9tku85z1
Tags: 1.10.3-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
   Created: March 1996
6
 
 
7
 
   This file is part of the GNUstep Base Library.
8
 
 
9
 
   This library is free software; you can redistribute it and/or
10
 
   modify it under the terms of the GNU Library General Public
11
 
   License as published by the Free Software Foundation; either
12
 
   version 2 of the License, or (at your option) any later version.
13
 
   
14
 
   This library is distributed in the hope that it will be useful,
15
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17
 
   Library General Public License for more details.
18
 
 
19
 
   You should have received a copy of the GNU Library General Public
20
 
   License along with this library; if not, write to the Free
21
 
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA.
22
 
*/
23
 
 
24
 
#ifndef __NSNotification_h_GNUSTEP_BASE_INCLUDE
25
 
#define __NSNotification_h_GNUSTEP_BASE_INCLUDE
26
 
 
27
 
#include <Foundation/NSObject.h>
28
 
#include <Foundation/NSMapTable.h>
29
 
 
30
 
@class NSString;
31
 
@class NSDictionary;
32
 
@class NSLock;
33
 
 
34
 
@interface NSNotification : NSObject <NSCopying, NSCoding>
35
 
{
36
 
  NSString      *_name;
37
 
  id            _object;
38
 
  NSDictionary  *_info;
39
 
}
40
 
 
41
 
/* Creating a Notification Object */
42
 
+ (NSNotification*) notificationWithName: (NSString*)name
43
 
                                  object: (id)object;
44
 
 
45
 
+ (NSNotification*) notificationWithName: (NSString*)name
46
 
                                  object: (id)object
47
 
                                userInfo: (NSDictionary*)info;
48
 
 
49
 
/* Querying a Notification Object */
50
 
 
51
 
- (NSString*) name;
52
 
- (id) object;
53
 
- (NSDictionary*) userInfo;
54
 
 
55
 
@end
56
 
 
57
 
 
58
 
 
59
 
@interface NSNotificationCenter : NSObject <GCFinalization>
60
 
{
61
 
  void  *_table;
62
 
}
63
 
 
64
 
+ (NSNotificationCenter*) defaultCenter;
65
 
 
66
 
- (void) addObserver: (id)observer
67
 
            selector: (SEL)sel
68
 
                name: (NSString*)name
69
 
              object: (id)object;
70
 
 
71
 
- (void) removeObserver: (id)observer;
72
 
- (void) removeObserver: (id)observer
73
 
                   name: (NSString*)name
74
 
                 object: (id)object;
75
 
 
76
 
- (void) postNotification: (NSNotification*)notification;
77
 
- (void) postNotificationName: (NSString*)name
78
 
                       object: (id)object;
79
 
- (void) postNotificationName: (NSString*)name
80
 
                       object: (id)object
81
 
                     userInfo: (NSDictionary*)info;
82
 
 
83
 
@end
84
 
 
85
 
#ifndef NO_GNUSTEP
86
 
@interface NSNotification (GNUstep)
87
 
- (id) initWithName: (NSString*)name
88
 
             object: (id)object
89
 
           userInfo: (NSDictionary*)user_info;
90
 
@end
91
 
 
92
 
@interface NSNotificationCenter (GNUstep)
93
 
/*
94
 
 * Extensions for maximising posting performance - these options are
95
 
 * NOT adjustable for the default notification center.
96
 
 *
97
 
 * You can disable locking in a multi-threaded program if you KNOW that only
98
 
 * one thread will ever use the notification center.
99
 
 *
100
 
 * You can turn on 'immutability' if you KNOW that the posting of a
101
 
 * notification will never result in an attempt to modify the center.
102
 
 * In this case, the center can optimise delivery of notifications.
103
 
 */
104
 
- (BOOL) setImmutableInPost: (BOOL)flag;
105
 
- (BOOL) setLockingDisabled: (BOOL)flag;
106
 
@end
107
 
#endif
108
 
 
109
 
#endif /*__NSNotification_h_GNUSTEP_BASE_INCLUDE */