Framework/Source/GrowlApplicationBridge.h
author Peter Hosey <hg@boredzo.org>
Sat Sep 05 01:56:08 2009 -0700 (2009-09-05)
changeset 4379 83d7e0469e8a
parent 3862 ca3c4a1845a8
child 4819 2e39ce17d1ea
child 5610 17135613f89b
permissions -rw-r--r--
Removed redundant declaration of +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:identifier:], introduced in 92e61e67284c with an additional parameter.

Ingmar, also the author of that changeset, removed that distinguishing parameter in 8f9a64ef21c3, but in the header, he only removed the parameter, not the whole method declaration, thus creating the duplicate declaration.
boredzo@1385
     1
//
boredzo@1385
     2
//  GrowlApplicationBridge.h
boredzo@1385
     3
//  Growl
boredzo@1385
     4
//
boredzo@1385
     5
//  Created by Evan Schoenberg on Wed Jun 16 2004.
ingmarstein@3040
     6
//  Copyright 2004-2006 The Growl Project. All rights reserved.
boredzo@1385
     7
//
boredzo@1385
     8
boredzo@1385
     9
/*!
boredzo@1385
    10
 *	@header		GrowlApplicationBridge.h
boredzo@1385
    11
 *	@abstract   Defines the GrowlApplicationBridge class.
boredzo@1385
    12
 *	@discussion This header defines the GrowlApplicationBridge class as well as
boredzo@1385
    13
 *	 the GROWL_PREFPANE_BUNDLE_IDENTIFIER constant.
boredzo@1385
    14
 */
boredzo@1385
    15
boredzo@1385
    16
#ifndef __GrowlApplicationBridge_h__
boredzo@1385
    17
#define __GrowlApplicationBridge_h__
boredzo@1385
    18
boredzo@1385
    19
#import <Foundation/Foundation.h>
sdwilsh@3324
    20
#import <AppKit/AppKit.h>
boredzo@1385
    21
#import "GrowlDefines.h"
boredzo@1385
    22
boredzo@1385
    23
//Forward declarations
boredzo@1385
    24
@protocol GrowlApplicationBridgeDelegate;
boredzo@1385
    25
boredzo@1385
    26
//Internal notification when the user chooses not to install (to avoid continuing to cache notifications awaiting installation)
boredzo@1385
    27
#define GROWL_USER_CHOSE_NOT_TO_INSTALL_NOTIFICATION @"User chose not to install"
boredzo@1385
    28
boredzo@1385
    29
//------------------------------------------------------------------------------
boredzo@1385
    30
#pragma mark -
boredzo@1385
    31
boredzo@1385
    32
/*!
boredzo@1385
    33
 *	@class      GrowlApplicationBridge
boredzo@1385
    34
 *	@abstract   A class used to interface with Growl.
boredzo@1385
    35
 *	@discussion This class provides a means to interface with Growl.
boredzo@1385
    36
 *
boredzo@1385
    37
 *	 Currently it provides a way to detect if Growl is installed and launch the
boredzo@1385
    38
 *	 GrowlHelperApp if it's not already running.
boredzo@1385
    39
 */
boredzo@1385
    40
@interface GrowlApplicationBridge : NSObject {
boredzo@1385
    41
boredzo@1385
    42
}
boredzo@1385
    43
boredzo@1385
    44
/*!
boredzo@1385
    45
 *	@method isGrowlInstalled
boredzo@1385
    46
 *	@abstract Detects whether Growl is installed.
boredzo@1385
    47
 *	@discussion Determines if the Growl prefpane and its helper app are installed.
boredzo@1385
    48
 *	@result Returns YES if Growl is installed, NO otherwise.
boredzo@1385
    49
 */
boredzo@1385
    50
+ (BOOL) isGrowlInstalled;
boredzo@1385
    51
boredzo@1385
    52
/*!
boredzo@1385
    53
 *	@method isGrowlRunning
boredzo@1385
    54
 *	@abstract Detects whether GrowlHelperApp is currently running.
boredzo@1385
    55
 *	@discussion Cycles through the process list to find whether GrowlHelperApp is running and returns its findings.
boredzo@1385
    56
 *	@result Returns YES if GrowlHelperApp is running, NO otherwise.
boredzo@1385
    57
 */
boredzo@1385
    58
+ (BOOL) isGrowlRunning;
boredzo@1385
    59
boredzo@1776
    60
#pragma mark -
boredzo@1776
    61
boredzo@1385
    62
/*!
boredzo@1385
    63
 *	@method setGrowlDelegate:
boredzo@1385
    64
 *	@abstract Set the object which will be responsible for providing and receiving Growl information.
boredzo@1385
    65
 *	@discussion This must be called before using GrowlApplicationBridge.
boredzo@1385
    66
 *
boredzo@1385
    67
 *	 The methods in the GrowlApplicationBridgeDelegate protocol are required
boredzo@1385
    68
 *	 and return the basic information needed to register with Growl.
boredzo@1385
    69
 *
boredzo@1385
    70
 *	 The methods in the GrowlApplicationBridgeDelegate_InformalProtocol
boredzo@1385
    71
 *	 informal protocol are individually optional.  They provide a greater
boredzo@1385
    72
 *	 degree of interaction between the application and growl such as informing
boredzo@1385
    73
 *	 the application when one of its Growl notifications is clicked by the user.
boredzo@1385
    74
 *
boredzo@1385
    75
 *	 The methods in the GrowlApplicationBridgeDelegate_Installation_InformalProtocol
boredzo@1385
    76
 *	 informal protocol are individually optional and are only applicable when
boredzo@1385
    77
 *	 using the Growl-WithInstaller.framework which allows for automated Growl
boredzo@1385
    78
 *	 installation.
boredzo@1385
    79
 *
boredzo@1385
    80
 *	 When this method is called, data will be collected from inDelegate, Growl
boredzo@1385
    81
 *	 will be launched if it is not already running, and the application will be
boredzo@1385
    82
 *	 registered with Growl.
boredzo@1385
    83
 *
boredzo@1385
    84
 *	 If using the Growl-WithInstaller framework, if Growl is already installed
boredzo@1385
    85
 *	 but this copy of the framework has an updated version of Growl, the user
boredzo@1385
    86
 *	 will be prompted to update automatically.
boredzo@1776
    87
 *
boredzo@1385
    88
 *	@param inDelegate The delegate for the GrowlApplicationBridge. It must conform to the GrowlApplicationBridgeDelegate protocol.
boredzo@1385
    89
 */
boredzo@1385
    90
+ (void) setGrowlDelegate:(NSObject<GrowlApplicationBridgeDelegate> *)inDelegate;
boredzo@1385
    91
boredzo@1385
    92
/*!
boredzo@1385
    93
 *	@method growlDelegate
boredzo@1385
    94
 *	@abstract Return the object responsible for providing and receiving Growl information.
boredzo@1385
    95
 *	@discussion See setGrowlDelegate: for details.
boredzo@1385
    96
 *	@result The Growl delegate.
boredzo@1385
    97
 */
boredzo@1385
    98
+ (NSObject<GrowlApplicationBridgeDelegate> *) growlDelegate;
boredzo@1385
    99
boredzo@1776
   100
#pragma mark -
boredzo@1776
   101
boredzo@1385
   102
/*!
boredzo@1385
   103
 *	@method notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:
boredzo@1385
   104
 *	@abstract Send a Growl notification.
boredzo@1385
   105
 *	@discussion This is the preferred means for sending a Growl notification.
boredzo@1385
   106
 *	 The notification name and at least one of the title and description are
boredzo@1776
   107
 *	 required (all three are preferred).  All other parameters may be
boredzo@1776
   108
 *	 <code>nil</code> (or 0 or NO as appropriate) to accept default values.
boredzo@1776
   109
 *
boredzo@1385
   110
 *	 If using the Growl-WithInstaller framework, if Growl is not installed the
boredzo@1385
   111
 *	 user will be prompted to install Growl. If the user cancels, this method
boredzo@1385
   112
 *	 will have no effect until the next application session, at which time when
boredzo@1385
   113
 *	 it is called the user will be prompted again. The user is also given the
boredzo@1385
   114
 *	 option to not be prompted again.  If the user does choose to install Growl,
boredzo@1385
   115
 *	 the requested notification will be displayed once Growl is installed and
boredzo@1385
   116
 *	 running.
boredzo@1776
   117
 *
boredzo@1385
   118
 *	@param title		The title of the notification displayed to the user.
boredzo@1385
   119
 *	@param description	The full description of the notification displayed to the user.
boredzo@1385
   120
 *	@param notifName	The internal name of the notification. Should be human-readable, as it will be displayed in the Growl preference pane.
boredzo@1776
   121
 *	@param iconData		<code>NSData</code> object to show with the notification as its icon. If <code>nil</code>, the application's icon will be used instead.
boredzo@1385
   122
 *	@param priority		The priority of the notification. The default value is 0; positive values are higher priority and negative values are lower priority. Not all Growl displays support priority.
boredzo@1385
   123
 *	@param isSticky		If YES, the notification will remain on screen until clicked. Not all Growl displays support sticky notifications.
boredzo@1776
   124
 *	@param clickContext	A context passed back to the Growl delegate if it implements -(void)growlNotificationWasClicked: and the notification is clicked. Not all display plugins support clicking. The clickContext must be plist-encodable (completely of <code>NSString</code>, <code>NSArray</code>, <code>NSNumber</code>, <code>NSDictionary</code>, and <code>NSData</code> types).
boredzo@1385
   125
 */
boredzo@1385
   126
+ (void) notifyWithTitle:(NSString *)title
boredzo@1385
   127
			 description:(NSString *)description
boredzo@1385
   128
		notificationName:(NSString *)notifName
ingmarstein@1905
   129
				iconData:(NSData *)iconData
boredzo@1385
   130
				priority:(signed int)priority
boredzo@1385
   131
				isSticky:(BOOL)isSticky
boredzo@1385
   132
			clickContext:(id)clickContext;
boredzo@1385
   133
ingmarstein@2289
   134
/*!
ingmarstein@2289
   135
 *	@method notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:identifier:
ingmarstein@2289
   136
 *	@abstract Send a Growl notification.
ingmarstein@2289
   137
 *	@discussion This is the preferred means for sending a Growl notification.
ingmarstein@2289
   138
 *	 The notification name and at least one of the title and description are
ingmarstein@2289
   139
 *	 required (all three are preferred).  All other parameters may be
ingmarstein@2289
   140
 *	 <code>nil</code> (or 0 or NO as appropriate) to accept default values.
ingmarstein@2289
   141
 *
ingmarstein@2289
   142
 *	 If using the Growl-WithInstaller framework, if Growl is not installed the
ingmarstein@2289
   143
 *	 user will be prompted to install Growl. If the user cancels, this method
ingmarstein@2289
   144
 *	 will have no effect until the next application session, at which time when
ingmarstein@2289
   145
 *	 it is called the user will be prompted again. The user is also given the
ingmarstein@2289
   146
 *	 option to not be prompted again.  If the user does choose to install Growl,
ingmarstein@2289
   147
 *	 the requested notification will be displayed once Growl is installed and
ingmarstein@2289
   148
 *	 running.
ingmarstein@2289
   149
 *
ingmarstein@2289
   150
 *	@param title		The title of the notification displayed to the user.
ingmarstein@2289
   151
 *	@param description	The full description of the notification displayed to the user.
ingmarstein@2289
   152
 *	@param notifName	The internal name of the notification. Should be human-readable, as it will be displayed in the Growl preference pane.
ingmarstein@2289
   153
 *	@param iconData		<code>NSData</code> object to show with the notification as its icon. If <code>nil</code>, the application's icon will be used instead.
ingmarstein@2289
   154
 *	@param priority		The priority of the notification. The default value is 0; positive values are higher priority and negative values are lower priority. Not all Growl displays support priority.
ingmarstein@2289
   155
 *	@param isSticky		If YES, the notification will remain on screen until clicked. Not all Growl displays support sticky notifications.
ingmarstein@2289
   156
 *	@param clickContext	A context passed back to the Growl delegate if it implements -(void)growlNotificationWasClicked: and the notification is clicked. Not all display plugins support clicking. The clickContext must be plist-encodable (completely of <code>NSString</code>, <code>NSArray</code>, <code>NSNumber</code>, <code>NSDictionary</code>, and <code>NSData</code> types).
ingmarstein@2289
   157
 *	@param identifier	An identifier for this notification. Notifications with equal identifiers are coalesced.
ingmarstein@2289
   158
 */
ingmarstein@2289
   159
+ (void) notifyWithTitle:(NSString *)title
ingmarstein@2289
   160
			 description:(NSString *)description
ingmarstein@2289
   161
		notificationName:(NSString *)notifName
ingmarstein@2289
   162
				iconData:(NSData *)iconData
ingmarstein@2289
   163
				priority:(signed int)priority
ingmarstein@2289
   164
				isSticky:(BOOL)isSticky
ingmarstein@2289
   165
			clickContext:(id)clickContext
ingmarstein@2289
   166
			  identifier:(NSString *)identifier;
ingmarstein@2289
   167
boredzo@1385
   168
/*!	@method	notifyWithDictionary:
boredzo@1385
   169
 *	@abstract	Notifies using a userInfo dictionary suitable for passing to
boredzo@1776
   170
 *	 <code>NSDistributedNotificationCenter</code>.
boredzo@1385
   171
 *	@param	userInfo	The dictionary to notify with.
boredzo@1385
   172
 *	@discussion	Before Growl 0.6, your application would have posted
boredzo@1776
   173
 *	 notifications using <code>NSDistributedNotificationCenter</code> by
boredzo@1776
   174
 *	 creating a userInfo dictionary with the notification data. This had the
boredzo@1776
   175
 *	 advantage of allowing you to add other data to the dictionary for programs
boredzo@1776
   176
 *	 besides Growl that might be listening.
boredzo@1776
   177
 *
boredzo@1776
   178
 *	 This method allows you to use such dictionaries without being restricted
boredzo@1776
   179
 *	 to using <code>NSDistributedNotificationCenter</code>. The keys for this dictionary
boredzo@1776
   180
 *	 can be found in GrowlDefines.h.
boredzo@1776
   181
 */
boredzo@1776
   182
+ (void) notifyWithDictionary:(NSDictionary *)userInfo;
boredzo@1776
   183
boredzo@1776
   184
#pragma mark -
boredzo@1776
   185
boredzo@1776
   186
/*!	@method	registerWithDictionary:
boredzo@1776
   187
 *	@abstract	Register your application with Growl without setting a delegate.
boredzo@1776
   188
 *	@discussion	When you call this method with a dictionary,
boredzo@1776
   189
 *	 GrowlApplicationBridge registers your application using that dictionary.
boredzo@1776
   190
 *	 If you pass <code>nil</code>, GrowlApplicationBridge will ask the delegate
boredzo@1776
   191
 *	 (if there is one) for a dictionary, and if that doesn't work, it will look
boredzo@1776
   192
 *	 in your application's bundle for an auto-discoverable plist.
boredzo@1776
   193
 *	 (XXX refer to more information on that)
boredzo@1776
   194
 *
boredzo@1776
   195
 *	 If you pass a dictionary to this method, it must include the
boredzo@1776
   196
 *	 <code>GROWL_APP_NAME</code> key, unless a delegate is set.
boredzo@1776
   197
 *
boredzo@1776
   198
 *	 This method is mainly an alternative to the delegate system introduced
boredzo@1776
   199
 *	 with Growl 0.6. Without a delegate, you cannot receive callbacks such as
boredzo@1776
   200
 *	 <code>-growlIsReady</code> (since they are sent to the delegate). You can,
boredzo@1776
   201
 *	 however, set a delegate after registering without one.
boredzo@1776
   202
 *
boredzo@1776
   203
 *	 This method was introduced in Growl.framework 0.7.
boredzo@1776
   204
 */
boredzo@1776
   205
+ (BOOL) registerWithDictionary:(NSDictionary *)regDict;
boredzo@1776
   206
boredzo@1776
   207
/*!	@method	reregisterGrowlNotifications
boredzo@1776
   208
 *	@abstract	Reregister the notifications for this application.
boredzo@1776
   209
 *	@discussion	This method does not normally need to be called.  If your
boredzo@1776
   210
 *	 application changes what notifications it is registering with Growl, call
boredzo@1776
   211
 *	 this method to have the Growl delegate's
boredzo@1776
   212
 *	 <code>-registrationDictionaryForGrowl</code> method called again and the
boredzo@1776
   213
 *	 Growl registration information updated.
boredzo@1776
   214
 *
boredzo@1776
   215
 *	 This method is now implemented using <code>-registerWithDictionary:</code>.
boredzo@1776
   216
 */
boredzo@1776
   217
+ (void) reregisterGrowlNotifications;
boredzo@1776
   218
boredzo@1776
   219
#pragma mark -
boredzo@1776
   220
boredzo@1776
   221
/*!	@method	setWillRegisterWhenGrowlIsReady:
boredzo@1776
   222
 *	@abstract	Tells GrowlApplicationBridge to register with Growl when Growl
boredzo@1776
   223
 *	 launches (or not).
boredzo@1776
   224
 *	@discussion	When Growl has started listening for notifications, it posts a
boredzo@1776
   225
 *	 <code>GROWL_IS_READY</code> notification on the Distributed Notification
boredzo@1776
   226
 *	 Center. GrowlApplicationBridge listens for this notification, using it to
boredzo@1776
   227
 *	 perform various tasks (such as calling your delegate's
boredzo@1776
   228
 *	 <code>-growlIsReady</code> method, if it has one). If this method is
boredzo@1776
   229
 *	 called with <code>YES</code>, one of those tasks will be to reregister
boredzo@1776
   230
 *	 with Growl (in the manner of <code>-reregisterGrowlNotifications</code>).
ingmarstein@1905
   231
 *
boredzo@1776
   232
 *	 This attribute is automatically set back to <code>NO</code> (the default)
boredzo@1776
   233
 *	 after every <code>GROWL_IS_READY</code> notification.
boredzo@2051
   234
 *	@param	flag	<code>YES</code> if you want GrowlApplicationBridge to register with
boredzo@2051
   235
 *	 Growl when next it is ready; <code>NO</code> if not.
boredzo@1776
   236
 */
boredzo@1776
   237
+ (void) setWillRegisterWhenGrowlIsReady:(BOOL)flag;
boredzo@1776
   238
/*!	@method	willRegisterWhenGrowlIsReady
boredzo@1776
   239
 *	@abstract	Reports whether GrowlApplicationBridge will register with Growl
boredzo@1776
   240
 *	 when Growl next launches.
boredzo@2051
   241
 *	@result	<code>YES</code> if GrowlApplicationBridge will register with Growl
boredzo@2051
   242
 *	 when next it posts GROWL_IS_READY; <code>NO</code> if not.
boredzo@1776
   243
 */
boredzo@1776
   244
+ (BOOL) willRegisterWhenGrowlIsReady;
boredzo@1776
   245
boredzo@1776
   246
#pragma mark -
boredzo@1776
   247
boredzo@1776
   248
/*!	@method	registrationDictionaryFromDelegate
boredzo@1776
   249
 *	@abstract	Asks the delegate for a registration dictionary.
boredzo@1776
   250
 *	@discussion	If no delegate is set, or if the delegate's
boredzo@1776
   251
 *	 <code>-registrationDictionaryForGrowl</code> method returns
boredzo@1776
   252
 *	 <code>nil</code>, this method returns <code>nil</code>.
boredzo@1776
   253
 *
boredzo@1776
   254
 *	 This method does not attempt to clean up the dictionary in any way - for
boredzo@1776
   255
 *	 example, if it is missing the <code>GROWL_APP_NAME</code> key, the result
boredzo@1776
   256
 *	 will be missing it too. Use <code>+[GrowlApplicationBridge
boredzo@1776
   257
 *	 registrationDictionaryByFillingInDictionary:]</code> or
boredzo@1776
   258
 *	 <code>+[GrowlApplicationBridge
boredzo@1776
   259
 *	 registrationDictionaryByFillingInDictionary:restrictToKeys:]</code> to try
boredzo@1776
   260
 *	 to fill in missing keys.
boredzo@1776
   261
 *
boredzo@1776
   262
 *	 This method was introduced in Growl.framework 0.7.
boredzo@1776
   263
 *	@result A registration dictionary.
boredzo@1776
   264
 */
boredzo@1776
   265
+ (NSDictionary *) registrationDictionaryFromDelegate;
boredzo@1776
   266
boredzo@1776
   267
/*!	@method	registrationDictionaryFromBundle:
boredzo@1776
   268
 *	@abstract	Looks in a bundle for a registration dictionary.
boredzo@1776
   269
 *	@discussion	This method looks in a bundle for an auto-discoverable
boredzo@1776
   270
 *	 registration dictionary file using <code>-[NSBundle
boredzo@1776
   271
 *	 pathForResource:ofType:]</code>. If it finds one, it loads the file using
boredzo@1776
   272
 *	 <code>+[NSDictionary dictionaryWithContentsOfFile:]</code> and returns the
boredzo@1776
   273
 *	 result.
boredzo@1776
   274
 *
boredzo@1776
   275
 *	 If you pass <code>nil</code> as the bundle, the main bundle is examined.
boredzo@1776
   276
 *
boredzo@1776
   277
 *	 This method does not attempt to clean up the dictionary in any way - for
boredzo@1776
   278
 *	 example, if it is missing the <code>GROWL_APP_NAME</code> key, the result
boredzo@1776
   279
 *	 will be missing it too. Use <code>+[GrowlApplicationBridge
boredzo@1776
   280
 *	 registrationDictionaryByFillingInDictionary:]</code> or
boredzo@1776
   281
 *	 <code>+[GrowlApplicationBridge
boredzo@1776
   282
 *	 registrationDictionaryByFillingInDictionary:restrictToKeys:]</code> to try
boredzo@1776
   283
 *	 to fill in missing keys.
boredzo@1776
   284
 *
boredzo@1776
   285
 *	 This method was introduced in Growl.framework 0.7.
boredzo@1776
   286
 *	@result A registration dictionary.
boredzo@1776
   287
 */
boredzo@1776
   288
+ (NSDictionary *) registrationDictionaryFromBundle:(NSBundle *)bundle;
boredzo@1776
   289
boredzo@1776
   290
/*!	@method	bestRegistrationDictionary
boredzo@1776
   291
 *	@abstract	Obtains a registration dictionary, filled out to the best of
boredzo@1776
   292
 *	 GrowlApplicationBridge's knowledge.
boredzo@1776
   293
 *	@discussion	This method creates a registration dictionary as best
boredzo@1776
   294
 *	 GrowlApplicationBridge knows how.
boredzo@1776
   295
 *
boredzo@1776
   296
 *	 First, GrowlApplicationBridge contacts the Growl delegate (if there is
boredzo@1776
   297
 *	 one) and gets the registration dictionary from that. If no such dictionary
boredzo@1776
   298
 *	 was obtained, GrowlApplicationBridge looks in your application's main
boredzo@1776
   299
 *	 bundle for an auto-discoverable registration dictionary file. If that
boredzo@1776
   300
 *	 doesn't exist either, this method returns <code>nil</code>.
boredzo@1776
   301
 *
boredzo@1776
   302
 *	 Second, GrowlApplicationBridge calls
boredzo@1776
   303
 *	 <code>+registrationDictionaryByFillingInDictionary:</code> with whatever
boredzo@1776
   304
 *	 dictionary was obtained. The result of that method is the result of this
boredzo@1776
   305
 *	 method.
boredzo@1776
   306
 *
boredzo@1776
   307
 *	 GrowlApplicationBridge uses this method when you call
boredzo@1776
   308
 *	 <code>+setGrowlDelegate:</code>, or when you call
boredzo@1776
   309
 *	 <code>+registerWithDictionary:</code> with <code>nil</code>.
boredzo@1776
   310
 *
boredzo@1776
   311
 *	 This method was introduced in Growl.framework 0.7.
boredzo@1776
   312
 *	@result	A registration dictionary.
boredzo@1776
   313
 */
boredzo@1776
   314
+ (NSDictionary *) bestRegistrationDictionary;
boredzo@1776
   315
boredzo@1776
   316
#pragma mark -
boredzo@1776
   317
boredzo@1776
   318
/*!	@method	registrationDictionaryByFillingInDictionary:
boredzo@1776
   319
 *	@abstract	Tries to fill in missing keys in a registration dictionary.
boredzo@1776
   320
 *	@discussion	This method examines the passed-in dictionary for missing keys,
boredzo@1776
   321
 *	 and tries to work out correct values for them. As of 0.7, it uses:
boredzo@1776
   322
 *
boredzo@1776
   323
 *	 Key							             Value
boredzo@1776
   324
 *	 ---							             -----
boredzo@1776
   325
 *	 <code>GROWL_APP_NAME</code>                 <code>CFBundleExecutableName</code>
boredzo@1776
   326
 *	 <code>GROWL_APP_ICON</code>                 The icon of the application.
boredzo@1776
   327
 *	 <code>GROWL_APP_LOCATION</code>             The location of the application.
boredzo@1776
   328
 *	 <code>GROWL_NOTIFICATIONS_DEFAULT</code>    <code>GROWL_NOTIFICATIONS_ALL</code>
boredzo@1776
   329
 *
boredzo@1776
   330
 *	 Keys are only filled in if missing; if a key is present in the dictionary,
boredzo@1776
   331
 *	 its value will not be changed.
boredzo@1776
   332
 *
boredzo@1776
   333
 *	 This method was introduced in Growl.framework 0.7.
boredzo@1776
   334
 *	@param	regDict	The dictionary to fill in.
boredzo@1776
   335
 *	@result	The dictionary with the keys filled in. This is an autoreleased
boredzo@1776
   336
 *	 copy of <code>regDict</code>.
boredzo@1776
   337
 */
boredzo@1776
   338
+ (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict;
boredzo@1776
   339
/*!	@method	registrationDictionaryByFillingInDictionary:restrictToKeys:
boredzo@1776
   340
 *	@abstract	Tries to fill in missing keys in a registration dictionary.
boredzo@1776
   341
 *	@discussion	This method examines the passed-in dictionary for missing keys,
boredzo@1776
   342
 *	 and tries to work out correct values for them. As of 0.7, it uses:
boredzo@1776
   343
 *
boredzo@1776
   344
 *	 Key							             Value
boredzo@1776
   345
 *	 ---							             -----
boredzo@1776
   346
 *	 <code>GROWL_APP_NAME</code>                 <code>CFBundleExecutableName</code>
boredzo@1776
   347
 *	 <code>GROWL_APP_ICON</code>                 The icon of the application.
boredzo@1776
   348
 *	 <code>GROWL_APP_LOCATION</code>             The location of the application.
boredzo@1776
   349
 *	 <code>GROWL_NOTIFICATIONS_DEFAULT</code>    <code>GROWL_NOTIFICATIONS_ALL</code>
boredzo@1776
   350
 *
boredzo@1776
   351
 *	 Only those keys that are listed in <code>keys</code> will be filled in.
boredzo@1776
   352
 *	 Other missing keys are ignored. Also, keys are only filled in if missing;
boredzo@1776
   353
 *	 if a key is present in the dictionary, its value will not be changed.
boredzo@1776
   354
 *
boredzo@1776
   355
 *	 This method was introduced in Growl.framework 0.7.
boredzo@1776
   356
 *	@param	regDict	The dictionary to fill in.
boredzo@1776
   357
 *	@param	keys	The keys to fill in. If <code>nil</code>, any missing keys are filled in.
boredzo@1776
   358
 *	@result	The dictionary with the keys filled in. This is an autoreleased
boredzo@1776
   359
 *	 copy of <code>regDict</code>.
boredzo@1776
   360
 */
boredzo@1776
   361
+ (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict restrictToKeys:(NSSet *)keys;
boredzo@1385
   362
boredzo@3238
   363
/*!	@brief	Tries to fill in missing keys in a notification dictionary.
boredzo@3238
   364
 *	@param	notifDict	The dictionary to fill in.
boredzo@3238
   365
 *	@return	The dictionary with the keys filled in. This will be a separate instance from \a notifDict.
boredzo@3238
   366
 *	@discussion	This function examines the \a notifDict for missing keys, and 
boredzo@3238
   367
 *	 tries to get them from the last known registration dictionary. As of 1.1, 
boredzo@3238
   368
 *	 the keys that it will look for are:
boredzo@3238
   369
 *
boredzo@3238
   370
 *	 \li <code>GROWL_APP_NAME</code>
boredzo@3238
   371
 *	 \li <code>GROWL_APP_ICON</code>
boredzo@3238
   372
 *
boredzo@3238
   373
 *	@since Growl.framework 1.1
boredzo@3238
   374
 */
boredzo@3238
   375
+ (NSDictionary *) notificationDictionaryByFillingInDictionary:(NSDictionary *)regDict;
boredzo@3238
   376
ingmarstein@2368
   377
+ (NSDictionary *) frameworkInfoDictionary;
boredzo@1385
   378
@end
boredzo@1385
   379
boredzo@1385
   380
//------------------------------------------------------------------------------
boredzo@1385
   381
#pragma mark -
boredzo@1385
   382
boredzo@1385
   383
/*!
boredzo@1385
   384
 *	@protocol GrowlApplicationBridgeDelegate
boredzo@1385
   385
 *	@abstract Required protocol for the Growl delegate.
boredzo@1776
   386
 *	@discussion The methods in this protocol are required and are called
boredzo@1776
   387
 *	 automatically as needed by GrowlApplicationBridge. See
boredzo@1776
   388
 *	 <code>+[GrowlApplicationBridge setGrowlDelegate:]</code>.
boredzo@1776
   389
 *	 See also <code>GrowlApplicationBridgeDelegate_InformalProtocol</code>.
boredzo@1385
   390
 */
boredzo@1385
   391
boredzo@1385
   392
@protocol GrowlApplicationBridgeDelegate
boredzo@1385
   393
boredzo@1776
   394
// -registrationDictionaryForGrowl has moved to the informal protocol as of 0.7.
boredzo@1718
   395
boredzo@1718
   396
@end
boredzo@1718
   397
boredzo@1718
   398
//------------------------------------------------------------------------------
boredzo@1718
   399
#pragma mark -
boredzo@1718
   400
boredzo@1718
   401
/*!
boredzo@1718
   402
 *	@category NSObject(GrowlApplicationBridgeDelegate_InformalProtocol)
boredzo@1718
   403
 *	@abstract Methods which may be optionally implemented by the GrowlDelegate.
boredzo@1718
   404
 *	@discussion The methods in this informal protocol will only be called if implemented by the delegate.
boredzo@1718
   405
 */
boredzo@1718
   406
@interface NSObject (GrowlApplicationBridgeDelegate_InformalProtocol)
boredzo@1718
   407
boredzo@1385
   408
/*!
boredzo@1385
   409
 *	@method registrationDictionaryForGrowl
boredzo@1385
   410
 *	@abstract Return the dictionary used to register this application with Growl.
boredzo@1385
   411
 *	@discussion The returned dictionary gives Growl the complete list of
boredzo@1385
   412
 *	 notifications this application will ever send, and it also specifies which
boredzo@1385
   413
 *	 notifications should be enabled by default.  Each is specified by an array
boredzo@1776
   414
 *	 of <code>NSString</code> objects.
boredzo@1385
   415
 *
boredzo@1385
   416
 *	 For most applications, these two arrays can be the same (if all sent
boredzo@1385
   417
 *	 notifications should be displayed by default).
ingmarstein@1905
   418
 *
boredzo@1776
   419
 *	 The <code>NSString</code> objects of these arrays will correspond to the
boredzo@1776
   420
 *	 <code>notificationName:</code> parameter passed in
boredzo@1776
   421
 *	 <code>+[GrowlApplicationBridge
boredzo@1776
   422
 *	 notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:]</code> calls.
ingmarstein@1905
   423
 *
evands@2920
   424
 *	 The dictionary should have the required key object pairs:
boredzo@1776
   425
 *	 key: GROWL_NOTIFICATIONS_ALL		object: <code>NSArray</code> of <code>NSString</code> objects
boredzo@1776
   426
 *	 key: GROWL_NOTIFICATIONS_DEFAULT	object: <code>NSArray</code> of <code>NSString</code> objects
boredzo@1718
   427
 *
evands@2920
   428
 *   The dictionary may have the following key object pairs:
evands@2920
   429
 *   key: GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES	object: <code>NSDictionary</code> of key: notification name		object: human-readable notification name
evands@2920
   430
 *
boredzo@1718
   431
 *	 You do not need to implement this method if you have an auto-discoverable
boredzo@1718
   432
 *	 plist file in your app bundle. (XXX refer to more information on that)
boredzo@1776
   433
 *
boredzo@1776
   434
 *	@result The <code>NSDictionary</code> to use for registration.
boredzo@1385
   435
 */
boredzo@1385
   436
- (NSDictionary *) registrationDictionaryForGrowl;
boredzo@1385
   437
boredzo@1385
   438
/*!
boredzo@1385
   439
 *	@method applicationNameForGrowl
boredzo@1385
   440
 *	@abstract Return the name of this application which will be used for Growl bookkeeping.
boredzo@1385
   441
 *	@discussion This name is used both internally and in the Growl preferences.
boredzo@1385
   442
 *
boredzo@1385
   443
 *	 This should remain stable between different versions and incarnations of
boredzo@1385
   444
 *	 your application.
boredzo@1385
   445
 *	 For example, "SurfWriter" is a good app name, whereas "SurfWriter 2.0" and
boredzo@1385
   446
 *	 "SurfWriter Lite" are not.
boredzo@1718
   447
 *
boredzo@1718
   448
 *	 You do not need to implement this method if you are providing the
boredzo@1718
   449
 *	 application name elsewhere, meaning in an auto-discoverable plist file in
boredzo@1718
   450
 *	 your app bundle (XXX refer to more information on that) or in the result
boredzo@1718
   451
 *	 of -registrationDictionaryForGrowl.
boredzo@1718
   452
 *
boredzo@1385
   453
 *	@result The name of the application using Growl.
boredzo@1385
   454
 */
boredzo@1385
   455
- (NSString *) applicationNameForGrowl;
boredzo@1385
   456
boredzo@1385
   457
/*!
boredzo@2239
   458
 *	@method applicationIconForGrowl
boredzo@2239
   459
 *	@abstract Return the <code>NSImage</code> to treat as the application icon.
boredzo@2239
   460
 *	@discussion The delegate may optionally return an <code>NSImage</code>
ingmarstein@2269
   461
 *	 object to use as the application icon. If this method is not implemented,
boredzo@2239
   462
 *	 {{{-applicationIconDataForGrowl}}} is tried. If that method is not
boredzo@2239
   463
 *	 implemented, the application's own icon is used. Neither method is
boredzo@2239
   464
 *	 generally needed.
boredzo@2239
   465
 *	@result The <code>NSImage</code> to treat as the application icon.
boredzo@2239
   466
 */
boredzo@2239
   467
- (NSImage *) applicationIconForGrowl;
boredzo@2239
   468
boredzo@2239
   469
/*!
boredzo@1385
   470
 *	@method applicationIconDataForGrowl
boredzo@1776
   471
 *	@abstract Return the <code>NSData</code> to treat as the application icon.
boredzo@1776
   472
 *	@discussion The delegate may optionally return an <code>NSData</code>
boredzo@1776
   473
 *	 object to use as the application icon; if this is not implemented, the
boredzo@1776
   474
 *	 application's own icon is used.  This is not generally needed.
boredzo@1776
   475
 *	@result The <code>NSData</code> to treat as the application icon.
boredzo@3862
   476
 *	@deprecated In version 1.1, in favor of {{{-applicationIconForGrowl}}}.
boredzo@1385
   477
 */
boredzo@1385
   478
- (NSData *) applicationIconDataForGrowl;
boredzo@1385
   479
boredzo@1385
   480
/*!
boredzo@1385
   481
 *	@method growlIsReady
boredzo@1385
   482
 *	@abstract Informs the delegate that Growl has launched.
boredzo@1385
   483
 *	@discussion Informs the delegate that Growl (specifically, the
ingmarstein@2335
   484
 *	 GrowlHelperApp) was launched successfully. The application can take actions
ingmarstein@2335
   485
 *   with the knowledge that Growl is installed and functional.
boredzo@1385
   486
 */
boredzo@1385
   487
- (void) growlIsReady;
boredzo@1385
   488
boredzo@1385
   489
/*!
boredzo@1385
   490
 *	@method growlNotificationWasClicked:
boredzo@1385
   491
 *	@abstract Informs the delegate that a Growl notification was clicked.
boredzo@1385
   492
 *	@discussion Informs the delegate that a Growl notification was clicked.  It
boredzo@1776
   493
 *	 is only sent for notifications sent with a non-<code>nil</code>
boredzo@1776
   494
 *	 clickContext, so if you want to receive a message when a notification is
boredzo@1776
   495
 *	 clicked, clickContext must not be <code>nil</code> when calling
boredzo@1776
   496
 *	 <code>+[GrowlApplicationBridge notifyWithTitle: description:notificationName:iconData:priority:isSticky:clickContext:]</code>.
boredzo@1385
   497
 *	@param clickContext The clickContext passed when displaying the notification originally via +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:].
boredzo@1385
   498
 */
boredzo@1385
   499
- (void) growlNotificationWasClicked:(id)clickContext;
boredzo@1385
   500
ingmarstein@1893
   501
/*!
ingmarstein@1893
   502
 *	@method growlNotificationTimedOut:
ingmarstein@1893
   503
 *	@abstract Informs the delegate that a Growl notification timed out.
ingmarstein@1893
   504
 *	@discussion Informs the delegate that a Growl notification timed out. It
ingmarstein@1893
   505
 *	 is only sent for notifications sent with a non-<code>nil</code>
ingmarstein@1893
   506
 *	 clickContext, so if you want to receive a message when a notification is
ingmarstein@1893
   507
 *	 clicked, clickContext must not be <code>nil</code> when calling
ingmarstein@1893
   508
 *	 <code>+[GrowlApplicationBridge notifyWithTitle: description:notificationName:iconData:priority:isSticky:clickContext:]</code>.
ingmarstein@1893
   509
 *	@param clickContext The clickContext passed when displaying the notification originally via +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:].
ingmarstein@1893
   510
 */
ingmarstein@1893
   511
- (void) growlNotificationTimedOut:(id)clickContext;
ingmarstein@1893
   512
boredzo@1385
   513
@end
boredzo@1385
   514
boredzo@1385
   515
#pragma mark -
boredzo@1385
   516
/*!
boredzo@1385
   517
 *	@category NSObject(GrowlApplicationBridgeDelegate_Installation_InformalProtocol)
boredzo@1385
   518
 *	@abstract Methods which may be optionally implemented by the Growl delegate when used with Growl-WithInstaller.framework.
boredzo@1385
   519
 *	@discussion The methods in this informal protocol will only be called if
boredzo@1385
   520
 *	 implemented by the delegate.  They allow greater control of the information
boredzo@1385
   521
 *	 presented to the user when installing or upgrading Growl from within your
boredzo@1385
   522
 *	 application when using Growl-WithInstaller.framework.
boredzo@1385
   523
 */
boredzo@1385
   524
@interface NSObject (GrowlApplicationBridgeDelegate_Installation_InformalProtocol)
boredzo@1385
   525
boredzo@1385
   526
/*!
boredzo@1385
   527
 *	@method growlInstallationWindowTitle
boredzo@1385
   528
 *	@abstract Return the title of the installation window.
boredzo@1385
   529
 *	@discussion If not implemented, Growl will use a default, localized title.
boredzo@1385
   530
 *	@result An NSString object to use as the title.
boredzo@1385
   531
 */
boredzo@1385
   532
- (NSString *)growlInstallationWindowTitle;
boredzo@1385
   533
boredzo@1385
   534
/*!
boredzo@1385
   535
 *	@method growlUpdateWindowTitle
boredzo@1385
   536
 *	@abstract Return the title of the upgrade window.
boredzo@1385
   537
 *	@discussion If not implemented, Growl will use a default, localized title.
boredzo@1385
   538
 *	@result An NSString object to use as the title.
boredzo@1385
   539
 */
boredzo@1385
   540
- (NSString *)growlUpdateWindowTitle;
boredzo@1385
   541
boredzo@1385
   542
/*!
boredzo@1385
   543
 *	@method growlInstallationInformation
boredzo@1385
   544
 *	@abstract Return the information to display when installing.
boredzo@1385
   545
 *	@discussion This information may be as long or short as desired (the window
boredzo@1385
   546
 *	 will be sized to fit it).  It will be displayed to the user as an
boredzo@1385
   547
 *	 explanation of what Growl is and what it can do in your application.  It
boredzo@1385
   548
 *	 should probably note that no download is required to install.
boredzo@1776
   549
 *
boredzo@1385
   550
 *	 If this is not implemented, Growl will use a default, localized explanation.
boredzo@1385
   551
 *	@result An NSAttributedString object to display.
boredzo@1385
   552
 */
boredzo@1385
   553
- (NSAttributedString *)growlInstallationInformation;
ingmarstein@1905
   554
boredzo@1385
   555
/*!
boredzo@1385
   556
 *	@method growlUpdateInformation
boredzo@1385
   557
 *	@abstract Return the information to display when upgrading.
boredzo@1385
   558
 *	@discussion This information may be as long or short as desired (the window
boredzo@1385
   559
 *	 will be sized to fit it).  It will be displayed to the user as an
boredzo@1385
   560
 *	 explanation that an updated version of Growl is included in your
boredzo@1385
   561
 *	 application and no download is required.
boredzo@1776
   562
 *
boredzo@1385
   563
 *	 If this is not implemented, Growl will use a default, localized explanation.
boredzo@1385
   564
 *	@result An NSAttributedString object to display.
boredzo@1385
   565
 */
boredzo@1385
   566
- (NSAttributedString *)growlUpdateInformation;
boredzo@1385
   567
boredzo@1385
   568
@end
boredzo@1385
   569
boredzo@1385
   570
//private
boredzo@1385
   571
@interface GrowlApplicationBridge (GrowlInstallationPrompt_private)
boredzo@1385
   572
+ (void) _userChoseNotToInstallGrowl;
boredzo@1385
   573
@end
boredzo@1385
   574
boredzo@1385
   575
#endif /* __GrowlApplicationBridge_h__ */