1 | /*-------------------------------------------------------------------------------------------------------*\ |
---|
2 | | Adium, Copyright (C) 2001-2005, Adam Iser (adamiser@mac.com | http://www.adiumx.com) | |
---|
3 | \---------------------------------------------------------------------------------------------------------/ |
---|
4 | | This program is free software; you can redistribute it and/or modify it under the terms of the GNU |
---|
5 | | General Public License as published by the Free Software Foundation; either version 2 of the License, |
---|
6 | | or (at your option) any later version. |
---|
7 | | |
---|
8 | | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even |
---|
9 | | the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
10 | | Public License for more details. |
---|
11 | | |
---|
12 | | You should have received a copy of the GNU General Public License along with this program; if not, |
---|
13 | | write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
14 | \------------------------------------------------------------------------------------------------------ */ |
---|
15 | |
---|
16 | /*! |
---|
17 | * @class AIAutoScrollView |
---|
18 | * @brief <tt>NSScrollView</tt> subclass which adds automatic scrolling, scroll bar hiding, and other features. |
---|
19 | * |
---|
20 | * This <tt>NSScrollView</tt> subclass adds: |
---|
21 | * - Methods to scroll to the top and bottom of the view |
---|
22 | * - Key press forwarding to the document view |
---|
23 | * - Focus ring drawing for views such as NSTextView which do not normally draw a focus ring |
---|
24 | */ |
---|
25 | @interface AIAutoScrollView : NSScrollView { |
---|
26 | NSRect oldDocumentFrame; |
---|
27 | |
---|
28 | BOOL autoScrollToBottom; |
---|
29 | BOOL inAutoScrollToBottom; |
---|
30 | |
---|
31 | BOOL passKeysToDocumentView; |
---|
32 | |
---|
33 | BOOL alwaysDrawFocusRingIfFocused; |
---|
34 | BOOL shouldDrawFocusRing; |
---|
35 | NSResponder *lastResp; |
---|
36 | } |
---|
37 | |
---|
38 | /*! |
---|
39 | * @brief Set if the scrollView should scroll to the bottom when new content is added |
---|
40 | * |
---|
41 | * If YES, the scrollView will scroll to the bottom when new content is added (i.e. when the frame of the document view increases), bringing the new data into visibility. Automatic scrolling will only occur if the view was scrolled to the bottom previously; it will not force a scroll to the bottom if the user has scrolled up in the scrollView. The default value is NO. |
---|
42 | * @param inValue YES if the scrollView should automatically scroll as described above. |
---|
43 | */ |
---|
44 | - (void)setAutoScrollToBottom:(BOOL)inValue; |
---|
45 | |
---|
46 | /*! |
---|
47 | * @brief Scroll to the top of the documentView. |
---|
48 | * |
---|
49 | * Scroll to the top of the documentView. |
---|
50 | */ |
---|
51 | - (void)scrollToTop; |
---|
52 | |
---|
53 | /*! |
---|
54 | * @brief Scroll to the bottom of the documentView. |
---|
55 | * |
---|
56 | * Scroll to the bottom of the documentView. |
---|
57 | */ |
---|
58 | - (void)scrollToBottom; |
---|
59 | |
---|
60 | /*! |
---|
61 | * @brief Set if keys unrelated to scrolling should be passed to the scrollView's documentView |
---|
62 | * |
---|
63 | * If YES, keyDown: events which the scrollView receives and which do not cause it to scroll will be passed to the documentView for handling. Defualts to NO. |
---|
64 | * @param inValue YES if keys should be passed to the document view. |
---|
65 | */ |
---|
66 | - (void)setPassKeysToDocumentView:(BOOL)inValue; |
---|
67 | |
---|
68 | /*! |
---|
69 | setAlwaysDrawFocusRingIfFocused: |
---|
70 | * @brief Set if a focus ring should be drawn in all cases when the view has focus. |
---|
71 | * |
---|
72 | * Some contained views, such as NSTextFields, do not draw focus rings. This is generally correct, but it may be desirable to draw a focus ring around such views anyways. If <b>inFlag</b> is YES, a focus ring will be drawn when the view has focus regardless of its type. The default value is NO. |
---|
73 | * @param inFlag YES if the focus ring should always be drawn |
---|
74 | */ |
---|
75 | - (void)setAlwaysDrawFocusRingIfFocused:(BOOL)inFlag; |
---|
76 | |
---|
77 | @end |
---|