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

28 lines
706 B
TypeScript
Raw Normal View History

2025-01-01 02:55:15 -05:00
import { register } from 'astal';
import { Astal, 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
export type BoxProps = ConstructProps<
2025-01-13 10:51:02 -05:00
BoxClass,
Astal.Box.ConstructorProps & AstalifyProps
2025-01-01 02:55:15 -05:00
>;
@register({ GTypeName: 'Box' })
2025-01-13 10:51:02 -05:00
export class BoxClass extends astalify(Astal.Box) {
constructor({ cssName = 'box', ...props }: BoxProps = {}) {
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
getChildren(self: BoxClass) {
2025-01-01 02:55:15 -05:00
return self.get_children();
}
2025-01-13 10:51:02 -05:00
setChildren(self: BoxClass, children: Gtk.Widget[]) {
return self.set_children(children);
2025-01-01 02:55:15 -05:00
}
}
2025-01-13 10:51:02 -05:00
export const Box = (props?: BoxProps) => new BoxClass(props);