UNPKG

2.7 kBTypeScriptView Raw
1import { CoreTypes } from '../../core-types';
2import { View, CustomLayoutView } from '../core/view';
3import { Property } from '../core/properties';
4
5/**
6 * Base class for all views that supports children positioning.
7 */
8export class LayoutBase extends CustomLayoutView {
9 /**
10 * Returns the number of children in this Layout.
11 */
12 getChildrenCount(): number;
13
14 /**
15 * Returns the view at the specified position.
16 * @param index The position at which to get the child from.
17 */
18 getChildAt(index: number): View;
19
20 /**
21 * Returns the position of the child view
22 * @param child The child view that we are looking for.
23 */
24 getChildIndex(child: View): number;
25
26 /**
27 * Adds the view to children array.
28 * @param view The view to be added to the end of the children array.
29 */
30 addChild(view: View): void;
31
32 /**
33 * Inserts the view to children array at the specified index.
34 * @param view The view to be added to the end of the children array.
35 * @param atIndex The insertion index.
36 */
37 insertChild(child: View, atIndex: number): void;
38
39 /**
40 * Removes the specified view from the children array.
41 * @param view The view to remove from the children array.
42 */
43 removeChild(view: View): void;
44
45 /**
46 * Removes all views in this layout.
47 */
48 removeChildren(): void;
49
50 /**
51 * INTERNAL. Used by the layout system.
52 */
53 _registerLayoutChild(child: View): void;
54
55 /**
56 * INTERNAL. Used by the layout system.
57 */
58 _unregisterLayoutChild(child: View): void;
59
60 /**
61 * Calls the callback for each child that should be laid out.
62 * @param callback The callback
63 */
64 eachLayoutChild(callback: (child: View, isLast: boolean) => void): void;
65
66 /**
67 * Gets or sets padding style property.
68 */
69 padding: string | CoreTypes.LengthType;
70
71 /**
72 * Specify the bottom padding of this layout.
73 */
74 paddingBottom: CoreTypes.LengthType;
75
76 /**
77 * Specify the left padding of this layout.
78 */
79 paddingLeft: CoreTypes.LengthType;
80
81 /**
82 * Specify the right padding of this layout.
83 */
84 paddingRight: CoreTypes.LengthType;
85
86 /**
87 * Specify the top padding of this layout.
88 */
89 paddingTop: CoreTypes.LengthType;
90
91 /**
92 * Gets or sets a value indicating whether to clip the content of this layout.
93 */
94 clipToBounds: boolean;
95
96 /**
97 * Gets or sets a value indicating whether touch event should pass through to a parent view of the
98 * layout container in case an interactive child view did not handle it.
99 * Default value of this property is false. This does not affect the appearance of the view.
100 */
101 isPassThroughParentEnabled: boolean;
102}
103
104export const clipToBoundsProperty: Property<LayoutBase, boolean>;
105export const isPassThroughParentEnabledProperty: Property<LayoutBase, boolean>;