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