declare namespace Titanium { namespace UI { /** * Base event for class Titanium.UI.Switch */ interface SwitchBaseEvent extends Ti.Event { /** * Source object that fired the event. */ source: Titanium.UI.Switch; } /** * Fired when the device detects a click against the view. */ interface Switch_click_Event extends SwitchBaseEvent { /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a double click against the view. */ interface Switch_dblclick_Event extends SwitchBaseEvent { /** * Returns `true` if the double click passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a double tap against the view. */ interface Switch_doubletap_Event extends SwitchBaseEvent { /** * Returns `true` if the double tap passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the view element gains focus. */ interface Switch_focus_Event extends SwitchBaseEvent { } /** * Fired when a hardware key is pressed in the view. */ interface Switch_keypressed_Event extends SwitchBaseEvent { /** * The code for the physical key that was pressed. For more details, see [KeyEvent](https://developer.android.com/reference/android/view/KeyEvent.html). This API is experimental and subject to change. */ keyCode: number; } /** * Fired when the device detects a long click. */ interface Switch_longclick_Event extends SwitchBaseEvent { } /** * Fired when the device detects a long press. */ interface Switch_longpress_Event extends SwitchBaseEvent { /** * Returns `true` if the long press passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a pinch gesture. */ interface Switch_pinch_Event extends SwitchBaseEvent { /** * The average distance between each of the pointers forming the gesture in progress through * the focal point. */ currentSpan: number; /** * The average X distance between each of the pointers forming the gesture in progress through * the focal point. */ currentSpanX: number; /** * The average Y distance between each of the pointers forming the gesture in progress through * the focal point. */ currentSpanY: number; /** * The X coordinate of the current gesture's focal point. */ focusX: number; /** * The Y coordinate of the current gesture's focal point. */ focusY: number; /** * Returns `true` if a scale gesture is in progress, `false` otherwise. */ inProgress: boolean; /** * The previous average distance between each of the pointers forming the gesture in progress through * the focal point. */ previousSpan: number; /** * The previous average X distance between each of the pointers forming the gesture in progress through * the focal point. */ previousSpanX: number; /** * The previous average Y distance between each of the pointers forming the gesture in progress through * the focal point. */ previousSpanY: number; /** * The scale factor relative to the points of the two touches in screen coordinates. */ scale: number; /** * The event time of the current event being processed. */ time: number; /** * The time difference in milliseconds between the previous accepted scaling event and the * current scaling event. */ timeDelta: number; /** * The velocity of the pinch in scale factor per second. */ velocity: number; } /** * Fired when a layout cycle is finished. */ interface Switch_postlayout_Event extends SwitchBaseEvent { } /** * Fired when the device detects a single tap against the view. */ interface Switch_singletap_Event extends SwitchBaseEvent { /** * Returns `true` if the single tap passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a swipe gesture against the view. */ interface Switch_swipe_Event extends SwitchBaseEvent { /** * Direction of the swipe--either 'left', 'right', 'up', or 'down'. */ direction: string; /** * Returns `true` if the swipe passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event's endpoint from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event's endpoint from the `source` view's coordinate system. */ y: number; } /** * Fired when a touch event is interrupted by the device. */ interface Switch_touchcancel_Event extends SwitchBaseEvent { /** * A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is * being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. * Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. */ altitudeAngle: number; /** * The x value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewX: number; /** * The y value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewY: number; /** * The current force value of the touch event. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. */ force: number; /** * Maximum possible value of the force property. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ maximumPossibleForce: number; /** * Returns `true` if the touch passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * The current size of the touch area. Note: This property is only available on some Android devices. */ size: number; /** * The time (in seconds) when the touch was used in correlation with the system start up. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ timestamp: number; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when a touch event is completed. */ interface Switch_touchend_Event extends SwitchBaseEvent { /** * A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is * being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. * Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. */ altitudeAngle: number; /** * The x value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewX: number; /** * The y value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Penciland are 9.1 or later. */ azimuthUnitVectorInViewY: number; /** * The current force value of the touch event. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. */ force: number; /** * Maximum possible value of the force property. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ maximumPossibleForce: number; /** * Returns `true` if the touch passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * The current size of the touch area. Note: This property is only available on some Android devices. */ size: number; /** * The time (in seconds) when the touch was used in correlation with the system start up. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ timestamp: number; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired as soon as the device detects movement of a touch. */ interface Switch_touchmove_Event extends SwitchBaseEvent { /** * A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is * being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. * Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. */ altitudeAngle: number; /** * The x value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewX: number; /** * The y value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewY: number; /** * The current force value of the touch event. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. */ force: number; /** * Maximum possible value of the force property. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ maximumPossibleForce: number; /** * Returns `true` if the touch passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * The current size of the touch area. Note: This property is only available on some Android devices. */ size: number; /** * The time (in seconds) when the touch was used in correlation with the system start up. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ timestamp: number; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired as soon as the device detects a touch gesture. */ interface Switch_touchstart_Event extends SwitchBaseEvent { /** * A value which indicates the stylus angle on the screen. If the stylus is perpendicular to the screen or no stylus is * being used, the value will be Pi/2. If the stylus is parallel to the screen, the value will be 0. * Note: This property is only available for iOS devices that support 3D-Touch and are 9.1 or later. */ altitudeAngle: number; /** * The x value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewX: number; /** * The y value of the unit vector that points in the direction of the azimuth of the stylus. * Note: This property is only available for iOS devices that support the Apple Pencil and are 9.1 or later. */ azimuthUnitVectorInViewY: number; /** * The current force value of the touch event. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later and on some Android devices. */ force: number; /** * Maximum possible value of the force property. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ maximumPossibleForce: number; /** * Returns `true` if the touch passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * The current size of the touch area. Note: This property is only available on some Android devices. */ size: number; /** * The time (in seconds) when the touch was used in correlation with the system start up. * Note: This property is only available for iOS devices that support 3D-Touch and run 9.0 or later. */ timestamp: number; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the device detects a two-finger tap against the view. */ interface Switch_twofingertap_Event extends SwitchBaseEvent { /** * Returns `true` if the tap passed through an overlapping window belonging to another app. * This is a security feature to protect an app from "tapjacking", where a malicious app can use a * system overlay to intercept touch events in your app or to trick the end-user to tap on UI * in your app intended for the overlay. */ obscured: boolean; /** * X coordinate of the event from the `source` view's coordinate system. */ x: number; /** * Y coordinate of the event from the `source` view's coordinate system. */ y: number; } /** * Fired when the switch value changes. */ interface Switch_change_Event extends SwitchBaseEvent { /** * New value of the switch. */ value: boolean; } interface SwitchEventMap extends ProxyEventMap { change: Switch_change_Event; click: Switch_click_Event; dblclick: Switch_dblclick_Event; doubletap: Switch_doubletap_Event; focus: Switch_focus_Event; keypressed: Switch_keypressed_Event; longclick: Switch_longclick_Event; longpress: Switch_longpress_Event; pinch: Switch_pinch_Event; postlayout: Switch_postlayout_Event; singletap: Switch_singletap_Event; swipe: Switch_swipe_Event; touchcancel: Switch_touchcancel_Event; touchend: Switch_touchend_Event; touchmove: Switch_touchmove_Event; touchstart: Switch_touchstart_Event; twofingertap: Switch_twofingertap_Event; } /** * An on/off switch control. */ class Switch extends Titanium.UI.View { /** * Determines if there is animation when the switch value changes. */ animated: boolean; /** * Array of this view's child views. */ readonly children: never; /** * Color to use for switch text, as a color name or hex triplet. */ color: string | Titanium.UI.Color; /** * Determines whether the switch is enabled. */ enabled: boolean; /** * Font to use for the switch text. */ font: Font; /** * The color used to tint the appearance of the switch when it is turned on. */ onTintColor: string | Titanium.UI.Color; /** * Style of the switch. */ style: number; /** * Horizontal text alignment of the switch title. */ textAlign: string | number; /** * The color used to tint the appearance of the thumb. */ thumbTintColor: string | Titanium.UI.Color; /** * The color used to tint the outline of the switch when it is turned off. */ tintColor: string | Titanium.UI.Color; /** * Text to display next to the switch, when the checkbox or slider style is in use. */ title: string; /** * Text to display on the switch in its "off" state, when the toggle button style is in use. */ titleOff: string; /** * Text to display on the switch in its "on" state, when the toggle button style is in use. */ titleOn: string; /** * Indicates whether the switch has been turned on or off by the user. May also be set * programmatically. */ value: boolean; /** * Vertical alignment for the text field. */ verticalAlign: number | string; /** * Adds a child to this view's hierarchy. */ add: never; /** * Adds the specified callback as an event listener for the named event. */ addEventListener(name: K, callback: (this: Titanium.UI.Switch, event: SwitchEventMap[K]) => void): void; /** * Adds the specified callback as an event listener for the named event. */ addEventListener(name: string, callback: (param0: Titanium.Event) => void): void; /** * Fires a synthesized event to any registered listeners. */ fireEvent(name: K, event?: SwitchEventMap[K]): void; /** * Fires a synthesized event to any registered listeners. */ fireEvent(name: string, event?: any): void; /** * Removes a child view from this view's hierarchy. */ remove: never; /** * Removes all child views from this view's hierarchy. */ removeAllChildren: never; /** * Removes the specified callback as an event listener for the named event. */ removeEventListener(name: K, callback: (this: Titanium.UI.Switch, event: SwitchEventMap[K]) => void): void; /** * Removes the specified callback as an event listener for the named event. */ removeEventListener(name: string, callback: (param0: Titanium.Event) => void): void; /** * Replaces a view at the specified position in the [children](Titanium.UI.View.children) array. */ replaceAt: never; } } }