source: trunk/Cocoa/Pester/Source/PSAlarm.h@ 74

Last change on this file since 74 was 61, checked in by Nicholas Riley, 22 years ago

Pester 1.1b1.

PSPowerManager: Fixed delegate method selectors to better reflect what
is going on (Apple's docs in IOKit Fundamentals help with this; the
kIOMessage*Sleep constants are really poorly named).

VERSION: Updated for 1.1b1.

PSSpeechAlert.h: Fixed company name.

PSAlert.[hm]: Added -prepareForAlarm: to support PSWakeAlert.

PSTimer.[hm]: Replacement for NSTimer that works properly across
sleep/wake cycles and will schedule wake timers.

PSAlerts.[hm]: Added -prepareForAlarm: to support PSWakeAlert.

Read Me.rtfd: Updated for 1.1b1.

PSAlarm.[hm]: Added -setWakeUp:, invoke -[PSAlerts prepareForAlarm],
replaced alarm timer NSTimer with PSTimer.

PSApplication.[hm]: Replaced dock update timer NSTimer with PSTimer.
Uncovered some issues, need to fix later. Enable alarm discard for
beta release.

PSWakeAlert.[hm]: Shared alert implementation for wakeup. Doesn't do
anything at trigger time, but uses new preparation interface to work
at alarm set time (should work for repeating alarms too, but I didn't
bother to test...)

PSAlarmSetController.m: Added support for PSWakeAlert. Save default
alert information on quit. Removed debug statements on hide/unhide;
it works fine regardless of whether the app is explicitly hidden or
the window hides itself.

PSAlarms.m: PSTimer support - invoke +[PSTimer setUp] to initialize
timer list.

File size: 2.5 KB
RevLine 
[24]1//
2// PSAlarm.h
3// Pester
4//
5// Created by Nicholas Riley on Wed Oct 09 2002.
6// Copyright (c) 2002 Nicholas Riley. All rights reserved.
7//
8
9#import <Foundation/Foundation.h>
[53]10#import "PSPropertyListSerialization.h"
[24]11
12typedef enum {
[53]13 PSAlarmInvalid, // incorrectly specified
14 PSAlarmInterval, // interval specified (possibly repeating)
15 PSAlarmDate, // date specified
16 PSAlarmSet, // pending, timer set
17 PSAlarmSnooze, // expired alarm with snooze interval set (possibly repeating)
18 PSAlarmExpired // expired alarm (possibly repeating)
[24]19} PSAlarmType;
20
[26]21extern NSString * const PSAlarmTimerSetNotification;
22extern NSString * const PSAlarmTimerExpiredNotification;
[53]23extern NSString * const PSAlarmDiedNotification;
[26]24
[61]25@class PSAlert, PSAlerts, PSTimer;
[34]26
[53]27@interface PSAlarm : NSObject <NSCoding, PSPropertyListSerialization> {
28 PSAlarmType alarmType; // changes during lifetime of alarm; more like a state
[24]29 NSCalendarDate *alarmDate;
30 NSTimeInterval alarmInterval;
[53]31 NSTimeInterval snoozeInterval;
32 NSTimeInterval timeRemaining;
[24]33 NSString *alarmMessage;
34 NSString *invalidMessage;
[61]35 PSTimer *timer;
[53]36 PSAlerts *alerts;
37 BOOL repeating;
[24]38}
39
40- (void)setInterval:(NSTimeInterval)anInterval;
[26]41- (void)setForDateAtTime:(NSCalendarDate *)dateTime;
[24]42- (void)setForDate:(NSDate *)date atTime:(NSDate *)time;
43- (void)setMessage:(NSString *)aMessage;
[53]44- (void)setAlerts:(PSAlerts *)theAlerts;
45- (void)setRepeating:(BOOL)isRepeating;
46- (void)setSnoozeInterval:(NSTimeInterval)anInterval;
[61]47- (void)setWakeUp:(BOOL)doWake;
[24]48
[28]49- (NSCalendarDate *)date;
[51]50- (NSCalendarDate *)time;
[24]51- (NSTimeInterval)interval;
[53]52- (NSTimeInterval)timeRemaining;
[26]53- (NSString *)message;
[53]54- (PSAlerts *)alerts;
55- (BOOL)isRepeating;
56- (NSTimeInterval)snoozeInterval; // most recent interval (nonzero return does not indicate alarm is snoozing or set to snooze)
[24]57
[43]58- (NSString *)dateString;
[28]59- (NSString *)shortDateString;
60- (NSString *)timeString;
[53]61- (NSString *)dateTimeString; // current or next alarm time
62- (NSString *)nextDateTimeString; // next alarm time
63- (NSString *)intervalString;
[28]64- (NSString *)timeRemainingString;
65
[24]66- (BOOL)isValid;
67- (NSString *)invalidMessage;
68
[53]69- (NSAttributedString *)prettyDescription;
70
[51]71- (NSComparisonResult)compareDate:(PSAlarm *)otherAlarm;
72- (NSComparisonResult)compareMessage:(PSAlarm *)otherAlarm;
[28]73
[53]74- (BOOL)setTimer; // or die, if expired and no snooze/repeat
[51]75- (void)cancelTimer;
[26]76
[53]77// 1.1 only, going away when we move to keyed archiving
78- (NSDictionary *)propertyListRepresentation;
79- (id)initWithPropertyList:(NSDictionary *)dict;
80
[24]81@end
Note: See TracBrowser for help on using the repository browser.