RAGS - v1.10.0
    Preparing search index...

    Function subclass

    • Creates a subclassed AGS widget factory from a GTK widget class.

      Registers the subclass as a GObject and returns a factory function that creates instances with AGS widget features (binding, hooking, etc.).

      Also serves as the default export namespace containing all built-in widget factories (e.g., Widget.Box, Widget.Label).

      Type Parameters

      • T extends new (...args: any[]) => Widget

        The base GTK widget class

      • Props

        The constructor props type for the base class

      Parameters

      • Base: T

        The GTK widget class to subclass

      • typename: string = Base.name

        GObject type name (defaults to the class name)

      Returns <Attr>(props: BaseProps<Instance<Attr>, Props, Attr>) => Instance<Attr>

      A factory function that creates widget instances

      // Create a custom widget from a GTK class
      const MyWidget = Widget(Gtk.DrawingArea, 'MyDrawingArea');

      // Use built-in widget factories
      const box = Widget.Box({ children: [Widget.Label({ label: 'hello' })] });
    Index

    Properties

    Box: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            propsOrChildren: Child[]
            | BoxProps<Child, Attr, Box<Child, Attr>>,
            ...children: Widget[],
        ],
    ) => Box<Child, Attr>

    Type Declaration

      • <Child extends Widget = Widget, Attr = unknown>(
            ...props: [
                propsOrChildren: Child[]
                | BoxProps<Child, Attr, Box<Child, Attr>>,
                ...children: Widget[],
            ],
        ): Box<Child, Attr>
      • Create a new Box container widget.

        Type Parameters

        • Child extends Widget = Widget
        • Attr = unknown

        Parameters

        Returns Box<Child, Attr>

        const myBox = newBox({ vertical: true, children: [child1, child2] });
        const hBox = newBox([child1, child2]);
    Button: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: ButtonProps<Child, Attr, Button<Child, Attr>>,
            child?: Child,
        ],
    ) => Button<Child, Attr>

    Type Declaration

    Calendar: <Attr = unknown>(
        ...props: [props: CalendarProps<Attr, Calendar<Attr>>],
    ) => Calendar<Attr>

    Type Declaration

    CenterBox: <
        StartWidget extends Widget = Widget,
        CenterWidget extends Widget = Widget,
        EndWidget extends Widget = Widget,
        Attr = unknown,
    >(
        ...props: [
            props: CenterBoxProps<
                StartWidget,
                CenterWidget,
                EndWidget,
                Attr,
                CenterBox<StartWidget, CenterWidget, EndWidget, Attr>,
            >,
            startWidget?: StartWidget,
            centerWidget?: CenterWidget,
            endWidget?: EndWidget,
        ],
    ) => CenterBox<StartWidget, CenterWidget, EndWidget, Attr>

    Type Declaration

    CircularProgress: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: CircularProgressProps<
                Child,
                Attr,
                CircularProgress<Child, Attr>,
            >,
            child?: Child,
        ],
    ) => CircularProgress<Child, Attr>

    Type Declaration

    ColorButton: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: ColorButtonProps<Child, Attr, ColorButton<Child, Attr>>,
            child?: Child,
        ],
    ) => ColorButton<Child, Attr>

    Type Declaration

    DrawingArea: <Attr = unknown>(
        ...props: [props: DrawingAreaProps<Attr, DrawingArea<Attr>>],
    ) => DrawingArea<Attr>

    Type Declaration

    Entry

    Entry: <Attr = unknown>(
        ...props: [props: EntryProps<Attr, Entry<Attr>>],
    ) => Entry<Attr>

    Type Declaration

      • <Attr = unknown>(...props: [props: EntryProps<Attr, Entry<Attr>>]): Entry<Attr>
      • Create a new Entry text input widget.

        Type Parameters

        • Attr = unknown

        Parameters

        Returns Entry<Attr>

        const input = newEntry({
        placeholder_text: 'Type here...',
        on_accept: (self) => print(self.text),
        });
    EventBox: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: EventBoxProps<Child, Attr, EventBox<Child, Attr>>,
            child?: Child,
        ],
    ) => EventBox<Child, Attr>

    Type Declaration

    FileChooserButton: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: FileChooserButtonProps<
                Child,
                Attr,
                FileChooserButton<Child, Attr>,
            >,
            child?: Child,
        ],
    ) => FileChooserButton<Child, Attr>

    Type Declaration

    Fixed: <Attr = unknown>(
        ...props: [props: FixedProps<Attr, Fixed<Attr>>],
    ) => Fixed<Attr>

    Type Declaration

    FlowBox: <Attr = unknown>(
        ...props: [props: FlowBoxProps<Attr, FlowBox<Attr>>],
    ) => FlowBox<Attr>

    Type Declaration

    FontButton: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: FontButtonProps<Child, Attr, FontButton<Child, Attr>>,
            child?: Child,
        ],
    ) => FontButton<Child, Attr>

    Type Declaration

    Icon: <Attr = unknown>(
        ...props: [props: Ico | IconProps<Attr, Icon<Attr>>],
    ) => Icon<Attr>

    Type Declaration

    Label: <Attr = unknown>(
        ...props: [props: string | LabelProps<Attr, Label<Attr>>],
    ) => Label<Attr>

    Type Declaration

      • <Attr = unknown>(
            ...props: [props: string | LabelProps<Attr, Label<Attr>>],
        ): Label<Attr>
      • Create a new Label for displaying text.

        Type Parameters

        • Attr = unknown

        Parameters

        Returns Label<Attr>

        const lbl = newLabel({ label: 'Hello, world!' });
        const simple = newLabel('Hello, world!');
    LevelBar: <Attr = unknown>(
        ...props: [props: LevelBarProps<Attr, LevelBar<Attr>>],
    ) => LevelBar<Attr>

    Type Declaration

    ListBox: <Attr = unknown>(
        ...props: [props: ListBoxProps<Attr, ListBox<Attr>>],
    ) => ListBox<Attr>

    Type Declaration

    Menu: <MenuItem extends MenuItem = MenuItem, Attr = unknown>(
        ...props: [
            props: MenuProps<MenuItem, Attr, Menu<MenuItem, Attr>>,
            ...children: MenuItem[],
        ],
    ) => Menu<MenuItem, Attr>

    Type Declaration

    MenuBar: <Attr = unknown>(
        ...props: [props: MenuBarProps<Attr, MenuBar<Attr>>],
    ) => MenuBar<Attr>

    Type Declaration

    MenuItem: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: MenuItemProps<Child, Attr, MenuItem<Child, Attr>>,
            child?: Child,
        ],
    ) => MenuItem<Child, Attr>

    Type Declaration

    Overlay: <
        Child extends Widget = Widget,
        OverlayChild extends Widget = Widget,
        Attr = unknown,
    >(
        ...props: [
            props: OverlayProps<
                Child,
                OverlayChild,
                Attr,
                Overlay<Child, OverlayChild, Attr>,
            >,
            child?: Child,
            ...overlays: Widget[],
        ],
    ) => Overlay<Child, OverlayChild, Attr>

    Type Declaration

    ProgressBar: <Attr = unknown>(
        ...props: [props: ProgressBarProps<Attr, ProgressBar<Attr>>],
    ) => ProgressBar<Attr>

    Type Declaration

    register: <T extends new (...args: any[]) => Widget>(
        klass: T,
        config?: {
            cssName?: string;
            properties?: { [prop: string]: [type?: PspecType, handle?: PspecFlag] };
            signals?: { [signal: string]: PspecType[] };
            typename?: string;
        } & { cssName?: string },
    ) => T

    Type Declaration

      • <T extends new (...args: any[]) => Widget>(
            klass: T,
            config?: {
                cssName?: string;
                properties?: { [prop: string]: [type?: PspecType, handle?: PspecFlag] };
                signals?: { [signal: string]: PspecType[] };
                typename?: string;
            } & { cssName?: string },
        ): T
      • Registers a GTK widget class as an AGS widget.

        Mixes in all AgsWidget prototype methods and registers the class as a GObject with AGS-specific properties (class-name, css, cursor, etc.).

        Type Parameters

        • T extends new (...args: any[]) => Widget

        Parameters

        • klass: T

          The GTK widget class to register

        • Optionalconfig: {
              cssName?: string;
              properties?: { [prop: string]: [type?: PspecType, handle?: PspecFlag] };
              signals?: { [signal: string]: PspecType[] };
              typename?: string;
          } & { cssName?: string }

          Registration options including GObject signals, properties, and CSS name

        Returns T

        The registered class

    Revealer: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: RevealerProps<Child, Attr, Revealer<Child, Attr>>,
            child?: Child,
        ],
    ) => Revealer<Child, Attr>

    Type Declaration

    Scrollable: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: ScrollableProps<Child, Attr, Scrollable<Child, Attr>>,
            child?: Child,
        ],
    ) => Scrollable<Child, Attr>

    Type Declaration

    Separator: <Attr = unknown>(
        ...props: [props: SeparatorProps<Attr, Separator<Attr>>],
    ) => Separator<Attr>

    Type Declaration

    Slider: <Attr = unknown>(
        ...props: [SliderProps<Attr, Slider<Attr>>?],
    ) => Slider<Attr>

    Type Declaration

      • <Attr = unknown>(...props: [SliderProps<Attr, Slider<Attr>>?]): Slider<Attr>
      • Creates a new Slider widget for selecting a numeric value within a range.

        Type Parameters

        • Attr = unknown

        Parameters

        Returns Slider<Attr>

        const slider = newSlider({
        min: 0,
        max: 100,
        value: 50,
        on_change: (self) => print(self.value),
        });
    SpinButton: <Attr = unknown>(
        ...props: [props: SpinButtonProps<Attr, SpinButton<Attr>>],
    ) => SpinButton<Attr>

    Type Declaration

    Spinner: <Attr = unknown>(
        ...props: [props: BaseProps<Spinner<Attr>, ConstructorProps, Attr>],
    ) => Spinner<Attr>

    Type Declaration

    Stack: <
        Children extends { [name: string]: Widget } = { [name: string]: Widget },
        Attr = unknown,
    >(
        ...props: [
            props: StackProps<Children, Attr, Stack<Children, Attr>>,
            children?: Children,
        ],
    ) => Stack<Children, Attr>

    Type Declaration

    subclass: typeof subclass
    Switch: <Attr = unknown>(
        ...props: [props: SwitchProps<Attr, Switch<Attr>>],
    ) => Switch<Attr>

    Type Declaration

    ToggleButton: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            props: ToggleButtonProps<Child, Attr, ToggleButton<Child, Attr>>,
            child?: Child,
        ],
    ) => ToggleButton<Child, Attr>

    Type Declaration

    Window: <Child extends Widget = Widget, Attr = unknown>(
        ...props: [
            WindowProps<Child, Attr, Window<Child, Attr>>?,
            child?: Child,
        ],
    ) => Window<Child, Attr>

    Type Declaration

      • <Child extends Widget = Widget, Attr = unknown>(
            ...props: [
                WindowProps<Child, Attr, Window<Child, Attr>>?,
                child?: Child,
            ],
        ): Window<Child, Attr>
      • Creates a new Window widget as a Wayland layer shell surface.

        Type Parameters

        • Child extends Widget = Widget
        • Attr = unknown

        Parameters

        Returns Window<Child, Attr>

        const window = newWindow({
        name: 'my-bar',
        anchor: ['top', 'left', 'right'],
        exclusivity: 'exclusive',
        layer: 'top',
        child: Widget.Box({ children: [...] }),
        });