summaryrefslogtreecommitdiff
path: root/core/gjs/src/widgets.ts
blob: 0a71d8b075e16f3f912e97e7f0df4ca61a1f48b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* eslint-disable max-len */
import { Astal, Gtk } from "./imports.js"
import astalify, { type ConstructProps, type Widget } from "./astalify.js"

export { astalify, ConstructProps }

// Box
export type Box = Widget<Astal.Box>
export const Box = astalify<typeof Astal.Box, BoxProps, "Box">(Astal.Box)
export type BoxProps = ConstructProps<Astal.Box, Astal.Box.ConstructorProps>

// Button
export type Button = Widget<Astal.Button>
export const Button = astalify<typeof Astal.Button, ButtonProps, "Button">(Astal.Button)
export type ButtonProps = ConstructProps<Astal.Button, Astal.Button.ConstructorProps, {
    onClicked: []
    onClick: [event: Astal.ClickEvent]
    onClickRelease: [event: Astal.ClickEvent]
    onHover: [event: Astal.HoverEvent]
    onHoverLost: [event: Astal.HoverEvent]
    onScroll: [event: Astal.ScrollEvent]
}>

// CenterBox
export type CenterBox = Widget<Astal.CenterBox>
export const CenterBox = astalify<typeof Astal.CenterBox, CenterBoxProps, "CenterBox">(Astal.CenterBox)
export type CenterBoxProps = ConstructProps<Astal.CenterBox, Astal.CenterBox.ConstructorProps>

// CircularProgress
export type CircularProgress = Widget<Astal.CircularProgress>
export const CircularProgress = astalify<typeof Astal.CircularProgress, CircularProgressProps, "CircularProgress">(Astal.CircularProgress)
export type CircularProgressProps = ConstructProps<Astal.CircularProgress, Astal.CircularProgress.ConstructorProps>


// DrawingArea
export type DrawingArea = Widget<Gtk.DrawingArea>
export const DrawingArea = astalify<typeof Gtk.DrawingArea, DrawingAreaProps, "DrawingArea">(Gtk.DrawingArea)
export type DrawingAreaProps = ConstructProps<Gtk.DrawingArea, Gtk.DrawingArea.ConstructorProps, {
    onDraw: [cr: any] // TODO: cairo types
}>

// Entry
export type Entry = Widget<Gtk.Entry>
export const Entry = astalify<typeof Gtk.Entry, EntryProps, "Entry">(Gtk.Entry)
export type EntryProps = ConstructProps<Gtk.Entry, Gtk.Entry.ConstructorProps, {
    onChanged: []
    onActivate: []
}>

// EventBox
export type EventBox = Widget<Astal.EventBox>
export const EventBox = astalify<typeof Astal.EventBox, EventBoxProps, "EventBox">(Astal.EventBox)
export type EventBoxProps = ConstructProps<Astal.EventBox, Astal.EventBox.ConstructorProps, {
    onClick: [event: Astal.ClickEvent]
    onClickRelease: [event: Astal.ClickEvent]
    onHover: [event: Astal.HoverEvent]
    onHoverLost: [event: Astal.HoverEvent]
    onScroll: [event: Astal.ScrollEvent]
}>

// TODO: Fixed
// TODO: FlowBox

// Icon
export type Icon = Widget<Astal.Icon>
export const Icon = astalify<typeof Astal.Icon, IconProps, "Icon">(Astal.Icon)
export type IconProps = ConstructProps<Astal.Icon, Astal.Icon.ConstructorProps>

// Label
export type Label = Widget<Astal.Label>
export const Label = astalify<typeof Astal.Label, LabelProps, "Label">(Astal.Label)
export type LabelProps = ConstructProps<Astal.Label, Astal.Label.ConstructorProps>

// LevelBar
export type LevelBar = Widget<Astal.LevelBar>
export const LevelBar = astalify<typeof Astal.LevelBar, LevelBarProps, "LevelBar">(Astal.LevelBar)
export type LevelBarProps = ConstructProps<Astal.LevelBar, Astal.LevelBar.ConstructorProps>

// TODO: ListBox

// Overlay
export type Overlay = Widget<Astal.Overlay>
export const Overlay = astalify<typeof Astal.Overlay, OverlayProps, "Overlay">(Astal.Overlay)
export type OverlayProps = ConstructProps<Astal.Overlay, Astal.Overlay.ConstructorProps>

// Revealer
export type Revealer = Widget<Gtk.Revealer>
export const Revealer = astalify<typeof Gtk.Revealer, RevealerProps, "Revealer">(Gtk.Revealer)
export type RevealerProps = ConstructProps<Gtk.Revealer, Gtk.Revealer.ConstructorProps>

// Scrollable
export type Scrollable = Widget<Astal.Scrollable>
export const Scrollable = astalify<typeof Astal.Scrollable, ScrollableProps, "Scrollable">(Astal.Scrollable)
export type ScrollableProps = ConstructProps<Astal.Scrollable, Astal.Scrollable.ConstructorProps>

// Slider
export type Slider = Widget<Astal.Slider>
export const Slider = astalify<typeof Astal.Slider, SliderProps, "Slider">(Astal.Slider)
export type SliderProps = ConstructProps<Astal.Slider, Astal.Slider.ConstructorProps, {
    onDragged: []
}>

// TODO: Stack

// Switch
export type Switch = Widget<Gtk.Switch>
export const Switch = astalify<typeof Gtk.Switch, SwitchProps, "Switch">(Gtk.Switch)
export type SwitchProps = ConstructProps<Gtk.Switch, Gtk.Switch.ConstructorProps>

// Window
export type Window = Widget<Astal.Window>
export const Window = astalify<typeof Astal.Window, WindowProps, "Window">(Astal.Window)
export type WindowProps = ConstructProps<Astal.Window, Astal.Window.ConstructorProps>