source: trunk/Cocoa/Pester/Source/PSDockBounceAlert.m@ 580

Last change on this file since 580 was 516, checked in by Nicholas Riley, 16 years ago

Restore Dock bouncing using Notification Manager; should be more reliable now.

File size: 1.3 KB
RevLine 
[34]1//
2// PSDockBounceAlert.m
3// Pester
4//
5// Created by Nicholas Riley on Sat Oct 26 2002.
6// Copyright (c) 2002 Nicholas Riley. All rights reserved.
7//
8
9#import <AppKit/AppKit.h>
10#import "PSDockBounceAlert.h"
[516]11#import "PSAlarmAlertController.h"
[34]12
[516]13#include <Carbon/Carbon.h>
14
[34]15static PSDockBounceAlert *PSDockBounceAlertShared;
[516]16static NMRec nmr;
[34]17
18@implementation PSDockBounceAlert
19
20+ (PSAlert *)alert;
21{
[516]22 if (PSDockBounceAlertShared == nil) {
[34]23 PSDockBounceAlertShared = [[PSDockBounceAlert alloc] init];
[516]24
25 [[NSNotificationCenter defaultCenter] addObserver: PSDockBounceAlertShared selector: @selector(_stopBouncing) name: PSAlarmAlertStopNotification object: nil];
26
27 bzero(&nmr, sizeof(nmr));
28 nmr.nmMark = 1;
29 nmr.qType = nmType;
30 }
31
[34]32 return PSDockBounceAlertShared;
33}
34
[516]35- (void)_stopBouncing;
[40]36{
[516]37 if ((void *)nmr.nmRefCon != self)
38 return;
39
40 nmr.nmRefCon = 0;
41 NMRemove(&nmr);
[40]42}
43
[34]44- (void)triggerForAlarm:(PSAlarm *)alarm;
45{
[516]46 if (nmr.nmRefCon == 0) {
47 nmr.nmRefCon = (long)self;
48 NMInstall(&nmr);
49 }
50
[53]51 [self completedForAlarm: alarm];
[34]52}
53
[53]54- (NSAttributedString *)actionDescription;
55{
[516]56 return [@"Bounce Dock icon" small];
[53]57}
58
59#pragma mark property list serialization (Pester 1.1)
60
61- (id)initWithPropertyList:(NSDictionary *)dict;
62{
63 [self release];
64 return [[PSDockBounceAlert alert] retain];
65}
66
[34]67@end
Note: See TracBrowser for help on using the repository browser.