1 /* 2 NSScrollView.h 3 4 A view that allows you to scroll a document view that's too big to display 5 entirely on a window. 6 7 Copyright (C) 1996-2015 Free Software Foundation, Inc. 8 9 Author: Ovidiu Predescu <ovidiu@net-community.com> 10 Date: July 1997 11 12 This file is part of the GNUstep GUI Library. 13 14 This library is free software; you can redistribute it and/or 15 modify it under the terms of the GNU Lesser General Public 16 License as published by the Free Software Foundation; either 17 version 2 of the License, or (at your option) any later version. 18 19 This library is distributed in the hope that it will be useful, 20 but WITHOUT ANY WARRANTY; without even the implied warranty of 21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 Lesser General Public License for more details. 23 24 You should have received a copy of the GNU Lesser General Public 25 License along with this library; see the file COPYING.LIB. 26 If not, see <http://www.gnu.org/licenses/> or write to the 27 Free Software Foundation, 51 Franklin Street, Fifth Floor, 28 Boston, MA 02110-1301, USA. 29 */ 30 31 #ifndef _GNUstep_H_NSScrollView 32 #define _GNUstep_H_NSScrollView 33 #import <GNUstepBase/GSVersionMacros.h> 34 35 #import <AppKit/NSView.h> 36 37 enum 38 { 39 NSScrollElasticityAutomatic = 0, 40 NSScrollElasticityNone = 1, 41 NSScrollElasticityAllowed = 2 42 }; 43 typedef NSInteger NSScrollElasticity; 44 45 46 @class NSClipView; 47 @class NSRulerView; 48 @class NSColor; 49 @class NSCursor; 50 @class NSScroller; 51 52 @interface NSScrollView : NSView 53 { 54 NSClipView *_contentView; 55 NSScroller *_horizScroller; 56 NSScroller *_vertScroller; 57 NSRulerView *_horizRuler; 58 NSRulerView *_vertRuler; 59 NSClipView *_headerClipView; 60 NSView *_cornerView; 61 float _hLineScroll; 62 float _hPageScroll; 63 float _vLineScroll; 64 float _vPageScroll; 65 NSBorderType _borderType; 66 BOOL _hasHorizScroller; 67 BOOL _hasVertScroller; 68 BOOL _hasHorizRuler; 69 BOOL _hasVertRuler; 70 BOOL _scrollsDynamically; 71 BOOL _rulersVisible; 72 BOOL _knobMoved; 73 BOOL _hasHeaderView; 74 BOOL _hasCornerView; 75 BOOL _autohidesScrollers; 76 NSScrollElasticity _horizScrollElasticity; 77 NSScrollElasticity _vertScrollElasticity; 78 } 79 80 /* Calculating layout */ 81 + (NSSize)contentSizeForFrameSize:(NSSize)frameSize 82 hasHorizontalScroller:(BOOL)hFlag 83 hasVerticalScroller:(BOOL)vFlag 84 borderType:(NSBorderType)borderType; 85 + (NSSize)frameSizeForContentSize:(NSSize)contentSize 86 hasHorizontalScroller:(BOOL)hFlag 87 hasVerticalScroller:(BOOL)vFlag 88 borderType:(NSBorderType)borderType; 89 90 /* Determining component sizes */ 91 - (NSSize)contentSize; 92 - (NSRect)documentVisibleRect; 93 94 /* Managing graphic attributes */ 95 - (void)setBackgroundColor:(NSColor*)aColor; 96 - (NSColor*)backgroundColor; 97 - (void)setBorderType:(NSBorderType)borderType; 98 - (NSBorderType)borderType; 99 100 /* Managing the scrolled views */ 101 - (void)setContentView:(NSClipView*)aView; 102 - (NSClipView*)contentView; 103 - (void)setDocumentView:(NSView*)aView; 104 - (id)documentView; 105 - (void)setDocumentCursor:(NSCursor*)aCursor; 106 - (NSCursor*)documentCursor; 107 108 /* Managing scrollers */ 109 - (void)setHorizontalScroller:(NSScroller*)aScroller; 110 - (NSScroller*)horizontalScroller; 111 - (void)setHasHorizontalScroller:(BOOL)flag; 112 - (BOOL)hasHorizontalScroller; 113 - (void)setVerticalScroller:(NSScroller*)aScroller; 114 - (NSScroller*)verticalScroller; 115 - (void)setHasVerticalScroller:(BOOL)flag; 116 - (BOOL)hasVerticalScroller; 117 118 /* Managing rulers */ 119 + (void)setRulerViewClass:(Class)aClass; 120 + (Class)rulerViewClass; 121 - (void)setHasHorizontalRuler:(BOOL)flag; 122 - (BOOL)hasHorizontalRuler; 123 - (void)setHorizontalRulerView:(NSRulerView*)aRulerView; 124 - (NSRulerView*)horizontalRulerView; 125 - (void)setHasVerticalRuler:(BOOL)flag; 126 - (BOOL)hasVerticalRuler; 127 - (void)setVerticalRulerView:(NSRulerView*)aRulerView; 128 - (NSRulerView*)verticalRulerView; 129 - (void)setRulersVisible:(BOOL)flag; 130 - (BOOL)rulersVisible; 131 132 /* Setting scrolling behavior */ 133 - (void)setLineScroll:(CGFloat)aFloat; 134 - (CGFloat)lineScroll; 135 - (void)setPageScroll:(CGFloat)aFloat; 136 - (CGFloat)pageScroll; 137 - (void)setScrollsDynamically:(BOOL)flag; 138 - (BOOL)scrollsDynamically; 139 #if OS_API_VERSION(GS_API_MACOSX, GS_API_LATEST) 140 - (CGFloat) horizontalLineScroll; 141 - (CGFloat) horizontalPageScroll; 142 - (CGFloat) verticalLineScroll; 143 - (CGFloat) verticalPageScroll; 144 - (void) setHorizontalLineScroll: (CGFloat)aFloat; 145 - (void) setHorizontalPageScroll: (CGFloat)aFloat; 146 - (void) setVerticalLineScroll: (CGFloat)aFloat; 147 - (void) setVerticalPageScroll: (CGFloat)aFloat; 148 /* Setting the background drawing */ 149 - (void)setDrawsBackground:(BOOL)flag; 150 - (BOOL)drawsBackground; 151 #endif 152 #if OS_API_VERSION(MAC_OS_X_VERSION_10_3, GS_API_LATEST) 153 - (BOOL)autohidesScrollers; 154 - (void)setAutohidesScrollers:(BOOL)flag; 155 #endif 156 #if OS_API_VERSION(MAC_OS_X_VERSION_10_7, GS_API_LATEST) 157 - (NSScrollElasticity)horizontalScrollElasticity; 158 - (void)setHorizontalScrollElasticity:(NSScrollElasticity)value; 159 - (NSScrollElasticity)verticalScrollElasticity; 160 - (void)setVerticalScrollElasticity:(NSScrollElasticity)value; 161 #endif 162 #if OS_API_VERSION(MAC_OS_X_VERSION_10_8, GS_API_LATEST) 163 - (BOOL)allowsMagnification; 164 - (void)setAllowsMagnification:(BOOL)m; 165 #endif 166 167 #if OS_API_VERSION(MAC_OS_X_VERSION_10_10, GS_API_LATEST) 168 #if GS_HAS_DECLARED_PROPERTIES 169 @property BOOL automaticallyAdjustsContentInsets; 170 @property NSEdgeInsets contentInsets; 171 @property NSEdgeInsets scrollerInsets; 172 #else 173 - (BOOL)automaticallyAdjustsContentInsets; 174 - (void)setAutomaticallyAdjustsContentInsets: (BOOL)adjusts; 175 176 - (NSEdgeInsets)contentInsets; 177 - (void)setContentInsets:(NSEdgeInsets)edgeInsets; 178 179 - (NSEdgeInsets)scrollerInsets; 180 - (void)setScrollerInsets:(NSEdgeInsets)insets; 181 #endif 182 #endif 183 184 /* Updating display after scrolling */ 185 - (void)reflectScrolledClipView:(NSClipView*)aClipView; 186 187 /* Arranging components */ 188 - (void)tile; 189 190 @end 191 192 #endif /* _GNUstep_H_NSScrollView */ 193