1 | import { CoreTypes } from '../../core-types';
|
2 |
|
3 | /**
|
4 | * Utility module related to layout.
|
5 | */
|
6 | export namespace layout {
|
7 | /**
|
8 | * Bits that provide the actual measured size.
|
9 | */
|
10 | export const MEASURED_HEIGHT_STATE_SHIFT: number;
|
11 | export const MEASURED_SIZE_MASK: number;
|
12 | export const MEASURED_STATE_MASK: number;
|
13 | export const MEASURED_STATE_TOO_SMALL: number;
|
14 | export const UNSPECIFIED: number;
|
15 | export const EXACTLY: number;
|
16 | export const AT_MOST: number;
|
17 |
|
18 | /**
|
19 | * Gets layout mode from a given specification as string.
|
20 | * @param mode - The measure specification mode.
|
21 | */
|
22 | export function getMode(mode: number): string;
|
23 |
|
24 | /**
|
25 | * Gets measure specification mode from a given specification.
|
26 | * @param spec - The measure specification.
|
27 | */
|
28 | export function getMeasureSpecMode(spec: number): number;
|
29 |
|
30 | /**
|
31 | * Gets measure specification size from a given specification.
|
32 | * @param spec - The measure specification.
|
33 | */
|
34 | export function getMeasureSpecSize(spec: number): number;
|
35 |
|
36 | /**
|
37 | * Creates measure specification size from size and mode.
|
38 | * @param size - The size component of measure specification.
|
39 | * @param mode - The mode component of measure specification.
|
40 | */
|
41 | export function makeMeasureSpec(px: number, mode: number): number;
|
42 |
|
43 | /**
|
44 | * Gets display density for the current device.
|
45 | */
|
46 | export function getDisplayDensity(): number;
|
47 |
|
48 | /**
|
49 | * Convert device independent pixels to device pixels - dip to px.
|
50 | * @param value - The pixel to convert.
|
51 | */
|
52 | export function toDevicePixels(value: CoreTypes.dip): CoreTypes.px;
|
53 |
|
54 | /**
|
55 | * Convert device pixels to device independent pixels - px to dip.
|
56 | * @param value - The pixel to convert.
|
57 | */
|
58 | export function toDeviceIndependentPixels(value: CoreTypes.px): CoreTypes.dip;
|
59 |
|
60 | /**
|
61 | * Rounds value used in layout.
|
62 | * @param px to round.
|
63 | */
|
64 | export function round(px: CoreTypes.px): CoreTypes.px;
|
65 |
|
66 | /**
|
67 | * Converts device pixels to device independent pixes and measure the nativeView.
|
68 | * Returns the desired size of the nativeView in device pixels.
|
69 | * @param nativeView the nativeView to measure (UIView or android.view.View)
|
70 | * @param width the available width
|
71 | * @param widthMode width mode - UNSPECIFIED, EXACTLY or AT_MOST
|
72 | * @param height the available hegiht
|
73 | * @param heightMode height mode - UNSPECIFIED, EXACTLY or AT_MOST
|
74 | */
|
75 | export function measureNativeView(nativeView: any /* UIView or android.view.View */, width: number, widthMode: number, height: number, heightMode: number): { width: number; height: number };
|
76 |
|
77 | /**
|
78 | * Prints user friendly version of the measureSpec.
|
79 | * @param measureSpec the spec to print
|
80 | */
|
81 | export function measureSpecToString(measureSpec: number): string;
|
82 | }
|