source: releases/Pester/1.1a5/Source/PSAlarm.h@ 665

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

Updated for Pester 1.1a5 (very limited release).

Pester 1.1a4 was never released.

File size: 2.5 KB
Line 
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>
10#import "PSPropertyListSerialization.h"
11
12typedef enum {
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)
19} PSAlarmType;
20
21extern NSString * const PSAlarmTimerSetNotification;
22extern NSString * const PSAlarmTimerExpiredNotification;
23extern NSString * const PSAlarmDiedNotification;
24
25@class PSAlert, PSAlerts;
26
27@interface PSAlarm : NSObject <NSCoding, PSPropertyListSerialization> {
28 PSAlarmType alarmType; // changes during lifetime of alarm; more like a state
29 NSCalendarDate *alarmDate;
30 NSTimeInterval alarmInterval;
31 NSTimeInterval snoozeInterval;
32 NSTimeInterval timeRemaining;
33 NSString *alarmMessage;
34 NSString *invalidMessage;
35 NSTimer *timer;
36 PSAlerts *alerts;
37 BOOL repeating;
38}
39
40- (void)setInterval:(NSTimeInterval)anInterval;
41- (void)setForDateAtTime:(NSCalendarDate *)dateTime;
42- (void)setForDate:(NSDate *)date atTime:(NSDate *)time;
43- (void)setMessage:(NSString *)aMessage;
44- (void)setAlerts:(PSAlerts *)theAlerts;
45- (void)setRepeating:(BOOL)isRepeating;
46- (void)setSnoozeInterval:(NSTimeInterval)anInterval;
47
48- (NSCalendarDate *)date;
49- (NSCalendarDate *)time;
50- (NSTimeInterval)interval;
51- (NSTimeInterval)timeRemaining;
52- (NSString *)message;
53- (PSAlerts *)alerts;
54- (BOOL)isRepeating;
55- (NSTimeInterval)snoozeInterval; // most recent interval (nonzero return does not indicate alarm is snoozing or set to snooze)
56
57- (NSString *)dateString;
58- (NSString *)shortDateString;
59- (NSString *)timeString;
60- (NSString *)dateTimeString; // current or next alarm time
61- (NSString *)nextDateTimeString; // next alarm time
62- (NSString *)intervalString;
63- (NSString *)timeRemainingString;
64
65- (BOOL)isValid;
66- (NSString *)invalidMessage;
67
68- (NSAttributedString *)prettyDescription;
69
70- (NSComparisonResult)compareDate:(PSAlarm *)otherAlarm;
71- (NSComparisonResult)compareMessage:(PSAlarm *)otherAlarm;
72
73- (BOOL)setTimer; // or die, if expired and no snooze/repeat
74- (void)cancelTimer;
75
76// 1.1 only, going away when we move to keyed archiving
77- (NSDictionary *)propertyListRepresentation;
78- (id)initWithPropertyList:(NSDictionary *)dict;
79
80@end
Note: See TracBrowser for help on using the repository browser.