nixos-configs/modules/ags/gtk4/widget/subclasses/switch.ts

22 lines
575 B
TypeScript
Raw Normal View History

2025-01-01 13:38:44 -05:00
import { register } from 'astal';
import { Gtk, type ConstructProps } from 'astal/gtk4';
2025-01-13 10:51:02 -05:00
import astalify, { type AstalifyProps } from './astalify';
2025-01-01 13:38:44 -05:00
export type SwitchProps = ConstructProps<
2025-01-13 10:51:02 -05:00
SwitchClass,
Gtk.Switch.ConstructorProps & AstalifyProps
2025-01-01 13:38:44 -05:00
>;
@register({ GTypeName: 'Switch' })
2025-01-13 10:51:02 -05:00
export class SwitchClass extends astalify(Gtk.Switch) {
constructor({ cssName = 'switch', ...props }: SwitchProps = {}) {
super({ cssName, ...props });
2025-01-13 10:51:02 -05:00
}
2025-01-01 13:38:44 -05:00
getChildren() { return []; }
}
2025-01-13 10:51:02 -05:00
export const Switch = (props?: SwitchProps) => new SwitchClass(props);