Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 73 lines (61 sloc) 2.741 kb
720b0e7 @uliwitness Added licensing information to the source files.
uliwitness authored
1 //
2 // UKPushbackMessenger.h
3 // Shovel
4 //
5 // Created by Uli Kusterer on 14.10.2004.
6 // Copyright 2004 Uli Kusterer.
7 //
8 // This software is provided 'as-is', without any express or implied
9 // warranty. In no event will the authors be held liable for any damages
10 // arising from the use of this software.
11 //
12 // Permission is granted to anyone to use this software for any purpose,
13 // including commercial applications, and to alter it and redistribute it
14 // freely, subject to the following restrictions:
15 //
16 // 1. The origin of this software must not be misrepresented; you must not
17 // claim that you wrote the original software. If you use this software
18 // in a product, an acknowledgment in the product documentation would be
19 // appreciated but is not required.
20 //
21 // 2. Altered source versions must be plainly marked as such, and must not be
22 // misrepresented as being the original software.
23 //
24 // 3. This notice may not be removed or altered from any source
25 // distribution.
26 //
dc5be1c Initial check-in.
uli authored
27
28 /*
29 Sometimes you have an action that should be performed as soon as the user
30 has changed the text in a text field. However, it is an expensive action,
31 and doing it on every keypress is not desirable.
32
33 UKPushbackMessenger acts as a proxy object. Send the message to a
34 UKPushbackMessenger instance, and it will pass the message on to the object
35 connected to its "target" outlet with a one second delay. If the message is
36 sent again before the second has elapsed, the timer will be reset to 1.0
37 seconds again, and the message won't be forwarded to the target until
38 another second has elapsed without the same message having been sent again.
39
40 Thus, the time at which the message is sent may be "pushed back".
41
42 Note: To use this in IB, drag this header into IB's window to add it to
43 the NIB file's list of classes, then select the class and add the
44 desired actions to it. If you don't add the action, IB will not
45 let you hook up the action to the messenger.
46
47 Note: UKPushbackMessenger can also be used as a proxy for a delegate.
48 You can even have a messenger stand in and apply the delay to several
49 messages.
50 */
51
52 // -----------------------------------------------------------------------------
53 // Headers:
54 // -----------------------------------------------------------------------------
55
56 #import <Cocoa/Cocoa.h>
57
58 @interface UKPushbackMessenger : NSObject
59 {
60 IBOutlet id target;
61 NSMutableDictionary* timers;
62 NSMutableDictionary* pushes;
63 double delay;
64 NSTimeInterval maxPushTime; // Maximum time we may push back a message. 0 is no maximum.
65 }
66
67 -(id) initWithTarget: (id)targ;
68
69 -(void) setDelay: (NSTimeInterval)n;
70 -(void) setMaxPushTime: (NSTimeInterval)n;
71
72 @end
Something went wrong with that request. Please try again.