import Event from "./Event"; import InteractiveObject from "../display/InteractiveObject"; declare namespace openfl.events { /** * An object dispatches a FocusEvent object when the user changes the focus * from one object in the display list to another. There are four types of * focus events: * * * `FocusEvent.FOCUS_IN` * * `FocusEvent.FOCUS_OUT` * * `FocusEvent.KEY_FOCUS_CHANGE` * * `FocusEvent.MOUSE_FOCUS_CHANGE` * */ export class FocusEvent extends Event { /** * Creates an Event object with specific information relevant to focus * events. Event objects are passed as parameters to event listeners. * * @param type The type of the event. Possible values are: * `FocusEvent.FOCUS_IN`, * `FocusEvent.FOCUS_OUT`, * `FocusEvent.KEY_FOCUS_CHANGE`, and * `FocusEvent.MOUSE_FOCUS_CHANGE`. * @param bubbles Determines whether the Event object participates in * the bubbling stage of the event flow. * @param cancelable Determines whether the Event object can be canceled. * @param relatedObject Indicates the complementary InteractiveObject * instance that is affected by the change in focus. For * example, when a `focusIn` event occurs, * `relatedObject` represents the * InteractiveObject that has lost focus. * @param shiftKey Indicates whether the Shift key modifier is * activated. * @param keyCode Indicates the code of the key pressed to trigger a * `keyFocusChange` event. * */ constructor(type: string, bubbles?: boolean, cancelable?: boolean, relatedObject?: InteractiveObject, shiftKey?: boolean, keyCode?: number); /** * Defines the value of the `type` property of a `focusIn` event object. * This event has the following properties: * * | Property | Value | * | --- | --- | * | `bubbles` | `true` | * | `cancelable` | `false`; there is no default behavior to cancel. | * | `currentTarget` | The object that is actively processing the Event object with an event listener. | * | `keyCode` | 0; applies only to `keyFocusChange` events. | * | `relatedObject` | The complementary InteractiveObject instance that is affected by the change in focus. | * | `shiftKey` | `false`; applies only to `keyFocusChange` events. | * | `target` | The InteractiveObject instance that has just received focus. The `target` is not always the object in the display list that registered the event listener. Use the `currentTarget` property to access the object in the display list that is currently processing the event. | * | `direction` | The direction from which focus was assigned. This property reports the value of the `direction` parameter of the `assignFocus()` method of the stage. If the focus changed through some other means, the value will always be `FocusDirection.NONE`. Applies only to `focusIn` events. For all other focus events the value will be `FocusDirection.NONE`. | * */ static readonly FOCUS_IN = "focusIn"; /** * Defines the value of the `type` property of a `focusOut` event object. * * This event has the following properties: * * |Property | Value || --- | --- || `bubbles` | `true` || `cancelable` | `false`; * there is no default behavior to * cancel. || `currentTarget` | The * object that is actively processing the Event object with an event * listener. || `keyCode` | 0; applies * only to `keyFocusChange` * events. || `relatedObject` | The * complementary InteractiveObject instance that is affected by the * change in * focus. || `shiftKey` | `false`; * applies only to `keyFocusChange` * events. || `target` | The * InteractiveObject instance that has just lost focus. The `target` is * not always the object in the display list that registered the event * listener. Use the `currentTarget` property to access the object in the * display list that is currently processing the event. * | * */ static readonly FOCUS_OUT = "focusOut"; /** * Defines the value of the `type` property of a `keyFocusChange` event * object. * This event has the following properties: * * | Property | Value | * | --- | --- | * | `bubbles` | `true` | * | `cancelable` | `true`; call the `preventDefault()` method to cancel default behavior. | * | `currentTarget` | The object that is actively processing the Event object with an event listener. | * | `keyCode` | The key code value of the key pressed to trigger a `keyFocusChange` event. | * | `relatedObject` | The complementary InteractiveObject instance that is affected by the change in focus. | * | `shiftKey` | `true` if the Shift key modifier is activated; `false` otherwise. | * | `target` | The InteractiveObject instance that currently has focus. The `target` is not always the object in the display list that registered the event listener. Use the `currentTarget` property to access the object in the display list that is currently processing the event. | * */ static readonly KEY_FOCUS_CHANGE = "keyFocusChange"; /** * Defines the value of the `type` property of a `mouseFocusChange` event * object. * This event has the following properties: * * | Property | Value | * | --- | --- | * | `bubbles` | `true` | * | `cancelable` | `true`; call the `preventDefault()` method to cancel default behavior. | * | `currentTarget` | The object that is actively processing the Event object with an event listener. | * | `keyCode` | 0; applies only to `keyFocusChange` events. | * | `relatedObject` | The complementary InteractiveObject instance that is affected by the change in focus. | * | `shiftKey` | `false`; applies only to `keyFocusChange` events. | * | `target` | The InteractiveObject instance that currently has focus. The `target` is not always the object in the display list that registered the event listener. Use the `currentTarget` property to access the object in the display list that is currently processing the event. | * */ static readonly MOUSE_FOCUS_CHANGE = "mouseFocusChange"; /** * The key code value of the key pressed to trigger a * `keyFocusChange` event. * */ keyCode: number; /** * A reference to the complementary InteractiveObject instance that is * affected by the change in focus. For example, when a `focusOut` * event occurs, the `relatedObject` represents the * InteractiveObject instance that has gained focus. * * The value of this property can be `null` in two * circumstances: if there no related object, or there is a related object, * but it is in a security sandbox to which you don't have access. Use the * `isRelatedObjectInaccessible()` property to determine which of * these reasons applies. * */ relatedObject: InteractiveObject; /** * Indicates whether the Shift key modifier is activated, in which case the * value is `true`. Otherwise, the value is `false`. * This property is used only if the FocusEvent is of type * `keyFocusChange`. * */ shiftKey: boolean; override clone(): FocusEvent; override toString(): string; } } export default openfl.events.FocusEvent;