1 | import { ContentView } from '../content-view';
|
2 | import { Property } from '../core/properties';
|
3 | import { EventData } from '../../data/observable';
|
4 | import { CoreTypes } from '../../core-types';
|
5 |
|
6 | /**
|
7 | * Represents a scrollable area that can have content that is larger than its bounds.
|
8 | */
|
9 | export class ScrollView extends ContentView {
|
10 | /**
|
11 | * String value used when hooking to scroll event.
|
12 | */
|
13 | public static scrollEvent: string;
|
14 |
|
15 | /**
|
16 | * Gets or sets a value indicating whether scroll is enabled.
|
17 | */
|
18 | isScrollEnabled: boolean;
|
19 |
|
20 | /**
|
21 | * Gets a value that contains the vertical offset of the scrolled content.
|
22 | */
|
23 | verticalOffset: number;
|
24 |
|
25 | /**
|
26 | * Gets a value that contains the horizontal offset of the scrolled content.
|
27 | */
|
28 | horizontalOffset: number;
|
29 |
|
30 | /**
|
31 | * Gets the maximum value for the verticalOffset.
|
32 | */
|
33 | scrollableHeight: number;
|
34 |
|
35 | /**
|
36 | * Gets the maximum value for the horizontalOffset.
|
37 | */
|
38 | scrollableWidth: number;
|
39 |
|
40 | /**
|
41 | * Toggles scrollbar indicator visibility
|
42 | */
|
43 | scrollBarIndicatorVisible: boolean;
|
44 |
|
45 | /**
|
46 | * Scrolls the content the specified vertical offset position.
|
47 | * @param value The offset value
|
48 | * @param animated true for animated scroll, false for immediate scroll.
|
49 | */
|
50 | scrollToVerticalOffset(value: number, animated: boolean);
|
51 |
|
52 | /**
|
53 | * Scrolls the content the specified horizontal offset position.
|
54 | * @param value The offset value
|
55 | * @param animated true for animated scroll, false for immediate scroll.
|
56 | */
|
57 | scrollToHorizontalOffset(value: number, animated: boolean);
|
58 |
|
59 | /**
|
60 | * Gets or sets direction in which the content can be scrolled.
|
61 | */
|
62 | orientation: CoreTypes.OrientationType;
|
63 |
|
64 | /**
|
65 | * Adds a listener for the specified event name.
|
66 | *
|
67 | * @param eventName The name of the event.
|
68 | * @param callback The event listener to add. Will be called when an event of
|
69 | * the given name is raised.
|
70 | * @param thisArg An optional parameter which, when set, will be bound as the
|
71 | * `this` context when the callback is called. Falsy values will be not be
|
72 | * bound.
|
73 | */
|
74 | on(eventName: string, callback: (data: EventData) => void, thisArg?: any): void;
|
75 |
|
76 | /**
|
77 | * Raised when a scroll event occurs.
|
78 | */
|
79 | on(event: 'scroll', callback: (args: ScrollEventData) => void, thisArg?: any): void;
|
80 |
|
81 | _onOrientationChanged(): void;
|
82 | }
|
83 |
|
84 | export interface ScrollEventData extends EventData {
|
85 | scrollX: number;
|
86 | scrollY: number;
|
87 | }
|
88 |
|
89 | export const orientationProperty: Property<ScrollView, CoreTypes.OrientationType>;
|