root/Trunk/AIUtilities.framework/Versions/A/Headers/AISendingTextView.h @ 2

Revision 2, 3.1 KB (checked in by jon, 16 years ago)

Initial commit of skeletal project.

Line 
1//
2//  AISendingTextView.h
3//  Adium
4//
5//  Created by Adam Iser on Thu Mar 25 2004.
6//  Copyright (c) 2004-2005 The Adium Team. All rights reserved.
7//
8
9#import <AIUtilities/AITextViewWithPlaceholder.h>
10
11/*!
12 * @class AISendingTextView
13 * @brief NSTextView which fixes issues with return and enter under high system load
14 *
15 * <p>When the system is busy and things slow down, characters are grouped, but keys are not.  This causes problems, since using the regular method of catching returns will not work.  The first return will come in, the current text will be sent, and then the other returns will come in (and nothing will happen since there's no text in the text view).  After the returns are processed, THEN the rest of the text will be inserted as a clump into the text view.  To the user this looks like their return was 'missed', since it gets inserted into the text view, and doesn't trigger a send.</p>
16 * <p>This fix watches for returns in the insertText method.  However, since it's impossible to distinguish a return from an enter by the characters inserted (both insert /r, 10), it also watches and remembers the keys being pressed with interpretKeyEvents... When insertText sees a /r, it checks to see what key was pressed to generate that /r, and makes a decision to send or not.  Since the sending occurs from within insertText, the returns are processed in the correct order with the text, and the problem is illiminated.</p>
17 */
18
19@interface AISendingTextView : AITextViewWithPlaceholder {
20    NSMutableArray      *returnArray;
21    BOOL                        insertingText;
22
23    id                          target;
24    SEL                         selector;
25    BOOL                        sendingEnabled;
26
27    BOOL                        sendOnEnter;
28    BOOL                        sendOnReturn;
29       
30        BOOL                    nextIsReturn;
31    BOOL                        nextIsEnter;
32    BOOL                        optionPressedWithNext;
33}
34
35/*!
36 * @brief Set if send keys trigger the set action
37 *
38 * Set if send keys trigger the set action. If YES, we will invoke action on target when a send key is pressed.
39 * @param inBool YES if sending is enabled
40 * @see setTarget:action:
41 */
42- (void)setSendingEnabled:(BOOL)inBool;
43
44/*!
45 * @brief Return whether sending keys are enabled
46 *
47 * Returns whether sending keys will trigger the send action to be sent to the target
48 */
49- (BOOL)isSendingEnabled;
50
51/*!
52 * @brief Set if Return triggers a send
53 *
54 * Set if Return triggers a send. If it does, the send will be performed instead of a newline being inserted.
55 * @param inBool YES if Return triggers a send.
56 */
57- (void)setSendOnReturn:(BOOL)inBool;
58
59/*!
60 * @brief Set if Enter triggers a send
61 *
62 * Set if Enter triggers a send. If it does, the send will be performed instead of a newline being inserted.
63 * @param inBool YES if Enter triggers a send.
64 */
65- (void)setSendOnEnter:(BOOL)inBool;
66
67/*!
68 * @brief Set the target and action to message when a send occurs
69 *
70 * When a send occurs, <b>inTarget</b> will be sent <b>inSelector</b>, which should take one argument which will be the sender.
71 * @param inTarget The target
72 * @param inSelector The selector to perform on <b>inTarget</b>
73 */
74- (void)setTarget:(id)inTarget action:(SEL)inSelector;
75
76@end
77
78@interface AISendingTextView (PRIVATE_AISendingTextViewAndSubclasses)
79- (IBAction)sendContent:(id)sender;
80@end
Note: See TracBrowser for help on using the browser.