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

29 lines
783 B
TypeScript
Raw Normal View History

2025-01-01 02:55:15 -05:00
import { register } from 'astal';
import { Astal, type ConstructProps, Gtk } from 'astal/gtk4';
2025-01-01 02:55:15 -05:00
2025-01-13 10:51:02 -05:00
import astalify, { type AstalifyProps } 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 = {}) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
super({ cssName, ...props as any });
}
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);