123456789101112131415161718192021222324252627282930 |
- using PixiEditor.Extensions.CommonApi.LayoutBuilding;
- using PixiEditor.Extensions.CommonApi.LayoutBuilding.Events;
- namespace PixiEditor.Extensions.Wasm.Api.LayoutBuilding;
- public class Button : SingleChildLayoutElement
- {
- public event ElementEventHandler Click
- {
- add => AddEvent(nameof(Click), value);
- remove => RemoveEvent(nameof(Click), value);
- }
- public Button(ILayoutElement<CompiledControl> child = null, ElementEventHandler onClick = null)
- {
- Child = child;
- if (onClick != null)
- Click += onClick;
- }
- public override CompiledControl Build()
- {
- CompiledControl button = new CompiledControl(UniqueId, "Button");
- if (Child != null)
- button.AddChild(Child.Build());
- BuildPendingEvents(button);
- return button;
- }
- }
|