import { Container } from 'pixi.js'; import { Signal } from 'typed-signals'; import { type GetViewSettings } from './utils/helpers/view'; import { ButtonEvent } from './utils/HelpTypes'; /** * Container based component that switches visibility of a given containers by any of the interaction events. * * By default it switches on press. * * Can be used for creating buttons, tabs, radio buttons, checkboxes etc. * @example * // switch on onPress * const switch = new Swich([`switch_off.png`, `switch_on.png`]); * * // switch on hover * const button = new Swich([`button_default.png`, `button_hover.png`], ['onHover', 'onOut']); * * button.events.onPress.connect(() => console.log('button pressed')); */ export declare class Switcher extends Container { protected _triggerEvents: Set; /** Container that holds all the content of the component. */ innerView: Container; /** The id of the visible(active) view. */ protected _active: number | undefined; /** Fired when active view changes. */ onChange: Signal<(state: number | boolean) => void>; /** * @param {Array} views - Array of views or textures that will be switching. * @param triggerEvents - Button events, to switch views (can be one event or an array of events). * @param activeViewID - The id of the view, visible by default. */ constructor(views?: Array, triggerEvents?: ButtonEvent | ButtonEvent[], activeViewID?: number); protected setInteractionEvents(): void; protected handleEvents(event: ButtonEvent): void; /** Returns the active view. */ get activeView(): Container | undefined; /** Sets the list of instances for switching. */ set views(views: Array); /** Returns all the switchable views */ get views(): Array; /** * Adds view instance to a switching list. * @param view */ add(view: GetViewSettings): void; /** * Removes view instance from a switching list by id. * @param id - id of the view to remove. */ remove(id: number): void; /** * Sets a list of events that will make a switcher switch to the next view. * @param {ButtonEvent | ButtonEvent[]} triggerEvents - Button events, * to switch views (can be one event or an array of events). */ set triggerEvents(triggerEvents: ButtonEvent | ButtonEvent[]); /** Returns a list of events that will make a switcher switch to the next view. */ get triggerEvents(): ButtonEvent[]; /** * Show a view by id, or to next one by order, if no ID provided. * @param {number} id - optional id of the view to show. If not set, will switch to the next view. */ switch(id?: number): void; /** * Switches a view to a given one without triggering the onChange event. * @param {number} id - optional id of the view to show. If not set, will switch to the next view. */ forceSwitch(id?: number): void; /** Returns the id of the next view in order. Or undefined, if order is empty. */ protected get nextActive(): number | undefined; /** Sets the id of the visible(active) view and shows to it. */ set active(id: number); /** Gets the id of the visible(active) view. */ get active(): number | undefined; } //# sourceMappingURL=Switcher.d.ts.map