From bd6fa7ba282dcfb415cfdb3b51740c8d45e3a2cb Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 14 Jan 2025 23:39:57 -0500 Subject: [PATCH] feat(ags4): add cursorName to AstalifyProps --- modules/ags/gtk4/widget/astalify/astalify.ts | 15 +++++++- modules/ags/gtk4/widget/astalify/generics.ts | 37 ++++++++++++++++++++ modules/ags/gtk4/widget/bar.ts | 2 +- 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/modules/ags/gtk4/widget/astalify/astalify.ts b/modules/ags/gtk4/widget/astalify/astalify.ts index f37e9bd2..2f6b54d2 100644 --- a/modules/ags/gtk4/widget/astalify/astalify.ts +++ b/modules/ags/gtk4/widget/astalify/astalify.ts @@ -7,11 +7,12 @@ import setupControllers from './controller'; import { type BindableProps, + childType, + type Cursor, dummyBuilder, type MixinParams, noImplicitDestroy, setChildren, - childType, } from './generics'; @@ -107,6 +108,18 @@ export default < this.setChildren(this, children); } + private _cursorName: Cursor = 'default'; + + @property(String) + get cursorName(): Cursor { + return this._cursorName; + } + + set cursorName(val: Cursor) { + this._cursorName = val; + this.set_cursor_from_name(val); + } + hook( object: Connectable, diff --git a/modules/ags/gtk4/widget/astalify/generics.ts b/modules/ags/gtk4/widget/astalify/generics.ts index d4d006fa..ad27a871 100644 --- a/modules/ags/gtk4/widget/astalify/generics.ts +++ b/modules/ags/gtk4/widget/astalify/generics.ts @@ -25,4 +25,41 @@ export interface AstalifyProps { css: string child: Gtk.Widget children: Gtk.Widget[] + cursorName: Cursor } + +export type Cursor = + | 'default' + | 'help' + | 'pointer' + | 'context-menu' + | 'progress' + | 'wait' + | 'cell' + | 'crosshair' + | 'text' + | 'vertical-text' + | 'alias' + | 'copy' + | 'no-drop' + | 'move' + | 'not-allowed' + | 'grab' + | 'grabbing' + | 'all-scroll' + | 'col-resize' + | 'row-resize' + | 'n-resize' + | 'e-resize' + | 's-resize' + | 'w-resize' + | 'ne-resize' + | 'nw-resize' + | 'sw-resize' + | 'se-resize' + | 'ew-resize' + | 'ns-resize' + | 'nesw-resize' + | 'nwse-resize' + | 'zoom-in' + | 'zoom-out'; diff --git a/modules/ags/gtk4/widget/bar.ts b/modules/ags/gtk4/widget/bar.ts index ea708963..7e91473d 100644 --- a/modules/ags/gtk4/widget/bar.ts +++ b/modules/ags/gtk4/widget/bar.ts @@ -35,7 +35,7 @@ export default () => { centerWidget: styledBox, endWidget: MenuButton({ - cursor: Gdk.Cursor.new_from_name('pointer', null), + cursorName: 'pointer', hexpand: true, halign: CENTER,