1997-09-01 21:59:51 +00:00
|
|
|
/*
|
|
|
|
NSNotificationQueue.h
|
|
|
|
|
|
|
|
Copyright (C) 1995, 1996 Ovidiu Predescu and Mircea Oancea.
|
|
|
|
All rights reserved.
|
|
|
|
|
|
|
|
Author: Mircea Oancea <mircea@jupiter.elcom.pub.ro>
|
|
|
|
|
|
|
|
This file is part of libFoundation.
|
|
|
|
|
|
|
|
Permission to use, copy, modify, and distribute this software and its
|
|
|
|
documentation for any purpose and without fee is hereby granted, provided
|
|
|
|
that the above copyright notice appear in all copies and that both that
|
|
|
|
copyright notice and this permission notice appear in supporting
|
|
|
|
documentation.
|
|
|
|
|
|
|
|
We disclaim all warranties with regard to this software, including all
|
|
|
|
implied warranties of merchantability and fitness, in no event shall
|
|
|
|
we be liable for any special, indirect or consequential damages or any
|
|
|
|
damages whatsoever resulting from loss of use, data or profits, whether in
|
|
|
|
an action of contract, negligence or other tortious action, arising out of
|
|
|
|
or in connection with the use or performance of this software.
|
|
|
|
*/
|
|
|
|
/* Interface for NSNotificationQueue for GNUStep
|
|
|
|
Copyright (C) 1996 Free Software Foundation, Inc.
|
|
|
|
|
1999-04-20 16:28:04 +00:00
|
|
|
Modified by: Richard Frith-Macdonald <richard@brainstorm.co.uk>
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
|
|
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
|
2005-05-22 03:32:16 +00:00
|
|
|
Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA.
|
1997-09-01 21:59:51 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __NSNotificationQueue_h__
|
|
|
|
#define __NSNotificationQueue_h__
|
|
|
|
|
|
|
|
#include <Foundation/NSNotification.h>
|
|
|
|
|
|
|
|
@class NSMutableArray;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Posting styles into notification queue
|
|
|
|
*/
|
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* Enumeration of possible timings for distribution of notifications handed
|
|
|
|
* to an [NSNotificationQueue]:
|
|
|
|
<example>
|
|
|
|
{
|
|
|
|
NSPostWhenIdle, // post when runloop is idle
|
|
|
|
NSPostASAP, // post soon
|
|
|
|
NSPostNow // post synchronously
|
|
|
|
}
|
|
|
|
</example>
|
|
|
|
*/
|
1997-09-01 21:59:51 +00:00
|
|
|
typedef enum {
|
1999-04-20 16:28:04 +00:00
|
|
|
NSPostWhenIdle,
|
|
|
|
NSPostASAP,
|
|
|
|
NSPostNow
|
1997-09-01 21:59:51 +00:00
|
|
|
} NSPostingStyle;
|
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* Enumeration of possible ways to combine notifications when dealing with
|
|
|
|
* [NSNotificationQueue]:
|
|
|
|
<example>
|
|
|
|
{
|
|
|
|
NSNotificationNoCoalescing, // don't combine
|
|
|
|
NSNotificationCoalescingOnName, // combine all registered with same name
|
|
|
|
NSNotificationCoalescingOnSender // combine all registered with same object
|
|
|
|
}
|
|
|
|
</example>
|
|
|
|
*/
|
1997-09-01 21:59:51 +00:00
|
|
|
typedef enum {
|
1999-04-20 16:28:04 +00:00
|
|
|
NSNotificationNoCoalescing = 0,
|
|
|
|
NSNotificationCoalescingOnName = 1,
|
|
|
|
NSNotificationCoalescingOnSender = 2,
|
1997-09-01 21:59:51 +00:00
|
|
|
} NSNotificationCoalescing;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* NSNotificationQueue class
|
|
|
|
*/
|
|
|
|
|
2004-07-29 15:30:47 +00:00
|
|
|
/**
|
|
|
|
* Structure used internally by [NSNotificationQueue].
|
|
|
|
*/
|
1997-09-01 21:59:51 +00:00
|
|
|
struct _NSNotificationQueueList;
|
|
|
|
|
|
|
|
@interface NSNotificationQueue : NSObject
|
|
|
|
{
|
1999-09-16 07:21:34 +00:00
|
|
|
NSNotificationCenter *_center;
|
|
|
|
struct _NSNotificationQueueList *_asapQueue;
|
|
|
|
struct _NSNotificationQueueList *_idleQueue;
|
|
|
|
NSZone *_zone;
|
1997-09-01 21:59:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Creating Notification Queues */
|
|
|
|
|
1999-04-20 16:28:04 +00:00
|
|
|
+ (NSNotificationQueue*) defaultQueue;
|
|
|
|
- (id) initWithNotificationCenter: (NSNotificationCenter*)notificationCenter;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
|
|
/* Inserting and Removing Notifications From a Queue */
|
|
|
|
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) dequeueNotificationsMatching: (NSNotification*)notification
|
|
|
|
coalesceMask: (unsigned int)coalesceMask;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) enqueueNotification: (NSNotification*)notification
|
|
|
|
postingStyle: (NSPostingStyle)postingStyle;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
1999-09-16 07:21:34 +00:00
|
|
|
- (void) enqueueNotification: (NSNotification*)notification
|
|
|
|
postingStyle: (NSPostingStyle)postingStyle
|
|
|
|
coalesceMask: (unsigned int)coalesceMask
|
|
|
|
forModes: (NSArray*)modes;
|
1997-09-01 21:59:51 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#endif /* __NSNotificationQueue_h__ */
|