Wired Foundation  2.0
A foundation framework for the Wired implementation on Mac OS X
NSNotificationCenter-WIFoundation.m
00001 /* $Id$ */
00002 
00003 /*
00004  *  Copyright (c) 2003-2009 Axel Andersson
00005  *  All rights reserved.
00006  *
00007  *  Redistribution and use in source and binary forms, with or without
00008  *  modification, are permitted provided that the following conditions
00009  *  are met:
00010  *  1. Redistributions of source code must retain the above copyright
00011  *     notice, this list of conditions and the following disclaimer.
00012  *  2. Redistributions in binary form must reproduce the above copyright
00013  *     notice, this list of conditions and the following disclaimer in the
00014  *     documentation and/or other materials provided with the distribution.
00015  *
00016  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00017  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00018  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
00020  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00021  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
00023  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
00024  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
00025  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00026  * POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00029 #import <WiredFoundation/NSObject-WIFoundation.h>
00030 #import <WiredFoundation/NSNotificationCenter-WIFoundation.h>
00031 #import <WiredFoundation/NSThread-WIFoundation.h>
00032 
00033 @implementation NSNotificationCenter(WIFoundation)
00034 
00035 - (void)addObserver:(id)observer selector:(SEL)selector name:(NSString *)name {
00036         [self addObserver:observer selector:selector name:name object:NULL];
00037 }
00038 
00039 
00040 
00041 - (void)removeObserver:(id)observer name:(NSString *)name {
00042         [self removeObserver:observer name:name object:NULL];
00043 }
00044 
00045 
00046 
00047 - (void)postNotificationName:(NSString *)name {
00048         [self postNotificationName:name object:NULL];
00049 }
00050 
00051 
00052 
00053 #pragma mark -
00054 
00055 - (void)mainThreadPostNotificationName:(NSString *)name {
00056         [self mainThreadPostNotificationName:name waitUntilDone:NO];
00057 }
00058 
00059 
00060 
00061 - (void)mainThreadPostNotificationName:(NSString *)name waitUntilDone:(BOOL)waitUntilDone {
00062         [self performSelectorOnMainThread:@selector(postNotificationName:object:)
00063                                                    withObject:name
00064                                                    withObject:NULL
00065                                                 waitUntilDone:waitUntilDone];
00066 }
00067 
00068 
00069 
00070 - (void)mainThreadPostNotificationName:(NSString *)name object:(id)object {
00071         [self mainThreadPostNotificationName:name object:object waitUntilDone:NO];
00072 }
00073 
00074 
00075 
00076 - (void)mainThreadPostNotificationName:(NSString *)name object:(id)object waitUntilDone:(BOOL)waitUntilDone {
00077         [self performSelectorOnMainThread:@selector(postNotificationName:object:)
00078                                                    withObject:name
00079                                                    withObject:object
00080                                                 waitUntilDone:waitUntilDone];
00081 }
00082 
00083 
00084 
00085 - (void)mainThreadPostNotificationName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo {
00086         [self mainThreadPostNotificationName:name object:object userInfo:userInfo waitUntilDone:NO];
00087 }
00088 
00089 
00090 
00091 - (void)mainThreadPostNotificationName:(NSString *)name object:(id)object userInfo:(NSDictionary *)userInfo waitUntilDone:(BOOL)waitUntilDone {
00092         [self performSelectorOnMainThread:@selector(postNotificationName:object:userInfo:)
00093                                                    withObject:name
00094                                                    withObject:object
00095                                                    withObject:userInfo
00096                                                 waitUntilDone:waitUntilDone];
00097 }
00098 
00099 @end
 All Classes