lazy-widgets
Version:
Typescript retained mode GUI for the HTML canvas API
34 lines (33 loc) • 1.3 kB
TypeScript
import { Widget } from '../widgets/Widget.js';
import type { Theme } from '../theme/Theme.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;
protected handleAttachment(): void;
protected handleDetachment(): void;
updateActiveState(): boolean;
finalizeBounds(): void;
}