UNPKG

lazy-widgets

Version:

Typescript retained mode GUI for the HTML canvas API

36 lines (35 loc) 1.41 kB
import { Widget } from '../widgets/Widget.js'; import type { Viewport } from '../core/Viewport.js'; import type { Theme } from '../theme/Theme.js'; import type { Root } from '../core/Root.js'; /** * A class for widgets which may have children. * * Overrides the {@link Widget#inheritedTheme} accessor so that inherited themes * are propagated to children. Also provides a getter for the amount of children * that this parent has, and is an iterable which iterates each child of this * parent. Child classes are responsible for implementing both the getter and * the iterator. * * Can be constrained to a specific type of children. * * See {@link MultiParent} and {@link SingleParent} for more specialised * versions. * * @category Widget */ export declare abstract class Parent<W extends Widget = Widget> extends Widget implements Iterable<W> { /** * Get iterator for children of this parent widget. Cannot modify list of * children via this iterator; for read-only purposes only. */ abstract [Symbol.iterator](): Iterator<W>; /** Get amount of children of this parent widget. */ abstract get childCount(): number; set inheritedTheme(theme: Theme | undefined); get inheritedTheme(): Theme | undefined; attach(root: Root, viewport: Viewport, parent: Widget | null): void; detach(): void; updateActiveState(): boolean; finalizeBounds(): void; }