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

24 lines
640 B
TypeScript
Raw Normal View History

2025-01-01 02:55:15 -05:00
import { register } from 'astal';
import { Gtk } from 'astal/gtk4';
2025-01-01 02:55:15 -05:00
import astalify, { type AstalifyProps, type ConstructProps } from '../astalify';
2025-01-01 02:55:15 -05:00
type ButtonSignals = Record<`on${string}`, unknown[]> & {
onClicked: []
};
export type ButtonProps = ConstructProps<
2025-01-13 10:51:02 -05:00
ButtonClass,
Gtk.Button.ConstructorProps & AstalifyProps,
2025-01-01 02:55:15 -05:00
ButtonSignals
>;
@register({ GTypeName: 'Button' })
2025-01-13 10:51:02 -05:00
export class ButtonClass extends astalify(Gtk.Button) {
constructor({ cssName = 'button', ...props }: ButtonProps = {}) {
super({ cssName, ...props });
2025-01-13 10:51:02 -05:00
}
2025-01-01 02:55:15 -05:00
}
2025-01-13 10:51:02 -05:00
export const Button = (props?: ButtonProps) => new ButtonClass(props);