2025-01-01 13:38:44 -05:00
|
|
|
import { register } from 'astal';
|
|
|
|
import { Gtk, type ConstructProps } from 'astal/gtk4';
|
|
|
|
|
2025-01-14 10:12:20 -05:00
|
|
|
import astalify, { type AstalifyProps } from '../astalify';
|
2025-01-01 13:38:44 -05:00
|
|
|
|
|
|
|
|
|
|
|
type CalendarSignals = Record<`on${string}`, unknown[]> & {
|
|
|
|
onDaySelected: []
|
|
|
|
onNextMonth: []
|
|
|
|
onNextYear: []
|
|
|
|
onPrevMonth: []
|
|
|
|
onPrevYear: []
|
|
|
|
|
|
|
|
};
|
|
|
|
export type CalendarProps = ConstructProps<
|
2025-01-13 10:51:02 -05:00
|
|
|
CalendarClass,
|
|
|
|
Gtk.Calendar.ConstructorProps & AstalifyProps,
|
2025-01-01 13:38:44 -05:00
|
|
|
CalendarSignals
|
|
|
|
>;
|
|
|
|
|
|
|
|
@register({ GTypeName: 'Calendar' })
|
2025-01-13 10:51:02 -05:00
|
|
|
export class CalendarClass extends astalify(Gtk.Calendar) {
|
|
|
|
constructor({ cssName = 'calendar', ...props }: CalendarProps = {}) {
|
2025-01-14 00:09:11 -05:00
|
|
|
super({ cssName, ...props });
|
2025-01-13 10:51:02 -05:00
|
|
|
}
|
2025-01-01 13:38:44 -05:00
|
|
|
}
|
2025-01-13 10:51:02 -05:00
|
|
|
|
|
|
|
export const Calendar = (props?: CalendarProps) => new CalendarClass(props);
|