1998-11-02 17:01:52 +00:00
|
|
|
/* Interface of NSDistributedNotificationCenter class
|
|
|
|
Copyright (C) 1998 Free Software Foundation, Inc.
|
|
|
|
|
|
|
|
Written by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
|
|
|
Created: October 1998
|
|
|
|
|
|
|
|
This file is part of the GNUstep Base Library.
|
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU Library General Public
|
|
|
|
License as published by the Free Software Foundation; either
|
|
|
|
version 2 of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This library 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
|
|
|
|
Library General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Library General Public
|
|
|
|
License along with this library; if not, write to the Free
|
2006-10-31 07:05:46 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
Boston, MA 02111 USA.
|
1998-11-02 17:01:52 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NSDistributedNotificationCenter_h_GNUSTEP_BASE_INCLUDE
|
|
|
|
#define __NSDistributedNotificationCenter_h_GNUSTEP_BASE_INCLUDE
|
2006-10-31 07:05:46 +00:00
|
|
|
#import <GNUstepBase/GSVersionMacros.h>
|
1998-11-02 17:01:52 +00:00
|
|
|
|
2006-10-31 07:05:46 +00:00
|
|
|
#if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST)
|
1998-11-10 20:27:21 +00:00
|
|
|
|
2006-10-31 07:05:46 +00:00
|
|
|
#import <Foundation/NSObject.h>
|
|
|
|
#import <Foundation/NSLock.h>
|
|
|
|
#import <Foundation/NSNotification.h>
|
1998-11-02 17:01:52 +00:00
|
|
|
|
2006-09-13 10:20:49 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
1998-11-02 17:01:52 +00:00
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* Enumeration of possible values for specifying how
|
|
|
|
* [NSDistributedNotificationCenter] deals with notifications when the
|
|
|
|
* process to which the notification should be delivered is suspended:
|
|
|
|
<example>
|
|
|
|
{
|
|
|
|
NSNotificationSuspensionBehaviorDrop, // drop the notification
|
|
|
|
NSNotificationSuspensionBehaviorCoalesce, // drop all for this process but the latest-sent notification
|
|
|
|
NSNotificationSuspensionBehaviorHold, // queue all notifications for this process until it is resumed
|
|
|
|
NSNotificationSuspensionBehaviorDeliverImmediately // resume the process and deliver
|
|
|
|
}
|
|
|
|
</example>
|
|
|
|
*/
|
1998-11-02 17:01:52 +00:00
|
|
|
typedef enum {
|
|
|
|
NSNotificationSuspensionBehaviorDrop,
|
|
|
|
NSNotificationSuspensionBehaviorCoalesce,
|
|
|
|
NSNotificationSuspensionBehaviorHold,
|
|
|
|
NSNotificationSuspensionBehaviorDeliverImmediately
|
|
|
|
} NSNotificationSuspensionBehavior;
|
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* Type for [NSDistributedNotificationCenter+notificationCenterForType:] -
|
2005-04-12 09:48:04 +00:00
|
|
|
* localhost current user broadcast only. This is the only type on OS X.
|
2004-07-29 15:30:47 +00:00
|
|
|
*/
|
2004-09-19 23:19:53 +00:00
|
|
|
GS_EXPORT NSString* const NSLocalNotificationCenterType;
|
2006-10-31 07:05:46 +00:00
|
|
|
#if OS_API_VERSION(GS_API_NONE, GS_API_NONE)
|
2004-07-29 15:30:47 +00:00
|
|
|
|
2005-04-12 09:48:04 +00:00
|
|
|
/**
|
|
|
|
* Type of [NSDistributedNotificationCenter+notificationCenterForType:] -
|
|
|
|
* all users on the local host. This type is available only on GNUstep.
|
|
|
|
*/
|
|
|
|
GS_EXPORT NSString* const GSPublicNotificationCenterType;
|
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* Type of [NSDistributedNotificationCenter+notificationCenterForType:] -
|
|
|
|
* localhost and LAN broadcast. This type is available only on GNUstep.
|
|
|
|
*/
|
2004-09-19 23:19:53 +00:00
|
|
|
GS_EXPORT NSString* const GSNetworkNotificationCenterType;
|
2002-12-12 15:14:13 +00:00
|
|
|
#endif
|
1998-11-02 17:01:52 +00:00
|
|
|
|
2000-09-10 05:34:31 +00:00
|
|
|
@interface NSDistributedNotificationCenter : NSNotificationCenter
|
1998-11-02 17:01:52 +00:00
|
|
|
{
|
1999-09-16 07:21:34 +00:00
|
|
|
NSRecursiveLock *_centerLock; /* For thread safety. */
|
2002-12-12 15:14:13 +00:00
|
|
|
NSString *_type; /* Type of notification center. */
|
|
|
|
id _remote; /* Proxy for center. */
|
1999-09-16 07:21:34 +00:00
|
|
|
BOOL _suspended; /* Is delivery suspended? */
|
1998-11-02 17:01:52 +00:00
|
|
|
}
|
2000-09-10 05:34:31 +00:00
|
|
|
+ (NSNotificationCenter*) defaultCenter;
|
|
|
|
+ (NSNotificationCenter*) notificationCenterForType: (NSString*)type;
|
1998-11-02 17:01:52 +00:00
|
|
|
|
|
|
|
- (void) addObserver: (id)anObserver
|
|
|
|
selector: (SEL)aSelector
|
|
|
|
name: (NSString*)notificationName
|
|
|
|
object: (NSString*)anObject;
|
|
|
|
- (void) addObserver: (id)anObserver
|
|
|
|
selector: (SEL)aSelector
|
|
|
|
name: (NSString*)notificationName
|
|
|
|
object: (NSString*)anObject
|
|
|
|
suspensionBehavior: (NSNotificationSuspensionBehavior)suspensionBehavior;
|
|
|
|
- (void) postNotification: (NSNotification*)notification;
|
|
|
|
- (void) postNotificationName: (NSString*)notificationName
|
|
|
|
object: (NSString*)anObject;
|
|
|
|
- (void) postNotificationName: (NSString*)notificationName
|
|
|
|
object: (NSString*)anObject
|
|
|
|
userInfo: (NSDictionary*)userInfo;
|
|
|
|
- (void) postNotificationName: (NSString*)notificationName
|
|
|
|
object: (NSString*)anObject
|
|
|
|
userInfo: (NSDictionary*)userInfo
|
|
|
|
deliverImmediately: (BOOL)deliverImmediately;
|
|
|
|
- (void) removeObserver: (id)anObserver
|
|
|
|
name: (NSString*)notificationName
|
|
|
|
object: (NSString*)anObject;
|
2001-12-17 14:31:42 +00:00
|
|
|
- (void) setSuspended: (BOOL)flag;
|
1998-11-02 17:01:52 +00:00
|
|
|
- (BOOL) suspended;
|
|
|
|
|
|
|
|
@end
|
|
|
|
|
2006-09-13 10:20:49 +00:00
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
1998-11-02 17:01:52 +00:00
|
|
|
#endif
|
1998-11-10 20:27:21 +00:00
|
|
|
#endif
|
1998-11-02 17:01:52 +00:00
|
|
|
|