diff --git a/bindings/csharp/src/CNativeAPI/generated/Window.cs b/bindings/csharp/src/CNativeAPI/generated/Window.cs index 3bd760b9..17bf0e83 100644 --- a/bindings/csharp/src/CNativeAPI/generated/Window.cs +++ b/bindings/csharp/src/CNativeAPI/generated/Window.cs @@ -436,6 +436,9 @@ public static partial class Interop [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] public static extern ulong native_window_get_parent_window(ulong self); + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern ulong native_window_get_taskbar(ulong self); + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] public static extern void native_window_blur(ulong self); diff --git a/bindings/csharp/src/CNativeAPI/generated/WindowTaskbar.cs b/bindings/csharp/src/CNativeAPI/generated/WindowTaskbar.cs new file mode 100644 index 00000000..01b2819e --- /dev/null +++ b/bindings/csharp/src/CNativeAPI/generated/WindowTaskbar.cs @@ -0,0 +1,201 @@ +// AUTO-GENERATED. DO NOT EDIT. +// Any manual changes WILL BE LOST when this file is regenerated. +#nullable enable + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; + +namespace CNativeAPI; + +[StructLayout(LayoutKind.Sequential)] +public struct native_taskbar_flash_options_t +{ + public int target; + public int count; + public int timeout_ms; + public byte stop_on_foreground; +} + +[StructLayout(LayoutKind.Sequential)] +public struct native_taskbar_event_t +{ + public int type; + public DataUnion data; + + [StructLayout(LayoutKind.Explicit)] + public struct DataUnion + { + [FieldOffset(0)] public ThumbnailButtonClickedData thumbnail_button_clicked; + } + + [StructLayout(LayoutKind.Sequential)] + public struct ThumbnailButtonClickedData + { + public uint button_id; + } +} + +[StructLayout(LayoutKind.Sequential)] +public struct native_taskbar_thumbnail_button_list_t +{ + public IntPtr taskbar_thumbnail_buttons; + public CLong count; +} + +[UnmanagedFunctionPointer(CallingConvention.Cdecl)] +public delegate void TaskbarEventNativeCallback(IntPtr evt, IntPtr userData); + +public static partial class Interop +{ + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_taskbar_thumbnail_button_has_background(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_taskbar_thumbnail_button_is_dismiss_on_click(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_taskbar_thumbnail_button_is_enabled(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_taskbar_thumbnail_button_is_interactive(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_taskbar_thumbnail_button_is_visible(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_taskbar_thumbnail_button_remove_listener(ulong self, ulong listenerId); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_add_thumbnail_button(ulong self, ulong button); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_insert_thumbnail_button(ulong self, CULong index, ulong button); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_is_supported(); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_remove_listener(ulong self, ulong listenerId); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_remove_thumbnail_button(ulong self, ulong button); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_remove_thumbnail_button_at(ulong self, CULong index); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_remove_thumbnail_button_by_id(ulong self, uint buttonId); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_set_overlay_icon(ulong self, ulong icon, [MarshalAs(UnmanagedType.LPUTF8Str)] string? description); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_set_progress_state(ulong self, int state); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_set_progress_value(ulong self, double progress); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_start_flashing(ulong self, native_taskbar_flash_options_t options); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + [return: MarshalAs(UnmanagedType.I1)] + public static extern bool native_window_taskbar_stop_flashing(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern CULong native_window_taskbar_get_max_thumbnail_button_count(); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern CULong native_window_taskbar_get_thumbnail_button_count(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr native_taskbar_thumbnail_button_get_tooltip(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern IntPtr native_window_taskbar_get_overlay_icon_description(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern double native_window_taskbar_get_progress_value(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern int native_window_taskbar_get_progress_state(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern native_taskbar_thumbnail_button_list_t native_window_taskbar_get_all_thumbnail_buttons(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern uint native_taskbar_thumbnail_button_get_id(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern ulong native_taskbar_thumbnail_button_add_listener(ulong self, TaskbarEventNativeCallback callback, IntPtr userData, ReleaseUserDataNativeCallback releaseUserData); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern ulong native_taskbar_thumbnail_button_create(ulong icon, [MarshalAs(UnmanagedType.LPUTF8Str)] string? tooltip); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern ulong native_taskbar_thumbnail_button_get_icon(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern ulong native_window_taskbar_add_listener(ulong self, TaskbarEventNativeCallback callback, IntPtr userData, ReleaseUserDataNativeCallback releaseUserData); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern ulong native_window_taskbar_get_overlay_icon(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern ulong native_window_taskbar_get_thumbnail_button_at(ulong self, CULong index); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern ulong native_window_taskbar_get_thumbnail_button_by_id(ulong self, uint buttonId); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_taskbar_thumbnail_button_free(ulong handle); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_taskbar_thumbnail_button_list_release(ref native_taskbar_thumbnail_button_list_t list); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_taskbar_thumbnail_button_set_dismiss_on_click(ulong self, [MarshalAs(UnmanagedType.I1)] bool isDismissOnClick); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_taskbar_thumbnail_button_set_enabled(ulong self, [MarshalAs(UnmanagedType.I1)] bool isEnabled); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_taskbar_thumbnail_button_set_has_background(ulong self, [MarshalAs(UnmanagedType.I1)] bool hasBackground); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_taskbar_thumbnail_button_set_icon(ulong self, ulong icon); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_taskbar_thumbnail_button_set_interactive(ulong self, [MarshalAs(UnmanagedType.I1)] bool isInteractive); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_taskbar_thumbnail_button_set_tooltip(ulong self, [MarshalAs(UnmanagedType.LPUTF8Str)] string? tooltip); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_taskbar_thumbnail_button_set_visible(ulong self, [MarshalAs(UnmanagedType.I1)] bool isVisible); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_window_taskbar_clear_thumbnail_buttons(ulong self); + + [DllImport(Libraries.NativeApi, CallingConvention = CallingConvention.Cdecl)] + public static extern void native_window_taskbar_free(ulong handle); +} + diff --git a/bindings/csharp/src/NativeAPI/Window.cs b/bindings/csharp/src/NativeAPI/Window.cs index e4fa0dc9..c0d42ce9 100644 --- a/bindings/csharp/src/NativeAPI/Window.cs +++ b/bindings/csharp/src/NativeAPI/Window.cs @@ -975,6 +975,15 @@ public bool IsVisibleInTaskbar } } + public WindowTaskbar? Taskbar + { + get + { + var rawResult = Interop.native_window_get_taskbar(NativeHandle); + return rawResult == 0 ? null : new WindowTaskbar(rawResult); + } + } + public bool SetIgnoreMouseEvents(bool isIgnoreMouseEvents, bool forward) { var rawResult = Interop.native_window_set_ignore_mouse_events(NativeHandle, isIgnoreMouseEvents, forward); diff --git a/bindings/csharp/src/NativeAPI/WindowTaskbar.cs b/bindings/csharp/src/NativeAPI/WindowTaskbar.cs new file mode 100644 index 00000000..f685930a --- /dev/null +++ b/bindings/csharp/src/NativeAPI/WindowTaskbar.cs @@ -0,0 +1,459 @@ +// AUTO-GENERATED. DO NOT EDIT. +// Any manual changes WILL BE LOST when this file is regenerated. +#nullable enable + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using CNativeAPI; + +namespace NativeAPI; + +public enum TaskbarProgressState +{ + None = 0, + Indeterminate = 1, + Normal = 2, + Paused = 3, + Error = 4, +} + +public enum TaskbarFlashTarget +{ + All = 0, + Caption = 1, + Taskbar = 2, +} + +public struct TaskbarFlashOptions +{ + public TaskbarFlashTarget Target; + public int Count; + public int TimeoutMs; + public bool StopOnForeground; + + public TaskbarFlashOptions(TaskbarFlashTarget target, int count, int timeoutMs, bool stopOnForeground) + { + Target = target; + Count = count; + TimeoutMs = timeoutMs; + StopOnForeground = stopOnForeground; + } + + internal static TaskbarFlashOptions FromRaw(in native_taskbar_flash_options_t raw) + { + return new TaskbarFlashOptions((TaskbarFlashTarget)raw.target, raw.count, raw.timeout_ms, raw.stop_on_foreground != 0); + } + + internal native_taskbar_flash_options_t ToRaw() + { + var raw = new native_taskbar_flash_options_t(); + raw.target = (int)Target; + raw.count = Count; + raw.timeout_ms = TimeoutMs; + raw.stop_on_foreground = (byte)(StopOnForeground ? 1 : 0); + return raw; + } +} + +/// One TaskbarEvent, in its concrete form. +public abstract record TaskbarEvent +{ + private TaskbarEvent() { } + + public sealed record ThumbnailButtonClicked(uint ButtonId) : TaskbarEvent; + + internal static TaskbarEvent? FromRaw(in native_taskbar_event_t raw) + { + switch (raw.type) + { + case 0: return new ThumbnailButtonClicked(raw.data.thumbnail_button_clicked.button_id); + default: return null; + } + } +} + +/// Owned handle to a native TaskbarThumbnailButton. +public sealed partial class TaskbarThumbnailButton : IDisposable +{ + public ulong NativeHandle { get; private set; } + private readonly bool _ownsHandle; + + public TaskbarThumbnailButton(ulong nativeHandle, bool ownsHandle = true) + { + NativeHandle = nativeHandle; + _ownsHandle = ownsHandle; + } + + ~TaskbarThumbnailButton() => ReleaseHandle(); + + public void Dispose() + { + ReleaseHandle(); + GC.SuppressFinalize(this); + } + + private void ReleaseHandle() + { + if (_ownsHandle && NativeHandle != 0) + { + Interop.native_taskbar_thumbnail_button_free(NativeHandle); + NativeHandle = 0; + } + } + + /// Creates a new TaskbarThumbnailButton; returns null if the native side failed. + public static TaskbarThumbnailButton? Create(Image? icon, string tooltip) + { + var handle = Interop.native_taskbar_thumbnail_button_create(icon?.NativeHandle ?? 0, tooltip); + return handle == 0 ? null : new TaskbarThumbnailButton(handle); + } + + public uint Id + { + get + { + var rawResult = Interop.native_taskbar_thumbnail_button_get_id(NativeHandle); + return rawResult; + } + } + + public void SetIcon(Image? icon) + { + Interop.native_taskbar_thumbnail_button_set_icon(NativeHandle, icon?.NativeHandle ?? 0); + } + + public Image? Icon + { + get + { + var rawResult = Interop.native_taskbar_thumbnail_button_get_icon(NativeHandle); + return rawResult == 0 ? null : new Image(rawResult); + } + } + + public void SetTooltip(string tooltip) + { + Interop.native_taskbar_thumbnail_button_set_tooltip(NativeHandle, tooltip); + } + + public string? Tooltip + { + get + { + var rawResult = Interop.native_taskbar_thumbnail_button_get_tooltip(NativeHandle); + return Interop.ConsumeString(rawResult); + } + } + + public void SetEnabled(bool isEnabled) + { + Interop.native_taskbar_thumbnail_button_set_enabled(NativeHandle, isEnabled); + } + + public bool IsEnabled + { + get + { + var rawResult = Interop.native_taskbar_thumbnail_button_is_enabled(NativeHandle); + return rawResult; + } + } + + public void SetVisible(bool isVisible) + { + Interop.native_taskbar_thumbnail_button_set_visible(NativeHandle, isVisible); + } + + public bool IsVisible + { + get + { + var rawResult = Interop.native_taskbar_thumbnail_button_is_visible(NativeHandle); + return rawResult; + } + } + + public void SetInteractive(bool isInteractive) + { + Interop.native_taskbar_thumbnail_button_set_interactive(NativeHandle, isInteractive); + } + + public bool IsInteractive + { + get + { + var rawResult = Interop.native_taskbar_thumbnail_button_is_interactive(NativeHandle); + return rawResult; + } + } + + public void SetHasBackground(bool hasBackground) + { + Interop.native_taskbar_thumbnail_button_set_has_background(NativeHandle, hasBackground); + } + + public bool HasBackground + { + get + { + var rawResult = Interop.native_taskbar_thumbnail_button_has_background(NativeHandle); + return rawResult; + } + } + + public void SetDismissOnClick(bool isDismissOnClick) + { + Interop.native_taskbar_thumbnail_button_set_dismiss_on_click(NativeHandle, isDismissOnClick); + } + + public bool IsDismissOnClick + { + get + { + var rawResult = Interop.native_taskbar_thumbnail_button_is_dismiss_on_click(NativeHandle); + return rawResult; + } + } + + /// Registers for every TaskbarEvent this TaskbarThumbnailButton emits. + /// + /// The delegate is kept alive until the listener is removed or its emitter + /// destroyed; the core releases it then. + /// + public ulong AddListener(Action callback) + { + TaskbarEventNativeCallback native = (evt, userData) => + { + if (evt == IntPtr.Zero) + { + return; + } + var value = TaskbarEvent.FromRaw(Marshal.PtrToStructure(evt)); + if (value is not null) + { + callback(value); + } + }; + return Interop.native_taskbar_thumbnail_button_add_listener(NativeHandle, native, CallbackKeeper.Hold(native), CallbackKeeper.Release); + } + + /// Unregisters a listener. Returns false if unknown. + public bool RemoveListener(ulong listenerId) + { + return Interop.native_taskbar_thumbnail_button_remove_listener(NativeHandle, listenerId); + } + +} + +/// Owned handle to a native WindowTaskbar. +public sealed partial class WindowTaskbar : IDisposable +{ + public ulong NativeHandle { get; private set; } + private readonly bool _ownsHandle; + + public WindowTaskbar(ulong nativeHandle, bool ownsHandle = true) + { + NativeHandle = nativeHandle; + _ownsHandle = ownsHandle; + } + + ~WindowTaskbar() => ReleaseHandle(); + + public void Dispose() + { + ReleaseHandle(); + GC.SuppressFinalize(this); + } + + private void ReleaseHandle() + { + if (_ownsHandle && NativeHandle != 0) + { + Interop.native_window_taskbar_free(NativeHandle); + NativeHandle = 0; + } + } + + public static bool IsSupported() + { + var rawResult = Interop.native_window_taskbar_is_supported(); + return rawResult; + } + + public static ulong GetMaxThumbnailButtonCount() + { + var rawResult = Interop.native_window_taskbar_get_max_thumbnail_button_count(); + return (ulong)rawResult.Value; + } + + public bool SetProgressState(TaskbarProgressState state) + { + var rawResult = Interop.native_window_taskbar_set_progress_state(NativeHandle, (int)state); + return rawResult; + } + + public TaskbarProgressState ProgressState + { + get + { + var rawResult = Interop.native_window_taskbar_get_progress_state(NativeHandle); + return (TaskbarProgressState)rawResult; + } + } + + public bool SetProgressValue(double progress) + { + var rawResult = Interop.native_window_taskbar_set_progress_value(NativeHandle, progress); + return rawResult; + } + + public double ProgressValue + { + get + { + var rawResult = Interop.native_window_taskbar_get_progress_value(NativeHandle); + return rawResult; + } + } + + public bool SetOverlayIcon(Image? icon, string description) + { + var rawResult = Interop.native_window_taskbar_set_overlay_icon(NativeHandle, icon?.NativeHandle ?? 0, description); + return rawResult; + } + + public Image? OverlayIcon + { + get + { + var rawResult = Interop.native_window_taskbar_get_overlay_icon(NativeHandle); + return rawResult == 0 ? null : new Image(rawResult); + } + } + + public string? OverlayIconDescription + { + get + { + var rawResult = Interop.native_window_taskbar_get_overlay_icon_description(NativeHandle); + return Interop.ConsumeString(rawResult); + } + } + + public bool AddThumbnailButton(TaskbarThumbnailButton? button) + { + var rawResult = Interop.native_window_taskbar_add_thumbnail_button(NativeHandle, button?.NativeHandle ?? 0); + return rawResult; + } + + public bool InsertThumbnailButton(ulong index, TaskbarThumbnailButton? button) + { + var rawResult = Interop.native_window_taskbar_insert_thumbnail_button(NativeHandle, new CULong(checked((nuint)index)), button?.NativeHandle ?? 0); + return rawResult; + } + + public bool RemoveThumbnailButton(TaskbarThumbnailButton? button) + { + var rawResult = Interop.native_window_taskbar_remove_thumbnail_button(NativeHandle, button?.NativeHandle ?? 0); + return rawResult; + } + + public bool RemoveThumbnailButtonById(uint buttonId) + { + var rawResult = Interop.native_window_taskbar_remove_thumbnail_button_by_id(NativeHandle, buttonId); + return rawResult; + } + + public bool RemoveThumbnailButtonAt(ulong index) + { + var rawResult = Interop.native_window_taskbar_remove_thumbnail_button_at(NativeHandle, new CULong(checked((nuint)index))); + return rawResult; + } + + public void ClearThumbnailButtons() + { + Interop.native_window_taskbar_clear_thumbnail_buttons(NativeHandle); + } + + public ulong ThumbnailButtonCount + { + get + { + var rawResult = Interop.native_window_taskbar_get_thumbnail_button_count(NativeHandle); + return (ulong)rawResult.Value; + } + } + + public TaskbarThumbnailButton? GetThumbnailButtonAt(ulong index) + { + var rawResult = Interop.native_window_taskbar_get_thumbnail_button_at(NativeHandle, new CULong(checked((nuint)index))); + return rawResult == 0 ? null : new TaskbarThumbnailButton(rawResult); + } + + public TaskbarThumbnailButton? GetThumbnailButtonById(uint buttonId) + { + var rawResult = Interop.native_window_taskbar_get_thumbnail_button_by_id(NativeHandle, buttonId); + return rawResult == 0 ? null : new TaskbarThumbnailButton(rawResult); + } + + public TaskbarThumbnailButton[] AllThumbnailButtons + { + get + { + var rawResult = Interop.native_window_taskbar_get_all_thumbnail_buttons(NativeHandle); + var count = rawResult.taskbar_thumbnail_buttons == IntPtr.Zero ? 0 : checked((int)rawResult.count.Value); + var items = new TaskbarThumbnailButton[count]; + for (var i = 0; i < count; i++) + { + items[i] = new TaskbarThumbnailButton((ulong)Marshal.ReadInt64(rawResult.taskbar_thumbnail_buttons, i * 8)); + } + // The handles now belong to `items`; free just the array. + Interop.native_taskbar_thumbnail_button_list_release(ref rawResult); + return items; + } + } + + public bool StartFlashing(TaskbarFlashOptions options) + { + var rawOptions = options.ToRaw(); + var rawResult = Interop.native_window_taskbar_start_flashing(NativeHandle, rawOptions); + return rawResult; + } + + public bool StopFlashing() + { + var rawResult = Interop.native_window_taskbar_stop_flashing(NativeHandle); + return rawResult; + } + + /// Registers for every TaskbarEvent this WindowTaskbar emits. + /// + /// The delegate is kept alive until the listener is removed or its emitter + /// destroyed; the core releases it then. + /// + public ulong AddListener(Action callback) + { + TaskbarEventNativeCallback native = (evt, userData) => + { + if (evt == IntPtr.Zero) + { + return; + } + var value = TaskbarEvent.FromRaw(Marshal.PtrToStructure(evt)); + if (value is not null) + { + callback(value); + } + }; + return Interop.native_window_taskbar_add_listener(NativeHandle, native, CallbackKeeper.Hold(native), CallbackKeeper.Release); + } + + /// Unregisters a listener. Returns false if unknown. + public bool RemoveListener(ulong listenerId) + { + return Interop.native_window_taskbar_remove_listener(NativeHandle, listenerId); + } + +} + diff --git a/bindings/dart/cnativeapi/ffigen.yaml b/bindings/dart/cnativeapi/ffigen.yaml index 4682b97f..a8c55ff1 100644 --- a/bindings/dart/cnativeapi/ffigen.yaml +++ b/bindings/dart/cnativeapi/ffigen.yaml @@ -49,6 +49,7 @@ headers: - "../../../core/src/capi/window_manager_c.h" - "../../../core/src/capi/window_shadow_c.h" - "../../../core/src/capi/window_shape_c.h" + - "../../../core/src/capi/window_taskbar_c.h" include-directives: - "../../../core/src/capi/accessibility_manager_c.h" @@ -90,6 +91,7 @@ headers: - "../../../core/src/capi/window_manager_c.h" - "../../../core/src/capi/window_shadow_c.h" - "../../../core/src/capi/window_shape_c.h" + - "../../../core/src/capi/window_taskbar_c.h" preamble: | // ignore_for_file: always_specify_types diff --git a/bindings/dart/cnativeapi/lib/src/bindings_generated.dart b/bindings/dart/cnativeapi/lib/src/bindings_generated.dart index cad7ff79..40e18aa7 100644 --- a/bindings/dart/cnativeapi/lib/src/bindings_generated.dart +++ b/bindings/dart/cnativeapi/lib/src/bindings_generated.dart @@ -2298,6 +2298,177 @@ external void native_string_list_free(ffi.Pointer list); @ffi.Native)>() external void native_string_map_free(ffi.Pointer map); +/// Registers @p callback for every TaskbarEvent this TaskbarThumbnailButton emits. +/// @return the listener id, or NATIVE_INVALID_LISTENER_ID on failure. +@ffi.Native< + native_listener_id_t Function( + native_taskbar_thumbnail_button_t, + native_taskbar_event_callback_t, + ffi.Pointer, + native_release_user_data_t, + ) +>() +external int native_taskbar_thumbnail_button_add_listener( + int taskbar_thumbnail_button, + native_taskbar_event_callback_t callback, + ffi.Pointer user_data, + native_release_user_data_t release_user_data, +); + +/// Registers an asynchronous callback. Its event, borrowed handles and user_data +/// remain valid until event_delivery_complete is called, including after removal. +/// Every delivered payload must be acknowledged. Check is_active before invoking a queued callback. +@ffi.Native< + native_listener_id_t Function( + native_taskbar_thumbnail_button_t, + native_taskbar_event_callback_t_async, + ffi.Pointer, + native_release_user_data_t, + ) +>() +external int native_taskbar_thumbnail_button_add_listener_async( + int taskbar_thumbnail_button, + native_taskbar_event_callback_t_async callback, + ffi.Pointer user_data, + native_release_user_data_t release_user_data, +); + +/// Creates a TaskbarThumbnailButton instance; release it with native_taskbar_thumbnail_button_free(). +@ffi.Native< + native_taskbar_thumbnail_button_t Function( + native_image_t$2, + ffi.Pointer, + ) +>() +external int native_taskbar_thumbnail_button_create( + int icon, + ffi.Pointer tooltip, +); + +/// Releases the caller's reference. Safe to call with an invalid or +/// already-released handle. +@ffi.Native() +external void native_taskbar_thumbnail_button_free( + int taskbar_thumbnail_button, +); + +/// Caller owns the returned handle; release it with native_image_free(). +@ffi.Native() +external int native_taskbar_thumbnail_button_get_icon( + int taskbar_thumbnail_button, +); + +@ffi.Native< + native_taskbar_thumbnail_button_id_t Function( + native_taskbar_thumbnail_button_t, + ) +>() +external int native_taskbar_thumbnail_button_get_id( + int taskbar_thumbnail_button, +); + +/// Caller owns the returned string; free it with free_c_str(). +@ffi.Native Function(native_taskbar_thumbnail_button_t)>() +external ffi.Pointer native_taskbar_thumbnail_button_get_tooltip( + int taskbar_thumbnail_button, +); + +@ffi.Native() +external bool native_taskbar_thumbnail_button_has_background( + int taskbar_thumbnail_button, +); + +@ffi.Native() +external bool native_taskbar_thumbnail_button_is_dismiss_on_click( + int taskbar_thumbnail_button, +); + +@ffi.Native() +external bool native_taskbar_thumbnail_button_is_enabled( + int taskbar_thumbnail_button, +); + +@ffi.Native() +external bool native_taskbar_thumbnail_button_is_interactive( + int taskbar_thumbnail_button, +); + +@ffi.Native() +external bool native_taskbar_thumbnail_button_is_visible( + int taskbar_thumbnail_button, +); + +/// Frees the array and releases every handle it contains. +@ffi.Native< + ffi.Void Function(ffi.Pointer) +>() +external void native_taskbar_thumbnail_button_list_free( + ffi.Pointer list, +); + +/// Frees only the array; the caller takes over the handles. +@ffi.Native< + ffi.Void Function(ffi.Pointer) +>() +external void native_taskbar_thumbnail_button_list_release( + ffi.Pointer list, +); + +/// Unregisters a listener. Returns false if unknown. +@ffi.Native< + ffi.Bool Function(native_taskbar_thumbnail_button_t, native_listener_id_t) +>() +external bool native_taskbar_thumbnail_button_remove_listener( + int taskbar_thumbnail_button, + int listener_id, +); + +@ffi.Native() +external void native_taskbar_thumbnail_button_set_dismiss_on_click( + int taskbar_thumbnail_button, + bool is_dismiss_on_click, +); + +@ffi.Native() +external void native_taskbar_thumbnail_button_set_enabled( + int taskbar_thumbnail_button, + bool is_enabled, +); + +@ffi.Native() +external void native_taskbar_thumbnail_button_set_has_background( + int taskbar_thumbnail_button, + bool has_background, +); + +@ffi.Native< + ffi.Void Function(native_taskbar_thumbnail_button_t, native_image_t$2) +>() +external void native_taskbar_thumbnail_button_set_icon( + int taskbar_thumbnail_button, + int icon, +); + +@ffi.Native() +external void native_taskbar_thumbnail_button_set_interactive( + int taskbar_thumbnail_button, + bool is_interactive, +); + +@ffi.Native< + ffi.Void Function(native_taskbar_thumbnail_button_t, ffi.Pointer) +>() +external void native_taskbar_thumbnail_button_set_tooltip( + int taskbar_thumbnail_button, + ffi.Pointer tooltip, +); + +@ffi.Native() +external void native_taskbar_thumbnail_button_set_visible( + int taskbar_thumbnail_button, + bool is_visible, +); + /// Creates a TextField instance; release it with native_text_field_free(). @ffi.Native)>() external int native_text_field_create(ffi.Pointer text); @@ -3207,6 +3378,10 @@ external native_point_t native_window_get_position(int window); @ffi.Native() external native_size_t native_window_get_size(int window); +/// Caller owns the returned handle; release it with native_window_taskbar_free(). +@ffi.Native() +external int native_window_get_taskbar(int window); + /// Caller owns the returned string; free it with free_c_str(). @ffi.Native Function(native_window_t)>() external ffi.Pointer native_window_get_title(int window); @@ -3806,6 +3981,213 @@ void native_window_start_resizing( return _native_window_start_resizing(window, edge.value); } +/// Registers @p callback for every TaskbarEvent this WindowTaskbar emits. +/// @return the listener id, or NATIVE_INVALID_LISTENER_ID on failure. +@ffi.Native< + native_listener_id_t Function( + native_window_taskbar_t, + native_taskbar_event_callback_t, + ffi.Pointer, + native_release_user_data_t, + ) +>() +external int native_window_taskbar_add_listener( + int window_taskbar, + native_taskbar_event_callback_t callback, + ffi.Pointer user_data, + native_release_user_data_t release_user_data, +); + +/// Registers an asynchronous callback. Its event, borrowed handles and user_data +/// remain valid until event_delivery_complete is called, including after removal. +/// Every delivered payload must be acknowledged. Check is_active before invoking a queued callback. +@ffi.Native< + native_listener_id_t Function( + native_window_taskbar_t, + native_taskbar_event_callback_t_async, + ffi.Pointer, + native_release_user_data_t, + ) +>() +external int native_window_taskbar_add_listener_async( + int window_taskbar, + native_taskbar_event_callback_t_async callback, + ffi.Pointer user_data, + native_release_user_data_t release_user_data, +); + +@ffi.Native< + ffi.Bool Function(native_window_taskbar_t, native_taskbar_thumbnail_button_t) +>() +external bool native_window_taskbar_add_thumbnail_button( + int window_taskbar, + int button, +); + +@ffi.Native() +external void native_window_taskbar_clear_thumbnail_buttons(int window_taskbar); + +/// Releases the caller's reference. Safe to call with an invalid or +/// already-released handle. +@ffi.Native() +external void native_window_taskbar_free(int window_taskbar); + +@ffi.Native< + native_taskbar_thumbnail_button_list_t Function(native_window_taskbar_t) +>() +external native_taskbar_thumbnail_button_list_t +native_window_taskbar_get_all_thumbnail_buttons(int window_taskbar); + +@ffi.Native() +external int native_window_taskbar_get_max_thumbnail_button_count(); + +/// Caller owns the returned handle; release it with native_image_free(). +@ffi.Native() +external int native_window_taskbar_get_overlay_icon(int window_taskbar); + +/// Caller owns the returned string; free it with free_c_str(). +@ffi.Native Function(native_window_taskbar_t)>() +external ffi.Pointer +native_window_taskbar_get_overlay_icon_description(int window_taskbar); + +@ffi.Native( + symbol: 'native_window_taskbar_get_progress_state', +) +external int _native_window_taskbar_get_progress_state(int window_taskbar); + +native_taskbar_progress_state_t native_window_taskbar_get_progress_state( + Dartnative_window_taskbar_t window_taskbar, +) { + return native_taskbar_progress_state_t.fromValue( + _native_window_taskbar_get_progress_state(window_taskbar), + ); +} + +@ffi.Native() +external double native_window_taskbar_get_progress_value(int window_taskbar); + +/// Caller owns the returned handle; release it with native_taskbar_thumbnail_button_free(). +@ffi.Native< + native_taskbar_thumbnail_button_t Function( + native_window_taskbar_t, + ffi.UnsignedLong, + ) +>() +external int native_window_taskbar_get_thumbnail_button_at( + int window_taskbar, + int index, +); + +/// Caller owns the returned handle; release it with native_taskbar_thumbnail_button_free(). +@ffi.Native< + native_taskbar_thumbnail_button_t Function( + native_window_taskbar_t, + native_taskbar_thumbnail_button_id_t, + ) +>() +external int native_window_taskbar_get_thumbnail_button_by_id( + int window_taskbar, + int button_id, +); + +@ffi.Native() +external int native_window_taskbar_get_thumbnail_button_count( + int window_taskbar, +); + +@ffi.Native< + ffi.Bool Function( + native_window_taskbar_t, + ffi.UnsignedLong, + native_taskbar_thumbnail_button_t, + ) +>() +external bool native_window_taskbar_insert_thumbnail_button( + int window_taskbar, + int index, + int button, +); + +@ffi.Native() +external bool native_window_taskbar_is_supported(); + +/// Unregisters a listener. Returns false if unknown. +@ffi.Native() +external bool native_window_taskbar_remove_listener( + int window_taskbar, + int listener_id, +); + +@ffi.Native< + ffi.Bool Function(native_window_taskbar_t, native_taskbar_thumbnail_button_t) +>() +external bool native_window_taskbar_remove_thumbnail_button( + int window_taskbar, + int button, +); + +@ffi.Native() +external bool native_window_taskbar_remove_thumbnail_button_at( + int window_taskbar, + int index, +); + +@ffi.Native< + ffi.Bool Function( + native_window_taskbar_t, + native_taskbar_thumbnail_button_id_t, + ) +>() +external bool native_window_taskbar_remove_thumbnail_button_by_id( + int window_taskbar, + int button_id, +); + +@ffi.Native< + ffi.Bool Function( + native_window_taskbar_t, + native_image_t$2, + ffi.Pointer, + ) +>() +external bool native_window_taskbar_set_overlay_icon( + int window_taskbar, + int icon, + ffi.Pointer description, +); + +@ffi.Native( + symbol: 'native_window_taskbar_set_progress_state', +) +external bool _native_window_taskbar_set_progress_state( + int window_taskbar, + int state, +); + +bool native_window_taskbar_set_progress_state( + Dartnative_window_taskbar_t window_taskbar, + native_taskbar_progress_state_t state, +) { + return _native_window_taskbar_set_progress_state(window_taskbar, state.value); +} + +@ffi.Native() +external bool native_window_taskbar_set_progress_value( + int window_taskbar, + double progress, +); + +@ffi.Native< + ffi.Bool Function(native_window_taskbar_t, native_taskbar_flash_options_t) +>() +external bool native_window_taskbar_start_flashing( + int window_taskbar, + native_taskbar_flash_options_t options, +); + +@ffi.Native() +external bool native_window_taskbar_stop_flashing(int window_taskbar); + @ffi.Native() external bool native_window_undock(int window); @@ -3855,6 +4237,8 @@ const int NATIVE_INVALID_SECURE_STORAGE = 0; const int NATIVE_INVALID_SHORTCUT = 0; +const int NATIVE_INVALID_TASKBAR_THUMBNAIL_BUTTON = 0; + const int NATIVE_INVALID_TEXT_FIELD = 0; const int NATIVE_INVALID_TRAY_ICON = 0; @@ -3869,6 +4253,8 @@ const int NATIVE_INVALID_WINDOW_SHADOW = 0; const int NATIVE_INVALID_WINDOW_SHAPE = 0; +const int NATIVE_INVALID_WINDOW_TASKBAR = 0; + final class UnnamedStruct extends ffi.Struct { @ffi.Int() external int exit_code; @@ -3927,13 +4313,13 @@ final class UnnamedStruct$13 extends ffi.Struct { } final class UnnamedStruct$14 extends ffi.Struct { - @native_tray_icon_id_t() - external int tray_icon_id; + @native_taskbar_thumbnail_button_id_t() + external int button_id; static ffi.Pointer $allocate( ffi.Allocator $allocator, { - required int tray_icon_id, - }) => $allocator()..ref.tray_icon_id = tray_icon_id; + required int button_id, + }) => $allocator()..ref.button_id = button_id; } final class UnnamedStruct$15 extends ffi.Struct { @@ -3957,20 +4343,26 @@ final class UnnamedStruct$16 extends ffi.Struct { } final class UnnamedStruct$17 extends ffi.Struct { - external ffi.Pointer text; + @native_tray_icon_id_t() + external int tray_icon_id; static ffi.Pointer $allocate( ffi.Allocator $allocator, { - required ffi.Pointer text, - }) => $allocator()..ref.text = text; + required int tray_icon_id, + }) => $allocator()..ref.tray_icon_id = tray_icon_id; } final class UnnamedStruct$18 extends ffi.Struct { - external native_size_t new_size; + external ffi.Pointer text; + + static ffi.Pointer $allocate( + ffi.Allocator $allocator, { + required ffi.Pointer text, + }) => $allocator()..ref.text = text; } final class UnnamedStruct$19 extends ffi.Struct { - external native_point_t new_position; + external native_size_t new_size; } final class UnnamedStruct$2 extends ffi.Struct { @@ -3988,20 +4380,24 @@ final class UnnamedStruct$2 extends ffi.Struct { } final class UnnamedStruct$20 extends ffi.Struct { - external native_size_t new_size; + external native_point_t new_position; } final class UnnamedStruct$21 extends ffi.Struct { + external native_size_t new_size; +} + +final class UnnamedStruct$22 extends ffi.Struct { @native_event_request_t() external int request; - static ffi.Pointer $allocate( + static ffi.Pointer $allocate( ffi.Allocator $allocator, { required int request, - }) => $allocator()..ref.request = request; + }) => $allocator()..ref.request = request; } -final class UnnamedStruct$22 extends ffi.Struct { +final class UnnamedStruct$23 extends ffi.Struct { @ffi.UnsignedInt() external int propertyAsInt; @@ -4009,13 +4405,13 @@ final class UnnamedStruct$22 extends ffi.Struct { native_window_property_t.fromValue(propertyAsInt); set property(native_window_property_t value) => propertyAsInt = value.value; - static ffi.Pointer $allocate( + static ffi.Pointer $allocate( ffi.Allocator $allocator, { required native_window_property_t property, - }) => $allocator()..ref.property = property; + }) => $allocator()..ref.property = property; } -final class UnnamedStruct$23 extends ffi.Struct { +final class UnnamedStruct$24 extends ffi.Struct { @ffi.UnsignedInt() external int occlusion_stateAsInt; @@ -4024,13 +4420,13 @@ final class UnnamedStruct$23 extends ffi.Struct { set occlusion_state(native_window_occlusion_state_t value) => occlusion_stateAsInt = value.value; - static ffi.Pointer $allocate( + static ffi.Pointer $allocate( ffi.Allocator $allocator, { required native_window_occlusion_state_t occlusion_state, - }) => $allocator()..ref.occlusion_state = occlusion_state; + }) => $allocator()..ref.occlusion_state = occlusion_state; } -final class UnnamedStruct$24 extends ffi.Struct { +final class UnnamedStruct$25 extends ffi.Struct { @ffi.UnsignedInt() external int sideAsInt; @@ -4038,20 +4434,20 @@ final class UnnamedStruct$24 extends ffi.Struct { native_window_dock_side_t.fromValue(sideAsInt); set side(native_window_dock_side_t value) => sideAsInt = value.value; - static ffi.Pointer $allocate( + static ffi.Pointer $allocate( ffi.Allocator $allocator, { required native_window_dock_side_t side, - }) => $allocator()..ref.side = side; + }) => $allocator()..ref.side = side; } -final class UnnamedStruct$25 extends ffi.Struct { +final class UnnamedStruct$26 extends ffi.Struct { @ffi.Double() external double scale_factor; - static ffi.Pointer $allocate( + static ffi.Pointer $allocate( ffi.Allocator $allocator, { required double scale_factor, - }) => $allocator()..ref.scale_factor = scale_factor; + }) => $allocator()..ref.scale_factor = scale_factor; } final class UnnamedStruct$3 extends ffi.Struct { @@ -4137,19 +4533,25 @@ final class UnnamedUnion$1 extends ffi.Union { } final class UnnamedUnion$10 extends ffi.Union { - external UnnamedStruct$19 moved; + external UnnamedStruct$18 text_field_changed; - external UnnamedStruct$20 resized; + external UnnamedStruct$19 resized; +} + +final class UnnamedUnion$11 extends ffi.Union { + external UnnamedStruct$20 moved; + + external UnnamedStruct$21 resized; - external UnnamedStruct$21 close_requested; + external UnnamedStruct$22 close_requested; - external UnnamedStruct$22 property_changed; + external UnnamedStruct$23 property_changed; - external UnnamedStruct$23 occlusion_changed; + external UnnamedStruct$24 occlusion_changed; - external UnnamedStruct$24 docked; + external UnnamedStruct$25 docked; - external UnnamedStruct$25 scale_factor_changed; + external UnnamedStruct$26 scale_factor_changed; } final class UnnamedUnion$2 extends ffi.Union { @@ -4185,17 +4587,15 @@ final class UnnamedUnion$7 extends ffi.Union { } final class UnnamedUnion$8 extends ffi.Union { - external UnnamedStruct$14 clicked; - - external UnnamedStruct$15 right_clicked; - - external UnnamedStruct$16 double_clicked; + external UnnamedStruct$14 thumbnail_button_clicked; } final class UnnamedUnion$9 extends ffi.Union { - external UnnamedStruct$17 text_field_changed; + external UnnamedStruct$15 clicked; - external UnnamedStruct$18 resized; + external UnnamedStruct$16 right_clicked; + + external UnnamedStruct$17 double_clicked; } typedef native_application_event_callback_t = @@ -4961,6 +5361,8 @@ typedef native_image_t$4 = ffi.Uint64; typedef Dartnative_image_t$4 = int; typedef native_image_t$5 = ffi.Uint64; typedef Dartnative_image_t$5 = int; +typedef native_image_t$6 = ffi.Uint64; +typedef Dartnative_image_t$6 = int; /// Opaque ImageView handle. /// @@ -5837,6 +6239,162 @@ final class native_string_map_t extends ffi.Struct { ..ref.count = count; } +typedef native_taskbar_event_callback_t = + ffi.Pointer>; +typedef native_taskbar_event_callback_tFunction = ffi.Void Function( + ffi.Pointer event, + ffi.Pointer user_data, +); +typedef Dartnative_taskbar_event_callback_tFunction = void Function( + ffi.Pointer event, + ffi.Pointer user_data, +); +typedef native_taskbar_event_callback_t_async = + ffi.Pointer< + ffi.NativeFunction + >; +typedef native_taskbar_event_callback_t_asyncFunction = ffi.Void Function( + ffi.Pointer event, + native_event_delivery_t delivery, + ffi.Pointer user_data, +); +typedef Dartnative_taskbar_event_callback_t_asyncFunction = void Function( + ffi.Pointer event, + Dartnative_event_delivery_t delivery, + ffi.Pointer user_data, +); + +/// One TaskbarEvent, tagged by its concrete type. +/// +/// Synchronous callbacks borrow this payload until they return. Async callbacks +/// borrow it until event_delivery_complete. Copy anything needed after that. +final class native_taskbar_event_t extends ffi.Struct { + @ffi.UnsignedInt() + external int typeAsInt; + + native_taskbar_event_type_t get type => + native_taskbar_event_type_t.fromValue(typeAsInt); + set type(native_taskbar_event_type_t value) => typeAsInt = value.value; + + external UnnamedUnion$8 data; +} + +/// Which concrete TaskbarEvent arrived. +enum native_taskbar_event_type_t { + NATIVE_TASKBAR_EVENT_TYPE_THUMBNAIL_BUTTON_CLICKED(0); + + final int value; + const native_taskbar_event_type_t(this.value); + + static native_taskbar_event_type_t fromValue(int value) => switch (value) { + 0 => NATIVE_TASKBAR_EVENT_TYPE_THUMBNAIL_BUTTON_CLICKED, + _ => throw ArgumentError( + 'Unknown value for native_taskbar_event_type_t: $value', + ), + }; +} + +final class native_taskbar_flash_options_t extends ffi.Struct { + @ffi.UnsignedInt() + external int targetAsInt; + + native_taskbar_flash_target_t get target => + native_taskbar_flash_target_t.fromValue(targetAsInt); + set target(native_taskbar_flash_target_t value) => targetAsInt = value.value; + + @ffi.Int() + external int count; + + @ffi.Int() + external int timeout_ms; + + @ffi.Bool() + external bool stop_on_foreground; + + static ffi.Pointer $allocate( + ffi.Allocator $allocator, { + required native_taskbar_flash_target_t target, + required int count, + required int timeout_ms, + required bool stop_on_foreground, + }) => $allocator() + ..ref.target = target + ..ref.count = count + ..ref.timeout_ms = timeout_ms + ..ref.stop_on_foreground = stop_on_foreground; +} + +enum native_taskbar_flash_target_t { + NATIVE_TASKBAR_FLASH_TARGET_ALL(0), + NATIVE_TASKBAR_FLASH_TARGET_CAPTION(1), + NATIVE_TASKBAR_FLASH_TARGET_TASKBAR(2); + + final int value; + const native_taskbar_flash_target_t(this.value); + + static native_taskbar_flash_target_t fromValue(int value) => switch (value) { + 0 => NATIVE_TASKBAR_FLASH_TARGET_ALL, + 1 => NATIVE_TASKBAR_FLASH_TARGET_CAPTION, + 2 => NATIVE_TASKBAR_FLASH_TARGET_TASKBAR, + _ => throw ArgumentError( + 'Unknown value for native_taskbar_flash_target_t: $value', + ), + }; +} + +enum native_taskbar_progress_state_t { + NATIVE_TASKBAR_PROGRESS_STATE_NONE(0), + NATIVE_TASKBAR_PROGRESS_STATE_INDETERMINATE(1), + NATIVE_TASKBAR_PROGRESS_STATE_NORMAL(2), + NATIVE_TASKBAR_PROGRESS_STATE_PAUSED(3), + NATIVE_TASKBAR_PROGRESS_STATE_ERROR(4); + + final int value; + const native_taskbar_progress_state_t(this.value); + + static native_taskbar_progress_state_t fromValue(int value) => + switch (value) { + 0 => NATIVE_TASKBAR_PROGRESS_STATE_NONE, + 1 => NATIVE_TASKBAR_PROGRESS_STATE_INDETERMINATE, + 2 => NATIVE_TASKBAR_PROGRESS_STATE_NORMAL, + 3 => NATIVE_TASKBAR_PROGRESS_STATE_PAUSED, + 4 => NATIVE_TASKBAR_PROGRESS_STATE_ERROR, + _ => throw ArgumentError( + 'Unknown value for native_taskbar_progress_state_t: $value', + ), + }; +} + +typedef native_taskbar_thumbnail_button_id_t = ffi.UnsignedInt; +typedef Dartnative_taskbar_thumbnail_button_id_t = int; + +/// Owning list of TaskbarThumbnailButton handles. +final class native_taskbar_thumbnail_button_list_t extends ffi.Struct { + external ffi.Pointer + taskbar_thumbnail_buttons; + + @ffi.Long() + external int count; + + static ffi.Pointer $allocate( + ffi.Allocator $allocator, { + required ffi.Pointer + taskbar_thumbnail_buttons, + required int count, + }) => $allocator() + ..ref.taskbar_thumbnail_buttons = taskbar_thumbnail_buttons + ..ref.count = count; +} + +/// Opaque TaskbarThumbnailButton handle. +/// +/// A generational index into the library's handle table, NOT a pointer: +/// never dereference it, and compare it against NATIVE_INVALID_TASKBAR_THUMBNAIL_BUTTON rather than NULL. +/// Releasing a handle invalidates it; later calls fail safely instead of +/// touching freed memory. +typedef native_taskbar_thumbnail_button_t = ffi.Uint64; +typedef Dartnative_taskbar_thumbnail_button_t = int; + enum native_text_alignment_t { NATIVE_TEXT_ALIGNMENT_START(0), NATIVE_TEXT_ALIGNMENT_CENTER(1), @@ -5936,7 +6494,7 @@ final class native_tray_icon_event_t extends ffi.Struct { native_tray_icon_event_type_t.fromValue(typeAsInt); set type(native_tray_icon_event_type_t value) => typeAsInt = value.value; - external UnnamedUnion$8 data; + external UnnamedUnion$9 data; } /// Which concrete TrayIconEvent arrived. @@ -6125,7 +6683,7 @@ final class native_view_event_t extends ffi.Struct { @native_view_id_t() external int view_id; - external UnnamedUnion$9 data; + external UnnamedUnion$10 data; } /// Which concrete ViewEvent arrived. @@ -6382,7 +6940,7 @@ final class native_window_event_t extends ffi.Struct { @native_window_id_t() external int window_id; - external UnnamedUnion$10 data; + external UnnamedUnion$11 data; } /// Which concrete WindowEvent arrived. @@ -6575,3 +7133,14 @@ typedef native_window_t$7 = ffi.Uint64; typedef Dartnative_window_t$7 = int; typedef native_window_t$8 = ffi.Uint64; typedef Dartnative_window_t$8 = int; + +/// Opaque WindowTaskbar handle. +/// +/// A generational index into the library's handle table, NOT a pointer: +/// never dereference it, and compare it against NATIVE_INVALID_WINDOW_TASKBAR rather than NULL. +/// Releasing a handle invalidates it; later calls fail safely instead of +/// touching freed memory. +typedef native_window_taskbar_t = ffi.Uint64; +typedef Dartnative_window_taskbar_t = int; +typedef native_window_taskbar_t$1 = ffi.Uint64; +typedef Dartnative_window_taskbar_t$1 = int; diff --git a/bindings/dart/nativeapi/lib/src/generated.dart b/bindings/dart/nativeapi/lib/src/generated.dart index e6e3663e..ac772894 100644 --- a/bindings/dart/nativeapi/lib/src/generated.dart +++ b/bindings/dart/nativeapi/lib/src/generated.dart @@ -39,3 +39,4 @@ export 'window_drag_session.dart'; export 'window_manager.dart'; export 'window_shadow.dart'; export 'window_shape.dart'; +export 'window_taskbar.dart'; diff --git a/bindings/dart/nativeapi/lib/src/web/generated.dart b/bindings/dart/nativeapi/lib/src/web/generated.dart index e6e3663e..ac772894 100644 --- a/bindings/dart/nativeapi/lib/src/web/generated.dart +++ b/bindings/dart/nativeapi/lib/src/web/generated.dart @@ -39,3 +39,4 @@ export 'window_drag_session.dart'; export 'window_manager.dart'; export 'window_shadow.dart'; export 'window_shape.dart'; +export 'window_taskbar.dart'; diff --git a/bindings/dart/nativeapi/lib/src/web/window.dart b/bindings/dart/nativeapi/lib/src/web/window.dart index 006c5511..c08dd6ad 100644 --- a/bindings/dart/nativeapi/lib/src/web/window.dart +++ b/bindings/dart/nativeapi/lib/src/web/window.dart @@ -11,6 +11,7 @@ import 'foundation/geometry.dart'; import 'view.dart'; import 'window_shadow.dart'; import 'window_shape.dart'; +import 'window_taskbar.dart'; import 'support.dart'; import 'unsupported.dart'; @@ -553,6 +554,8 @@ class Window { bool get isVisibleInTaskbar => unsupported(); + WindowTaskbar? get taskbar => unsupported(); + bool setIgnoreMouseEvents(bool isIgnoreMouseEvents, bool forward) => unsupported(); diff --git a/bindings/dart/nativeapi/lib/src/web/window_taskbar.dart b/bindings/dart/nativeapi/lib/src/web/window_taskbar.dart new file mode 100644 index 00000000..837950e0 --- /dev/null +++ b/bindings/dart/nativeapi/lib/src/web/window_taskbar.dart @@ -0,0 +1,196 @@ +// AUTO-GENERATED. DO NOT EDIT. +// Any manual changes WILL BE LOST when this file is regenerated. + +// ignore_for_file: unused_import, unnecessary_import + +import 'dart:async'; + +import 'image.dart'; +import 'support.dart'; +import 'unsupported.dart'; + +typedef TaskbarThumbnailButtonId = int; + +enum TaskbarProgressState { + none(0), + indeterminate(1), + normal(2), + paused(3), + error(4); + + const TaskbarProgressState(this.value); + final int value; + + static TaskbarProgressState fromValue(int value) => switch (value) { + 0 => TaskbarProgressState.none, + 1 => TaskbarProgressState.indeterminate, + 2 => TaskbarProgressState.normal, + 3 => TaskbarProgressState.paused, + 4 => TaskbarProgressState.error, + _ => TaskbarProgressState.none, + }; +} + +enum TaskbarFlashTarget { + all(0), + caption(1), + taskbar(2); + + const TaskbarFlashTarget(this.value); + final int value; + + static TaskbarFlashTarget fromValue(int value) => switch (value) { + 0 => TaskbarFlashTarget.all, + 1 => TaskbarFlashTarget.caption, + 2 => TaskbarFlashTarget.taskbar, + _ => TaskbarFlashTarget.all, + }; +} + +class TaskbarFlashOptions { + const TaskbarFlashOptions({ + required this.target, + required this.count, + required this.timeoutMs, + required this.stopOnForeground, + }); + + final TaskbarFlashTarget target; + final int count; + final int timeoutMs; + final bool stopOnForeground; + + @override + bool operator ==(Object other) => + identical(this, other) || + (other is TaskbarFlashOptions && + other.target == target && + other.count == count && + other.timeoutMs == timeoutMs && + other.stopOnForeground == stopOnForeground); + + @override + int get hashCode => Object.hash(target, count, timeoutMs, stopOnForeground); + + @override + String toString() => + 'TaskbarFlashOptions(target: $target, count: $count, timeoutMs: $timeoutMs, stopOnForeground: $stopOnForeground)'; +} + +/// One `TaskbarEvent`, in its concrete form. +sealed class TaskbarEvent { + const TaskbarEvent(); +} + +final class TaskbarThumbnailButtonClickedEvent extends TaskbarEvent { + const TaskbarThumbnailButtonClickedEvent({required this.buttonId}); + + final TaskbarThumbnailButtonId buttonId; +} + +class TaskbarThumbnailButton { + TaskbarThumbnailButton.fromHandle(this.nativeHandle); + TaskbarThumbnailButton.borrowed(this.nativeHandle); + + final int nativeHandle; + + void dispose() => unsupported(); + + static TaskbarThumbnailButton? create(Image? icon, String tooltip) => + unsupported(); + + TaskbarThumbnailButtonId get id => unsupported(); + + set icon(Image? value) => unsupported(); + + Image? get icon => unsupported(); + + set tooltip(String value) => unsupported(); + + String? get tooltip => unsupported(); + + set isEnabled(bool value) => unsupported(); + + bool get isEnabled => unsupported(); + + set isVisible(bool value) => unsupported(); + + bool get isVisible => unsupported(); + + set isInteractive(bool value) => unsupported(); + + bool get isInteractive => unsupported(); + + set hasBackground(bool value) => unsupported(); + + bool get hasBackground => unsupported(); + + set isDismissOnClick(bool value) => unsupported(); + + bool get isDismissOnClick => unsupported(); + + ListenerId addListener(FutureOr Function(TaskbarEvent) callback) => + unsupported(); + + bool removeListener(ListenerId listenerId) => unsupported(); +} + +class WindowTaskbar { + WindowTaskbar.fromHandle(this.nativeHandle); + WindowTaskbar.borrowed(this.nativeHandle); + + final int nativeHandle; + + void dispose() => unsupported(); + + static bool isSupported() => unsupported(); + + static int getMaxThumbnailButtonCount() => unsupported(); + + bool setProgressState(TaskbarProgressState state) => unsupported(); + + TaskbarProgressState get progressState => unsupported(); + + bool setProgressValue(double progress) => unsupported(); + + double get progressValue => unsupported(); + + bool setOverlayIcon(Image? icon, String description) => unsupported(); + + Image? get overlayIcon => unsupported(); + + String? get overlayIconDescription => unsupported(); + + bool addThumbnailButton(TaskbarThumbnailButton? button) => unsupported(); + + bool insertThumbnailButton(int index, TaskbarThumbnailButton? button) => + unsupported(); + + bool removeThumbnailButton(TaskbarThumbnailButton? button) => unsupported(); + + bool removeThumbnailButtonById(TaskbarThumbnailButtonId buttonId) => + unsupported(); + + bool removeThumbnailButtonAt(int index) => unsupported(); + + void clearThumbnailButtons() => unsupported(); + + int get thumbnailButtonCount => unsupported(); + + TaskbarThumbnailButton? getThumbnailButtonAt(int index) => unsupported(); + + TaskbarThumbnailButton? getThumbnailButtonById( + TaskbarThumbnailButtonId buttonId, + ) => unsupported(); + + List get allThumbnailButtons => unsupported(); + + bool startFlashing(TaskbarFlashOptions options) => unsupported(); + + bool stopFlashing() => unsupported(); + + ListenerId addListener(FutureOr Function(TaskbarEvent) callback) => + unsupported(); + + bool removeListener(ListenerId listenerId) => unsupported(); +} diff --git a/bindings/dart/nativeapi/lib/src/window.dart b/bindings/dart/nativeapi/lib/src/window.dart index 1d51a13a..5184bed4 100644 --- a/bindings/dart/nativeapi/lib/src/window.dart +++ b/bindings/dart/nativeapi/lib/src/window.dart @@ -15,6 +15,7 @@ import 'foundation/geometry.dart'; import 'view.dart'; import 'window_shadow.dart'; import 'window_shape.dart'; +import 'window_taskbar.dart'; import 'support.dart'; @@ -1035,6 +1036,12 @@ class Window implements ffi.Finalizable { return c.native_window_is_visible_in_taskbar(nativeHandle); } + WindowTaskbar? get taskbar { + final handle = c.native_window_get_taskbar(nativeHandle); + if (handle == 0) return null; + return WindowTaskbar.fromHandle(handle); + } + bool setIgnoreMouseEvents(bool isIgnoreMouseEvents, bool forward) { return c.native_window_set_ignore_mouse_events( nativeHandle, diff --git a/bindings/dart/nativeapi/lib/src/window_taskbar.dart b/bindings/dart/nativeapi/lib/src/window_taskbar.dart new file mode 100644 index 00000000..37d37f14 --- /dev/null +++ b/bindings/dart/nativeapi/lib/src/window_taskbar.dart @@ -0,0 +1,522 @@ +// AUTO-GENERATED. DO NOT EDIT. +// Any manual changes WILL BE LOST when this file is regenerated. + +// ignore_for_file: unused_import, unnecessary_import + +import 'dart:async'; +import 'dart:ffi' as ffi; + +import 'package:cnativeapi/cnativeapi.dart' as c; +import 'package:ffi/ffi.dart' as pkg_ffi; + +import 'image.dart'; + +import 'support.dart'; + +import 'callbacks.dart'; + +typedef TaskbarThumbnailButtonId = int; + +enum TaskbarProgressState { + none(0), + indeterminate(1), + normal(2), + paused(3), + error(4); + + const TaskbarProgressState(this.value); + final int value; + + static TaskbarProgressState fromValue(int value) => switch (value) { + 0 => TaskbarProgressState.none, + 1 => TaskbarProgressState.indeterminate, + 2 => TaskbarProgressState.normal, + 3 => TaskbarProgressState.paused, + 4 => TaskbarProgressState.error, + _ => TaskbarProgressState.none, + }; + + c.native_taskbar_progress_state_t get raw => + c.native_taskbar_progress_state_t.fromValue(value); +} + +enum TaskbarFlashTarget { + all(0), + caption(1), + taskbar(2); + + const TaskbarFlashTarget(this.value); + final int value; + + static TaskbarFlashTarget fromValue(int value) => switch (value) { + 0 => TaskbarFlashTarget.all, + 1 => TaskbarFlashTarget.caption, + 2 => TaskbarFlashTarget.taskbar, + _ => TaskbarFlashTarget.all, + }; + + c.native_taskbar_flash_target_t get raw => + c.native_taskbar_flash_target_t.fromValue(value); +} + +class TaskbarFlashOptions { + const TaskbarFlashOptions({ + required this.target, + required this.count, + required this.timeoutMs, + required this.stopOnForeground, + }); + + final TaskbarFlashTarget target; + final int count; + final int timeoutMs; + final bool stopOnForeground; + + @override + bool operator ==(Object other) => + identical(this, other) || + (other is TaskbarFlashOptions && + other.target == target && + other.count == count && + other.timeoutMs == timeoutMs && + other.stopOnForeground == stopOnForeground); + + @override + int get hashCode => Object.hash(target, count, timeoutMs, stopOnForeground); + + @override + String toString() => + 'TaskbarFlashOptions(target: $target, count: $count, timeoutMs: $timeoutMs, stopOnForeground: $stopOnForeground)'; + + factory TaskbarFlashOptions.fromNative( + c.native_taskbar_flash_options_t raw, + ) => TaskbarFlashOptions( + target: TaskbarFlashTarget.fromValue(raw.targetAsInt), + count: raw.count, + timeoutMs: raw.timeout_ms, + stopOnForeground: raw.stop_on_foreground, + ); + + /// Allocates the C form; free it with [freeNative]. + ffi.Pointer allocNative() { + final pointer = pkg_ffi.calloc(); + pointer.ref.targetAsInt = target.value; + pointer.ref.count = count; + pointer.ref.timeout_ms = timeoutMs; + pointer.ref.stop_on_foreground = stopOnForeground; + return pointer; + } + + static void freeNative( + ffi.Pointer pointer, + ) { + pkg_ffi.calloc.free(pointer); + } +} + +/// One `TaskbarEvent`, in its concrete form. +sealed class TaskbarEvent { + const TaskbarEvent(); + + /// Reads the event out of its C form. Returns null for a variant this + /// binding does not know about. + static TaskbarEvent? fromNative(c.native_taskbar_event_t raw) { + if (raw.typeAsInt == + c + .native_taskbar_event_type_t + .NATIVE_TASKBAR_EVENT_TYPE_THUMBNAIL_BUTTON_CLICKED + .value) { + return TaskbarThumbnailButtonClickedEvent( + buttonId: raw.data.thumbnail_button_clicked.button_id, + ); + } + return null; + } +} + +final class TaskbarThumbnailButtonClickedEvent extends TaskbarEvent { + const TaskbarThumbnailButtonClickedEvent({required this.buttonId}); + + final TaskbarThumbnailButtonId buttonId; +} + +class TaskbarThumbnailButton implements ffi.Finalizable { + /// Adopts a handle returned by the C API and releases it when this + /// object becomes unreachable. + TaskbarThumbnailButton.fromHandle(this.nativeHandle) { + _finalizer.attach( + this, + ffi.Pointer.fromAddress(nativeHandle), + detach: this, + ); + } + + /// Wraps a handle owned elsewhere; releasing it stays the owner's job. + TaskbarThumbnailButton.borrowed(this.nativeHandle); + + /// The underlying handle-table entry. + final int nativeHandle; + + static final _finalizer = ffi.NativeFinalizer( + ffi.Native.addressOf< + ffi.NativeFunction)> + >(c.native_handle_finalize), + ); + + /// Releases the handle now instead of at collection. + void dispose() { + _finalizer.detach(this); + c.native_taskbar_thumbnail_button_free(nativeHandle); + } + + /// Creates a new `TaskbarThumbnailButton`; returns null if the native side failed. + static TaskbarThumbnailButton? create(Image? icon, String tooltip) { + final tooltipNative = tooltip.toNativeUtf8().cast(); + final handle = c.native_taskbar_thumbnail_button_create( + icon?.nativeHandle ?? 0, + tooltipNative, + ); + pkg_ffi.calloc.free(tooltipNative); + if (handle == 0) return null; + return TaskbarThumbnailButton.fromHandle(handle); + } + + TaskbarThumbnailButtonId get id { + return c.native_taskbar_thumbnail_button_get_id(nativeHandle); + } + + set icon(Image? value) { + c.native_taskbar_thumbnail_button_set_icon( + nativeHandle, + value?.nativeHandle ?? 0, + ); + } + + Image? get icon { + final handle = c.native_taskbar_thumbnail_button_get_icon(nativeHandle); + if (handle == 0) return null; + return Image.fromHandle(handle); + } + + set tooltip(String value) { + final valueNative = value.toNativeUtf8().cast(); + c.native_taskbar_thumbnail_button_set_tooltip(nativeHandle, valueNative); + pkg_ffi.calloc.free(valueNative); + } + + String? get tooltip { + final resultPointer = c.native_taskbar_thumbnail_button_get_tooltip( + nativeHandle, + ); + if (resultPointer == ffi.nullptr) return null; + final result = resultPointer.cast().toDartString(); + c.free_c_str(resultPointer); + return result; + } + + set isEnabled(bool value) { + c.native_taskbar_thumbnail_button_set_enabled(nativeHandle, value); + } + + bool get isEnabled { + return c.native_taskbar_thumbnail_button_is_enabled(nativeHandle); + } + + set isVisible(bool value) { + c.native_taskbar_thumbnail_button_set_visible(nativeHandle, value); + } + + bool get isVisible { + return c.native_taskbar_thumbnail_button_is_visible(nativeHandle); + } + + set isInteractive(bool value) { + c.native_taskbar_thumbnail_button_set_interactive(nativeHandle, value); + } + + bool get isInteractive { + return c.native_taskbar_thumbnail_button_is_interactive(nativeHandle); + } + + set hasBackground(bool value) { + c.native_taskbar_thumbnail_button_set_has_background(nativeHandle, value); + } + + bool get hasBackground { + return c.native_taskbar_thumbnail_button_has_background(nativeHandle); + } + + set isDismissOnClick(bool value) { + c.native_taskbar_thumbnail_button_set_dismiss_on_click(nativeHandle, value); + } + + bool get isDismissOnClick { + return c.native_taskbar_thumbnail_button_is_dismiss_on_click(nativeHandle); + } + + /// Registers [callback] for every `TaskbarEvent` this `TaskbarThumbnailButton` emits. + /// + /// Delivered on the registering isolate, including events from native UI threads. + /// The callback may return a Future; borrowed handles stay valid until it completes. + /// Events queued before removal are skipped if their callback has not started. + ListenerId addListener(FutureOr Function(TaskbarEvent) callback) { + final callable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Uint64, + ffi.Pointer, + ) + >.listener(( + ffi.Pointer event, + int delivery, + ffi.Pointer _, + ) { + unawaited( + NativeCallbacks.deliverEvent( + delivery, + () => event == ffi.nullptr + ? null + : TaskbarEvent.fromNative( + event.cast().ref, + ), + callback, + ), + ); + }); + return c.native_taskbar_thumbnail_button_add_listener_async( + nativeHandle, + callable.nativeFunction.cast(), + NativeCallbacks.userData(callable), + NativeCallbacks.release, + ); + } + + /// Unregisters a listener. Returns false if unknown. + bool removeListener(ListenerId listenerId) => + c.native_taskbar_thumbnail_button_remove_listener( + nativeHandle, + listenerId, + ); +} + +class WindowTaskbar implements ffi.Finalizable { + /// Adopts a handle returned by the C API and releases it when this + /// object becomes unreachable. + WindowTaskbar.fromHandle(this.nativeHandle) { + _finalizer.attach( + this, + ffi.Pointer.fromAddress(nativeHandle), + detach: this, + ); + } + + /// Wraps a handle owned elsewhere; releasing it stays the owner's job. + WindowTaskbar.borrowed(this.nativeHandle); + + /// The underlying handle-table entry. + final int nativeHandle; + + static final _finalizer = ffi.NativeFinalizer( + ffi.Native.addressOf< + ffi.NativeFunction)> + >(c.native_handle_finalize), + ); + + /// Releases the handle now instead of at collection. + void dispose() { + _finalizer.detach(this); + c.native_window_taskbar_free(nativeHandle); + } + + static bool isSupported() { + return c.native_window_taskbar_is_supported(); + } + + static int getMaxThumbnailButtonCount() { + return c.native_window_taskbar_get_max_thumbnail_button_count(); + } + + bool setProgressState(TaskbarProgressState state) { + return c.native_window_taskbar_set_progress_state(nativeHandle, state.raw); + } + + TaskbarProgressState get progressState { + final raw = c.native_window_taskbar_get_progress_state(nativeHandle); + return TaskbarProgressState.fromValue(raw.value); + } + + bool setProgressValue(double progress) { + return c.native_window_taskbar_set_progress_value(nativeHandle, progress); + } + + double get progressValue { + return c.native_window_taskbar_get_progress_value(nativeHandle); + } + + bool setOverlayIcon(Image? icon, String description) { + final descriptionNative = description.toNativeUtf8().cast(); + final result = c.native_window_taskbar_set_overlay_icon( + nativeHandle, + icon?.nativeHandle ?? 0, + descriptionNative, + ); + pkg_ffi.calloc.free(descriptionNative); + return result; + } + + Image? get overlayIcon { + final handle = c.native_window_taskbar_get_overlay_icon(nativeHandle); + if (handle == 0) return null; + return Image.fromHandle(handle); + } + + String? get overlayIconDescription { + final resultPointer = c.native_window_taskbar_get_overlay_icon_description( + nativeHandle, + ); + if (resultPointer == ffi.nullptr) return null; + final result = resultPointer.cast().toDartString(); + c.free_c_str(resultPointer); + return result; + } + + bool addThumbnailButton(TaskbarThumbnailButton? button) { + return c.native_window_taskbar_add_thumbnail_button( + nativeHandle, + button?.nativeHandle ?? 0, + ); + } + + bool insertThumbnailButton(int index, TaskbarThumbnailButton? button) { + return c.native_window_taskbar_insert_thumbnail_button( + nativeHandle, + index, + button?.nativeHandle ?? 0, + ); + } + + bool removeThumbnailButton(TaskbarThumbnailButton? button) { + return c.native_window_taskbar_remove_thumbnail_button( + nativeHandle, + button?.nativeHandle ?? 0, + ); + } + + bool removeThumbnailButtonById(TaskbarThumbnailButtonId buttonId) { + return c.native_window_taskbar_remove_thumbnail_button_by_id( + nativeHandle, + buttonId, + ); + } + + bool removeThumbnailButtonAt(int index) { + return c.native_window_taskbar_remove_thumbnail_button_at( + nativeHandle, + index, + ); + } + + void clearThumbnailButtons() { + c.native_window_taskbar_clear_thumbnail_buttons(nativeHandle); + } + + int get thumbnailButtonCount { + return c.native_window_taskbar_get_thumbnail_button_count(nativeHandle); + } + + TaskbarThumbnailButton? getThumbnailButtonAt(int index) { + final handle = c.native_window_taskbar_get_thumbnail_button_at( + nativeHandle, + index, + ); + if (handle == 0) return null; + return TaskbarThumbnailButton.fromHandle(handle); + } + + TaskbarThumbnailButton? getThumbnailButtonById( + TaskbarThumbnailButtonId buttonId, + ) { + final handle = c.native_window_taskbar_get_thumbnail_button_by_id( + nativeHandle, + buttonId, + ); + if (handle == 0) return null; + return TaskbarThumbnailButton.fromHandle(handle); + } + + List get allThumbnailButtons { + final list = c.native_window_taskbar_get_all_thumbnail_buttons( + nativeHandle, + ); + final items = []; + for (var i = 0; i < list.count; i++) { + items.add( + TaskbarThumbnailButton.fromHandle(list.taskbar_thumbnail_buttons[i]), + ); + } + final listPointer = pkg_ffi + .calloc(); + listPointer.ref = list; + // The handles now belong to `items`; free just the array. + c.native_taskbar_thumbnail_button_list_release(listPointer); + pkg_ffi.calloc.free(listPointer); + return items; + } + + bool startFlashing(TaskbarFlashOptions options) { + final optionsPointer = options.allocNative(); + final result = c.native_window_taskbar_start_flashing( + nativeHandle, + optionsPointer.ref, + ); + TaskbarFlashOptions.freeNative(optionsPointer); + return result; + } + + bool stopFlashing() { + return c.native_window_taskbar_stop_flashing(nativeHandle); + } + + /// Registers [callback] for every `TaskbarEvent` this `WindowTaskbar` emits. + /// + /// Delivered on the registering isolate, including events from native UI threads. + /// The callback may return a Future; borrowed handles stay valid until it completes. + /// Events queued before removal are skipped if their callback has not started. + ListenerId addListener(FutureOr Function(TaskbarEvent) callback) { + final callable = + ffi.NativeCallable< + ffi.Void Function( + ffi.Pointer, + ffi.Uint64, + ffi.Pointer, + ) + >.listener(( + ffi.Pointer event, + int delivery, + ffi.Pointer _, + ) { + unawaited( + NativeCallbacks.deliverEvent( + delivery, + () => event == ffi.nullptr + ? null + : TaskbarEvent.fromNative( + event.cast().ref, + ), + callback, + ), + ); + }); + return c.native_window_taskbar_add_listener_async( + nativeHandle, + callable.nativeFunction.cast(), + NativeCallbacks.userData(callable), + NativeCallbacks.release, + ); + } + + /// Unregisters a listener. Returns false if unknown. + bool removeListener(ListenerId listenerId) => + c.native_window_taskbar_remove_listener(nativeHandle, listenerId); +} diff --git a/bindings/go/bridge.gen.h b/bindings/go/bridge.gen.h index 5b392ced..06e79313 100644 --- a/bindings/go/bridge.gen.h +++ b/bindings/go/bridge.gen.h @@ -34,6 +34,10 @@ static inline native_size_t go_native_view_event_t_resized_NewSize(const native_ extern void goEvent_native_view_event_t(uintptr_t handle, native_view_event_t* event); static inline void go_native_view_event_callback_t(const native_view_event_t* event, void* data) { goEvent_native_view_event_t(*(uintptr_t*)data, (native_view_event_t*)event); } static inline native_view_event_callback_t go_get_native_view_event_callback_t(void) { return go_native_view_event_callback_t; } +static inline native_taskbar_thumbnail_button_id_t go_native_taskbar_event_t_thumbnail_button_clicked_ButtonId(const native_taskbar_event_t* event) { return event->data.thumbnail_button_clicked.button_id; } +extern void goEvent_native_taskbar_event_t(uintptr_t handle, native_taskbar_event_t* event); +static inline void go_native_taskbar_event_callback_t(const native_taskbar_event_t* event, void* data) { goEvent_native_taskbar_event_t(*(uintptr_t*)data, (native_taskbar_event_t*)event); } +static inline native_taskbar_event_callback_t go_get_native_taskbar_event_callback_t(void) { return go_native_taskbar_event_callback_t; } static inline native_point_t go_native_window_event_t_moved_NewPosition(const native_window_event_t* event) { return event->data.moved.new_position; } static inline native_size_t go_native_window_event_t_resized_NewSize(const native_window_event_t* event) { return event->data.resized.new_size; } static inline native_event_request_t go_native_window_event_t_close_requested_Request(const native_window_event_t* event) { return event->data.close_requested.request; } diff --git a/bindings/go/nativeapi.gen.go b/bindings/go/nativeapi.gen.go index b7e65730..27ba806d 100644 --- a/bindings/go/nativeapi.gen.go +++ b/bindings/go/nativeapi.gen.go @@ -3402,6 +3402,462 @@ func (iv *ImageView) Image() *Image { return wrapImage(uint64(result), false) } +// TaskbarThumbnailButtonID identifies a native object. +type TaskbarThumbnailButtonID uint32 + +// TaskbarProgressState represents native TaskbarProgressState values. +type TaskbarProgressState int32 + +const ( + TaskbarProgressStateNone TaskbarProgressState = 0 + TaskbarProgressStateIndeterminate TaskbarProgressState = 1 + TaskbarProgressStateNormal TaskbarProgressState = 2 + TaskbarProgressStatePaused TaskbarProgressState = 3 + TaskbarProgressStateError TaskbarProgressState = 4 +) + +// TaskbarFlashTarget represents native TaskbarFlashTarget values. +type TaskbarFlashTarget int32 + +const ( + TaskbarFlashTargetAll TaskbarFlashTarget = 0 + TaskbarFlashTargetCaption TaskbarFlashTarget = 1 + TaskbarFlashTargetTaskbar TaskbarFlashTarget = 2 +) + +// TaskbarFlashOptions holds the native TaskbarFlashOptions value. +type TaskbarFlashOptions struct { + Target TaskbarFlashTarget + Count int32 + TimeoutMs int32 + StopOnForeground bool +} + +func fromCTaskbarFlashOptions(raw C.native_taskbar_flash_options_t) TaskbarFlashOptions { + return TaskbarFlashOptions{ + Target: TaskbarFlashTarget(raw.target), + Count: int32(raw.count), + TimeoutMs: int32(raw.timeout_ms), + StopOnForeground: bool(raw.stop_on_foreground), + } +} +func toCTaskbarFlashOptions(value TaskbarFlashOptions) (C.native_taskbar_flash_options_t, func()) { + var raw C.native_taskbar_flash_options_t + var cleanup []func() + raw.target = C.native_taskbar_flash_target_t(value.Target) + raw.count = C.int(value.Count) + raw.timeout_ms = C.int(value.TimeoutMs) + raw.stop_on_foreground = C.bool(value.StopOnForeground) + return raw, func() { + for i := len(cleanup) - 1; i >= 0; i-- { + cleanup[i]() + } + } +} + +// TaskbarEventType identifies the active event variant. +type TaskbarEventType int32 + +const ( + TaskbarEventThumbnailButtonClicked TaskbarEventType = 0 +) + +// TaskbarEvent copies an event payload. Handle fields are borrowed until the callback returns. +// Only fields belonging to Type are populated. +type TaskbarEvent struct { + Type TaskbarEventType + ButtonID TaskbarThumbnailButtonID +} + +func fromCTaskbarEvent(raw *C.native_taskbar_event_t) TaskbarEvent { + value := TaskbarEvent{Type: TaskbarEventType(raw._type)} + switch value.Type { + case TaskbarEventThumbnailButtonClicked: + value.ButtonID = TaskbarThumbnailButtonID(C.go_native_taskbar_event_t_thumbnail_button_clicked_ButtonId(raw)) + } + return value +} + +//export goEvent_native_taskbar_event_t +func goEvent_native_taskbar_event_t(handle C.uintptr_t, event *C.native_taskbar_event_t) { + cgo.Handle(handle).Value().(func(TaskbarEvent))(fromCTaskbarEvent(event)) +} + +// TaskbarThumbnailButton owns a native handle. Call Release on the UI thread when done. +// Copies share ownership state; borrowed event handles must not outlive their callback. +type TaskbarThumbnailButton struct{ *nativeHandle } + +func wrapTaskbarThumbnailButton(value uint64, borrowed bool) *TaskbarThumbnailButton { + if value == 0 { + return nil + } + return wrapTaskbarThumbnailButtonState(&nativeHandle{value: value, borrowed: borrowed}) +} +func wrapTaskbarThumbnailButtonState(state *nativeHandle) *TaskbarThumbnailButton { + return &TaskbarThumbnailButton{state} +} +func (ttb *TaskbarThumbnailButton) nativeHandleValue() uint64 { + if ttb == nil || ttb.nativeHandle == nil { + return 0 + } + return ttb.nativeHandle.nativeHandleValue() +} + +// Release drops this owned reference. Repeated calls and nil receivers are safe. +func (ttb *TaskbarThumbnailButton) Release() { + if ttb.nativeHandleValue() == 0 || ttb.borrowed { + return + } + C.native_taskbar_thumbnail_button_free(C.native_taskbar_thumbnail_button_t(ttb.value)) + ttb.value = 0 +} + +// NewTaskbarThumbnailButton creates an owned TaskbarThumbnailButton. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func NewTaskbarThumbnailButton(icon *Image, tooltip string) (*TaskbarThumbnailButton, error) { + cArg1 := C.CString(tooltip) + defer C.free(unsafe.Pointer(cArg1)) + result := C.native_taskbar_thumbnail_button_create(C.native_image_t(icon.nativeHandleValue()), cArg1) + if result == 0 { + return nil, nativeError("NewTaskbarThumbnailButton") + } + return wrapTaskbarThumbnailButton(uint64(result), false), nil +} + +// ID invokes the native GetId operation. +func (ttb *TaskbarThumbnailButton) ID() TaskbarThumbnailButtonID { + result := C.native_taskbar_thumbnail_button_get_id(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue())) + return TaskbarThumbnailButtonID(result) +} + +// SetIcon invokes the native SetIcon operation. +func (ttb *TaskbarThumbnailButton) SetIcon(icon *Image) { + C.native_taskbar_thumbnail_button_set_icon(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue()), C.native_image_t(icon.nativeHandleValue())) +} + +// Icon invokes the native GetIcon operation. +// The returned reference is owned; nil means no object is available. +func (ttb *TaskbarThumbnailButton) Icon() *Image { + result := C.native_taskbar_thumbnail_button_get_icon(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue())) + return wrapImage(uint64(result), false) +} + +// SetTooltip invokes the native SetTooltip operation. +func (ttb *TaskbarThumbnailButton) SetTooltip(tooltip string) { + cArg0 := C.CString(tooltip) + defer C.free(unsafe.Pointer(cArg0)) + C.native_taskbar_thumbnail_button_set_tooltip(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue()), cArg0) +} + +// Tooltip invokes the native GetTooltip operation. +func (ttb *TaskbarThumbnailButton) Tooltip() string { + result := C.native_taskbar_thumbnail_button_get_tooltip(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue())) + defer C.free_c_str(result) + return C.GoString(result) +} + +// SetEnabled invokes the native SetEnabled operation. +func (ttb *TaskbarThumbnailButton) SetEnabled(isEnabled bool) { + C.native_taskbar_thumbnail_button_set_enabled(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue()), C.bool(isEnabled)) +} + +// IsEnabled invokes the native IsEnabled operation. +func (ttb *TaskbarThumbnailButton) IsEnabled() bool { + result := C.native_taskbar_thumbnail_button_is_enabled(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue())) + return bool(result) +} + +// SetVisible invokes the native SetVisible operation. +func (ttb *TaskbarThumbnailButton) SetVisible(isVisible bool) { + C.native_taskbar_thumbnail_button_set_visible(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue()), C.bool(isVisible)) +} + +// IsVisible invokes the native IsVisible operation. +func (ttb *TaskbarThumbnailButton) IsVisible() bool { + result := C.native_taskbar_thumbnail_button_is_visible(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue())) + return bool(result) +} + +// SetInteractive invokes the native SetInteractive operation. +func (ttb *TaskbarThumbnailButton) SetInteractive(isInteractive bool) { + C.native_taskbar_thumbnail_button_set_interactive(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue()), C.bool(isInteractive)) +} + +// IsInteractive invokes the native IsInteractive operation. +func (ttb *TaskbarThumbnailButton) IsInteractive() bool { + result := C.native_taskbar_thumbnail_button_is_interactive(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue())) + return bool(result) +} + +// SetHasBackground invokes the native SetHasBackground operation. +func (ttb *TaskbarThumbnailButton) SetHasBackground(hasBackground bool) { + C.native_taskbar_thumbnail_button_set_has_background(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue()), C.bool(hasBackground)) +} + +// HasBackground invokes the native HasBackground operation. +func (ttb *TaskbarThumbnailButton) HasBackground() bool { + result := C.native_taskbar_thumbnail_button_has_background(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue())) + return bool(result) +} + +// SetDismissOnClick invokes the native SetDismissOnClick operation. +func (ttb *TaskbarThumbnailButton) SetDismissOnClick(isDismissOnClick bool) { + C.native_taskbar_thumbnail_button_set_dismiss_on_click(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue()), C.bool(isDismissOnClick)) +} + +// IsDismissOnClick invokes the native IsDismissOnClick operation. +func (ttb *TaskbarThumbnailButton) IsDismissOnClick() bool { + result := C.native_taskbar_thumbnail_button_is_dismiss_on_click(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue())) + return bool(result) +} + +// AddListener invokes callback synchronously on the native UI thread. +// Remove the listener before releasing its owner. A nil callback is invalid. +func (ttb *TaskbarThumbnailButton) AddListener(callback func(TaskbarEvent)) (ListenerID, error) { + if callback == nil { + return 0, invalidArgument("TaskbarThumbnailButton.AddListener") + } + data := newCallback(callback) + id := C.native_taskbar_thumbnail_button_add_listener(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue()), C.native_taskbar_event_callback_t(C.go_get_native_taskbar_event_callback_t()), data, C.native_release_user_data_t(C.go_get_release_callback())) + if id == 0 { + return 0, nativeError("TaskbarThumbnailButton.AddListener") + } + return ListenerID(id), nil +} + +// RemoveListener unregisters id; an unknown id returns an error. +func (ttb *TaskbarThumbnailButton) RemoveListener(id ListenerID) error { + if !bool(C.native_taskbar_thumbnail_button_remove_listener(C.native_taskbar_thumbnail_button_t(ttb.nativeHandleValue()), C.native_listener_id_t(id))) { + return nativeError("TaskbarThumbnailButton.RemoveListener") + } + return nil +} + +// WindowTaskbar owns a native handle. Call Release on the UI thread when done. +// Copies share ownership state; borrowed event handles must not outlive their callback. +type WindowTaskbar struct{ *nativeHandle } + +func wrapWindowTaskbar(value uint64, borrowed bool) *WindowTaskbar { + if value == 0 { + return nil + } + return wrapWindowTaskbarState(&nativeHandle{value: value, borrowed: borrowed}) +} +func wrapWindowTaskbarState(state *nativeHandle) *WindowTaskbar { + return &WindowTaskbar{state} +} +func (wt *WindowTaskbar) nativeHandleValue() uint64 { + if wt == nil || wt.nativeHandle == nil { + return 0 + } + return wt.nativeHandle.nativeHandleValue() +} + +// Release drops this owned reference. Repeated calls and nil receivers are safe. +func (wt *WindowTaskbar) Release() { + if wt.nativeHandleValue() == 0 || wt.borrowed { + return + } + C.native_window_taskbar_free(C.native_window_taskbar_t(wt.value)) + wt.value = 0 +} + +// WindowTaskbarIsSupported invokes the native IsSupported operation. +func WindowTaskbarIsSupported() bool { + result := C.native_window_taskbar_is_supported() + return bool(result) +} + +// WindowTaskbarMaxThumbnailButtonCount invokes the native GetMaxThumbnailButtonCount operation. +func WindowTaskbarMaxThumbnailButtonCount() uint64 { + result := C.native_window_taskbar_get_max_thumbnail_button_count() + return uint64(result) +} + +// SetProgressState invokes the native SetProgressState operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) SetProgressState(state TaskbarProgressState) error { + result := C.native_window_taskbar_set_progress_state(C.native_window_taskbar_t(wt.nativeHandleValue()), C.native_taskbar_progress_state_t(state)) + if !bool(result) { + return nativeError("WindowTaskbar.SetProgressState") + } + return nil +} + +// ProgressState invokes the native GetProgressState operation. +func (wt *WindowTaskbar) ProgressState() TaskbarProgressState { + result := C.native_window_taskbar_get_progress_state(C.native_window_taskbar_t(wt.nativeHandleValue())) + return TaskbarProgressState(result) +} + +// SetProgressValue invokes the native SetProgressValue operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) SetProgressValue(progress float64) error { + result := C.native_window_taskbar_set_progress_value(C.native_window_taskbar_t(wt.nativeHandleValue()), C.double(progress)) + if !bool(result) { + return nativeError("WindowTaskbar.SetProgressValue") + } + return nil +} + +// ProgressValue invokes the native GetProgressValue operation. +func (wt *WindowTaskbar) ProgressValue() float64 { + result := C.native_window_taskbar_get_progress_value(C.native_window_taskbar_t(wt.nativeHandleValue())) + return float64(result) +} + +// SetOverlayIcon invokes the native SetOverlayIcon operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) SetOverlayIcon(icon *Image, description string) error { + cArg1 := C.CString(description) + defer C.free(unsafe.Pointer(cArg1)) + result := C.native_window_taskbar_set_overlay_icon(C.native_window_taskbar_t(wt.nativeHandleValue()), C.native_image_t(icon.nativeHandleValue()), cArg1) + if !bool(result) { + return nativeError("WindowTaskbar.SetOverlayIcon") + } + return nil +} + +// OverlayIcon invokes the native GetOverlayIcon operation. +// The returned reference is owned; nil means no object is available. +func (wt *WindowTaskbar) OverlayIcon() *Image { + result := C.native_window_taskbar_get_overlay_icon(C.native_window_taskbar_t(wt.nativeHandleValue())) + return wrapImage(uint64(result), false) +} + +// OverlayIconDescription invokes the native GetOverlayIconDescription operation. +func (wt *WindowTaskbar) OverlayIconDescription() string { + result := C.native_window_taskbar_get_overlay_icon_description(C.native_window_taskbar_t(wt.nativeHandleValue())) + defer C.free_c_str(result) + return C.GoString(result) +} + +// AddThumbnailButton invokes the native AddThumbnailButton operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) AddThumbnailButton(button *TaskbarThumbnailButton) error { + result := C.native_window_taskbar_add_thumbnail_button(C.native_window_taskbar_t(wt.nativeHandleValue()), C.native_taskbar_thumbnail_button_t(button.nativeHandleValue())) + if !bool(result) { + return nativeError("WindowTaskbar.AddThumbnailButton") + } + return nil +} + +// InsertThumbnailButton invokes the native InsertThumbnailButton operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) InsertThumbnailButton(index uint64, button *TaskbarThumbnailButton) error { + result := C.native_window_taskbar_insert_thumbnail_button(C.native_window_taskbar_t(wt.nativeHandleValue()), C.ulong(index), C.native_taskbar_thumbnail_button_t(button.nativeHandleValue())) + if !bool(result) { + return nativeError("WindowTaskbar.InsertThumbnailButton") + } + return nil +} + +// RemoveThumbnailButton invokes the native RemoveThumbnailButton operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) RemoveThumbnailButton(button *TaskbarThumbnailButton) error { + result := C.native_window_taskbar_remove_thumbnail_button(C.native_window_taskbar_t(wt.nativeHandleValue()), C.native_taskbar_thumbnail_button_t(button.nativeHandleValue())) + if !bool(result) { + return nativeError("WindowTaskbar.RemoveThumbnailButton") + } + return nil +} + +// RemoveThumbnailButtonByID invokes the native RemoveThumbnailButtonById operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) RemoveThumbnailButtonByID(buttonID TaskbarThumbnailButtonID) error { + result := C.native_window_taskbar_remove_thumbnail_button_by_id(C.native_window_taskbar_t(wt.nativeHandleValue()), C.native_taskbar_thumbnail_button_id_t(buttonID)) + if !bool(result) { + return nativeError("WindowTaskbar.RemoveThumbnailButtonByID") + } + return nil +} + +// RemoveThumbnailButtonAt invokes the native RemoveThumbnailButtonAt operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) RemoveThumbnailButtonAt(index uint64) error { + result := C.native_window_taskbar_remove_thumbnail_button_at(C.native_window_taskbar_t(wt.nativeHandleValue()), C.ulong(index)) + if !bool(result) { + return nativeError("WindowTaskbar.RemoveThumbnailButtonAt") + } + return nil +} + +// ClearThumbnailButtons invokes the native ClearThumbnailButtons operation. +func (wt *WindowTaskbar) ClearThumbnailButtons() { + C.native_window_taskbar_clear_thumbnail_buttons(C.native_window_taskbar_t(wt.nativeHandleValue())) +} + +// ThumbnailButtonCount invokes the native GetThumbnailButtonCount operation. +func (wt *WindowTaskbar) ThumbnailButtonCount() uint64 { + result := C.native_window_taskbar_get_thumbnail_button_count(C.native_window_taskbar_t(wt.nativeHandleValue())) + return uint64(result) +} + +// ThumbnailButtonAt invokes the native GetThumbnailButtonAt operation. +// The returned reference is owned; nil means no object is available. +func (wt *WindowTaskbar) ThumbnailButtonAt(index uint64) *TaskbarThumbnailButton { + result := C.native_window_taskbar_get_thumbnail_button_at(C.native_window_taskbar_t(wt.nativeHandleValue()), C.ulong(index)) + return wrapTaskbarThumbnailButton(uint64(result), false) +} + +// ThumbnailButtonByID invokes the native GetThumbnailButtonById operation. +// The returned reference is owned; nil means no object is available. +func (wt *WindowTaskbar) ThumbnailButtonByID(buttonID TaskbarThumbnailButtonID) *TaskbarThumbnailButton { + result := C.native_window_taskbar_get_thumbnail_button_by_id(C.native_window_taskbar_t(wt.nativeHandleValue()), C.native_taskbar_thumbnail_button_id_t(buttonID)) + return wrapTaskbarThumbnailButton(uint64(result), false) +} + +// AllThumbnailButtons invokes the native GetAllThumbnailButtons operation. +func (wt *WindowTaskbar) AllThumbnailButtons() []*TaskbarThumbnailButton { + result := C.native_window_taskbar_get_all_thumbnail_buttons(C.native_window_taskbar_t(wt.nativeHandleValue())) + defer C.native_taskbar_thumbnail_button_list_release(&result) + return listTaskbarThumbnailButtonFromC(result, false) +} + +// StartFlashing invokes the native StartFlashing operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) StartFlashing(options TaskbarFlashOptions) error { + cArg0, cArg0Cleanup := toCTaskbarFlashOptions(options) + defer cArg0Cleanup() + result := C.native_window_taskbar_start_flashing(C.native_window_taskbar_t(wt.nativeHandleValue()), cArg0) + if !bool(result) { + return nativeError("WindowTaskbar.StartFlashing") + } + return nil +} + +// StopFlashing invokes the native StopFlashing operation. +// Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. +func (wt *WindowTaskbar) StopFlashing() error { + result := C.native_window_taskbar_stop_flashing(C.native_window_taskbar_t(wt.nativeHandleValue())) + if !bool(result) { + return nativeError("WindowTaskbar.StopFlashing") + } + return nil +} + +// AddListener invokes callback synchronously on the native UI thread. +// Remove the listener before releasing its owner. A nil callback is invalid. +func (wt *WindowTaskbar) AddListener(callback func(TaskbarEvent)) (ListenerID, error) { + if callback == nil { + return 0, invalidArgument("WindowTaskbar.AddListener") + } + data := newCallback(callback) + id := C.native_window_taskbar_add_listener(C.native_window_taskbar_t(wt.nativeHandleValue()), C.native_taskbar_event_callback_t(C.go_get_native_taskbar_event_callback_t()), data, C.native_release_user_data_t(C.go_get_release_callback())) + if id == 0 { + return 0, nativeError("WindowTaskbar.AddListener") + } + return ListenerID(id), nil +} + +// RemoveListener unregisters id; an unknown id returns an error. +func (wt *WindowTaskbar) RemoveListener(id ListenerID) error { + if !bool(C.native_window_taskbar_remove_listener(C.native_window_taskbar_t(wt.nativeHandleValue()), C.native_listener_id_t(id))) { + return nativeError("WindowTaskbar.RemoveListener") + } + return nil +} + // WindowID identifies a native object. type WindowID uint32 @@ -4371,6 +4827,13 @@ func (w *Window) IsVisibleInTaskbar() bool { return bool(result) } +// Taskbar invokes the native GetTaskbar operation. +// The returned reference is owned; nil means no object is available. +func (w *Window) Taskbar() *WindowTaskbar { + result := C.native_window_get_taskbar(C.native_window_t(w.nativeHandleValue())) + return wrapWindowTaskbar(uint64(result), false) +} + // SetIgnoreMouseEvents invokes the native SetIgnoreMouseEvents operation. // Failure wraps ErrOperationFailed; the native ABI provides no detailed cause. func (w *Window) SetIgnoreMouseEvents(isIgnoreMouseEvents, forward bool) error { @@ -6759,6 +7222,13 @@ func listShortcutFromC(raw C.native_shortcut_list_t, borrowed bool) []*Shortcut } return result } +func listTaskbarThumbnailButtonFromC(raw C.native_taskbar_thumbnail_button_list_t, borrowed bool) []*TaskbarThumbnailButton { + result := make([]*TaskbarThumbnailButton, int(raw.count)) + for i, handle := range unsafe.Slice(raw.taskbar_thumbnail_buttons, int(raw.count)) { + result[i] = wrapTaskbarThumbnailButton(uint64(handle), borrowed) + } + return result +} func listTrayIconFromC(raw C.native_tray_icon_list_t, borrowed bool) []*TrayIcon { result := make([]*TrayIcon, int(raw.count)) for i, handle := range unsafe.Slice(raw.tray_icons, int(raw.count)) { diff --git a/bindings/js/lib/modules.ts b/bindings/js/lib/modules.ts index 66a5b572..e99d60c1 100644 --- a/bindings/js/lib/modules.ts +++ b/bindings/js/lib/modules.ts @@ -25,6 +25,7 @@ export * from "./image.ts"; export * from "./window_shape.ts"; export * from "./window_shadow.ts"; export * from "./view.ts"; +export * from "./window_taskbar.ts"; export * from "./window.ts"; export * from "./window_manager.ts"; export * from "./window_drag_session.ts"; diff --git a/bindings/js/lib/window.ts b/bindings/js/lib/window.ts index 0c6dd950..aeba3d00 100644 --- a/bindings/js/lib/window.ts +++ b/bindings/js/lib/window.ts @@ -8,6 +8,7 @@ import { type Point, type Rectangle, type Size } from "./geometry.ts"; import { View } from "./view.ts"; import { WindowShadow } from "./window_shadow.ts"; import { WindowShape } from "./window_shape.ts"; +import { WindowTaskbar } from "./window_taskbar.ts"; export type WindowId = number; @@ -577,6 +578,10 @@ export class Window extends NativeObject { return native.native_window_is_visible_in_taskbar(this.nativeHandle); } + get taskbar(): WindowTaskbar | null { + return wrapHandle(WindowTaskbar, native.native_window_get_taskbar(this.nativeHandle)); + } + setIgnoreMouseEvents(isIgnoreMouseEvents: boolean, forward: boolean): boolean { return native.native_window_set_ignore_mouse_events(this.nativeHandle, isIgnoreMouseEvents, forward); } diff --git a/bindings/js/lib/window_taskbar.ts b/bindings/js/lib/window_taskbar.ts new file mode 100644 index 00000000..a151990a --- /dev/null +++ b/bindings/js/lib/window_taskbar.ts @@ -0,0 +1,224 @@ +// AUTO-GENERATED. DO NOT EDIT. +// Any manual changes WILL BE LOST when this file is regenerated. + +import { native, NativeObject, wrapHandle, deliverEvent } from "./runtime.ts"; +import { Image } from "./image.ts"; + +export type TaskbarThumbnailButtonId = number; + +export const TaskbarProgressState = { + None: 0, + Indeterminate: 1, + Normal: 2, + Paused: 3, + Error: 4, +} as const; +export type TaskbarProgressState = (typeof TaskbarProgressState)[keyof typeof TaskbarProgressState]; + +export const TaskbarFlashTarget = { + All: 0, + Caption: 1, + Taskbar: 2, +} as const; +export type TaskbarFlashTarget = (typeof TaskbarFlashTarget)[keyof typeof TaskbarFlashTarget]; + +export interface TaskbarFlashOptions { + target: TaskbarFlashTarget; + count: number; + timeoutMs: number; + stopOnForeground: boolean; +} + +export type TaskbarEvent = + | { type: "thumbnailButtonClicked"; buttonId: TaskbarThumbnailButtonId }; + +/** A native TaskbarThumbnailButton, held through an owned handle. */ +export class TaskbarThumbnailButton extends NativeObject { + /** Wraps a raw handle; an owned one is released on `dispose()` or collection. */ + constructor(handle: bigint, owned = true) { + super(handle, owned ? native.native_taskbar_thumbnail_button_free : undefined); + } + + static create(icon: Image | null = null, tooltip: string = ""): TaskbarThumbnailButton | null { + const handle: bigint = native.native_taskbar_thumbnail_button_create(icon?.nativeHandle ?? 0n, tooltip); + return handle ? new TaskbarThumbnailButton(handle) : null; + } + + get id(): TaskbarThumbnailButtonId { + return native.native_taskbar_thumbnail_button_get_id(this.nativeHandle); + } + + setIcon(icon: Image | null): void { + native.native_taskbar_thumbnail_button_set_icon(this.nativeHandle, icon?.nativeHandle ?? 0n); + } + + get icon(): Image | null { + return wrapHandle(Image, native.native_taskbar_thumbnail_button_get_icon(this.nativeHandle)); + } + + setTooltip(tooltip: string): void { + native.native_taskbar_thumbnail_button_set_tooltip(this.nativeHandle, tooltip); + } + + get tooltip(): string { + return native.native_taskbar_thumbnail_button_get_tooltip(this.nativeHandle); + } + + setEnabled(isEnabled: boolean): void { + native.native_taskbar_thumbnail_button_set_enabled(this.nativeHandle, isEnabled); + } + + get isEnabled(): boolean { + return native.native_taskbar_thumbnail_button_is_enabled(this.nativeHandle); + } + + setVisible(isVisible: boolean): void { + native.native_taskbar_thumbnail_button_set_visible(this.nativeHandle, isVisible); + } + + get isVisible(): boolean { + return native.native_taskbar_thumbnail_button_is_visible(this.nativeHandle); + } + + setInteractive(isInteractive: boolean): void { + native.native_taskbar_thumbnail_button_set_interactive(this.nativeHandle, isInteractive); + } + + get isInteractive(): boolean { + return native.native_taskbar_thumbnail_button_is_interactive(this.nativeHandle); + } + + setHasBackground(hasBackground: boolean): void { + native.native_taskbar_thumbnail_button_set_has_background(this.nativeHandle, hasBackground); + } + + get hasBackground(): boolean { + return native.native_taskbar_thumbnail_button_has_background(this.nativeHandle); + } + + setDismissOnClick(isDismissOnClick: boolean): void { + native.native_taskbar_thumbnail_button_set_dismiss_on_click(this.nativeHandle, isDismissOnClick); + } + + get isDismissOnClick(): boolean { + return native.native_taskbar_thumbnail_button_is_dismiss_on_click(this.nativeHandle); + } + + /** Receives events on the JS thread. Borrowed objects stay valid until the returned Promise settles. */ + addListener(listener: (event: TaskbarEvent) => void | Promise): number { + return native.native_taskbar_thumbnail_button_add_listener(this.nativeHandle, (event: Record, delivery: bigint) => + deliverEvent(delivery, () => { + return event as unknown as TaskbarEvent; + }, listener)); + } + + /** Unregisters a listener; returns false if the id is unknown. */ + removeListener(listenerId: number): boolean { + return native.native_taskbar_thumbnail_button_remove_listener(this.nativeHandle, listenerId); + } +} + +/** A native WindowTaskbar, held through an owned handle. */ +export class WindowTaskbar extends NativeObject { + /** Wraps a raw handle; an owned one is released on `dispose()` or collection. */ + constructor(handle: bigint, owned = true) { + super(handle, owned ? native.native_window_taskbar_free : undefined); + } + + static isSupported(): boolean { + return native.native_window_taskbar_is_supported(); + } + + static getMaxThumbnailButtonCount(): number { + return native.native_window_taskbar_get_max_thumbnail_button_count(); + } + + setProgressState(state: TaskbarProgressState): boolean { + return native.native_window_taskbar_set_progress_state(this.nativeHandle, state); + } + + get progressState(): TaskbarProgressState { + return native.native_window_taskbar_get_progress_state(this.nativeHandle); + } + + setProgressValue(progress: number): boolean { + return native.native_window_taskbar_set_progress_value(this.nativeHandle, progress); + } + + get progressValue(): number { + return native.native_window_taskbar_get_progress_value(this.nativeHandle); + } + + setOverlayIcon(icon: Image | null, description: string): boolean { + return native.native_window_taskbar_set_overlay_icon(this.nativeHandle, icon?.nativeHandle ?? 0n, description); + } + + get overlayIcon(): Image | null { + return wrapHandle(Image, native.native_window_taskbar_get_overlay_icon(this.nativeHandle)); + } + + get overlayIconDescription(): string { + return native.native_window_taskbar_get_overlay_icon_description(this.nativeHandle); + } + + addThumbnailButton(button: TaskbarThumbnailButton | null): boolean { + return native.native_window_taskbar_add_thumbnail_button(this.nativeHandle, button?.nativeHandle ?? 0n); + } + + insertThumbnailButton(index: number, button: TaskbarThumbnailButton | null): boolean { + return native.native_window_taskbar_insert_thumbnail_button(this.nativeHandle, index, button?.nativeHandle ?? 0n); + } + + removeThumbnailButton(button: TaskbarThumbnailButton | null): boolean { + return native.native_window_taskbar_remove_thumbnail_button(this.nativeHandle, button?.nativeHandle ?? 0n); + } + + removeThumbnailButtonById(buttonId: TaskbarThumbnailButtonId): boolean { + return native.native_window_taskbar_remove_thumbnail_button_by_id(this.nativeHandle, buttonId); + } + + removeThumbnailButtonAt(index: number): boolean { + return native.native_window_taskbar_remove_thumbnail_button_at(this.nativeHandle, index); + } + + clearThumbnailButtons(): void { + native.native_window_taskbar_clear_thumbnail_buttons(this.nativeHandle); + } + + get thumbnailButtonCount(): number { + return native.native_window_taskbar_get_thumbnail_button_count(this.nativeHandle); + } + + getThumbnailButtonAt(index: number): TaskbarThumbnailButton | null { + return wrapHandle(TaskbarThumbnailButton, native.native_window_taskbar_get_thumbnail_button_at(this.nativeHandle, index)); + } + + getThumbnailButtonById(buttonId: TaskbarThumbnailButtonId): TaskbarThumbnailButton | null { + return wrapHandle(TaskbarThumbnailButton, native.native_window_taskbar_get_thumbnail_button_by_id(this.nativeHandle, buttonId)); + } + + get allThumbnailButtons(): TaskbarThumbnailButton[] { + return (native.native_window_taskbar_get_all_thumbnail_buttons(this.nativeHandle) as bigint[]).map((handle) => new TaskbarThumbnailButton(handle)); + } + + startFlashing(options: TaskbarFlashOptions): boolean { + return native.native_window_taskbar_start_flashing(this.nativeHandle, options); + } + + stopFlashing(): boolean { + return native.native_window_taskbar_stop_flashing(this.nativeHandle); + } + + /** Receives events on the JS thread. Borrowed objects stay valid until the returned Promise settles. */ + addListener(listener: (event: TaskbarEvent) => void | Promise): number { + return native.native_window_taskbar_add_listener(this.nativeHandle, (event: Record, delivery: bigint) => + deliverEvent(delivery, () => { + return event as unknown as TaskbarEvent; + }, listener)); + } + + /** Unregisters a listener; returns false if the id is unknown. */ + removeListener(listenerId: number): boolean { + return native.native_window_taskbar_remove_listener(this.nativeHandle, listenerId); + } +} diff --git a/bindings/js/src/generated/modules.cc b/bindings/js/src/generated/modules.cc index d9c07424..bdf44935 100644 --- a/bindings/js/src/generated/modules.cc +++ b/bindings/js/src/generated/modules.cc @@ -29,6 +29,7 @@ void RegisterImage(napi_env env, napi_value exports); void RegisterWindowShape(napi_env env, napi_value exports); void RegisterWindowShadow(napi_env env, napi_value exports); void RegisterView(napi_env env, napi_value exports); +void RegisterWindowTaskbar(napi_env env, napi_value exports); void RegisterWindow(napi_env env, napi_value exports); void RegisterWindowManager(napi_env env, napi_value exports); void RegisterWindowDragSession(napi_env env, napi_value exports); @@ -68,6 +69,7 @@ void RegisterGenerated(napi_env env, napi_value exports) { RegisterWindowShape(env, exports); RegisterWindowShadow(env, exports); RegisterView(env, exports); + RegisterWindowTaskbar(env, exports); RegisterWindow(env, exports); RegisterWindowManager(env, exports); RegisterWindowDragSession(env, exports); diff --git a/bindings/js/src/generated/types.h b/bindings/js/src/generated/types.h index 261527b7..0196ebd5 100644 --- a/bindings/js/src/generated/types.h +++ b/bindings/js/src/generated/types.h @@ -29,6 +29,7 @@ #include "capi/window_shape_c.h" #include "capi/window_shadow_c.h" #include "capi/view_c.h" +#include "capi/window_taskbar_c.h" #include "capi/window_c.h" #include "capi/window_manager_c.h" #include "capi/window_drag_session_c.h" @@ -69,6 +70,9 @@ inline Value ToValue(const native_notification_event_t& event); inline Value ToValue(const native_text_range_t& value); inline bool FromJs(napi_env env, napi_value value, native_text_range_t* out, Arena& arena); inline Value ToValue(const native_view_event_t& event); +inline Value ToValue(const native_taskbar_flash_options_t& value); +inline bool FromJs(napi_env env, napi_value value, native_taskbar_flash_options_t* out, Arena& arena); +inline Value ToValue(const native_taskbar_event_t& event); inline Value ToValue(const native_window_event_t& event); inline Value ToValue(const native_window_drag_event_t& event); inline Value ToValue(const native_drag_source_event_t& event); @@ -559,6 +563,68 @@ inline Value ToValue(const native_view_event_t& event) { return result; } +inline Value ToValue(const native_taskbar_flash_options_t& value) { + Value result = Value::Object(); + result.Set("target", Value::Number(static_cast(value.target))); + result.Set("count", Value::Number(static_cast(value.count))); + result.Set("timeoutMs", Value::Number(static_cast(value.timeout_ms))); + result.Set("stopOnForeground", Value::Bool(value.stop_on_foreground)); + return result; +} + +inline bool FromJs(napi_env env, napi_value value, native_taskbar_flash_options_t* out, Arena& arena) { + if (!ExpectObject(env, value, "TaskbarFlashOptions")) { + return false; + } + napi_value field = nullptr; + if (!GetField(env, value, "target", &field)) { + return false; + } + if (field != nullptr) { + if (!GetNumber(env, field, &out->target)) { + return false; + } + } + if (!GetField(env, value, "count", &field)) { + return false; + } + if (field != nullptr) { + if (!GetNumber(env, field, &out->count)) { + return false; + } + } + if (!GetField(env, value, "timeoutMs", &field)) { + return false; + } + if (field != nullptr) { + if (!GetNumber(env, field, &out->timeout_ms)) { + return false; + } + } + if (!GetField(env, value, "stopOnForeground", &field)) { + return false; + } + if (field != nullptr) { + if (!GetBool(env, field, &out->stop_on_foreground)) { + return false; + } + } + return true; +} + +inline Value ToValue(const native_taskbar_event_t& event) { + Value result = Value::Object(); + switch (event.type) { + case NATIVE_TASKBAR_EVENT_TYPE_THUMBNAIL_BUTTON_CLICKED: + result.Set("type", Value::String("thumbnailButtonClicked")); + result.Set("buttonId", Value::Number(static_cast(event.data.thumbnail_button_clicked.button_id))); + break; + default: + return Value::Null(); + } + return result; +} + inline Value ToValue(const native_window_event_t& event) { Value result = Value::Object(); switch (event.type) { diff --git a/bindings/js/src/generated/window.cc b/bindings/js/src/generated/window.cc index 5e2e81f3..b94c1255 100644 --- a/bindings/js/src/generated/window.cc +++ b/bindings/js/src/generated/window.cc @@ -1921,6 +1921,21 @@ napi_value Js_native_window_is_visible_in_taskbar(napi_env env, napi_callback_in return Value::Bool(result).ToJs(env); } +napi_value Js_native_window_get_taskbar(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_get_taskbar(self); }); + return Value::BigInt(result).ToJs(env); +} + napi_value Js_native_window_set_ignore_mouse_events(napi_env env, napi_callback_info info) { Args args(env, info); if (!args.ok()) { @@ -2305,6 +2320,7 @@ void RegisterWindow(napi_env env, napi_value exports) { Export(env, exports, "native_window_is_keyboard_grab_supported", Js_native_window_is_keyboard_grab_supported); Export(env, exports, "native_window_set_visible_in_taskbar", Js_native_window_set_visible_in_taskbar); Export(env, exports, "native_window_is_visible_in_taskbar", Js_native_window_is_visible_in_taskbar); + Export(env, exports, "native_window_get_taskbar", Js_native_window_get_taskbar); Export(env, exports, "native_window_set_ignore_mouse_events", Js_native_window_set_ignore_mouse_events); Export(env, exports, "native_window_is_ignore_mouse_events", Js_native_window_is_ignore_mouse_events); Export(env, exports, "native_window_is_mouse_move_forwarding_enabled", Js_native_window_is_mouse_move_forwarding_enabled); diff --git a/bindings/js/src/generated/window_taskbar.cc b/bindings/js/src/generated/window_taskbar.cc new file mode 100644 index 00000000..eab598e2 --- /dev/null +++ b/bindings/js/src/generated/window_taskbar.cc @@ -0,0 +1,806 @@ +// AUTO-GENERATED. DO NOT EDIT. +// Any manual changes WILL BE LOST when this file is regenerated. + +#include "types.h" + +namespace nativeapi_js { +namespace { + +napi_value Js_native_taskbar_thumbnail_button_create(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + native_image_t p0 = {}; + if (!GetHandle(env, args[0], &p0)) { + return nullptr; + } + const char* p1 = {}; + if (!GetString(env, args[1], arena, &p1)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_taskbar_thumbnail_button_create(p0, p1); }); + return Value::BigInt(result).ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_free(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + OnMainThread([&] { return native_taskbar_thumbnail_button_free(self); }); + return Undefined(env); +} + +napi_value Js_native_taskbar_thumbnail_button_get_id(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_taskbar_thumbnail_button_get_id(self); }); + return Value::Number(static_cast(result)).ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_set_icon(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_image_t p0 = {}; + if (!GetHandle(env, args[1], &p0)) { + return nullptr; + } + OnMainThread([&] { return native_taskbar_thumbnail_button_set_icon(self, p0); }); + return Undefined(env); +} + +napi_value Js_native_taskbar_thumbnail_button_get_icon(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_taskbar_thumbnail_button_get_icon(self); }); + return Value::BigInt(result).ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_set_tooltip(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + const char* p0 = {}; + if (!GetString(env, args[1], arena, &p0)) { + return nullptr; + } + OnMainThread([&] { return native_taskbar_thumbnail_button_set_tooltip(self, p0); }); + return Undefined(env); +} + +napi_value Js_native_taskbar_thumbnail_button_get_tooltip(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_taskbar_thumbnail_button_get_tooltip(self); }); + Value value = Value::String(result ? result : ""); + free_c_str(result); + return value.ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_set_enabled(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + bool p0 = {}; + if (!GetBool(env, args[1], &p0)) { + return nullptr; + } + OnMainThread([&] { return native_taskbar_thumbnail_button_set_enabled(self, p0); }); + return Undefined(env); +} + +napi_value Js_native_taskbar_thumbnail_button_is_enabled(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_taskbar_thumbnail_button_is_enabled(self); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_set_visible(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + bool p0 = {}; + if (!GetBool(env, args[1], &p0)) { + return nullptr; + } + OnMainThread([&] { return native_taskbar_thumbnail_button_set_visible(self, p0); }); + return Undefined(env); +} + +napi_value Js_native_taskbar_thumbnail_button_is_visible(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_taskbar_thumbnail_button_is_visible(self); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_set_interactive(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + bool p0 = {}; + if (!GetBool(env, args[1], &p0)) { + return nullptr; + } + OnMainThread([&] { return native_taskbar_thumbnail_button_set_interactive(self, p0); }); + return Undefined(env); +} + +napi_value Js_native_taskbar_thumbnail_button_is_interactive(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_taskbar_thumbnail_button_is_interactive(self); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_set_has_background(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + bool p0 = {}; + if (!GetBool(env, args[1], &p0)) { + return nullptr; + } + OnMainThread([&] { return native_taskbar_thumbnail_button_set_has_background(self, p0); }); + return Undefined(env); +} + +napi_value Js_native_taskbar_thumbnail_button_has_background(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_taskbar_thumbnail_button_has_background(self); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_set_dismiss_on_click(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + bool p0 = {}; + if (!GetBool(env, args[1], &p0)) { + return nullptr; + } + OnMainThread([&] { return native_taskbar_thumbnail_button_set_dismiss_on_click(self, p0); }); + return Undefined(env); +} + +napi_value Js_native_taskbar_thumbnail_button_is_dismiss_on_click(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_taskbar_thumbnail_button_is_dismiss_on_click(self); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_add_listener(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + Callback* callback = nullptr; + if (!GetCallback(env, args[1], /*optional=*/false, &callback)) { + return nullptr; + } + native_listener_id_t id = OnMainThread([&] { return native_taskbar_thumbnail_button_add_listener_async(self, +[](const native_taskbar_event_t* event, native_event_delivery_t delivery, void* user_data) { + if (event != nullptr) { + Callback::DispatchEvent(user_data, {ToValue(*event)}, delivery); + } else { native_event_delivery_complete(delivery, false); } + }, callback, &Callback::ReleaseUserData); }); + if (id) Callback::AttachRegistration(callback, [self, id] { (void)native_taskbar_thumbnail_button_remove_listener(self, id); }); + return Value::Number(static_cast(id)).ToJs(env); +} + +napi_value Js_native_taskbar_thumbnail_button_remove_listener(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_listener_id_t id = 0; + if (!GetNumber(env, args[1], &id)) { + return nullptr; + } + bool removed = OnMainThread([&] { return native_taskbar_thumbnail_button_remove_listener(self, id); }); + return Value::Bool(removed).ToJs(env); +} + +napi_value Js_native_window_taskbar_free(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + OnMainThread([&] { return native_window_taskbar_free(self); }); + return Undefined(env); +} + +napi_value Js_native_window_taskbar_is_supported(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + auto result = OnMainThread([&] { return native_window_taskbar_is_supported(); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_get_max_thumbnail_button_count(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + auto result = OnMainThread([&] { return native_window_taskbar_get_max_thumbnail_button_count(); }); + return Value::Number(static_cast(result)).ToJs(env); +} + +napi_value Js_native_window_taskbar_set_progress_state(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_taskbar_progress_state_t p0 = {}; + if (!GetNumber(env, args[1], &p0)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_set_progress_state(self, p0); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_get_progress_state(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_get_progress_state(self); }); + return Value::Number(static_cast(result)).ToJs(env); +} + +napi_value Js_native_window_taskbar_set_progress_value(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + double p0 = {}; + if (!GetNumber(env, args[1], &p0)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_set_progress_value(self, p0); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_get_progress_value(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_get_progress_value(self); }); + return Value::Number(static_cast(result)).ToJs(env); +} + +napi_value Js_native_window_taskbar_set_overlay_icon(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_image_t p0 = {}; + if (!GetHandle(env, args[1], &p0)) { + return nullptr; + } + const char* p1 = {}; + if (!GetString(env, args[2], arena, &p1)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_set_overlay_icon(self, p0, p1); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_get_overlay_icon(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_get_overlay_icon(self); }); + return Value::BigInt(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_get_overlay_icon_description(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_get_overlay_icon_description(self); }); + Value value = Value::String(result ? result : ""); + free_c_str(result); + return value.ToJs(env); +} + +napi_value Js_native_window_taskbar_add_thumbnail_button(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_taskbar_thumbnail_button_t p0 = {}; + if (!GetHandle(env, args[1], &p0)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_add_thumbnail_button(self, p0); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_insert_thumbnail_button(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + unsigned long p0 = {}; + if (!GetNumber(env, args[1], &p0)) { + return nullptr; + } + native_taskbar_thumbnail_button_t p1 = {}; + if (!GetHandle(env, args[2], &p1)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_insert_thumbnail_button(self, p0, p1); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_remove_thumbnail_button(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_taskbar_thumbnail_button_t p0 = {}; + if (!GetHandle(env, args[1], &p0)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_remove_thumbnail_button(self, p0); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_remove_thumbnail_button_by_id(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_taskbar_thumbnail_button_id_t p0 = {}; + if (!GetNumber(env, args[1], &p0)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_remove_thumbnail_button_by_id(self, p0); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_remove_thumbnail_button_at(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + unsigned long p0 = {}; + if (!GetNumber(env, args[1], &p0)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_remove_thumbnail_button_at(self, p0); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_clear_thumbnail_buttons(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + OnMainThread([&] { return native_window_taskbar_clear_thumbnail_buttons(self); }); + return Undefined(env); +} + +napi_value Js_native_window_taskbar_get_thumbnail_button_count(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_get_thumbnail_button_count(self); }); + return Value::Number(static_cast(result)).ToJs(env); +} + +napi_value Js_native_window_taskbar_get_thumbnail_button_at(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + unsigned long p0 = {}; + if (!GetNumber(env, args[1], &p0)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_get_thumbnail_button_at(self, p0); }); + return Value::BigInt(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_get_thumbnail_button_by_id(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_taskbar_thumbnail_button_id_t p0 = {}; + if (!GetNumber(env, args[1], &p0)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_get_thumbnail_button_by_id(self, p0); }); + return Value::BigInt(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_get_all_thumbnail_buttons(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_get_all_thumbnail_buttons(self); }); + Value value = Value::Array(); + for (long i = 0; i < result.count; ++i) { + value.Push(Value::BigInt(result.taskbar_thumbnail_buttons[i])); + } + // The handles now belong to JS; free just the array. + native_taskbar_thumbnail_button_list_release(&result); + return value.ToJs(env); +} + +napi_value Js_native_window_taskbar_start_flashing(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_taskbar_flash_options_t p0 = {}; + if (!FromJs(env, args[1], &p0, arena)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_start_flashing(self, p0); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_stop_flashing(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + Arena arena; + (void)arena; + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + auto result = OnMainThread([&] { return native_window_taskbar_stop_flashing(self); }); + return Value::Bool(result).ToJs(env); +} + +napi_value Js_native_window_taskbar_add_listener(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + Callback* callback = nullptr; + if (!GetCallback(env, args[1], /*optional=*/false, &callback)) { + return nullptr; + } + native_listener_id_t id = OnMainThread([&] { return native_window_taskbar_add_listener_async(self, +[](const native_taskbar_event_t* event, native_event_delivery_t delivery, void* user_data) { + if (event != nullptr) { + Callback::DispatchEvent(user_data, {ToValue(*event)}, delivery); + } else { native_event_delivery_complete(delivery, false); } + }, callback, &Callback::ReleaseUserData); }); + if (id) Callback::AttachRegistration(callback, [self, id] { (void)native_window_taskbar_remove_listener(self, id); }); + return Value::Number(static_cast(id)).ToJs(env); +} + +napi_value Js_native_window_taskbar_remove_listener(napi_env env, napi_callback_info info) { + Args args(env, info); + if (!args.ok()) { + return nullptr; + } + uint64_t self = 0; + if (!GetHandle(env, args[0], &self)) { + return nullptr; + } + native_listener_id_t id = 0; + if (!GetNumber(env, args[1], &id)) { + return nullptr; + } + bool removed = OnMainThread([&] { return native_window_taskbar_remove_listener(self, id); }); + return Value::Bool(removed).ToJs(env); +} + +} // namespace + +void RegisterWindowTaskbar(napi_env env, napi_value exports) { + Export(env, exports, "native_taskbar_thumbnail_button_create", Js_native_taskbar_thumbnail_button_create); + Export(env, exports, "native_taskbar_thumbnail_button_free", Js_native_taskbar_thumbnail_button_free); + Export(env, exports, "native_taskbar_thumbnail_button_get_id", Js_native_taskbar_thumbnail_button_get_id); + Export(env, exports, "native_taskbar_thumbnail_button_set_icon", Js_native_taskbar_thumbnail_button_set_icon); + Export(env, exports, "native_taskbar_thumbnail_button_get_icon", Js_native_taskbar_thumbnail_button_get_icon); + Export(env, exports, "native_taskbar_thumbnail_button_set_tooltip", Js_native_taskbar_thumbnail_button_set_tooltip); + Export(env, exports, "native_taskbar_thumbnail_button_get_tooltip", Js_native_taskbar_thumbnail_button_get_tooltip); + Export(env, exports, "native_taskbar_thumbnail_button_set_enabled", Js_native_taskbar_thumbnail_button_set_enabled); + Export(env, exports, "native_taskbar_thumbnail_button_is_enabled", Js_native_taskbar_thumbnail_button_is_enabled); + Export(env, exports, "native_taskbar_thumbnail_button_set_visible", Js_native_taskbar_thumbnail_button_set_visible); + Export(env, exports, "native_taskbar_thumbnail_button_is_visible", Js_native_taskbar_thumbnail_button_is_visible); + Export(env, exports, "native_taskbar_thumbnail_button_set_interactive", Js_native_taskbar_thumbnail_button_set_interactive); + Export(env, exports, "native_taskbar_thumbnail_button_is_interactive", Js_native_taskbar_thumbnail_button_is_interactive); + Export(env, exports, "native_taskbar_thumbnail_button_set_has_background", Js_native_taskbar_thumbnail_button_set_has_background); + Export(env, exports, "native_taskbar_thumbnail_button_has_background", Js_native_taskbar_thumbnail_button_has_background); + Export(env, exports, "native_taskbar_thumbnail_button_set_dismiss_on_click", Js_native_taskbar_thumbnail_button_set_dismiss_on_click); + Export(env, exports, "native_taskbar_thumbnail_button_is_dismiss_on_click", Js_native_taskbar_thumbnail_button_is_dismiss_on_click); + Export(env, exports, "native_taskbar_thumbnail_button_add_listener", Js_native_taskbar_thumbnail_button_add_listener); + Export(env, exports, "native_taskbar_thumbnail_button_remove_listener", Js_native_taskbar_thumbnail_button_remove_listener); + Export(env, exports, "native_window_taskbar_free", Js_native_window_taskbar_free); + Export(env, exports, "native_window_taskbar_is_supported", Js_native_window_taskbar_is_supported); + Export(env, exports, "native_window_taskbar_get_max_thumbnail_button_count", Js_native_window_taskbar_get_max_thumbnail_button_count); + Export(env, exports, "native_window_taskbar_set_progress_state", Js_native_window_taskbar_set_progress_state); + Export(env, exports, "native_window_taskbar_get_progress_state", Js_native_window_taskbar_get_progress_state); + Export(env, exports, "native_window_taskbar_set_progress_value", Js_native_window_taskbar_set_progress_value); + Export(env, exports, "native_window_taskbar_get_progress_value", Js_native_window_taskbar_get_progress_value); + Export(env, exports, "native_window_taskbar_set_overlay_icon", Js_native_window_taskbar_set_overlay_icon); + Export(env, exports, "native_window_taskbar_get_overlay_icon", Js_native_window_taskbar_get_overlay_icon); + Export(env, exports, "native_window_taskbar_get_overlay_icon_description", Js_native_window_taskbar_get_overlay_icon_description); + Export(env, exports, "native_window_taskbar_add_thumbnail_button", Js_native_window_taskbar_add_thumbnail_button); + Export(env, exports, "native_window_taskbar_insert_thumbnail_button", Js_native_window_taskbar_insert_thumbnail_button); + Export(env, exports, "native_window_taskbar_remove_thumbnail_button", Js_native_window_taskbar_remove_thumbnail_button); + Export(env, exports, "native_window_taskbar_remove_thumbnail_button_by_id", Js_native_window_taskbar_remove_thumbnail_button_by_id); + Export(env, exports, "native_window_taskbar_remove_thumbnail_button_at", Js_native_window_taskbar_remove_thumbnail_button_at); + Export(env, exports, "native_window_taskbar_clear_thumbnail_buttons", Js_native_window_taskbar_clear_thumbnail_buttons); + Export(env, exports, "native_window_taskbar_get_thumbnail_button_count", Js_native_window_taskbar_get_thumbnail_button_count); + Export(env, exports, "native_window_taskbar_get_thumbnail_button_at", Js_native_window_taskbar_get_thumbnail_button_at); + Export(env, exports, "native_window_taskbar_get_thumbnail_button_by_id", Js_native_window_taskbar_get_thumbnail_button_by_id); + Export(env, exports, "native_window_taskbar_get_all_thumbnail_buttons", Js_native_window_taskbar_get_all_thumbnail_buttons); + Export(env, exports, "native_window_taskbar_start_flashing", Js_native_window_taskbar_start_flashing); + Export(env, exports, "native_window_taskbar_stop_flashing", Js_native_window_taskbar_stop_flashing); + Export(env, exports, "native_window_taskbar_add_listener", Js_native_window_taskbar_add_listener); + Export(env, exports, "native_window_taskbar_remove_listener", Js_native_window_taskbar_remove_listener); +} + +} // namespace nativeapi_js diff --git a/bindings/python/nativeapi/__init__.py b/bindings/python/nativeapi/__init__.py index b465be0a..02dd1b60 100644 --- a/bindings/python/nativeapi/__init__.py +++ b/bindings/python/nativeapi/__init__.py @@ -240,6 +240,16 @@ from .window_shape import ( WindowShape, ) +from .window_taskbar import ( + TaskbarEvent, + TaskbarFlashOptions, + TaskbarFlashTarget, + TaskbarProgressState, + TaskbarThumbnailButton, + TaskbarThumbnailButtonClickedEvent, + TaskbarThumbnailButtonId, + WindowTaskbar, +) __all__ = [ "AccessibilityManager", @@ -341,6 +351,13 @@ "ShortcutScope", "ShortcutUnregisteredEvent", "Size", + "TaskbarEvent", + "TaskbarFlashOptions", + "TaskbarFlashTarget", + "TaskbarProgressState", + "TaskbarThumbnailButton", + "TaskbarThumbnailButtonClickedEvent", + "TaskbarThumbnailButtonId", "TextAlignment", "TextField", "TextFieldChangedEvent", @@ -401,6 +418,7 @@ "WindowScaleFactorChangedEvent", "WindowShadow", "WindowShape", + "WindowTaskbar", "WindowUndockedEvent", "is_event_loop_running", ] diff --git a/bindings/python/nativeapi/_capi.py b/bindings/python/nativeapi/_capi.py index 2a291e5c..74c5c045 100644 --- a/bindings/python/nativeapi/_capi.py +++ b/bindings/python/nativeapi/_capi.py @@ -154,6 +154,22 @@ class native_view_event_t(Structure): pass +class native_taskbar_flash_options_t(Structure): + pass + + +class native_taskbar_event_thumbnail_button_clicked_t(Structure): + pass + + +class native_taskbar_event_data_t(Union): + pass + + +class native_taskbar_event_t(Structure): + pass + + class native_window_event_moved_t(Structure): pass @@ -314,6 +330,10 @@ class native_shortcut_list_t(Structure): pass +class native_taskbar_thumbnail_button_list_t(Structure): + pass + + class native_tray_icon_list_t(Structure): pass @@ -403,6 +423,11 @@ class native_window_list_t(Structure): POINTER(native_shortcut_event_t), c_void_p, ) +native_taskbar_event_callback_t = CFUNCTYPE( + None, + POINTER(native_taskbar_event_t), + c_void_p, +) native_tray_icon_event_callback_t = CFUNCTYPE( None, POINTER(native_tray_icon_event_t), @@ -523,6 +548,22 @@ class native_window_list_t(Structure): ("view_id", c_uint), ("data", native_view_event_data_t), ] +native_taskbar_flash_options_t._fields_ = [ + ("target", c_int), + ("count", c_int), + ("timeout_ms", c_int), + ("stop_on_foreground", c_bool), +] +native_taskbar_event_thumbnail_button_clicked_t._fields_ = [ + ("button_id", c_uint), +] +native_taskbar_event_data_t._fields_ = [ + ("thumbnail_button_clicked", native_taskbar_event_thumbnail_button_clicked_t), +] +native_taskbar_event_t._fields_ = [ + ("type", c_int), + ("data", native_taskbar_event_data_t), +] native_window_event_moved_t._fields_ = [ ("new_position", native_point_t), ] @@ -683,6 +724,10 @@ class native_window_list_t(Structure): ("shortcuts", POINTER(c_uint64)), ("count", c_long), ] +native_taskbar_thumbnail_button_list_t._fields_ = [ + ("taskbar_thumbnail_buttons", POINTER(c_uint64)), + ("count", c_long), +] native_tray_icon_list_t._fields_ = [ ("tray_icons", POINTER(c_uint64)), ("count", c_long), @@ -2470,6 +2515,345 @@ class native_window_list_t(Structure): ], ) +# window_taskbar.h + +native_taskbar_thumbnail_button_list_free = function( + "native_taskbar_thumbnail_button_list_free", + None, + [ + POINTER(native_taskbar_thumbnail_button_list_t), + ], +) +native_taskbar_thumbnail_button_list_release = function( + "native_taskbar_thumbnail_button_list_release", + None, + [ + POINTER(native_taskbar_thumbnail_button_list_t), + ], +) +native_taskbar_thumbnail_button_free = function( + "native_taskbar_thumbnail_button_free", + None, + [ + c_uint64, + ], +) +native_taskbar_thumbnail_button_create = function( + "native_taskbar_thumbnail_button_create", + c_uint64, + [ + c_uint64, + c_char_p, + ], +) +native_taskbar_thumbnail_button_get_id = function( + "native_taskbar_thumbnail_button_get_id", + c_uint, + [ + c_uint64, + ], +) +native_taskbar_thumbnail_button_set_icon = function( + "native_taskbar_thumbnail_button_set_icon", + None, + [ + c_uint64, + c_uint64, + ], +) +native_taskbar_thumbnail_button_get_icon = function( + "native_taskbar_thumbnail_button_get_icon", + c_uint64, + [ + c_uint64, + ], +) +native_taskbar_thumbnail_button_set_tooltip = function( + "native_taskbar_thumbnail_button_set_tooltip", + None, + [ + c_uint64, + c_char_p, + ], +) +native_taskbar_thumbnail_button_get_tooltip = function( + "native_taskbar_thumbnail_button_get_tooltip", + c_void_p, + [ + c_uint64, + ], +) +native_taskbar_thumbnail_button_set_enabled = function( + "native_taskbar_thumbnail_button_set_enabled", + None, + [ + c_uint64, + c_bool, + ], +) +native_taskbar_thumbnail_button_is_enabled = function( + "native_taskbar_thumbnail_button_is_enabled", + c_bool, + [ + c_uint64, + ], +) +native_taskbar_thumbnail_button_set_visible = function( + "native_taskbar_thumbnail_button_set_visible", + None, + [ + c_uint64, + c_bool, + ], +) +native_taskbar_thumbnail_button_is_visible = function( + "native_taskbar_thumbnail_button_is_visible", + c_bool, + [ + c_uint64, + ], +) +native_taskbar_thumbnail_button_set_interactive = function( + "native_taskbar_thumbnail_button_set_interactive", + None, + [ + c_uint64, + c_bool, + ], +) +native_taskbar_thumbnail_button_is_interactive = function( + "native_taskbar_thumbnail_button_is_interactive", + c_bool, + [ + c_uint64, + ], +) +native_taskbar_thumbnail_button_set_has_background = function( + "native_taskbar_thumbnail_button_set_has_background", + None, + [ + c_uint64, + c_bool, + ], +) +native_taskbar_thumbnail_button_has_background = function( + "native_taskbar_thumbnail_button_has_background", + c_bool, + [ + c_uint64, + ], +) +native_taskbar_thumbnail_button_set_dismiss_on_click = function( + "native_taskbar_thumbnail_button_set_dismiss_on_click", + None, + [ + c_uint64, + c_bool, + ], +) +native_taskbar_thumbnail_button_is_dismiss_on_click = function( + "native_taskbar_thumbnail_button_is_dismiss_on_click", + c_bool, + [ + c_uint64, + ], +) +native_taskbar_thumbnail_button_add_listener = function( + "native_taskbar_thumbnail_button_add_listener", + c_uint64, + [ + c_uint64, + native_taskbar_event_callback_t, + c_void_p, + native_release_user_data_t, + ], +) +native_taskbar_thumbnail_button_remove_listener = function( + "native_taskbar_thumbnail_button_remove_listener", + c_bool, + [ + c_uint64, + c_uint64, + ], +) +native_window_taskbar_free = function("native_window_taskbar_free", None, [c_uint64]) +native_window_taskbar_is_supported = function( + "native_window_taskbar_is_supported", + c_bool, + [ + ], +) +native_window_taskbar_get_max_thumbnail_button_count = function( + "native_window_taskbar_get_max_thumbnail_button_count", + c_ulong, + [ + ], +) +native_window_taskbar_set_progress_state = function( + "native_window_taskbar_set_progress_state", + c_bool, + [ + c_uint64, + c_int, + ], +) +native_window_taskbar_get_progress_state = function( + "native_window_taskbar_get_progress_state", + c_int, + [ + c_uint64, + ], +) +native_window_taskbar_set_progress_value = function( + "native_window_taskbar_set_progress_value", + c_bool, + [ + c_uint64, + c_double, + ], +) +native_window_taskbar_get_progress_value = function( + "native_window_taskbar_get_progress_value", + c_double, + [ + c_uint64, + ], +) +native_window_taskbar_set_overlay_icon = function( + "native_window_taskbar_set_overlay_icon", + c_bool, + [ + c_uint64, + c_uint64, + c_char_p, + ], +) +native_window_taskbar_get_overlay_icon = function( + "native_window_taskbar_get_overlay_icon", + c_uint64, + [ + c_uint64, + ], +) +native_window_taskbar_get_overlay_icon_description = function( + "native_window_taskbar_get_overlay_icon_description", + c_void_p, + [ + c_uint64, + ], +) +native_window_taskbar_add_thumbnail_button = function( + "native_window_taskbar_add_thumbnail_button", + c_bool, + [ + c_uint64, + c_uint64, + ], +) +native_window_taskbar_insert_thumbnail_button = function( + "native_window_taskbar_insert_thumbnail_button", + c_bool, + [ + c_uint64, + c_ulong, + c_uint64, + ], +) +native_window_taskbar_remove_thumbnail_button = function( + "native_window_taskbar_remove_thumbnail_button", + c_bool, + [ + c_uint64, + c_uint64, + ], +) +native_window_taskbar_remove_thumbnail_button_by_id = function( + "native_window_taskbar_remove_thumbnail_button_by_id", + c_bool, + [ + c_uint64, + c_uint, + ], +) +native_window_taskbar_remove_thumbnail_button_at = function( + "native_window_taskbar_remove_thumbnail_button_at", + c_bool, + [ + c_uint64, + c_ulong, + ], +) +native_window_taskbar_clear_thumbnail_buttons = function( + "native_window_taskbar_clear_thumbnail_buttons", + None, + [ + c_uint64, + ], +) +native_window_taskbar_get_thumbnail_button_count = function( + "native_window_taskbar_get_thumbnail_button_count", + c_ulong, + [ + c_uint64, + ], +) +native_window_taskbar_get_thumbnail_button_at = function( + "native_window_taskbar_get_thumbnail_button_at", + c_uint64, + [ + c_uint64, + c_ulong, + ], +) +native_window_taskbar_get_thumbnail_button_by_id = function( + "native_window_taskbar_get_thumbnail_button_by_id", + c_uint64, + [ + c_uint64, + c_uint, + ], +) +native_window_taskbar_get_all_thumbnail_buttons = function( + "native_window_taskbar_get_all_thumbnail_buttons", + native_taskbar_thumbnail_button_list_t, + [ + c_uint64, + ], +) +native_window_taskbar_start_flashing = function( + "native_window_taskbar_start_flashing", + c_bool, + [ + c_uint64, + native_taskbar_flash_options_t, + ], +) +native_window_taskbar_stop_flashing = function( + "native_window_taskbar_stop_flashing", + c_bool, + [ + c_uint64, + ], +) +native_window_taskbar_add_listener = function( + "native_window_taskbar_add_listener", + c_uint64, + [ + c_uint64, + native_taskbar_event_callback_t, + c_void_p, + native_release_user_data_t, + ], +) +native_window_taskbar_remove_listener = function( + "native_window_taskbar_remove_listener", + c_bool, + [ + c_uint64, + c_uint64, + ], +) + # window.h native_window_list_free = function( @@ -3168,6 +3552,7 @@ class native_window_list_t(Structure): c_uint64, ], ) +native_window_get_taskbar = function("native_window_get_taskbar", c_uint64, [c_uint64]) native_window_set_ignore_mouse_events = function( "native_window_set_ignore_mouse_events", c_bool, diff --git a/bindings/python/nativeapi/window.py b/bindings/python/nativeapi/window.py index 3d44124e..a593fe5b 100644 --- a/bindings/python/nativeapi/window.py +++ b/bindings/python/nativeapi/window.py @@ -16,6 +16,7 @@ from . import view as _view from . import window_shadow as _window_shadow from . import window_shape as _window_shape +from . import window_taskbar as _window_taskbar WindowId = int @@ -765,6 +766,11 @@ def is_visible_in_taskbar(self) -> bool: raw = _C.native_window_is_visible_in_taskbar(self._handle) return raw + @property + def taskbar(self) -> _window_taskbar.WindowTaskbar | None: + raw = _C.native_window_get_taskbar(self._handle) + return _window_taskbar.WindowTaskbar._owned(raw) + def set_ignore_mouse_events( self, is_ignore_mouse_events: bool, diff --git a/bindings/python/nativeapi/window_taskbar.py b/bindings/python/nativeapi/window_taskbar.py new file mode 100644 index 00000000..593b261f --- /dev/null +++ b/bindings/python/nativeapi/window_taskbar.py @@ -0,0 +1,363 @@ +# AUTO-GENERATED. DO NOT EDIT. +# Any manual changes WILL BE LOST when this file is regenerated. +"""Generated from window_taskbar.h.""" + +from __future__ import annotations + +import enum +from collections.abc import Callable +from dataclasses import dataclass, field + +from . import _capi as _C +from . import _runtime as _rt +from . import image as _image + +TaskbarThumbnailButtonId = int + + +class TaskbarProgressState(enum.IntEnum): + NONE = 0 + INDETERMINATE = 1 + NORMAL = 2 + PAUSED = 3 + ERROR = 4 + + +class TaskbarFlashTarget(enum.IntEnum): + ALL = 0 + CAPTION = 1 + TASKBAR = 2 + + +@dataclass +class TaskbarFlashOptions: + target: TaskbarFlashTarget = field(default_factory=lambda: TaskbarFlashTarget.ALL) + count: int = 0 + timeout_ms: int = 0 + stop_on_foreground: bool = False + + @classmethod + def _from_c(cls, raw: _C.native_taskbar_flash_options_t) -> TaskbarFlashOptions: + return cls( + _rt.to_enum(TaskbarFlashTarget, raw.target), + raw.count, + raw.timeout_ms, + bool(raw.stop_on_foreground), + ) + + def _to_c(self) -> _C.native_taskbar_flash_options_t: + raw = _C.native_taskbar_flash_options_t() + raw.target = int(self.target) + raw.count = self.count + raw.timeout_ms = self.timeout_ms + raw.stop_on_foreground = self.stop_on_foreground + return raw + + +@dataclass(frozen=True) +class TaskbarEvent: + """Base of every TaskbarEvent; listeners receive one of its subclasses.""" + + @staticmethod + def _from_c(raw: _C.native_taskbar_event_t) -> TaskbarEvent | None: + if raw.type == 0: + return TaskbarThumbnailButtonClickedEvent( + raw.data.thumbnail_button_clicked.button_id, + ) + return None + + +@dataclass(frozen=True) +class TaskbarThumbnailButtonClickedEvent(TaskbarEvent): + button_id: TaskbarThumbnailButtonId + + +class TaskbarThumbnailButton(_rt.NativeObject): + """Owned reference to a native TaskbarThumbnailButton. + + `dispose()` (or `with`) releases it; otherwise it is released when the + wrapper is garbage collected. + """ + + __slots__ = () + _free = staticmethod(_C.native_taskbar_thumbnail_button_free) + + def __init__(self, icon: _image.Image | None, tooltip: str) -> None: + handle = _C.native_taskbar_thumbnail_button_create( + _rt.handle_of(icon), + _rt.encode(tooltip), + ) + if not handle: + raise _rt.NativeApiError("failed to create a TaskbarThumbnailButton") + self._adopt(handle) + + @property + def id(self) -> TaskbarThumbnailButtonId: + raw = _C.native_taskbar_thumbnail_button_get_id(self._handle) + return raw + + def set_icon(self, icon: _image.Image | None) -> None: + _C.native_taskbar_thumbnail_button_set_icon(self._handle, _rt.handle_of(icon)) + + @property + def icon(self) -> _image.Image | None: + raw = _C.native_taskbar_thumbnail_button_get_icon(self._handle) + return _image.Image._owned(raw) + + def set_tooltip(self, tooltip: str) -> None: + _C.native_taskbar_thumbnail_button_set_tooltip( + self._handle, + _rt.encode(tooltip), + ) + + @property + def tooltip(self) -> str: + raw = _C.native_taskbar_thumbnail_button_get_tooltip(self._handle) + return _rt.take_str(raw) + + def set_enabled(self, is_enabled: bool) -> None: + _C.native_taskbar_thumbnail_button_set_enabled(self._handle, is_enabled) + + @property + def is_enabled(self) -> bool: + raw = _C.native_taskbar_thumbnail_button_is_enabled(self._handle) + return raw + + def set_visible(self, is_visible: bool) -> None: + _C.native_taskbar_thumbnail_button_set_visible(self._handle, is_visible) + + @property + def is_visible(self) -> bool: + raw = _C.native_taskbar_thumbnail_button_is_visible(self._handle) + return raw + + def set_interactive(self, is_interactive: bool) -> None: + _C.native_taskbar_thumbnail_button_set_interactive(self._handle, is_interactive) + + @property + def is_interactive(self) -> bool: + raw = _C.native_taskbar_thumbnail_button_is_interactive(self._handle) + return raw + + def set_has_background(self, has_background: bool) -> None: + _C.native_taskbar_thumbnail_button_set_has_background( + self._handle, + has_background, + ) + + @property + def has_background(self) -> bool: + raw = _C.native_taskbar_thumbnail_button_has_background(self._handle) + return raw + + def set_dismiss_on_click(self, is_dismiss_on_click: bool) -> None: + _C.native_taskbar_thumbnail_button_set_dismiss_on_click( + self._handle, + is_dismiss_on_click, + ) + + @property + def is_dismiss_on_click(self) -> bool: + raw = _C.native_taskbar_thumbnail_button_is_dismiss_on_click(self._handle) + return raw + + @icon.setter + def icon(self, value: _image.Image | None) -> None: + self.set_icon(value) + + @tooltip.setter + def tooltip(self, value: str) -> None: + self.set_tooltip(value) + + def add_listener(self, callback: Callable[[TaskbarEvent], None]) -> int: + """Calls `callback` with every TaskbarEvent this TaskbarThumbnailButton emits. + + Callbacks run synchronously; coroutine callbacks are not accepted. + Use an owned EventDecision for asynchronous request confirmation. + Returns the listener id for `remove_listener()`. + """ + + def trampoline(raw, _user_data): + event = TaskbarEvent._from_c(raw.contents) + if event is not None: + _rt.deliver_event(callback, event) + + return _rt.add_listener( + _C.native_taskbar_thumbnail_button_add_listener, + _C.native_taskbar_event_callback_t, + trampoline, + self._handle, + ) + + def remove_listener(self, listener_id: int) -> bool: + """Unregisters a listener. Returns False if unknown.""" + return _rt.remove_listener( + _C.native_taskbar_thumbnail_button_remove_listener, + listener_id, + self._handle, + ) + + +class WindowTaskbar(_rt.NativeObject): + """Owned reference to a native WindowTaskbar. + + `dispose()` (or `with`) releases it; otherwise it is released when the + wrapper is garbage collected. + """ + + __slots__ = () + _free = staticmethod(_C.native_window_taskbar_free) + + @staticmethod + def is_supported() -> bool: + raw = _C.native_window_taskbar_is_supported() + return raw + + @staticmethod + def get_max_thumbnail_button_count() -> int: + raw = _C.native_window_taskbar_get_max_thumbnail_button_count() + return raw + + def set_progress_state(self, state: TaskbarProgressState) -> bool: + raw = _C.native_window_taskbar_set_progress_state(self._handle, int(state)) + return raw + + @property + def progress_state(self) -> TaskbarProgressState: + raw = _C.native_window_taskbar_get_progress_state(self._handle) + return _rt.to_enum(TaskbarProgressState, raw) + + def set_progress_value(self, progress: float) -> bool: + raw = _C.native_window_taskbar_set_progress_value(self._handle, progress) + return raw + + @property + def progress_value(self) -> float: + raw = _C.native_window_taskbar_get_progress_value(self._handle) + return raw + + def set_overlay_icon(self, icon: _image.Image | None, description: str) -> bool: + raw = _C.native_window_taskbar_set_overlay_icon( + self._handle, + _rt.handle_of(icon), + _rt.encode(description), + ) + return raw + + @property + def overlay_icon(self) -> _image.Image | None: + raw = _C.native_window_taskbar_get_overlay_icon(self._handle) + return _image.Image._owned(raw) + + @property + def overlay_icon_description(self) -> str: + raw = _C.native_window_taskbar_get_overlay_icon_description(self._handle) + return _rt.take_str(raw) + + def add_thumbnail_button(self, button: TaskbarThumbnailButton | None) -> bool: + raw = _C.native_window_taskbar_add_thumbnail_button( + self._handle, + _rt.handle_of(button), + ) + return raw + + def insert_thumbnail_button( + self, + index: int, + button: TaskbarThumbnailButton | None, + ) -> bool: + raw = _C.native_window_taskbar_insert_thumbnail_button( + self._handle, + index, + _rt.handle_of(button), + ) + return raw + + def remove_thumbnail_button(self, button: TaskbarThumbnailButton | None) -> bool: + raw = _C.native_window_taskbar_remove_thumbnail_button( + self._handle, + _rt.handle_of(button), + ) + return raw + + def remove_thumbnail_button_by_id( + self, + button_id: TaskbarThumbnailButtonId, + ) -> bool: + raw = _C.native_window_taskbar_remove_thumbnail_button_by_id( + self._handle, + button_id, + ) + return raw + + def remove_thumbnail_button_at(self, index: int) -> bool: + raw = _C.native_window_taskbar_remove_thumbnail_button_at(self._handle, index) + return raw + + def clear_thumbnail_buttons(self) -> None: + _C.native_window_taskbar_clear_thumbnail_buttons(self._handle) + + @property + def thumbnail_button_count(self) -> int: + raw = _C.native_window_taskbar_get_thumbnail_button_count(self._handle) + return raw + + def get_thumbnail_button_at(self, index: int) -> TaskbarThumbnailButton | None: + raw = _C.native_window_taskbar_get_thumbnail_button_at(self._handle, index) + return TaskbarThumbnailButton._owned(raw) + + def get_thumbnail_button_by_id( + self, + button_id: TaskbarThumbnailButtonId, + ) -> TaskbarThumbnailButton | None: + raw = _C.native_window_taskbar_get_thumbnail_button_by_id( + self._handle, + button_id, + ) + return TaskbarThumbnailButton._owned(raw) + + @property + def all_thumbnail_buttons(self) -> list[TaskbarThumbnailButton]: + raw = _C.native_window_taskbar_get_all_thumbnail_buttons(self._handle) + return _rt.take_handles( + raw, + raw.taskbar_thumbnail_buttons, + TaskbarThumbnailButton, + _C.native_taskbar_thumbnail_button_list_release, + ) + + def start_flashing(self, options: TaskbarFlashOptions) -> bool: + raw = _C.native_window_taskbar_start_flashing(self._handle, options._to_c()) + return raw + + def stop_flashing(self) -> bool: + raw = _C.native_window_taskbar_stop_flashing(self._handle) + return raw + + def add_listener(self, callback: Callable[[TaskbarEvent], None]) -> int: + """Calls `callback` with every TaskbarEvent this WindowTaskbar emits. + + Callbacks run synchronously; coroutine callbacks are not accepted. + Use an owned EventDecision for asynchronous request confirmation. + Returns the listener id for `remove_listener()`. + """ + + def trampoline(raw, _user_data): + event = TaskbarEvent._from_c(raw.contents) + if event is not None: + _rt.deliver_event(callback, event) + + return _rt.add_listener( + _C.native_window_taskbar_add_listener, + _C.native_taskbar_event_callback_t, + trampoline, + self._handle, + ) + + def remove_listener(self, listener_id: int) -> bool: + """Unregisters a listener. Returns False if unknown.""" + return _rt.remove_listener( + _C.native_window_taskbar_remove_listener, + listener_id, + self._handle, + ) diff --git a/bindings/rust/cnativeapi/src/bindings.rs b/bindings/rust/cnativeapi/src/bindings.rs index 63d51570..4a3887ca 100644 --- a/bindings/rust/cnativeapi/src/bindings.rs +++ b/bindings/rust/cnativeapi/src/bindings.rs @@ -176,7 +176,7 @@ pub const NATIVE_MODIFIER_KEY_FN: native_modifier_key_t = 16; pub const NATIVE_MODIFIER_KEY_CAPS_LOCK: native_modifier_key_t = 32; pub const NATIVE_MODIFIER_KEY_NUM_LOCK: native_modifier_key_t = 64; pub const NATIVE_MODIFIER_KEY_SCROLL_LOCK: native_modifier_key_t = 128; -pub type native_modifier_key_t = ::std::os::raw::c_uint; +pub type native_modifier_key_t = ::std::os::raw::c_int; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct native_keyboard_accelerator_t { @@ -196,7 +196,7 @@ pub const NATIVE_KEYBOARD_EVENT_TYPE_KEY_PRESSED: native_keyboard_event_type_t = pub const NATIVE_KEYBOARD_EVENT_TYPE_KEY_RELEASED: native_keyboard_event_type_t = 1; pub const NATIVE_KEYBOARD_EVENT_TYPE_MODIFIER_KEYS_CHANGED: native_keyboard_event_type_t = 2; #[doc = " Which concrete KeyboardEvent arrived."] -pub type native_keyboard_event_type_t = ::std::os::raw::c_uint; +pub type native_keyboard_event_type_t = ::std::os::raw::c_int; #[doc = " One KeyboardEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -273,13 +273,15 @@ pub const NATIVE_PLACEMENT_BOTTOM_END: native_placement_t = 8; pub const NATIVE_PLACEMENT_LEFT: native_placement_t = 9; pub const NATIVE_PLACEMENT_LEFT_START: native_placement_t = 10; pub const NATIVE_PLACEMENT_LEFT_END: native_placement_t = 11; -pub type native_placement_t = ::std::os::raw::c_uint; +pub type native_placement_t = ::std::os::raw::c_int; #[doc = " Opaque View handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_VIEW rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] pub type native_view_t = u64; #[doc = " Opaque WindowShadow handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_WINDOW_SHADOW rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] pub type native_window_shadow_t = u64; #[doc = " Opaque WindowShape handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_WINDOW_SHAPE rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] pub type native_window_shape_t = u64; +#[doc = " Opaque WindowTaskbar handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_WINDOW_TASKBAR rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] +pub type native_window_taskbar_t = u64; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct native_color_t { @@ -336,19 +338,19 @@ pub type native_view_id_t = ::std::os::raw::c_uint; pub const NATIVE_VIEW_LAYOUT_ABSOLUTE: native_view_layout_t = 0; pub const NATIVE_VIEW_LAYOUT_ROW: native_view_layout_t = 1; pub const NATIVE_VIEW_LAYOUT_COLUMN: native_view_layout_t = 2; -pub type native_view_layout_t = ::std::os::raw::c_uint; +pub type native_view_layout_t = ::std::os::raw::c_int; pub const NATIVE_VIEW_ALIGNMENT_STRETCH: native_view_alignment_t = 0; pub const NATIVE_VIEW_ALIGNMENT_START: native_view_alignment_t = 1; pub const NATIVE_VIEW_ALIGNMENT_CENTER: native_view_alignment_t = 2; pub const NATIVE_VIEW_ALIGNMENT_END: native_view_alignment_t = 3; -pub type native_view_alignment_t = ::std::os::raw::c_uint; +pub type native_view_alignment_t = ::std::os::raw::c_int; pub const NATIVE_TEXT_ALIGNMENT_START: native_text_alignment_t = 0; pub const NATIVE_TEXT_ALIGNMENT_CENTER: native_text_alignment_t = 1; pub const NATIVE_TEXT_ALIGNMENT_END: native_text_alignment_t = 2; -pub type native_text_alignment_t = ::std::os::raw::c_uint; +pub type native_text_alignment_t = ::std::os::raw::c_int; pub const NATIVE_VIEW_BACKEND_NATIVE: native_view_backend_t = 0; pub const NATIVE_VIEW_BACKEND_WIN_UI3: native_view_backend_t = 1; -pub type native_view_backend_t = ::std::os::raw::c_uint; +pub type native_view_backend_t = ::std::os::raw::c_int; #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct native_text_range_t { @@ -387,7 +389,7 @@ pub const NATIVE_VIEW_EVENT_TYPE_TEXT_FIELD_SUBMITTED: native_view_event_type_t pub const NATIVE_VIEW_EVENT_TYPE_UPDATING: native_view_event_type_t = 5; pub const NATIVE_VIEW_EVENT_TYPE_RESIZED: native_view_event_type_t = 6; #[doc = " Which concrete ViewEvent arrived."] -pub type native_view_event_type_t = ::std::os::raw::c_uint; +pub type native_view_event_type_t = ::std::os::raw::c_int; #[doc = " One ViewEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -950,20 +952,393 @@ unsafe extern "C" { #[doc = " Releases the caller's reference. Safe to call with an invalid or\n already-released handle."] pub fn native_window_shape_free(window_shape: native_window_shape_t); } +pub type native_taskbar_thumbnail_button_id_t = ::std::os::raw::c_uint; +pub const NATIVE_TASKBAR_PROGRESS_STATE_NONE: native_taskbar_progress_state_t = 0; +pub const NATIVE_TASKBAR_PROGRESS_STATE_INDETERMINATE: native_taskbar_progress_state_t = 1; +pub const NATIVE_TASKBAR_PROGRESS_STATE_NORMAL: native_taskbar_progress_state_t = 2; +pub const NATIVE_TASKBAR_PROGRESS_STATE_PAUSED: native_taskbar_progress_state_t = 3; +pub const NATIVE_TASKBAR_PROGRESS_STATE_ERROR: native_taskbar_progress_state_t = 4; +pub type native_taskbar_progress_state_t = ::std::os::raw::c_int; +pub const NATIVE_TASKBAR_FLASH_TARGET_ALL: native_taskbar_flash_target_t = 0; +pub const NATIVE_TASKBAR_FLASH_TARGET_CAPTION: native_taskbar_flash_target_t = 1; +pub const NATIVE_TASKBAR_FLASH_TARGET_TASKBAR: native_taskbar_flash_target_t = 2; +pub type native_taskbar_flash_target_t = ::std::os::raw::c_int; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct native_taskbar_flash_options_t { + pub target: native_taskbar_flash_target_t, + pub count: ::std::os::raw::c_int, + pub timeout_ms: ::std::os::raw::c_int, + pub stop_on_foreground: bool, +} +impl Default for native_taskbar_flash_options_t { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +#[doc = " Opaque TaskbarThumbnailButton handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_TASKBAR_THUMBNAIL_BUTTON rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] +pub type native_taskbar_thumbnail_button_t = u64; +#[doc = " Owning list of TaskbarThumbnailButton handles."] +#[repr(C)] +#[derive(Debug, Copy, Clone)] +pub struct native_taskbar_thumbnail_button_list_t { + pub taskbar_thumbnail_buttons: *mut native_taskbar_thumbnail_button_t, + pub count: ::std::os::raw::c_long, +} +impl Default for native_taskbar_thumbnail_button_list_t { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub const NATIVE_TASKBAR_EVENT_TYPE_THUMBNAIL_BUTTON_CLICKED: native_taskbar_event_type_t = 0; +#[doc = " Which concrete TaskbarEvent arrived."] +pub type native_taskbar_event_type_t = ::std::os::raw::c_int; +#[doc = " One TaskbarEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] +#[repr(C)] +#[derive(Copy, Clone)] +pub struct native_taskbar_event_t { + pub type_: native_taskbar_event_type_t, + pub data: native_taskbar_event_t__bindgen_ty_1, +} +#[repr(C)] +#[derive(Copy, Clone)] +pub union native_taskbar_event_t__bindgen_ty_1 { + pub thumbnail_button_clicked: native_taskbar_event_t__bindgen_ty_1__bindgen_ty_1, +} +#[repr(C)] +#[derive(Debug, Default, Copy, Clone)] +pub struct native_taskbar_event_t__bindgen_ty_1__bindgen_ty_1 { + pub button_id: native_taskbar_thumbnail_button_id_t, +} +impl Default for native_taskbar_event_t__bindgen_ty_1 { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +impl Default for native_taskbar_event_t { + fn default() -> Self { + let mut s = ::std::mem::MaybeUninit::::uninit(); + unsafe { + ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); + s.assume_init() + } + } +} +pub type native_taskbar_event_callback_t = ::std::option::Option< + unsafe extern "C" fn( + event: *const native_taskbar_event_t, + user_data: *mut ::std::os::raw::c_void, + ), +>; +pub type native_taskbar_event_callback_t_async = ::std::option::Option< + unsafe extern "C" fn( + event: *const native_taskbar_event_t, + delivery: native_event_delivery_t, + user_data: *mut ::std::os::raw::c_void, + ), +>; +unsafe extern "C" { + #[doc = " Creates a TaskbarThumbnailButton instance; release it with native_taskbar_thumbnail_button_free()."] + pub fn native_taskbar_thumbnail_button_create( + icon: native_image_t, + tooltip: *const ::std::os::raw::c_char, + ) -> native_taskbar_thumbnail_button_t; +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_get_id( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + ) -> native_taskbar_thumbnail_button_id_t; +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_set_icon( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + icon: native_image_t, + ); +} +unsafe extern "C" { + #[doc = " Caller owns the returned handle; release it with native_image_free()."] + pub fn native_taskbar_thumbnail_button_get_icon( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + ) -> native_image_t; +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_set_tooltip( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + tooltip: *const ::std::os::raw::c_char, + ); +} +unsafe extern "C" { + #[doc = " Caller owns the returned string; free it with free_c_str()."] + pub fn native_taskbar_thumbnail_button_get_tooltip( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + ) -> *mut ::std::os::raw::c_char; +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_set_enabled( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + is_enabled: bool, + ); +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_is_enabled( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_set_visible( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + is_visible: bool, + ); +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_is_visible( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_set_interactive( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + is_interactive: bool, + ); +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_is_interactive( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_set_has_background( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + has_background: bool, + ); +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_has_background( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_set_dismiss_on_click( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + is_dismiss_on_click: bool, + ); +} +unsafe extern "C" { + pub fn native_taskbar_thumbnail_button_is_dismiss_on_click( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + ) -> bool; +} +unsafe extern "C" { + #[doc = " Releases the caller's reference. Safe to call with an invalid or\n already-released handle."] + pub fn native_taskbar_thumbnail_button_free( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + ); +} +unsafe extern "C" { + #[doc = " Frees the array and releases every handle it contains."] + pub fn native_taskbar_thumbnail_button_list_free( + list: *mut native_taskbar_thumbnail_button_list_t, + ); +} +unsafe extern "C" { + #[doc = " Frees only the array; the caller takes over the handles."] + pub fn native_taskbar_thumbnail_button_list_release( + list: *mut native_taskbar_thumbnail_button_list_t, + ); +} +unsafe extern "C" { + #[doc = " Registers @p callback for every TaskbarEvent this TaskbarThumbnailButton emits.\n @return the listener id, or NATIVE_INVALID_LISTENER_ID on failure."] + pub fn native_taskbar_thumbnail_button_add_listener( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + callback: native_taskbar_event_callback_t, + user_data: *mut ::std::os::raw::c_void, + release_user_data: native_release_user_data_t, + ) -> native_listener_id_t; +} +unsafe extern "C" { + #[doc = " Registers an asynchronous callback. Its event, borrowed handles and user_data\n remain valid until event_delivery_complete is called, including after removal.\n Every delivered payload must be acknowledged. Check is_active before invoking a queued callback."] + pub fn native_taskbar_thumbnail_button_add_listener_async( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + callback: native_taskbar_event_callback_t_async, + user_data: *mut ::std::os::raw::c_void, + release_user_data: native_release_user_data_t, + ) -> native_listener_id_t; +} +unsafe extern "C" { + #[doc = " Unregisters a listener. Returns false if unknown."] + pub fn native_taskbar_thumbnail_button_remove_listener( + taskbar_thumbnail_button: native_taskbar_thumbnail_button_t, + listener_id: native_listener_id_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_is_supported() -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_get_max_thumbnail_button_count() -> ::std::os::raw::c_ulong; +} +unsafe extern "C" { + pub fn native_window_taskbar_set_progress_state( + window_taskbar: native_window_taskbar_t, + state: native_taskbar_progress_state_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_get_progress_state( + window_taskbar: native_window_taskbar_t, + ) -> native_taskbar_progress_state_t; +} +unsafe extern "C" { + pub fn native_window_taskbar_set_progress_value( + window_taskbar: native_window_taskbar_t, + progress: f64, + ) -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_get_progress_value(window_taskbar: native_window_taskbar_t) + -> f64; +} +unsafe extern "C" { + pub fn native_window_taskbar_set_overlay_icon( + window_taskbar: native_window_taskbar_t, + icon: native_image_t, + description: *const ::std::os::raw::c_char, + ) -> bool; +} +unsafe extern "C" { + #[doc = " Caller owns the returned handle; release it with native_image_free()."] + pub fn native_window_taskbar_get_overlay_icon( + window_taskbar: native_window_taskbar_t, + ) -> native_image_t; +} +unsafe extern "C" { + #[doc = " Caller owns the returned string; free it with free_c_str()."] + pub fn native_window_taskbar_get_overlay_icon_description( + window_taskbar: native_window_taskbar_t, + ) -> *mut ::std::os::raw::c_char; +} +unsafe extern "C" { + pub fn native_window_taskbar_add_thumbnail_button( + window_taskbar: native_window_taskbar_t, + button: native_taskbar_thumbnail_button_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_insert_thumbnail_button( + window_taskbar: native_window_taskbar_t, + index: ::std::os::raw::c_ulong, + button: native_taskbar_thumbnail_button_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_remove_thumbnail_button( + window_taskbar: native_window_taskbar_t, + button: native_taskbar_thumbnail_button_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_remove_thumbnail_button_by_id( + window_taskbar: native_window_taskbar_t, + button_id: native_taskbar_thumbnail_button_id_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_remove_thumbnail_button_at( + window_taskbar: native_window_taskbar_t, + index: ::std::os::raw::c_ulong, + ) -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_clear_thumbnail_buttons(window_taskbar: native_window_taskbar_t); +} +unsafe extern "C" { + pub fn native_window_taskbar_get_thumbnail_button_count( + window_taskbar: native_window_taskbar_t, + ) -> ::std::os::raw::c_ulong; +} +unsafe extern "C" { + #[doc = " Caller owns the returned handle; release it with native_taskbar_thumbnail_button_free()."] + pub fn native_window_taskbar_get_thumbnail_button_at( + window_taskbar: native_window_taskbar_t, + index: ::std::os::raw::c_ulong, + ) -> native_taskbar_thumbnail_button_t; +} +unsafe extern "C" { + #[doc = " Caller owns the returned handle; release it with native_taskbar_thumbnail_button_free()."] + pub fn native_window_taskbar_get_thumbnail_button_by_id( + window_taskbar: native_window_taskbar_t, + button_id: native_taskbar_thumbnail_button_id_t, + ) -> native_taskbar_thumbnail_button_t; +} +unsafe extern "C" { + pub fn native_window_taskbar_get_all_thumbnail_buttons( + window_taskbar: native_window_taskbar_t, + ) -> native_taskbar_thumbnail_button_list_t; +} +unsafe extern "C" { + pub fn native_window_taskbar_start_flashing( + window_taskbar: native_window_taskbar_t, + options: native_taskbar_flash_options_t, + ) -> bool; +} +unsafe extern "C" { + pub fn native_window_taskbar_stop_flashing(window_taskbar: native_window_taskbar_t) -> bool; +} +unsafe extern "C" { + #[doc = " Releases the caller's reference. Safe to call with an invalid or\n already-released handle."] + pub fn native_window_taskbar_free(window_taskbar: native_window_taskbar_t); +} +unsafe extern "C" { + #[doc = " Registers @p callback for every TaskbarEvent this WindowTaskbar emits.\n @return the listener id, or NATIVE_INVALID_LISTENER_ID on failure."] + pub fn native_window_taskbar_add_listener( + window_taskbar: native_window_taskbar_t, + callback: native_taskbar_event_callback_t, + user_data: *mut ::std::os::raw::c_void, + release_user_data: native_release_user_data_t, + ) -> native_listener_id_t; +} +unsafe extern "C" { + #[doc = " Registers an asynchronous callback. Its event, borrowed handles and user_data\n remain valid until event_delivery_complete is called, including after removal.\n Every delivered payload must be acknowledged. Check is_active before invoking a queued callback."] + pub fn native_window_taskbar_add_listener_async( + window_taskbar: native_window_taskbar_t, + callback: native_taskbar_event_callback_t_async, + user_data: *mut ::std::os::raw::c_void, + release_user_data: native_release_user_data_t, + ) -> native_listener_id_t; +} +unsafe extern "C" { + #[doc = " Unregisters a listener. Returns false if unknown."] + pub fn native_window_taskbar_remove_listener( + window_taskbar: native_window_taskbar_t, + listener_id: native_listener_id_t, + ) -> bool; +} pub type native_window_id_t = ::std::os::raw::c_uint; pub type native_window_number_t = ::std::os::raw::c_longlong; pub const NATIVE_TITLE_BAR_STYLE_NORMAL: native_title_bar_style_t = 0; pub const NATIVE_TITLE_BAR_STYLE_HIDDEN: native_title_bar_style_t = 1; -pub type native_title_bar_style_t = ::std::os::raw::c_uint; +pub type native_title_bar_style_t = ::std::os::raw::c_int; pub const NATIVE_WINDOW_DOCK_SIDE_NONE: native_window_dock_side_t = 0; pub const NATIVE_WINDOW_DOCK_SIDE_LEFT: native_window_dock_side_t = 1; pub const NATIVE_WINDOW_DOCK_SIDE_RIGHT: native_window_dock_side_t = 2; -pub type native_window_dock_side_t = ::std::os::raw::c_uint; +pub type native_window_dock_side_t = ::std::os::raw::c_int; pub const NATIVE_WINDOW_CORNER_PREFERENCE_DEFAULT: native_window_corner_preference_t = 0; pub const NATIVE_WINDOW_CORNER_PREFERENCE_DO_NOT_ROUND: native_window_corner_preference_t = 1; pub const NATIVE_WINDOW_CORNER_PREFERENCE_ROUND: native_window_corner_preference_t = 2; pub const NATIVE_WINDOW_CORNER_PREFERENCE_ROUND_SMALL: native_window_corner_preference_t = 3; -pub type native_window_corner_preference_t = ::std::os::raw::c_uint; +pub type native_window_corner_preference_t = ::std::os::raw::c_int; pub const NATIVE_WINDOW_PROPERTY_TITLE: native_window_property_t = 0; pub const NATIVE_WINDOW_PROPERTY_RESIZABLE: native_window_property_t = 1; pub const NATIVE_WINDOW_PROPERTY_MOVABLE: native_window_property_t = 2; @@ -976,11 +1351,11 @@ pub const NATIVE_WINDOW_PROPERTY_ALWAYS_ON_TOP: native_window_property_t = 8; pub const NATIVE_WINDOW_PROPERTY_ALWAYS_ON_BOTTOM: native_window_property_t = 9; pub const NATIVE_WINDOW_PROPERTY_TITLE_BAR_STYLE: native_window_property_t = 10; pub const NATIVE_WINDOW_PROPERTY_FRAMELESS: native_window_property_t = 11; -pub type native_window_property_t = ::std::os::raw::c_uint; +pub type native_window_property_t = ::std::os::raw::c_int; pub const NATIVE_WINDOW_OCCLUSION_STATE_UNKNOWN: native_window_occlusion_state_t = 0; pub const NATIVE_WINDOW_OCCLUSION_STATE_VISIBLE: native_window_occlusion_state_t = 1; pub const NATIVE_WINDOW_OCCLUSION_STATE_OCCLUDED: native_window_occlusion_state_t = 2; -pub type native_window_occlusion_state_t = ::std::os::raw::c_uint; +pub type native_window_occlusion_state_t = ::std::os::raw::c_int; pub const NATIVE_VISUAL_EFFECT_NONE: native_visual_effect_t = 0; pub const NATIVE_VISUAL_EFFECT_BLUR: native_visual_effect_t = 1; pub const NATIVE_VISUAL_EFFECT_ACRYLIC: native_visual_effect_t = 2; @@ -989,7 +1364,7 @@ pub const NATIVE_VISUAL_EFFECT_MICA_ALT: native_visual_effect_t = 4; pub const NATIVE_VISUAL_EFFECT_HUD: native_visual_effect_t = 5; pub const NATIVE_VISUAL_EFFECT_POPOVER: native_visual_effect_t = 6; pub const NATIVE_VISUAL_EFFECT_MENU: native_visual_effect_t = 7; -pub type native_visual_effect_t = ::std::os::raw::c_uint; +pub type native_visual_effect_t = ::std::os::raw::c_int; pub const NATIVE_RESIZE_EDGE_TOP: native_resize_edge_t = 0; pub const NATIVE_RESIZE_EDGE_LEFT: native_resize_edge_t = 1; pub const NATIVE_RESIZE_EDGE_RIGHT: native_resize_edge_t = 2; @@ -998,7 +1373,7 @@ pub const NATIVE_RESIZE_EDGE_TOP_LEFT: native_resize_edge_t = 4; pub const NATIVE_RESIZE_EDGE_TOP_RIGHT: native_resize_edge_t = 5; pub const NATIVE_RESIZE_EDGE_BOTTOM_LEFT: native_resize_edge_t = 6; pub const NATIVE_RESIZE_EDGE_BOTTOM_RIGHT: native_resize_edge_t = 7; -pub type native_resize_edge_t = ::std::os::raw::c_uint; +pub type native_resize_edge_t = ::std::os::raw::c_int; #[doc = " Owning list of Window handles."] #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -1033,7 +1408,7 @@ pub const NATIVE_WINDOW_EVENT_TYPE_DOCKED: native_window_event_type_t = 14; pub const NATIVE_WINDOW_EVENT_TYPE_UNDOCKED: native_window_event_type_t = 15; pub const NATIVE_WINDOW_EVENT_TYPE_SCALE_FACTOR_CHANGED: native_window_event_type_t = 16; #[doc = " Which concrete WindowEvent arrived."] -pub type native_window_event_type_t = ::std::os::raw::c_uint; +pub type native_window_event_type_t = ::std::os::raw::c_int; #[doc = " One WindowEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -1559,6 +1934,10 @@ unsafe extern "C" { unsafe extern "C" { pub fn native_window_is_visible_in_taskbar(window: native_window_t) -> bool; } +unsafe extern "C" { + #[doc = " Caller owns the returned handle; release it with native_window_taskbar_free()."] + pub fn native_window_get_taskbar(window: native_window_t) -> native_window_taskbar_t; +} unsafe extern "C" { pub fn native_window_set_ignore_mouse_events( window: native_window_t, @@ -1655,7 +2034,7 @@ unsafe extern "C" { pub const NATIVE_POSITIONING_STRATEGY_TYPE_ABSOLUTE: native_positioning_strategy_type_t = 0; pub const NATIVE_POSITIONING_STRATEGY_TYPE_CURSOR_POSITION: native_positioning_strategy_type_t = 1; pub const NATIVE_POSITIONING_STRATEGY_TYPE_RELATIVE: native_positioning_strategy_type_t = 2; -pub type native_positioning_strategy_type_t = ::std::os::raw::c_uint; +pub type native_positioning_strategy_type_t = ::std::os::raw::c_int; unsafe extern "C" { #[doc = " Caller owns the returned handle; release it with native_positioning_strategy_free()."] pub fn native_positioning_strategy_absolute( @@ -1714,17 +2093,17 @@ pub type native_menu_id_t = ::std::os::raw::c_uint; pub type native_menu_item_id_t = ::std::os::raw::c_uint; pub const NATIVE_MENU_BACKEND_NATIVE: native_menu_backend_t = 0; pub const NATIVE_MENU_BACKEND_WIN_UI3: native_menu_backend_t = 1; -pub type native_menu_backend_t = ::std::os::raw::c_uint; +pub type native_menu_backend_t = ::std::os::raw::c_int; pub const NATIVE_MENU_ITEM_TYPE_NORMAL: native_menu_item_type_t = 0; pub const NATIVE_MENU_ITEM_TYPE_CHECKBOX: native_menu_item_type_t = 1; pub const NATIVE_MENU_ITEM_TYPE_RADIO: native_menu_item_type_t = 2; pub const NATIVE_MENU_ITEM_TYPE_SEPARATOR: native_menu_item_type_t = 3; pub const NATIVE_MENU_ITEM_TYPE_SUBMENU: native_menu_item_type_t = 4; -pub type native_menu_item_type_t = ::std::os::raw::c_uint; +pub type native_menu_item_type_t = ::std::os::raw::c_int; pub const NATIVE_MENU_ITEM_STATE_UNCHECKED: native_menu_item_state_t = 0; pub const NATIVE_MENU_ITEM_STATE_CHECKED: native_menu_item_state_t = 1; pub const NATIVE_MENU_ITEM_STATE_MIXED: native_menu_item_state_t = 2; -pub type native_menu_item_state_t = ::std::os::raw::c_uint; +pub type native_menu_item_state_t = ::std::os::raw::c_int; #[doc = " Opaque MenuItem handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_MENU_ITEM rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] pub type native_menu_item_t = u64; #[doc = " Owning list of MenuItem handles."] @@ -1749,7 +2128,7 @@ pub const NATIVE_MENU_EVENT_TYPE_ITEM_CLICKED: native_menu_event_type_t = 2; pub const NATIVE_MENU_EVENT_TYPE_ITEM_SUBMENU_OPENED: native_menu_event_type_t = 3; pub const NATIVE_MENU_EVENT_TYPE_ITEM_SUBMENU_CLOSED: native_menu_event_type_t = 4; #[doc = " Which concrete MenuEvent arrived."] -pub type native_menu_event_type_t = ::std::os::raw::c_uint; +pub type native_menu_event_type_t = ::std::os::raw::c_int; #[doc = " One MenuEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -2073,7 +2452,7 @@ unsafe extern "C" { pub const NATIVE_BRIGHTNESS_SYSTEM: native_brightness_t = 0; pub const NATIVE_BRIGHTNESS_LIGHT: native_brightness_t = 1; pub const NATIVE_BRIGHTNESS_DARK: native_brightness_t = 2; -pub type native_brightness_t = ::std::os::raw::c_uint; +pub type native_brightness_t = ::std::os::raw::c_int; pub const NATIVE_APPLICATION_EVENT_TYPE_STARTED: native_application_event_type_t = 0; pub const NATIVE_APPLICATION_EVENT_TYPE_EXITING: native_application_event_type_t = 1; pub const NATIVE_APPLICATION_EVENT_TYPE_ACTIVATED: native_application_event_type_t = 2; @@ -2082,7 +2461,7 @@ pub const NATIVE_APPLICATION_EVENT_TYPE_QUIT_REQUESTED: native_application_event pub const NATIVE_APPLICATION_EVENT_TYPE_SYSTEM_BRIGHTNESS_CHANGED: native_application_event_type_t = 5; #[doc = " Which concrete ApplicationEvent arrived."] -pub type native_application_event_type_t = ::std::os::raw::c_uint; +pub type native_application_event_type_t = ::std::os::raw::c_int; #[doc = " One ApplicationEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -2355,7 +2734,7 @@ impl Default for native_clipboard_data_t { } pub const NATIVE_CLIPBOARD_EVENT_TYPE_CHANGED: native_clipboard_event_type_t = 0; #[doc = " Which concrete ClipboardEvent arrived."] -pub type native_clipboard_event_type_t = ::std::os::raw::c_uint; +pub type native_clipboard_event_type_t = ::std::os::raw::c_int; #[doc = " One ClipboardEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -2549,13 +2928,13 @@ unsafe extern "C" { pub const NATIVE_DIALOG_MODALITY_NONE: native_dialog_modality_t = 0; pub const NATIVE_DIALOG_MODALITY_APPLICATION: native_dialog_modality_t = 1; pub const NATIVE_DIALOG_MODALITY_WINDOW: native_dialog_modality_t = 2; -pub type native_dialog_modality_t = ::std::os::raw::c_uint; +pub type native_dialog_modality_t = ::std::os::raw::c_int; pub type native_display_id_t = ::std::os::raw::c_uint; pub const NATIVE_DISPLAY_ORIENTATION_PORTRAIT: native_display_orientation_t = 0; pub const NATIVE_DISPLAY_ORIENTATION_LANDSCAPE: native_display_orientation_t = 90; pub const NATIVE_DISPLAY_ORIENTATION_PORTRAIT_FLIPPED: native_display_orientation_t = 180; pub const NATIVE_DISPLAY_ORIENTATION_LANDSCAPE_FLIPPED: native_display_orientation_t = 270; -pub type native_display_orientation_t = ::std::os::raw::c_uint; +pub type native_display_orientation_t = ::std::os::raw::c_int; #[doc = " Opaque Display handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_DISPLAY rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] pub type native_display_t = u64; #[doc = " Owning list of Display handles."] @@ -2578,7 +2957,7 @@ pub const NATIVE_DISPLAY_EVENT_TYPE_ADDED: native_display_event_type_t = 0; pub const NATIVE_DISPLAY_EVENT_TYPE_REMOVED: native_display_event_type_t = 1; pub const NATIVE_DISPLAY_EVENT_TYPE_CHANGED: native_display_event_type_t = 2; #[doc = " Which concrete DisplayEvent arrived."] -pub type native_display_event_type_t = ::std::os::raw::c_uint; +pub type native_display_event_type_t = ::std::os::raw::c_int; #[doc = " One DisplayEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Debug, Copy, Clone)] @@ -2697,12 +3076,12 @@ pub const NATIVE_DRAG_OPERATION_NONE: native_drag_operation_t = 0; pub const NATIVE_DRAG_OPERATION_COPY: native_drag_operation_t = 1; pub const NATIVE_DRAG_OPERATION_MOVE: native_drag_operation_t = 2; pub const NATIVE_DRAG_OPERATION_LINK: native_drag_operation_t = 3; -pub type native_drag_operation_t = ::std::os::raw::c_uint; +pub type native_drag_operation_t = ::std::os::raw::c_int; #[doc = " Opaque DragSource handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_DRAG_SOURCE rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] pub type native_drag_source_t = u64; pub const NATIVE_DRAG_SOURCE_EVENT_TYPE_ENDED: native_drag_source_event_type_t = 0; #[doc = " Which concrete DragSourceEvent arrived."] -pub type native_drag_source_event_type_t = ::std::os::raw::c_uint; +pub type native_drag_source_event_type_t = ::std::os::raw::c_int; #[doc = " One DragSourceEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -2861,7 +3240,7 @@ pub const NATIVE_DROP_TARGET_EVENT_TYPE_MOVED: native_drop_target_event_type_t = pub const NATIVE_DROP_TARGET_EVENT_TYPE_EXITED: native_drop_target_event_type_t = 2; pub const NATIVE_DROP_TARGET_EVENT_TYPE_DROPPED: native_drop_target_event_type_t = 3; #[doc = " Which concrete DropTargetEvent arrived."] -pub type native_drop_target_event_type_t = ::std::os::raw::c_uint; +pub type native_drop_target_event_type_t = ::std::os::raw::c_int; #[doc = " One DropTargetEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -2981,12 +3360,12 @@ pub const NATIVE_FILE_DIALOG_MODE_OPEN_FILE: native_file_dialog_mode_t = 0; pub const NATIVE_FILE_DIALOG_MODE_OPEN_FILES: native_file_dialog_mode_t = 1; pub const NATIVE_FILE_DIALOG_MODE_SAVE_FILE: native_file_dialog_mode_t = 2; pub const NATIVE_FILE_DIALOG_MODE_SELECT_FOLDER: native_file_dialog_mode_t = 3; -pub type native_file_dialog_mode_t = ::std::os::raw::c_uint; +pub type native_file_dialog_mode_t = ::std::os::raw::c_int; pub const NATIVE_FILE_DIALOG_RESULT_NONE: native_file_dialog_result_t = 0; pub const NATIVE_FILE_DIALOG_RESULT_ACCEPTED: native_file_dialog_result_t = 1; pub const NATIVE_FILE_DIALOG_RESULT_CANCELLED: native_file_dialog_result_t = 2; pub const NATIVE_FILE_DIALOG_RESULT_FAILED: native_file_dialog_result_t = 3; -pub type native_file_dialog_result_t = ::std::os::raw::c_uint; +pub type native_file_dialog_result_t = ::std::os::raw::c_int; #[doc = " Opaque FileDialog handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_FILE_DIALOG rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] pub type native_file_dialog_t = u64; unsafe extern "C" { @@ -3170,7 +3549,7 @@ pub const NATIVE_MESSAGE_DIALOG_RESULT_NONE: native_message_dialog_result_t = 0; pub const NATIVE_MESSAGE_DIALOG_RESULT_PRIMARY: native_message_dialog_result_t = 1; pub const NATIVE_MESSAGE_DIALOG_RESULT_SECONDARY: native_message_dialog_result_t = 2; pub const NATIVE_MESSAGE_DIALOG_RESULT_CLOSE: native_message_dialog_result_t = 3; -pub type native_message_dialog_result_t = ::std::os::raw::c_uint; +pub type native_message_dialog_result_t = ::std::os::raw::c_int; #[doc = " Opaque MessageDialog handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_MESSAGE_DIALOG rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] pub type native_message_dialog_t = u64; unsafe extern "C" { @@ -3294,7 +3673,7 @@ unsafe extern "C" { } pub const NATIVE_NOTIFICATION_EVENT_TYPE_ACTIVATED: native_notification_event_type_t = 0; #[doc = " Which concrete NotificationEvent arrived."] -pub type native_notification_event_type_t = ::std::os::raw::c_uint; +pub type native_notification_event_type_t = ::std::os::raw::c_int; #[doc = " One NotificationEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -3462,7 +3841,7 @@ unsafe extern "C" { pub const NATIVE_PROTOCOL_HANDLER_EVENT_TYPE_PROTOCOL_URL_RECEIVED: native_protocol_handler_event_type_t = 0; #[doc = " Which concrete ProtocolHandlerEvent arrived."] -pub type native_protocol_handler_event_type_t = ::std::os::raw::c_uint; +pub type native_protocol_handler_event_type_t = ::std::os::raw::c_int; #[doc = " One ProtocolHandlerEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -3623,7 +4002,7 @@ unsafe extern "C" { pub type native_shortcut_id_t = ::std::os::raw::c_uint; pub const NATIVE_SHORTCUT_SCOPE_GLOBAL: native_shortcut_scope_t = 0; pub const NATIVE_SHORTCUT_SCOPE_APPLICATION: native_shortcut_scope_t = 1; -pub type native_shortcut_scope_t = ::std::os::raw::c_uint; +pub type native_shortcut_scope_t = ::std::os::raw::c_int; pub type native_shortcut_options_callback_t = ::std::option::Option; pub type native_shortcut_create_with_id_and_accelerator_and_callback_t = @@ -3674,7 +4053,7 @@ pub const NATIVE_SHORTCUT_EVENT_TYPE_UNREGISTERED: native_shortcut_event_type_t pub const NATIVE_SHORTCUT_EVENT_TYPE_REGISTRATION_FAILED: native_shortcut_event_type_t = 3; pub const NATIVE_SHORTCUT_EVENT_TYPE_RELEASED: native_shortcut_event_type_t = 4; #[doc = " Which concrete ShortcutEvent arrived."] -pub type native_shortcut_event_type_t = ::std::os::raw::c_uint; +pub type native_shortcut_event_type_t = ::std::os::raw::c_int; #[doc = " One ShortcutEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -3934,10 +4313,10 @@ pub const NATIVE_CONTEXT_MENU_TRIGGER_NONE: native_context_menu_trigger_t = 0; pub const NATIVE_CONTEXT_MENU_TRIGGER_CLICKED: native_context_menu_trigger_t = 1; pub const NATIVE_CONTEXT_MENU_TRIGGER_RIGHT_CLICKED: native_context_menu_trigger_t = 2; pub const NATIVE_CONTEXT_MENU_TRIGGER_DOUBLE_CLICKED: native_context_menu_trigger_t = 3; -pub type native_context_menu_trigger_t = ::std::os::raw::c_uint; +pub type native_context_menu_trigger_t = ::std::os::raw::c_int; pub const NATIVE_TRAY_ICON_POSITION_LEFT: native_tray_icon_position_t = 0; pub const NATIVE_TRAY_ICON_POSITION_RIGHT: native_tray_icon_position_t = 1; -pub type native_tray_icon_position_t = ::std::os::raw::c_uint; +pub type native_tray_icon_position_t = ::std::os::raw::c_int; #[doc = " Opaque TrayIcon handle.\n\n A generational index into the library's handle table, NOT a pointer:\n never dereference it, and compare it against NATIVE_INVALID_TRAY_ICON rather than NULL.\n Releasing a handle invalidates it; later calls fail safely instead of\n touching freed memory."] pub type native_tray_icon_t = u64; #[doc = " Owning list of TrayIcon handles."] @@ -3960,7 +4339,7 @@ pub const NATIVE_TRAY_ICON_EVENT_TYPE_CLICKED: native_tray_icon_event_type_t = 0 pub const NATIVE_TRAY_ICON_EVENT_TYPE_RIGHT_CLICKED: native_tray_icon_event_type_t = 1; pub const NATIVE_TRAY_ICON_EVENT_TYPE_DOUBLE_CLICKED: native_tray_icon_event_type_t = 2; #[doc = " Which concrete TrayIconEvent arrived."] -pub type native_tray_icon_event_type_t = ::std::os::raw::c_uint; +pub type native_tray_icon_event_type_t = ::std::os::raw::c_int; #[doc = " One TrayIconEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Copy, Clone)] @@ -4202,7 +4581,7 @@ pub const NATIVE_URL_OPEN_ERROR_CODE_INVALID_URL_UNSUPPORTED_SCHEME: native_url_ 3; pub const NATIVE_URL_OPEN_ERROR_CODE_UNSUPPORTED_PLATFORM: native_url_open_error_code_t = 4; pub const NATIVE_URL_OPEN_ERROR_CODE_INVOCATION_FAILED: native_url_open_error_code_t = 5; -pub type native_url_open_error_code_t = ::std::os::raw::c_uint; +pub type native_url_open_error_code_t = ::std::os::raw::c_int; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct native_url_open_result_t { @@ -4238,7 +4617,7 @@ pub const NATIVE_WINDOW_DRAG_EVENT_TYPE_MOVED: native_window_drag_event_type_t = pub const NATIVE_WINDOW_DRAG_EVENT_TYPE_ENDED: native_window_drag_event_type_t = 1; pub const NATIVE_WINDOW_DRAG_EVENT_TYPE_CANCELLED: native_window_drag_event_type_t = 2; #[doc = " Which concrete WindowDragEvent arrived."] -pub type native_window_drag_event_type_t = ::std::os::raw::c_uint; +pub type native_window_drag_event_type_t = ::std::os::raw::c_int; #[doc = " One WindowDragEvent, tagged by its concrete type.\n\n Synchronous callbacks borrow this payload until they return. Async callbacks\n borrow it until event_delivery_complete. Copy anything needed after that."] #[repr(C)] #[derive(Debug, Copy, Clone)] diff --git a/bindings/rust/nativeapi/src/modules.rs b/bindings/rust/nativeapi/src/modules.rs index 6f8efcdd..f85e4146 100644 --- a/bindings/rust/nativeapi/src/modules.rs +++ b/bindings/rust/nativeapi/src/modules.rs @@ -40,6 +40,7 @@ pub mod window_drag_session; pub mod window_manager; pub mod window_shadow; pub mod window_shape; +pub mod window_taskbar; // Flat re-exports, so `use nativeapi::Display;` works alongside // `use nativeapi::display::Display;`. @@ -80,3 +81,4 @@ pub use window_drag_session::{WindowDragEvent, WindowDragSession, WindowDragSess pub use window_manager::{WindowManager}; pub use window_shadow::{WindowShadow, WindowShadowRef}; pub use window_shape::{WindowShape, WindowShapeRef}; +pub use window_taskbar::{TaskbarThumbnailButtonId, TaskbarProgressState, TaskbarFlashTarget, TaskbarFlashOptions, TaskbarEvent, TaskbarThumbnailButton, TaskbarThumbnailButtonRef, WindowTaskbar, WindowTaskbarRef}; diff --git a/bindings/rust/nativeapi/src/window.rs b/bindings/rust/nativeapi/src/window.rs index 09e89258..45e0ee32 100644 --- a/bindings/rust/nativeapi/src/window.rs +++ b/bindings/rust/nativeapi/src/window.rs @@ -12,6 +12,7 @@ use crate::geometry::{Point, Rectangle, Size}; use crate::view::View; use crate::window_shadow::WindowShadow; use crate::window_shape::WindowShape; +use crate::window_taskbar::WindowTaskbar; /// Identifies one registered event listener. pub type ListenerId = cnativeapi::native_listener_id_t; @@ -1026,6 +1027,12 @@ impl Window { } } + pub fn taskbar(&self) -> Option { + unsafe { + WindowTaskbar::from_raw(cnativeapi::native_window_get_taskbar(self.handle)) + } + } + pub fn set_ignore_mouse_events(&self, is_ignore_mouse_events: bool, forward: bool) -> bool { unsafe { cnativeapi::native_window_set_ignore_mouse_events(self.handle, is_ignore_mouse_events, forward) diff --git a/bindings/rust/nativeapi/src/window_taskbar.rs b/bindings/rust/nativeapi/src/window_taskbar.rs new file mode 100644 index 00000000..f21b9f4e --- /dev/null +++ b/bindings/rust/nativeapi/src/window_taskbar.rs @@ -0,0 +1,530 @@ +// AUTO-GENERATED. DO NOT EDIT. +// Any manual changes WILL BE LOST when this file is regenerated. +#![allow(dead_code)] +#![allow(unused_imports)] + +use cnativeapi; +use std::ffi::{CStr, CString}; + +use crate::image::Image; + +/// Identifies one registered event listener. +pub type ListenerId = cnativeapi::native_listener_id_t; + +pub type TaskbarThumbnailButtonId = u32; + +#[repr(i32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum TaskbarProgressState { + None = 0, + Indeterminate = 1, + Normal = 2, + Paused = 3, + Error = 4, +} + +impl TaskbarProgressState { + pub(crate) fn from_raw(raw: cnativeapi::native_taskbar_progress_state_t) -> Self { + match raw { + cnativeapi::NATIVE_TASKBAR_PROGRESS_STATE_NONE => Self::None, + cnativeapi::NATIVE_TASKBAR_PROGRESS_STATE_INDETERMINATE => Self::Indeterminate, + cnativeapi::NATIVE_TASKBAR_PROGRESS_STATE_NORMAL => Self::Normal, + cnativeapi::NATIVE_TASKBAR_PROGRESS_STATE_PAUSED => Self::Paused, + cnativeapi::NATIVE_TASKBAR_PROGRESS_STATE_ERROR => Self::Error, + _ => Self::None, + } + } + + pub(crate) fn to_raw(self) -> cnativeapi::native_taskbar_progress_state_t { + self as cnativeapi::native_taskbar_progress_state_t + } +} + +#[repr(i32)] +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub enum TaskbarFlashTarget { + All = 0, + Caption = 1, + Taskbar = 2, +} + +impl TaskbarFlashTarget { + pub(crate) fn from_raw(raw: cnativeapi::native_taskbar_flash_target_t) -> Self { + match raw { + cnativeapi::NATIVE_TASKBAR_FLASH_TARGET_ALL => Self::All, + cnativeapi::NATIVE_TASKBAR_FLASH_TARGET_CAPTION => Self::Caption, + cnativeapi::NATIVE_TASKBAR_FLASH_TARGET_TASKBAR => Self::Taskbar, + _ => Self::All, + } + } + + pub(crate) fn to_raw(self) -> cnativeapi::native_taskbar_flash_target_t { + self as cnativeapi::native_taskbar_flash_target_t + } +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub struct TaskbarFlashOptions { + pub target: TaskbarFlashTarget, + pub count: i32, + pub timeout_ms: i32, + pub stop_on_foreground: bool, +} + +impl TaskbarFlashOptions { + pub(crate) unsafe fn from_raw(raw: &cnativeapi::native_taskbar_flash_options_t) -> Self { + Self { + target: TaskbarFlashTarget::from_raw(raw.target), + count: raw.count, + timeout_ms: raw.timeout_ms, + stop_on_foreground: raw.stop_on_foreground, + } + } + + pub(crate) fn to_raw(&self) -> RawOfTaskbarFlashOptions { + let mut raw = cnativeapi::native_taskbar_flash_options_t::default(); + raw.target = self.target.to_raw(); + raw.count = self.count; + raw.timeout_ms = self.timeout_ms; + raw.stop_on_foreground = self.stop_on_foreground; + RawOfTaskbarFlashOptions { raw, _owned: () } + } +} + +/// `TaskbarFlashOptions` in its C form, keeping any borrowed buffers alive. +pub(crate) struct RawOfTaskbarFlashOptions { + pub(crate) raw: cnativeapi::native_taskbar_flash_options_t, + _owned: (), +} + +/// One `TaskbarEvent`, in its concrete form. +#[derive(Debug, Clone, PartialEq)] +pub enum TaskbarEvent { + ThumbnailButtonClicked { button_id: TaskbarThumbnailButtonId }, +} + +impl TaskbarEvent { + pub(crate) unsafe fn from_raw(raw: &cnativeapi::native_taskbar_event_t) -> Option { + Some(match raw.type_ { + cnativeapi::NATIVE_TASKBAR_EVENT_TYPE_THUMBNAIL_BUTTON_CLICKED => Self::ThumbnailButtonClicked { button_id: raw.data.thumbnail_button_clicked.button_id }, + _ => return None, + }) + } +} + +/// Owned handle to a native `TaskbarThumbnailButton`. +#[derive(Debug)] +#[repr(transparent)] +pub struct TaskbarThumbnailButton { + handle: cnativeapi::native_taskbar_thumbnail_button_t, +} + +impl TaskbarThumbnailButton { + /// Adopts a handle returned by the C API. + /// + /// # Safety + /// `handle` must be a live handle that is not owned elsewhere. + pub unsafe fn from_raw(handle: cnativeapi::native_taskbar_thumbnail_button_t) -> Option { + if handle == 0 { + None + } else { + Some(Self { handle }) + } + } + + /// Borrows the underlying C handle. + pub fn as_raw(&self) -> cnativeapi::native_taskbar_thumbnail_button_t { + self.handle + } + + /// Creates a new `TaskbarThumbnailButton`; returns `None` if the native side failed. + pub fn new(icon: Option<&Image>, tooltip: &str) -> Option { + let tooltip_native = CString::new(tooltip).expect("string argument contains interior nul byte"); + unsafe { + Self::from_raw(cnativeapi::native_taskbar_thumbnail_button_create(icon.map_or(0, |value| value.as_raw()), tooltip_native.as_ptr())) + } + } + + pub fn id(&self) -> TaskbarThumbnailButtonId { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_get_id(self.handle) + } + } + + pub fn set_icon(&self, icon: Option<&Image>) { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_set_icon(self.handle, icon.map_or(0, |value| value.as_raw())); + } + } + + pub fn icon(&self) -> Option { + unsafe { + Image::from_raw(cnativeapi::native_taskbar_thumbnail_button_get_icon(self.handle)) + } + } + + pub fn set_tooltip(&self, tooltip: &str) { + let tooltip_native = CString::new(tooltip).expect("string argument contains interior nul byte"); + unsafe { + cnativeapi::native_taskbar_thumbnail_button_set_tooltip(self.handle, tooltip_native.as_ptr()); + } + } + + pub fn tooltip(&self) -> Option { + unsafe { + let ptr = cnativeapi::native_taskbar_thumbnail_button_get_tooltip(self.handle); + if ptr.is_null() { + return None; + } + let value = CStr::from_ptr(ptr).to_string_lossy().into_owned(); + cnativeapi::free_c_str(ptr); + Some(value) + } + } + + pub fn set_enabled(&self, is_enabled: bool) { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_set_enabled(self.handle, is_enabled); + } + } + + pub fn is_enabled(&self) -> bool { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_is_enabled(self.handle) + } + } + + pub fn set_visible(&self, is_visible: bool) { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_set_visible(self.handle, is_visible); + } + } + + pub fn is_visible(&self) -> bool { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_is_visible(self.handle) + } + } + + pub fn set_interactive(&self, is_interactive: bool) { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_set_interactive(self.handle, is_interactive); + } + } + + pub fn is_interactive(&self) -> bool { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_is_interactive(self.handle) + } + } + + pub fn set_has_background(&self, has_background: bool) { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_set_has_background(self.handle, has_background); + } + } + + pub fn has_background(&self) -> bool { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_has_background(self.handle) + } + } + + pub fn set_dismiss_on_click(&self, is_dismiss_on_click: bool) { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_set_dismiss_on_click(self.handle, is_dismiss_on_click); + } + } + + pub fn is_dismiss_on_click(&self) -> bool { + unsafe { + cnativeapi::native_taskbar_thumbnail_button_is_dismiss_on_click(self.handle) + } + } + + /// Registers `callback` for every `TaskbarEvent` this `TaskbarThumbnailButton` emits. + /// + /// The closure is dropped on the main thread once the listener is removed + /// or its emitter destroyed. + pub fn add_listener(&self, callback: impl Fn(&TaskbarEvent) + 'static) -> ListenerId { + unsafe extern "C" fn trampoline(event: *const cnativeapi::native_taskbar_event_t, user_data: *mut std::ffi::c_void) { + if event.is_null() || user_data.is_null() { + return; + } + let callback = &*(user_data as *const Box); + if let Some(event) = TaskbarEvent::from_raw(&*event) { + callback(&event); + } + } + let boxed: Box> = Box::new(Box::new(callback)); + let user_data = Box::into_raw(boxed) as *mut std::ffi::c_void; + unsafe extern "C" fn release(user_data: *mut std::ffi::c_void) { + drop(Box::from_raw(user_data as *mut Box)); + } + unsafe { cnativeapi::native_taskbar_thumbnail_button_add_listener(self.handle, Some(trampoline), user_data, Some(release)) } + } + + /// Unregisters a listener. Returns false if unknown. + pub fn remove_listener(&self, listener_id: ListenerId) -> bool { + unsafe { cnativeapi::native_taskbar_thumbnail_button_remove_listener(self.handle, listener_id) } + } + +} + +impl Drop for TaskbarThumbnailButton { + fn drop(&mut self) { + if self.handle != 0 { + unsafe { cnativeapi::native_taskbar_thumbnail_button_free(self.handle) }; + } + } +} + +/// A `TaskbarThumbnailButton` owned elsewhere; using it does not release it. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct TaskbarThumbnailButtonRef(cnativeapi::native_taskbar_thumbnail_button_t); + +impl TaskbarThumbnailButtonRef { + pub(crate) fn from_raw(handle: cnativeapi::native_taskbar_thumbnail_button_t) -> Self { + Self(handle) + } + + pub fn as_raw(&self) -> cnativeapi::native_taskbar_thumbnail_button_t { + self.0 + } + + /// Runs `f` against the borrowed handle. The `TaskbarThumbnailButton` it receives + /// must not outlive the call. + pub fn with(&self, f: impl FnOnce(&TaskbarThumbnailButton) -> R) -> R { + let borrowed = std::mem::ManuallyDrop::new(TaskbarThumbnailButton { handle: self.0 }); + f(&borrowed) + } +} + +/// Owned handle to a native `WindowTaskbar`. +#[derive(Debug)] +#[repr(transparent)] +pub struct WindowTaskbar { + handle: cnativeapi::native_window_taskbar_t, +} + +impl WindowTaskbar { + /// Adopts a handle returned by the C API. + /// + /// # Safety + /// `handle` must be a live handle that is not owned elsewhere. + pub unsafe fn from_raw(handle: cnativeapi::native_window_taskbar_t) -> Option { + if handle == 0 { + None + } else { + Some(Self { handle }) + } + } + + /// Borrows the underlying C handle. + pub fn as_raw(&self) -> cnativeapi::native_window_taskbar_t { + self.handle + } + + pub fn is_supported() -> bool { + unsafe { + cnativeapi::native_window_taskbar_is_supported() + } + } + + pub fn get_max_thumbnail_button_count() -> std::os::raw::c_ulong { + unsafe { + cnativeapi::native_window_taskbar_get_max_thumbnail_button_count() + } + } + + pub fn set_progress_state(&self, state: TaskbarProgressState) -> bool { + unsafe { + cnativeapi::native_window_taskbar_set_progress_state(self.handle, state.to_raw()) + } + } + + pub fn progress_state(&self) -> TaskbarProgressState { + unsafe { + TaskbarProgressState::from_raw(cnativeapi::native_window_taskbar_get_progress_state(self.handle)) + } + } + + pub fn set_progress_value(&self, progress: f64) -> bool { + unsafe { + cnativeapi::native_window_taskbar_set_progress_value(self.handle, progress) + } + } + + pub fn progress_value(&self) -> f64 { + unsafe { + cnativeapi::native_window_taskbar_get_progress_value(self.handle) + } + } + + pub fn set_overlay_icon(&self, icon: Option<&Image>, description: &str) -> bool { + let description_native = CString::new(description).expect("string argument contains interior nul byte"); + unsafe { + cnativeapi::native_window_taskbar_set_overlay_icon(self.handle, icon.map_or(0, |value| value.as_raw()), description_native.as_ptr()) + } + } + + pub fn overlay_icon(&self) -> Option { + unsafe { + Image::from_raw(cnativeapi::native_window_taskbar_get_overlay_icon(self.handle)) + } + } + + pub fn overlay_icon_description(&self) -> Option { + unsafe { + let ptr = cnativeapi::native_window_taskbar_get_overlay_icon_description(self.handle); + if ptr.is_null() { + return None; + } + let value = CStr::from_ptr(ptr).to_string_lossy().into_owned(); + cnativeapi::free_c_str(ptr); + Some(value) + } + } + + pub fn add_thumbnail_button(&self, button: Option<&TaskbarThumbnailButton>) -> bool { + unsafe { + cnativeapi::native_window_taskbar_add_thumbnail_button(self.handle, button.map_or(0, |value| value.as_raw())) + } + } + + pub fn insert_thumbnail_button(&self, index: std::os::raw::c_ulong, button: Option<&TaskbarThumbnailButton>) -> bool { + unsafe { + cnativeapi::native_window_taskbar_insert_thumbnail_button(self.handle, index, button.map_or(0, |value| value.as_raw())) + } + } + + pub fn remove_thumbnail_button(&self, button: Option<&TaskbarThumbnailButton>) -> bool { + unsafe { + cnativeapi::native_window_taskbar_remove_thumbnail_button(self.handle, button.map_or(0, |value| value.as_raw())) + } + } + + pub fn remove_thumbnail_button_by_id(&self, button_id: TaskbarThumbnailButtonId) -> bool { + unsafe { + cnativeapi::native_window_taskbar_remove_thumbnail_button_by_id(self.handle, button_id) + } + } + + pub fn remove_thumbnail_button_at(&self, index: std::os::raw::c_ulong) -> bool { + unsafe { + cnativeapi::native_window_taskbar_remove_thumbnail_button_at(self.handle, index) + } + } + + pub fn clear_thumbnail_buttons(&self) { + unsafe { + cnativeapi::native_window_taskbar_clear_thumbnail_buttons(self.handle); + } + } + + pub fn thumbnail_button_count(&self) -> std::os::raw::c_ulong { + unsafe { + cnativeapi::native_window_taskbar_get_thumbnail_button_count(self.handle) + } + } + + pub fn get_thumbnail_button_at(&self, index: std::os::raw::c_ulong) -> Option { + unsafe { + TaskbarThumbnailButton::from_raw(cnativeapi::native_window_taskbar_get_thumbnail_button_at(self.handle, index)) + } + } + + pub fn get_thumbnail_button_by_id(&self, button_id: TaskbarThumbnailButtonId) -> Option { + unsafe { + TaskbarThumbnailButton::from_raw(cnativeapi::native_window_taskbar_get_thumbnail_button_by_id(self.handle, button_id)) + } + } + + pub fn all_thumbnail_buttons(&self) -> Vec { + unsafe { + let mut list = cnativeapi::native_window_taskbar_get_all_thumbnail_buttons(self.handle); + let mut items = Vec::new(); + if !list.taskbar_thumbnail_buttons.is_null() { + for index in 0..list.count as isize { + if let Some(item) = TaskbarThumbnailButton::from_raw(*list.taskbar_thumbnail_buttons.offset(index)) { + items.push(item); + } + } + } + // Handles are now owned by `items`; drop just the array. + cnativeapi::native_taskbar_thumbnail_button_list_release(&mut list); + items + } + } + + pub fn start_flashing(&self, options: &TaskbarFlashOptions) -> bool { + let options_raw = options.to_raw(); + unsafe { + cnativeapi::native_window_taskbar_start_flashing(self.handle, options_raw.raw) + } + } + + pub fn stop_flashing(&self) -> bool { + unsafe { + cnativeapi::native_window_taskbar_stop_flashing(self.handle) + } + } + + /// Registers `callback` for every `TaskbarEvent` this `WindowTaskbar` emits. + /// + /// The closure is dropped on the main thread once the listener is removed + /// or its emitter destroyed. + pub fn add_listener(&self, callback: impl Fn(&TaskbarEvent) + 'static) -> ListenerId { + unsafe extern "C" fn trampoline(event: *const cnativeapi::native_taskbar_event_t, user_data: *mut std::ffi::c_void) { + if event.is_null() || user_data.is_null() { + return; + } + let callback = &*(user_data as *const Box); + if let Some(event) = TaskbarEvent::from_raw(&*event) { + callback(&event); + } + } + let boxed: Box> = Box::new(Box::new(callback)); + let user_data = Box::into_raw(boxed) as *mut std::ffi::c_void; + unsafe extern "C" fn release(user_data: *mut std::ffi::c_void) { + drop(Box::from_raw(user_data as *mut Box)); + } + unsafe { cnativeapi::native_window_taskbar_add_listener(self.handle, Some(trampoline), user_data, Some(release)) } + } + + /// Unregisters a listener. Returns false if unknown. + pub fn remove_listener(&self, listener_id: ListenerId) -> bool { + unsafe { cnativeapi::native_window_taskbar_remove_listener(self.handle, listener_id) } + } + +} + +impl Drop for WindowTaskbar { + fn drop(&mut self) { + if self.handle != 0 { + unsafe { cnativeapi::native_window_taskbar_free(self.handle) }; + } + } +} + +/// A `WindowTaskbar` owned elsewhere; using it does not release it. +#[derive(Debug, Clone, Copy, PartialEq, Eq)] +pub struct WindowTaskbarRef(cnativeapi::native_window_taskbar_t); + +impl WindowTaskbarRef { + pub(crate) fn from_raw(handle: cnativeapi::native_window_taskbar_t) -> Self { + Self(handle) + } + + pub fn as_raw(&self) -> cnativeapi::native_window_taskbar_t { + self.0 + } + + /// Runs `f` against the borrowed handle. The `WindowTaskbar` it receives + /// must not outlive the call. + pub fn with(&self, f: impl FnOnce(&WindowTaskbar) -> R) -> R { + let borrowed = std::mem::ManuallyDrop::new(WindowTaskbar { handle: self.0 }); + f(&borrowed) + } +} + diff --git a/bindings/swift/Sources/NativeAPI/Window.swift b/bindings/swift/Sources/NativeAPI/Window.swift index 6e31cde9..c622b4fe 100644 --- a/bindings/swift/Sources/NativeAPI/Window.swift +++ b/bindings/swift/Sources/NativeAPI/Window.swift @@ -747,6 +747,12 @@ public class Window { return native_window_is_visible_in_taskbar(nativeHandle) } + public var taskbar: WindowTaskbar? { + let handle = native_window_get_taskbar(nativeHandle) + guard handle != NATIVE_INVALID_WINDOW_TASKBAR else { return nil } + return WindowTaskbar(nativeHandle: handle) + } + public func setIgnoreMouseEvents(_ isIgnoreMouseEvents: Bool, forward: Bool) -> Bool { return native_window_set_ignore_mouse_events(nativeHandle, isIgnoreMouseEvents, forward) } diff --git a/bindings/swift/Sources/NativeAPI/WindowTaskbar.swift b/bindings/swift/Sources/NativeAPI/WindowTaskbar.swift new file mode 100644 index 00000000..c3407931 --- /dev/null +++ b/bindings/swift/Sources/NativeAPI/WindowTaskbar.swift @@ -0,0 +1,369 @@ +// AUTO-GENERATED. DO NOT EDIT. +// Code generated by ./codegen. DO NOT EDIT. +// Any manual changes WILL BE LOST when this file is regenerated. + +import CNativeAPI +import Foundation + +public typealias TaskbarThumbnailButtonId = UInt32 + +public enum TaskbarProgressState: CInt { + case none = 0 + case indeterminate = 1 + case normal = 2 + case paused = 3 + case error = 4 + + init(raw: native_taskbar_progress_state_t) { + switch raw { + case NATIVE_TASKBAR_PROGRESS_STATE_NONE: self = .none + case NATIVE_TASKBAR_PROGRESS_STATE_INDETERMINATE: self = .indeterminate + case NATIVE_TASKBAR_PROGRESS_STATE_NORMAL: self = .normal + case NATIVE_TASKBAR_PROGRESS_STATE_PAUSED: self = .paused + case NATIVE_TASKBAR_PROGRESS_STATE_ERROR: self = .error + default: self = .none + } + } + + var raw: native_taskbar_progress_state_t { + native_taskbar_progress_state_t(rawValue: numericCast(self.rawValue)) + } +} + +public enum TaskbarFlashTarget: CInt { + case all = 0 + case caption = 1 + case taskbar = 2 + + init(raw: native_taskbar_flash_target_t) { + switch raw { + case NATIVE_TASKBAR_FLASH_TARGET_ALL: self = .all + case NATIVE_TASKBAR_FLASH_TARGET_CAPTION: self = .caption + case NATIVE_TASKBAR_FLASH_TARGET_TASKBAR: self = .taskbar + default: self = .all + } + } + + var raw: native_taskbar_flash_target_t { + native_taskbar_flash_target_t(rawValue: numericCast(self.rawValue)) + } +} + +public struct TaskbarFlashOptions { + public var target: TaskbarFlashTarget + public var count: CInt + public var timeoutMs: CInt + public var stopOnForeground: Bool + + public init(target: TaskbarFlashTarget, count: CInt, timeoutMs: CInt, stopOnForeground: Bool) { + self.target = target + self.count = count + self.timeoutMs = timeoutMs + self.stopOnForeground = stopOnForeground + } +} + +extension TaskbarFlashOptions { + init(raw: native_taskbar_flash_options_t) { + self.init(target: TaskbarFlashTarget(raw: raw.target), count: raw.count, timeoutMs: raw.timeout_ms, stopOnForeground: raw.stop_on_foreground) + } + + func toRaw() -> native_taskbar_flash_options_t { + var raw = native_taskbar_flash_options_t() + raw.target = self.target.raw + raw.count = self.count + raw.timeout_ms = self.timeoutMs + raw.stop_on_foreground = self.stopOnForeground + return raw + } +} + +/// One `TaskbarEvent`, in its concrete form. +public enum TaskbarEvent { + case thumbnailButtonClicked(buttonId: TaskbarThumbnailButtonId) + + init?(raw: native_taskbar_event_t) { + switch raw.type { + case NATIVE_TASKBAR_EVENT_TYPE_THUMBNAIL_BUTTON_CLICKED: self = .thumbnailButtonClicked(buttonId: raw.data.thumbnail_button_clicked.button_id) + default: return nil + } + } +} + +/// Owned handle to a native `TaskbarThumbnailButton`. +public class TaskbarThumbnailButton { + public let nativeHandle: native_taskbar_thumbnail_button_t + private let ownsHandle: Bool + private var disposed = false + + public init(nativeHandle: native_taskbar_thumbnail_button_t, ownsHandle: Bool = true) { + self.nativeHandle = nativeHandle + self.ownsHandle = ownsHandle + } + + deinit { + guard ownsHandle, !disposed else { return } + native_handle_finalize(UnsafeMutableRawPointer(bitPattern: UInt(nativeHandle))) + } + + /// Releases this reference now; call on the UI thread. + public func dispose() { + guard ownsHandle, !disposed else { return } + disposed = true + releaseNativeHandle() + } + + /// Releases this reference with its own C ABI function. + public func releaseNativeHandle() { + native_taskbar_thumbnail_button_free(nativeHandle) + } + + /// Creates a new `TaskbarThumbnailButton`; returns nil if the native side failed. + public class func create(_ icon: Image?, tooltip: String) -> TaskbarThumbnailButton? { + let tooltipCString = strdup(tooltip) + defer { free(tooltipCString) } + let handle = native_taskbar_thumbnail_button_create(icon?.nativeHandle ?? 0, tooltipCString) + guard handle != NATIVE_INVALID_TASKBAR_THUMBNAIL_BUTTON else { return nil } + return TaskbarThumbnailButton(nativeHandle: handle) + } + + public var id: TaskbarThumbnailButtonId { + return native_taskbar_thumbnail_button_get_id(nativeHandle) + } + + public func setIcon(_ icon: Image?) -> Void { + native_taskbar_thumbnail_button_set_icon(nativeHandle, icon?.nativeHandle ?? 0) + } + + public var icon: Image? { + let handle = native_taskbar_thumbnail_button_get_icon(nativeHandle) + guard handle != NATIVE_INVALID_IMAGE else { return nil } + return Image(nativeHandle: handle) + } + + public func setTooltip(_ tooltip: String) -> Void { + let tooltipCString = strdup(tooltip) + defer { free(tooltipCString) } + native_taskbar_thumbnail_button_set_tooltip(nativeHandle, tooltipCString) + } + + public var tooltip: String? { + guard let value = native_taskbar_thumbnail_button_get_tooltip(nativeHandle) else { return nil } + defer { free_c_str(value) } + return String(cString: value) + } + + public func setEnabled(_ isEnabled: Bool) -> Void { + native_taskbar_thumbnail_button_set_enabled(nativeHandle, isEnabled) + } + + public var isEnabled: Bool { + return native_taskbar_thumbnail_button_is_enabled(nativeHandle) + } + + public func setVisible(_ isVisible: Bool) -> Void { + native_taskbar_thumbnail_button_set_visible(nativeHandle, isVisible) + } + + public var isVisible: Bool { + return native_taskbar_thumbnail_button_is_visible(nativeHandle) + } + + public func setInteractive(_ isInteractive: Bool) -> Void { + native_taskbar_thumbnail_button_set_interactive(nativeHandle, isInteractive) + } + + public var isInteractive: Bool { + return native_taskbar_thumbnail_button_is_interactive(nativeHandle) + } + + public func setHasBackground(_ hasBackground: Bool) -> Void { + native_taskbar_thumbnail_button_set_has_background(nativeHandle, hasBackground) + } + + public var hasBackground: Bool { + return native_taskbar_thumbnail_button_has_background(nativeHandle) + } + + public func setDismissOnClick(_ isDismissOnClick: Bool) -> Void { + native_taskbar_thumbnail_button_set_dismiss_on_click(nativeHandle, isDismissOnClick) + } + + public var isDismissOnClick: Bool { + return native_taskbar_thumbnail_button_is_dismiss_on_click(nativeHandle) + } + + /// Registers `callback` for every `TaskbarEvent` this `TaskbarThumbnailButton` emits. + /// + /// The closure runs synchronously on the UI thread; the context is + /// released through the C ABI when the listener is removed. + @discardableResult public func addListener(_ callback: @escaping (TaskbarEvent) -> Void) -> ListenerId { + let context = Unmanaged.passRetained(CallbackBox1(callback)).toOpaque() + let trampoline: @convention(c) (UnsafePointer?, UnsafeMutableRawPointer?) -> Void = { event, userData in + guard let event, let userData, let value = TaskbarEvent(raw: event.pointee) else { return } + Unmanaged>.fromOpaque(userData).takeUnretainedValue().body(value) + } + return native_taskbar_thumbnail_button_add_listener(nativeHandle, trampoline, context, nativeapiReleaseUserData) + } + + /// Unregisters a listener. Returns false if unknown. + public func removeListener(_ listenerId: ListenerId) -> Bool { + native_taskbar_thumbnail_button_remove_listener(nativeHandle, listenerId) + } + +} + +/// Owned handle to a native `WindowTaskbar`. +public class WindowTaskbar { + public let nativeHandle: native_window_taskbar_t + private let ownsHandle: Bool + private var disposed = false + + public init(nativeHandle: native_window_taskbar_t, ownsHandle: Bool = true) { + self.nativeHandle = nativeHandle + self.ownsHandle = ownsHandle + } + + deinit { + guard ownsHandle, !disposed else { return } + native_handle_finalize(UnsafeMutableRawPointer(bitPattern: UInt(nativeHandle))) + } + + /// Releases this reference now; call on the UI thread. + public func dispose() { + guard ownsHandle, !disposed else { return } + disposed = true + releaseNativeHandle() + } + + /// Releases this reference with its own C ABI function. + public func releaseNativeHandle() { + native_window_taskbar_free(nativeHandle) + } + + public static func isSupported() -> Bool { + return native_window_taskbar_is_supported() + } + + public static func getMaxThumbnailButtonCount() -> CUnsignedLong { + return native_window_taskbar_get_max_thumbnail_button_count() + } + + public func setProgressState(_ state: TaskbarProgressState) -> Bool { + return native_window_taskbar_set_progress_state(nativeHandle, state.raw) + } + + public var progressState: TaskbarProgressState { + return TaskbarProgressState(raw: native_window_taskbar_get_progress_state(nativeHandle)) + } + + public func setProgressValue(_ progress: Double) -> Bool { + return native_window_taskbar_set_progress_value(nativeHandle, progress) + } + + public var progressValue: Double { + return native_window_taskbar_get_progress_value(nativeHandle) + } + + public func setOverlayIcon(_ icon: Image?, description: String) -> Bool { + let descriptionCString = strdup(description) + defer { free(descriptionCString) } + return native_window_taskbar_set_overlay_icon(nativeHandle, icon?.nativeHandle ?? 0, descriptionCString) + } + + public var overlayIcon: Image? { + let handle = native_window_taskbar_get_overlay_icon(nativeHandle) + guard handle != NATIVE_INVALID_IMAGE else { return nil } + return Image(nativeHandle: handle) + } + + public var overlayIconDescription: String? { + guard let value = native_window_taskbar_get_overlay_icon_description(nativeHandle) else { return nil } + defer { free_c_str(value) } + return String(cString: value) + } + + public func addThumbnailButton(_ button: TaskbarThumbnailButton?) -> Bool { + return native_window_taskbar_add_thumbnail_button(nativeHandle, button?.nativeHandle ?? 0) + } + + public func insertThumbnailButton(_ index: CUnsignedLong, button: TaskbarThumbnailButton?) -> Bool { + return native_window_taskbar_insert_thumbnail_button(nativeHandle, index, button?.nativeHandle ?? 0) + } + + public func removeThumbnailButton(_ button: TaskbarThumbnailButton?) -> Bool { + return native_window_taskbar_remove_thumbnail_button(nativeHandle, button?.nativeHandle ?? 0) + } + + public func removeThumbnailButtonById(_ buttonId: TaskbarThumbnailButtonId) -> Bool { + return native_window_taskbar_remove_thumbnail_button_by_id(nativeHandle, buttonId) + } + + public func removeThumbnailButtonAt(_ index: CUnsignedLong) -> Bool { + return native_window_taskbar_remove_thumbnail_button_at(nativeHandle, index) + } + + public func clearThumbnailButtons() -> Void { + native_window_taskbar_clear_thumbnail_buttons(nativeHandle) + } + + public var thumbnailButtonCount: CUnsignedLong { + return native_window_taskbar_get_thumbnail_button_count(nativeHandle) + } + + public func getThumbnailButtonAt(_ index: CUnsignedLong) -> TaskbarThumbnailButton? { + let handle = native_window_taskbar_get_thumbnail_button_at(nativeHandle, index) + guard handle != NATIVE_INVALID_TASKBAR_THUMBNAIL_BUTTON else { return nil } + return TaskbarThumbnailButton(nativeHandle: handle) + } + + public func getThumbnailButtonById(_ buttonId: TaskbarThumbnailButtonId) -> TaskbarThumbnailButton? { + let handle = native_window_taskbar_get_thumbnail_button_by_id(nativeHandle, buttonId) + guard handle != NATIVE_INVALID_TASKBAR_THUMBNAIL_BUTTON else { return nil } + return TaskbarThumbnailButton(nativeHandle: handle) + } + + public var allThumbnailButtons: [TaskbarThumbnailButton] { + var list = native_window_taskbar_get_all_thumbnail_buttons(nativeHandle) + var items: [TaskbarThumbnailButton] = [] + if let buffer = list.taskbar_thumbnail_buttons { + for index in 0.. Bool { + let optionsRaw = options.toRaw() + return native_window_taskbar_start_flashing(nativeHandle, optionsRaw) + } + + public func stopFlashing() -> Bool { + return native_window_taskbar_stop_flashing(nativeHandle) + } + + /// Registers `callback` for every `TaskbarEvent` this `WindowTaskbar` emits. + /// + /// The closure runs synchronously on the UI thread; the context is + /// released through the C ABI when the listener is removed. + @discardableResult public func addListener(_ callback: @escaping (TaskbarEvent) -> Void) -> ListenerId { + let context = Unmanaged.passRetained(CallbackBox1(callback)).toOpaque() + let trampoline: @convention(c) (UnsafePointer?, UnsafeMutableRawPointer?) -> Void = { event, userData in + guard let event, let userData, let value = TaskbarEvent(raw: event.pointee) else { return } + Unmanaged>.fromOpaque(userData).takeUnretainedValue().body(value) + } + return native_window_taskbar_add_listener(nativeHandle, trampoline, context, nativeapiReleaseUserData) + } + + /// Unregisters a listener. Returns false if unknown. + public func removeListener(_ listenerId: ListenerId) -> Bool { + native_window_taskbar_remove_listener(nativeHandle, listenerId) + } + +} diff --git a/core b/core index 0e5a6774..af9b56aa 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 0e5a6774c38c2f427fa4ba594816a05346cc8fd8 +Subproject commit af9b56aa591ceabe4edbce93b13ab93a629c6f4a diff --git a/specs/README.md b/specs/README.md index b58cb5bd..986376a0 100644 --- a/specs/README.md +++ b/specs/README.md @@ -18,6 +18,7 @@ | [handle-ownership.md](handle-ownership.md) | C ABI 句柄的所有权与失效语义 | 已决策,实施中 | | [view.md](view.md) | 怎么在窗口里放原生控件(View)并响应它:类型、所有权、布局、事件 | 已实施 | | [protocol-handler.md](protocol-handler.md) | 应用自己的 scheme(深链接)怎么进入进程:启动 URL、排队、宿主接入约定 | 已实施 | +| [window-taskbar.md](window-taskbar.md) | 窗口任务栏进度、叠加图标、缩略图工具栏与闪烁提醒 | 已实施 | 新增一个跨平台模块,按顺序读 architecture → object-model → api-style → platform-seam; 要过 C ABI 再读 c-abi + handle-ownership。 diff --git a/specs/window-taskbar.md b/specs/window-taskbar.md new file mode 100644 index 00000000..4ec3cf76 --- /dev/null +++ b/specs/window-taskbar.md @@ -0,0 +1,78 @@ +# 窗口任务栏(WindowTaskbar) + +> 状态:已实施(Windows 原生实现,其余平台留桩) +> 适用范围:`core/src/window_taskbar.h`、`window_taskbar.cpp`、`window_taskbar_impl.h`、 +> `core/src/window.h`(`Window::GetTaskbar()`)、`core/src/platform/*/window_taskbar_*`、 +> `core/src/platform/windows/application_windows.cpp` +> 核实基准:2026-12-01 + +`WindowTaskbar` 控制单个顶层窗口在操作系统任务栏上的表现:5 态进度条、自定义叠加图标、 +缩略图工具栏(最多 7 个可交互按钮)以及闪烁提醒。 + +窗口是否出现在任务栏上由既有 `Window::SetVisibleInTaskbar()` / `IsVisibleInTaskbar()` +管理;窗口标题由 `Window::SetTitle()` / `GetTitle()` 管理;跨平台应用级 Dock/Launcher +进度与文字角标保留在 `Application::SetProgressBar()` / `SetBadgeLabel()`。 + +## 1. 对象模型 + +- **`WindowTaskbar`**:无集合 ID 的身份对象(`IdTypeTag` 28),禁拷贝禁移动,继承 + `EventEmitter`,无公共构造函数。通过 `Window::GetTaskbar()` 惰性创建并 + 缓存;若底层原生窗口已失效则返回 `nullptr`。 + 同一原生窗口的多个 `Window` 包装各自缓存其 `WindowTaskbar` 句柄,但共享同一份按原生 + 窗口键控的底层状态。 +- **`TaskbarThumbnailButton`**:带整数 ID 的身份对象(`TaskbarThumbnailButtonId`, + `IdTypeTag` 29),禁拷贝禁移动,继承 `EventEmitter`。对标 `MenuItem`: + 独立构造与配置属性,添加到某个 `WindowTaskbar` 后,修改属性立即同步到原生缩略图工具栏。 + 同一按钮同一时刻最多挂接在一个 `WindowTaskbar` 上。 +- **值类型**:`TaskbarProgressState`、`TaskbarFlashTarget`、`TaskbarFlashOptions`、 + `TaskbarEvent`、`TaskbarThumbnailButtonClickedEvent`。 + +## 2. 规则与边界 + +- **进度状态与数值分离**:`SetProgressState(TaskbarProgressState)` 切换 5 种状态 + (`None`、`Indeterminate`、`Normal`、`Paused`、`Error`);`SetProgressValue(double)` + 接收 `[0.0, 1.0]` 内的有限浮点值(非法值返回 `false` 且不修改状态)。当当前状态为 + `None` 或 `Indeterminate` 时,`SetProgressValue` 自动切到 `Normal`;当当前状态为 + `Paused` 或 `Error` 时,更新数值同时保留原状态(屏蔽 Win32 `SetProgressValue` 隐式重置为 + `TBPF_NORMAL` 的行为)。 +- **叠加图标**:`SetOverlayIcon(image, description)` 接收 `std::shared_ptr`(`nullptr` + 清除)和无障碍描述。Windows 上与 `Application::SetBadgeLabel()` 共享同一 `HWND` 的叠加 + 槽位,遵循后写入生效语义。 +- **缩略图工具栏**:集合方法遵循 `Menu` 约定(`AddThumbnailButton` / `InsertThumbnailButton` / + `RemoveThumbnailButton*` / `ClearThumbnailButtons` / `GetAllThumbnailButtons`),上限 7 个 + 按钮(`WindowTaskbar::GetMaxThumbnailButtonCount()`)。不采用 `vector` 入参以 + 保持与 C ABI 生成器完全兼容。点击事件在被点击的 `TaskbarThumbnailButton` 以及该 `HWND` + 关联的所有活跃 `WindowTaskbar` 实例上通过 `EmitAsync` 派发。 +- **闪烁提醒**:`StartFlashing(TaskbarFlashOptions)` 接收目标(`All`/`Caption`/`Taskbar`)、 + 次数(`0` 为持续)、间隔毫秒(`0` 为系统默认)和 `stop_on_foreground`;负数参数返回 `false`。 + `StopFlashing()` 停止闪烁。 + +## 3. Windows 实现要点 + +- 使用 `ITaskbarList3` 与 `FlashWindowEx`;所有 COM / 子类化操作同步派发到目标 `HWND` 所属的 + Win32 线程,并兼容 `RPC_E_CHANGED_MODE`。 +- 在 `HWND` 上安装独立窗口子类(`SetWindowSubclass`),放行 UIPI 过滤的 + `TaskbarButtonCreated` 与 `WM_COMMAND`: + - 每次同步缩略图工具栏时固定使用 7 个槽位(未用槽位标记 `THBF_HIDDEN | THBF_NONINTERACTIVE`), + 优先尝试 `ThumbBarAddButtons`;若当前任务栏项已创建过按钮(返回 `E_INVALIDARG`),则回退调用 + `ThumbBarUpdateButtons`。这样既满足单次生命周期只能 `Add` 一次的约束,也能在窗口隐藏再显示 + (任务栏项被壳层重建)后自动恢复按钮。 + - 收到 `TaskbarButtonCreated`(窗口首次建按钮、隐藏后重新显示或 `explorer.exe` 重启)时重新绑定 + `ITaskbarList3` 并自动重放进度、叠加图标与 7 槽工具栏。 + - `WM_COMMAND` 中 `HIWORD(wParam) == THBN_CLICKED` 按槽位映射按钮并 `EmitAsync`。 + - `WM_NCDESTROY` 时销毁全部持有 `HICON`、解除按钮挂接并释放共享状态。 +- `Application::SetProgressBar` / `Application::SetBadgeLabel` 在 Windows 上复用同一 per-`HWND` + 状态,使任务栏重建后同样自动恢复且避免两套 `ITaskbarList3` 冲突。 + +## 4. 平台矩阵 + +| 平台 | `IsSupported()` | `GetMaxThumbnailButtonCount()` | 行为 | +|---|---|---|---| +| Windows | `true`(存在运行中的 `Shell_TrayWnd` 时) | `7` | `ITaskbarList3` + `FlashWindowEx` | +| macOS / Linux / Android / iOS / OpenHarmony / WASM | `false` | `0` | 全部写入返回 `false`,读取返回默认值;应用级进度与角标见 `Application` | + +## 5. 未决 + +- **Jump List(`ICustomDestinationList`)**:应用级能力、强依赖 AppUserModelID,后续单独设计。 +- **跨平台窗口提醒**:macOS `requestUserAttention:` / Linux `gtk_window_set_urgency_hint` 若需 + 统一入口,后续可在 `Window` 上另增跨平台 `RequestAttention` / `CancelAttention`。 diff --git a/tools/codegen/shared/src/lib.rs b/tools/codegen/shared/src/lib.rs index 54786b19..a4c08911 100644 --- a/tools/codegen/shared/src/lib.rs +++ b/tools/codegen/shared/src/lib.rs @@ -36,6 +36,7 @@ pub const API_HEADERS: &[&str] = &[ "window_shape.h", "window_shadow.h", "view.h", + "window_taskbar.h", "window.h", "window_manager.h", "window_drag_session.h", diff --git a/website/content/api/index.json b/website/content/api/index.json index cf099d00..21e2db5c 100644 --- a/website/content/api/index.json +++ b/website/content/api/index.json @@ -967,6 +967,116 @@ } ] }, + { + "id": "window_taskbar", + "header": "window_taskbar.h", + "items": [ + { + "key": "TaskbarThumbnailButton", + "kind": "class", + "summary": "An interactive button shown in a window's taskbar thumbnail preview.", + "languages": [ + "cpp", + "csharp", + "dart", + "go", + "js", + "python", + "rust", + "swift" + ] + }, + { + "key": "WindowTaskbar", + "kind": "class", + "summary": "Controls a window's representation on the operating system taskbar.", + "languages": [ + "cpp", + "csharp", + "dart", + "go", + "js", + "python", + "rust", + "swift" + ] + }, + { + "key": "TaskbarFlashOptions", + "kind": "struct", + "summary": "Configuration for WindowTaskbar::StartFlashing().", + "languages": [ + "cpp", + "csharp", + "dart", + "go", + "js", + "python", + "rust", + "swift" + ] + }, + { + "key": "TaskbarProgressState", + "kind": "enum", + "summary": "Progress indicator state shown on a window's taskbar button.", + "languages": [ + "cpp", + "csharp", + "dart", + "go", + "js", + "python", + "rust", + "swift" + ] + }, + { + "key": "TaskbarFlashTarget", + "kind": "enum", + "summary": "Visual target to flash when requesting user attention.", + "languages": [ + "cpp", + "csharp", + "dart", + "go", + "js", + "python", + "rust", + "swift" + ] + }, + { + "key": "TaskbarEvent", + "kind": "event", + "summary": "Base class for all window taskbar events.", + "languages": [ + "cpp", + "csharp", + "dart", + "go", + "js", + "python", + "rust", + "swift" + ] + }, + { + "key": "TaskbarThumbnailButtonId", + "kind": "alias", + "summary": "Unique identifier for a taskbar thumbnail toolbar button.", + "languages": [ + "cpp", + "dart", + "go", + "js", + "python", + "rust", + "swift" + ] + } + ] + }, { "id": "window", "header": "window.h", diff --git a/website/content/api/window.json b/website/content/api/window.json index d917cf49..34318162 100644 --- a/website/content/api/window.json +++ b/website/content/api/window.json @@ -5660,6 +5660,55 @@ } } }, + { + "key": "Window::GetTaskbar", + "kind": "method", + "doc": { + "summary": "Gets the taskbar controller for this window.", + "details": "Created on first call and cached: the same instance is returned for the life of this Window wrapper. Native taskbar state belongs to the native window and is shared across all wrappers referring to it.", + "returns": "The window's taskbar controller, or nullptr if the native window is no longer valid.", + "notes": [ + { + "kind": "note", + "text": "Platform availability:\n- macOS: ⚠️ Returns a controller whose operations are no-ops and return false; see WindowTaskbar::IsSupported() and Application::SetProgressBar().\n- Windows: ✅ Fully supported - ITaskbarList3 and FlashWindowEx.\n- Linux: ⚠️ Returns a controller whose operations are no-ops and return false; see WindowTaskbar::IsSupported() and Application::SetProgressBar().\n- Android: ❌ Not applicable - operations return false.\n- iOS: ❌ Not applicable - operations return false.\n- OpenHarmony: ❌ Not applicable - operations return false." + } + ] + }, + "signatures": { + "cpp": { + "name": "GetTaskbar", + "signature": "std::shared_ptr GetTaskbar() const" + }, + "csharp": { + "name": "Taskbar", + "signature": "public WindowTaskbar? Taskbar" + }, + "dart": { + "name": "taskbar", + "signature": "WindowTaskbar? get taskbar" + }, + "go": { + "name": "Taskbar", + "signature": "func (w *Window) Taskbar() *WindowTaskbar" + }, + "js": { + "name": "taskbar", + "signature": "get taskbar(): WindowTaskbar | null" + }, + "python": { + "name": "taskbar", + "signature": "@property\ndef taskbar(self) -> _window_taskbar.WindowTaskbar | None:" + }, + "rust": { + "name": "taskbar", + "signature": "pub fn taskbar(&self) -> Option" + }, + "swift": { + "name": "taskbar", + "signature": "var taskbar: WindowTaskbar?" + } + } + }, { "key": "Window::SetIgnoreMouseEvents", "kind": "method", diff --git a/website/content/api/window_taskbar.json b/website/content/api/window_taskbar.json new file mode 100644 index 00000000..a5c470f8 --- /dev/null +++ b/website/content/api/window_taskbar.json @@ -0,0 +1,2758 @@ +{ + "$comment": "AUTO-GENERATED. DO NOT EDIT. Generated by tools/codegen from the core headers; run ./codegen.", + "id": "window_taskbar", + "header": "window_taskbar.h", + "items": [ + { + "key": "TaskbarThumbnailButton", + "kind": "class", + "doc": { + "summary": "An interactive button shown in a window's taskbar thumbnail preview.", + "details": "Mirrors MenuItem in lifecycle and event handling: create a button, configure its icon, tooltip, and behavior flags, subscribe to TaskbarThumbnailButtonClickedEvent, and add it to a WindowTaskbar (up to 7 buttons per window on Windows). Mutating properties while attached immediately updates the native thumbnail toolbar.\n\nA button can be attached to at most one WindowTaskbar at a time.\n\n```cpp\nauto play = std::make_shared(\n Image::FromFile(\"play.png\"), \"Play\");\nplay->AddListener(\n [](const TaskbarThumbnailButtonClickedEvent&) {\n // Handle click\n });\nif (auto taskbar = window->GetTaskbar()) {\n taskbar->AddThumbnailButton(play);\n}\n```" + }, + "signatures": { + "cpp": { + "name": "TaskbarThumbnailButton", + "signature": "class TaskbarThumbnailButton : public EventEmitter" + }, + "csharp": { + "name": "TaskbarThumbnailButton", + "signature": "public sealed partial class TaskbarThumbnailButton : IDisposable" + }, + "dart": { + "name": "TaskbarThumbnailButton", + "signature": "class TaskbarThumbnailButton implements ffi.Finalizable" + }, + "go": { + "name": "TaskbarThumbnailButton", + "signature": "type TaskbarThumbnailButton struct" + }, + "js": { + "name": "TaskbarThumbnailButton", + "signature": "export class TaskbarThumbnailButton extends NativeObject" + }, + "python": { + "name": "TaskbarThumbnailButton", + "signature": "class TaskbarThumbnailButton(_rt.NativeObject):" + }, + "rust": { + "name": "TaskbarThumbnailButton", + "signature": "pub struct TaskbarThumbnailButton" + }, + "swift": { + "name": "TaskbarThumbnailButton", + "signature": "class TaskbarThumbnailButton" + } + }, + "members": [ + { + "key": "TaskbarThumbnailButton::new", + "kind": "constructor", + "doc": { + "summary": "Creates a thumbnail toolbar button.", + "params": [ + { + "name": "icon", + "text": "Button icon, or nullptr for no icon." + }, + { + "name": "tooltip", + "text": "Hover tooltip text (truncated to 259 UTF-16 code units on Windows)." + } + ] + }, + "signatures": { + "cpp": { + "name": "new", + "signature": "TaskbarThumbnailButton(std::shared_ptr icon, std::string tooltip)" + }, + "csharp": { + "name": "Create", + "signature": "public static TaskbarThumbnailButton? Create(Image? icon, string tooltip)" + }, + "dart": { + "name": "create", + "signature": "static TaskbarThumbnailButton? create(Image? icon, String tooltip)" + }, + "go": { + "name": "NewTaskbarThumbnailButton", + "signature": "func NewTaskbarThumbnailButton(icon *Image, tooltip string) (*TaskbarThumbnailButton, error)" + }, + "js": { + "name": "create", + "signature": "static create(icon: Image | null = null, tooltip: string = \"\"): TaskbarThumbnailButton | null" + }, + "python": { + "name": "__init__", + "signature": "def __init__(self, icon: _image.Image | None, tooltip: str) -> None:" + }, + "rust": { + "name": "new", + "signature": "pub fn new(icon: Option<&Image>, tooltip: &str) -> Option" + }, + "swift": { + "name": "create", + "signature": "class func create(_ icon: Image?, tooltip: String) -> TaskbarThumbnailButton?" + } + } + }, + { + "key": "TaskbarThumbnailButton::listener", + "kind": "listener", + "signatures": { + "cpp": { + "name": "listener", + "signature": "size_t AddListener(std::function listener)" + }, + "csharp": { + "name": "AddListener", + "signature": "public ulong AddListener(Action callback)\npublic bool RemoveListener(ulong listenerId)" + }, + "dart": { + "name": "addListener", + "signature": "ListenerId addListener(FutureOr Function(TaskbarEvent) callback)\nbool removeListener(ListenerId listenerId)" + }, + "go": { + "name": "AddListener", + "signature": "func (ttb *TaskbarThumbnailButton) AddListener(callback func(TaskbarEvent)) (ListenerID, error)\nfunc (ttb *TaskbarThumbnailButton) RemoveListener(id ListenerID) error" + }, + "js": { + "name": "addListener", + "signature": "addListener(listener: (event: TaskbarEvent) => void | Promise): number\nremoveListener(listenerId: number): boolean" + }, + "python": { + "name": "add_listener", + "signature": "def add_listener(self, callback: Callable[[TaskbarEvent], None]) -> int:\ndef remove_listener(self, listener_id: int) -> bool:" + }, + "rust": { + "name": "add_listener", + "signature": "pub fn add_listener(&self, callback: impl Fn(&TaskbarEvent) + 'static) -> ListenerId\npub fn remove_listener(&self, listener_id: ListenerId) -> bool" + }, + "swift": { + "name": "addListener", + "signature": "func addListener(_ callback: @escaping (TaskbarEvent) -> Void) -> ListenerId\nfunc removeListener(_ listenerId: ListenerId) -> Bool" + } + } + }, + { + "key": "TaskbarThumbnailButton::GetId", + "kind": "method", + "doc": { + "summary": "Gets the unique identifier for this button.", + "returns": "The button's TaskbarThumbnailButtonId." + }, + "signatures": { + "cpp": { + "name": "GetId", + "signature": "TaskbarThumbnailButtonId GetId() const" + }, + "csharp": { + "name": "Id", + "signature": "public uint Id" + }, + "dart": { + "name": "id", + "signature": "TaskbarThumbnailButtonId get id" + }, + "go": { + "name": "ID", + "signature": "func (ttb *TaskbarThumbnailButton) ID() TaskbarThumbnailButtonID" + }, + "js": { + "name": "id", + "signature": "get id(): TaskbarThumbnailButtonId" + }, + "python": { + "name": "id", + "signature": "@property\ndef id(self) -> TaskbarThumbnailButtonId:" + }, + "rust": { + "name": "id", + "signature": "pub fn id(&self) -> TaskbarThumbnailButtonId" + }, + "swift": { + "name": "id", + "signature": "var id: TaskbarThumbnailButtonId" + } + } + }, + { + "key": "TaskbarThumbnailButton::SetIcon", + "kind": "method", + "doc": { + "summary": "Sets the button icon, or nullptr to clear it.", + "params": [ + { + "name": "icon", + "text": "Image to display, or nullptr." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetIcon", + "signature": "void SetIcon(std::shared_ptr icon)" + }, + "csharp": { + "name": "SetIcon", + "signature": "public void SetIcon(Image? icon)" + }, + "dart": { + "name": "icon", + "signature": "set icon(Image? value)" + }, + "go": { + "name": "SetIcon", + "signature": "func (ttb *TaskbarThumbnailButton) SetIcon(icon *Image)" + }, + "js": { + "name": "setIcon", + "signature": "setIcon(icon: Image | null): void" + }, + "python": { + "name": "set_icon", + "signature": "def set_icon(self, icon: _image.Image | None) -> None:\n@icon.setter\ndef icon(self, value: _image.Image | None) -> None:" + }, + "rust": { + "name": "set_icon", + "signature": "pub fn set_icon(&self, icon: Option<&Image>)" + }, + "swift": { + "name": "setIcon", + "signature": "func setIcon(_ icon: Image?) -> Void" + } + } + }, + { + "key": "TaskbarThumbnailButton::GetIcon", + "kind": "method", + "doc": { + "summary": "Gets the current button icon, or nullptr if unset.", + "returns": "The button's icon image, or nullptr." + }, + "signatures": { + "cpp": { + "name": "GetIcon", + "signature": "std::shared_ptr GetIcon() const" + }, + "csharp": { + "name": "Icon", + "signature": "public Image? Icon" + }, + "dart": { + "name": "icon", + "signature": "Image? get icon" + }, + "go": { + "name": "Icon", + "signature": "func (ttb *TaskbarThumbnailButton) Icon() *Image" + }, + "js": { + "name": "icon", + "signature": "get icon(): Image | null" + }, + "python": { + "name": "icon", + "signature": "@property\ndef icon(self) -> _image.Image | None:" + }, + "rust": { + "name": "icon", + "signature": "pub fn icon(&self) -> Option" + }, + "swift": { + "name": "icon", + "signature": "var icon: Image?" + } + } + }, + { + "key": "TaskbarThumbnailButton::SetTooltip", + "kind": "method", + "doc": { + "summary": "Sets the tooltip displayed when hovering over this button.", + "params": [ + { + "name": "tooltip", + "text": "Tooltip text (UTF-8)." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetTooltip", + "signature": "void SetTooltip(std::string tooltip)" + }, + "csharp": { + "name": "SetTooltip", + "signature": "public void SetTooltip(string tooltip)" + }, + "dart": { + "name": "tooltip", + "signature": "set tooltip(String value)" + }, + "go": { + "name": "SetTooltip", + "signature": "func (ttb *TaskbarThumbnailButton) SetTooltip(tooltip string)" + }, + "js": { + "name": "setTooltip", + "signature": "setTooltip(tooltip: string): void" + }, + "python": { + "name": "set_tooltip", + "signature": "def set_tooltip(self, tooltip: str) -> None:\n@tooltip.setter\ndef tooltip(self, value: str) -> None:" + }, + "rust": { + "name": "set_tooltip", + "signature": "pub fn set_tooltip(&self, tooltip: &str)" + }, + "swift": { + "name": "setTooltip", + "signature": "func setTooltip(_ tooltip: String) -> Void" + } + } + }, + { + "key": "TaskbarThumbnailButton::GetTooltip", + "kind": "method", + "doc": { + "summary": "Gets the button's tooltip text.", + "returns": "The current tooltip text." + }, + "signatures": { + "cpp": { + "name": "GetTooltip", + "signature": "std::string GetTooltip() const" + }, + "csharp": { + "name": "Tooltip", + "signature": "public string? Tooltip" + }, + "dart": { + "name": "tooltip", + "signature": "String? get tooltip" + }, + "go": { + "name": "Tooltip", + "signature": "func (ttb *TaskbarThumbnailButton) Tooltip() string" + }, + "js": { + "name": "tooltip", + "signature": "get tooltip(): string" + }, + "python": { + "name": "tooltip", + "signature": "@property\ndef tooltip(self) -> str:" + }, + "rust": { + "name": "tooltip", + "signature": "pub fn tooltip(&self) -> Option" + }, + "swift": { + "name": "tooltip", + "signature": "var tooltip: String?" + } + } + }, + { + "key": "TaskbarThumbnailButton::SetEnabled", + "kind": "method", + "doc": { + "summary": "Sets whether the button is enabled and clickable.", + "params": [ + { + "name": "is_enabled", + "text": "true to enable, false to disable (THBF_DISABLED). Default: true." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetEnabled", + "signature": "void SetEnabled(bool is_enabled)" + }, + "csharp": { + "name": "SetEnabled", + "signature": "public void SetEnabled(bool isEnabled)" + }, + "dart": { + "name": "isEnabled", + "signature": "set isEnabled(bool value)" + }, + "go": { + "name": "SetEnabled", + "signature": "func (ttb *TaskbarThumbnailButton) SetEnabled(isEnabled bool)" + }, + "js": { + "name": "setEnabled", + "signature": "setEnabled(isEnabled: boolean): void" + }, + "python": { + "name": "set_enabled", + "signature": "def set_enabled(self, is_enabled: bool) -> None:" + }, + "rust": { + "name": "set_enabled", + "signature": "pub fn set_enabled(&self, is_enabled: bool)" + }, + "swift": { + "name": "setEnabled", + "signature": "func setEnabled(_ isEnabled: Bool) -> Void" + } + } + }, + { + "key": "TaskbarThumbnailButton::IsEnabled", + "kind": "method", + "doc": { + "summary": "Checks if the button is enabled.", + "returns": "true if enabled, false if disabled." + }, + "signatures": { + "cpp": { + "name": "IsEnabled", + "signature": "bool IsEnabled() const" + }, + "csharp": { + "name": "IsEnabled", + "signature": "public bool IsEnabled" + }, + "dart": { + "name": "isEnabled", + "signature": "bool get isEnabled" + }, + "go": { + "name": "IsEnabled", + "signature": "func (ttb *TaskbarThumbnailButton) IsEnabled() bool" + }, + "js": { + "name": "isEnabled", + "signature": "get isEnabled(): boolean" + }, + "python": { + "name": "is_enabled", + "signature": "@property\ndef is_enabled(self) -> bool:" + }, + "rust": { + "name": "is_enabled", + "signature": "pub fn is_enabled(&self) -> bool" + }, + "swift": { + "name": "isEnabled", + "signature": "var isEnabled: Bool" + } + } + }, + { + "key": "TaskbarThumbnailButton::SetVisible", + "kind": "method", + "doc": { + "summary": "Sets whether the button is visible in the thumbnail toolbar.", + "params": [ + { + "name": "is_visible", + "text": "true to show, false to hide (THBF_HIDDEN). Default: true." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetVisible", + "signature": "void SetVisible(bool is_visible)" + }, + "csharp": { + "name": "SetVisible", + "signature": "public void SetVisible(bool isVisible)" + }, + "dart": { + "name": "isVisible", + "signature": "set isVisible(bool value)" + }, + "go": { + "name": "SetVisible", + "signature": "func (ttb *TaskbarThumbnailButton) SetVisible(isVisible bool)" + }, + "js": { + "name": "setVisible", + "signature": "setVisible(isVisible: boolean): void" + }, + "python": { + "name": "set_visible", + "signature": "def set_visible(self, is_visible: bool) -> None:" + }, + "rust": { + "name": "set_visible", + "signature": "pub fn set_visible(&self, is_visible: bool)" + }, + "swift": { + "name": "setVisible", + "signature": "func setVisible(_ isVisible: Bool) -> Void" + } + } + }, + { + "key": "TaskbarThumbnailButton::IsVisible", + "kind": "method", + "doc": { + "summary": "Checks if the button is visible.", + "returns": "true if visible, false if hidden." + }, + "signatures": { + "cpp": { + "name": "IsVisible", + "signature": "bool IsVisible() const" + }, + "csharp": { + "name": "IsVisible", + "signature": "public bool IsVisible" + }, + "dart": { + "name": "isVisible", + "signature": "bool get isVisible" + }, + "go": { + "name": "IsVisible", + "signature": "func (ttb *TaskbarThumbnailButton) IsVisible() bool" + }, + "js": { + "name": "isVisible", + "signature": "get isVisible(): boolean" + }, + "python": { + "name": "is_visible", + "signature": "@property\ndef is_visible(self) -> bool:" + }, + "rust": { + "name": "is_visible", + "signature": "pub fn is_visible(&self) -> bool" + }, + "swift": { + "name": "isVisible", + "signature": "var isVisible: Bool" + } + } + }, + { + "key": "TaskbarThumbnailButton::SetInteractive", + "kind": "method", + "doc": { + "summary": "Sets whether the button responds to clicks and hover highlights.", + "params": [ + { + "name": "is_interactive", + "text": "true for normal buttons, false for static status indicators (THBF_NONINTERACTIVE). Default: true." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetInteractive", + "signature": "void SetInteractive(bool is_interactive)" + }, + "csharp": { + "name": "SetInteractive", + "signature": "public void SetInteractive(bool isInteractive)" + }, + "dart": { + "name": "isInteractive", + "signature": "set isInteractive(bool value)" + }, + "go": { + "name": "SetInteractive", + "signature": "func (ttb *TaskbarThumbnailButton) SetInteractive(isInteractive bool)" + }, + "js": { + "name": "setInteractive", + "signature": "setInteractive(isInteractive: boolean): void" + }, + "python": { + "name": "set_interactive", + "signature": "def set_interactive(self, is_interactive: bool) -> None:" + }, + "rust": { + "name": "set_interactive", + "signature": "pub fn set_interactive(&self, is_interactive: bool)" + }, + "swift": { + "name": "setInteractive", + "signature": "func setInteractive(_ isInteractive: Bool) -> Void" + } + } + }, + { + "key": "TaskbarThumbnailButton::IsInteractive", + "kind": "method", + "doc": { + "summary": "Checks if the button is interactive.", + "returns": "true if interactive, false otherwise." + }, + "signatures": { + "cpp": { + "name": "IsInteractive", + "signature": "bool IsInteractive() const" + }, + "csharp": { + "name": "IsInteractive", + "signature": "public bool IsInteractive" + }, + "dart": { + "name": "isInteractive", + "signature": "bool get isInteractive" + }, + "go": { + "name": "IsInteractive", + "signature": "func (ttb *TaskbarThumbnailButton) IsInteractive() bool" + }, + "js": { + "name": "isInteractive", + "signature": "get isInteractive(): boolean" + }, + "python": { + "name": "is_interactive", + "signature": "@property\ndef is_interactive(self) -> bool:" + }, + "rust": { + "name": "is_interactive", + "signature": "pub fn is_interactive(&self) -> bool" + }, + "swift": { + "name": "isInteractive", + "signature": "var isInteractive: Bool" + } + } + }, + { + "key": "TaskbarThumbnailButton::SetHasBackground", + "kind": "method", + "doc": { + "summary": "Sets whether the system draws the default button border/background.", + "params": [ + { + "name": "has_background", + "text": "true for default chrome, false for icon-only (THBF_NOBACKGROUND). Default: true." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetHasBackground", + "signature": "void SetHasBackground(bool has_background)" + }, + "csharp": { + "name": "SetHasBackground", + "signature": "public void SetHasBackground(bool hasBackground)" + }, + "dart": { + "name": "hasBackground", + "signature": "set hasBackground(bool value)" + }, + "go": { + "name": "SetHasBackground", + "signature": "func (ttb *TaskbarThumbnailButton) SetHasBackground(hasBackground bool)" + }, + "js": { + "name": "setHasBackground", + "signature": "setHasBackground(hasBackground: boolean): void" + }, + "python": { + "name": "set_has_background", + "signature": "def set_has_background(self, has_background: bool) -> None:" + }, + "rust": { + "name": "set_has_background", + "signature": "pub fn set_has_background(&self, has_background: bool)" + }, + "swift": { + "name": "setHasBackground", + "signature": "func setHasBackground(_ hasBackground: Bool) -> Void" + } + } + }, + { + "key": "TaskbarThumbnailButton::HasBackground", + "kind": "method", + "doc": { + "summary": "Checks if the button draws a background border.", + "returns": "true if the button draws a background border, false otherwise." + }, + "signatures": { + "cpp": { + "name": "HasBackground", + "signature": "bool HasBackground() const" + }, + "csharp": { + "name": "HasBackground", + "signature": "public bool HasBackground" + }, + "dart": { + "name": "hasBackground", + "signature": "bool get hasBackground" + }, + "go": { + "name": "HasBackground", + "signature": "func (ttb *TaskbarThumbnailButton) HasBackground() bool" + }, + "js": { + "name": "hasBackground", + "signature": "get hasBackground(): boolean" + }, + "python": { + "name": "has_background", + "signature": "@property\ndef has_background(self) -> bool:" + }, + "rust": { + "name": "has_background", + "signature": "pub fn has_background(&self) -> bool" + }, + "swift": { + "name": "hasBackground", + "signature": "var hasBackground: Bool" + } + } + }, + { + "key": "TaskbarThumbnailButton::SetDismissOnClick", + "kind": "method", + "doc": { + "summary": "Sets whether clicking this button dismisses the thumbnail preview.", + "params": [ + { + "name": "is_dismiss_on_click", + "text": "true to dismiss the preview on click (THBF_DISMISSONCLICK), false to keep it open. Default: false." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetDismissOnClick", + "signature": "void SetDismissOnClick(bool is_dismiss_on_click)" + }, + "csharp": { + "name": "SetDismissOnClick", + "signature": "public void SetDismissOnClick(bool isDismissOnClick)" + }, + "dart": { + "name": "isDismissOnClick", + "signature": "set isDismissOnClick(bool value)" + }, + "go": { + "name": "SetDismissOnClick", + "signature": "func (ttb *TaskbarThumbnailButton) SetDismissOnClick(isDismissOnClick bool)" + }, + "js": { + "name": "setDismissOnClick", + "signature": "setDismissOnClick(isDismissOnClick: boolean): void" + }, + "python": { + "name": "set_dismiss_on_click", + "signature": "def set_dismiss_on_click(self, is_dismiss_on_click: bool) -> None:" + }, + "rust": { + "name": "set_dismiss_on_click", + "signature": "pub fn set_dismiss_on_click(&self, is_dismiss_on_click: bool)" + }, + "swift": { + "name": "setDismissOnClick", + "signature": "func setDismissOnClick(_ isDismissOnClick: Bool) -> Void" + } + } + }, + { + "key": "TaskbarThumbnailButton::IsDismissOnClick", + "kind": "method", + "doc": { + "summary": "Checks if clicking this button dismisses the thumbnail preview.", + "returns": "true if clicking dismisses the preview, false otherwise." + }, + "signatures": { + "cpp": { + "name": "IsDismissOnClick", + "signature": "bool IsDismissOnClick() const" + }, + "csharp": { + "name": "IsDismissOnClick", + "signature": "public bool IsDismissOnClick" + }, + "dart": { + "name": "isDismissOnClick", + "signature": "bool get isDismissOnClick" + }, + "go": { + "name": "IsDismissOnClick", + "signature": "func (ttb *TaskbarThumbnailButton) IsDismissOnClick() bool" + }, + "js": { + "name": "isDismissOnClick", + "signature": "get isDismissOnClick(): boolean" + }, + "python": { + "name": "is_dismiss_on_click", + "signature": "@property\ndef is_dismiss_on_click(self) -> bool:" + }, + "rust": { + "name": "is_dismiss_on_click", + "signature": "pub fn is_dismiss_on_click(&self) -> bool" + }, + "swift": { + "name": "isDismissOnClick", + "signature": "var isDismissOnClick: Bool" + } + } + } + ] + }, + { + "key": "WindowTaskbar", + "kind": "class", + "doc": { + "summary": "Controls a window's representation on the operating system taskbar.", + "details": "Obtained via Window::GetTaskbar(). On Windows, wraps ITaskbarList3 and FlashWindowEx for the owning top-level HWND and automatically replays configured state when the taskbar button is created, recreated after hiding, or restored after Explorer restarts.\n\n```cpp\nif (WindowTaskbar::IsSupported()) {\n auto taskbar = window->GetTaskbar();\n taskbar->SetProgressState(TaskbarProgressState::Normal);\n taskbar->SetProgressValue(0.5);\n}\n```" + }, + "signatures": { + "cpp": { + "name": "WindowTaskbar", + "signature": "class WindowTaskbar : public EventEmitter" + }, + "csharp": { + "name": "WindowTaskbar", + "signature": "public sealed partial class WindowTaskbar : IDisposable" + }, + "dart": { + "name": "WindowTaskbar", + "signature": "class WindowTaskbar implements ffi.Finalizable" + }, + "go": { + "name": "WindowTaskbar", + "signature": "type WindowTaskbar struct" + }, + "js": { + "name": "WindowTaskbar", + "signature": "export class WindowTaskbar extends NativeObject" + }, + "python": { + "name": "WindowTaskbar", + "signature": "class WindowTaskbar(_rt.NativeObject):" + }, + "rust": { + "name": "WindowTaskbar", + "signature": "pub struct WindowTaskbar" + }, + "swift": { + "name": "WindowTaskbar", + "signature": "class WindowTaskbar" + } + }, + "members": [ + { + "key": "WindowTaskbar::listener", + "kind": "listener", + "signatures": { + "cpp": { + "name": "listener", + "signature": "size_t AddListener(std::function listener)" + }, + "csharp": { + "name": "AddListener", + "signature": "public ulong AddListener(Action callback)\npublic bool RemoveListener(ulong listenerId)" + }, + "dart": { + "name": "addListener", + "signature": "ListenerId addListener(FutureOr Function(TaskbarEvent) callback)\nbool removeListener(ListenerId listenerId)" + }, + "go": { + "name": "AddListener", + "signature": "func (wt *WindowTaskbar) AddListener(callback func(TaskbarEvent)) (ListenerID, error)\nfunc (wt *WindowTaskbar) RemoveListener(id ListenerID) error" + }, + "js": { + "name": "addListener", + "signature": "addListener(listener: (event: TaskbarEvent) => void | Promise): number\nremoveListener(listenerId: number): boolean" + }, + "python": { + "name": "add_listener", + "signature": "def add_listener(self, callback: Callable[[TaskbarEvent], None]) -> int:\ndef remove_listener(self, listener_id: int) -> bool:" + }, + "rust": { + "name": "add_listener", + "signature": "pub fn add_listener(&self, callback: impl Fn(&TaskbarEvent) + 'static) -> ListenerId\npub fn remove_listener(&self, listener_id: ListenerId) -> bool" + }, + "swift": { + "name": "addListener", + "signature": "func addListener(_ callback: @escaping (TaskbarEvent) -> Void) -> ListenerId\nfunc removeListener(_ listenerId: ListenerId) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::IsSupported", + "kind": "static", + "doc": { + "summary": "Checks whether per-window taskbar customization is supported here.", + "returns": "true on Windows with a running taskbar shell, false elsewhere." + }, + "signatures": { + "cpp": { + "name": "IsSupported", + "signature": "static bool IsSupported()" + }, + "csharp": { + "name": "IsSupported", + "signature": "public static bool IsSupported()" + }, + "dart": { + "name": "isSupported", + "signature": "static bool isSupported()" + }, + "go": { + "name": "WindowTaskbarIsSupported", + "signature": "func WindowTaskbarIsSupported() bool" + }, + "js": { + "name": "isSupported", + "signature": "static isSupported(): boolean" + }, + "python": { + "name": "is_supported", + "signature": "@staticmethod\ndef is_supported() -> bool:" + }, + "rust": { + "name": "is_supported", + "signature": "pub fn is_supported() -> bool" + }, + "swift": { + "name": "isSupported", + "signature": "static func isSupported() -> Bool" + } + } + }, + { + "key": "WindowTaskbar::GetMaxThumbnailButtonCount", + "kind": "static", + "doc": { + "summary": "Gets the maximum number of thumbnail toolbar buttons supported.", + "returns": "7 on Windows, 0 on unsupported platforms." + }, + "signatures": { + "cpp": { + "name": "GetMaxThumbnailButtonCount", + "signature": "static unsigned long GetMaxThumbnailButtonCount()" + }, + "csharp": { + "name": "GetMaxThumbnailButtonCount", + "signature": "public static ulong GetMaxThumbnailButtonCount()" + }, + "dart": { + "name": "getMaxThumbnailButtonCount", + "signature": "static int getMaxThumbnailButtonCount()" + }, + "go": { + "name": "WindowTaskbarMaxThumbnailButtonCount", + "signature": "func WindowTaskbarMaxThumbnailButtonCount() uint64" + }, + "js": { + "name": "getMaxThumbnailButtonCount", + "signature": "static getMaxThumbnailButtonCount(): number" + }, + "python": { + "name": "get_max_thumbnail_button_count", + "signature": "@staticmethod\ndef get_max_thumbnail_button_count() -> int:" + }, + "rust": { + "name": "get_max_thumbnail_button_count", + "signature": "pub fn get_max_thumbnail_button_count() -> std::os::raw::c_ulong" + }, + "swift": { + "name": "getMaxThumbnailButtonCount", + "signature": "static func getMaxThumbnailButtonCount() -> CUnsignedLong" + } + } + }, + { + "key": "WindowTaskbar::SetProgressState", + "kind": "method", + "doc": { + "summary": "Sets the taskbar progress indicator state.", + "details": "Switching between Normal, Paused, and Error preserves the last progress value set via SetProgressValue(). On Windows, this shares the primary window's taskbar progress indicator with Application::SetProgressBar(); the most recent call wins.", + "params": [ + { + "name": "state", + "text": "Desired progress state; TaskbarProgressState::None hides it." + } + ], + "returns": "true if applied or recorded for taskbar creation; false if unsupported, invalid enum value, or the native window is gone.", + "notes": [ + { + "kind": "note", + "text": "Platform availability:\n- macOS: ❌ Not supported - Always returns false (use Application::SetProgressBar).\n- Windows: ✅ Fully supported - ITaskbarList3::SetProgressState.\n- Linux: ❌ Not supported - Always returns false (use Application::SetProgressBar).\n- Android: ❌ Not applicable - Always returns false.\n- iOS: ❌ Not applicable - Always returns false.\n- OpenHarmony: ❌ Not applicable - Always returns false." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetProgressState", + "signature": "bool SetProgressState(TaskbarProgressState state)" + }, + "csharp": { + "name": "SetProgressState", + "signature": "public bool SetProgressState(TaskbarProgressState state)" + }, + "dart": { + "name": "setProgressState", + "signature": "bool setProgressState(TaskbarProgressState state)" + }, + "go": { + "name": "SetProgressState", + "signature": "func (wt *WindowTaskbar) SetProgressState(state TaskbarProgressState) error" + }, + "js": { + "name": "setProgressState", + "signature": "setProgressState(state: TaskbarProgressState): boolean" + }, + "python": { + "name": "set_progress_state", + "signature": "def set_progress_state(self, state: TaskbarProgressState) -> bool:" + }, + "rust": { + "name": "set_progress_state", + "signature": "pub fn set_progress_state(&self, state: TaskbarProgressState) -> bool" + }, + "swift": { + "name": "setProgressState", + "signature": "func setProgressState(_ state: TaskbarProgressState) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::GetProgressState", + "kind": "method", + "doc": { + "summary": "Gets the current taskbar progress state.", + "returns": "The active state, or TaskbarProgressState::None when unset, unsupported, or the native window is gone.", + "notes": [ + { + "kind": "see", + "text": "SetProgressState() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "GetProgressState", + "signature": "TaskbarProgressState GetProgressState() const" + }, + "csharp": { + "name": "ProgressState", + "signature": "public TaskbarProgressState ProgressState" + }, + "dart": { + "name": "progressState", + "signature": "TaskbarProgressState get progressState" + }, + "go": { + "name": "ProgressState", + "signature": "func (wt *WindowTaskbar) ProgressState() TaskbarProgressState" + }, + "js": { + "name": "progressState", + "signature": "get progressState(): TaskbarProgressState" + }, + "python": { + "name": "progress_state", + "signature": "@property\ndef progress_state(self) -> TaskbarProgressState:" + }, + "rust": { + "name": "progress_state", + "signature": "pub fn progress_state(&self) -> TaskbarProgressState" + }, + "swift": { + "name": "progressState", + "signature": "var progressState: TaskbarProgressState" + } + } + }, + { + "key": "WindowTaskbar::SetProgressValue", + "kind": "method", + "doc": { + "summary": "Sets the determinate progress fraction in the range 0.0 to 1.0.", + "details": "If the current state is None or Indeterminate, promotes the state to Normal. If the current state is Paused or Error, updates the value while preserving that state.", + "params": [ + { + "name": "progress", + "text": "Finite value in the range 0.0 to 1.0. Non-finite or out-of-range values return false without changing state." + } + ], + "returns": "true if applied; false if invalid, unsupported, or the native window is gone.", + "notes": [ + { + "kind": "see", + "text": "SetProgressState() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetProgressValue", + "signature": "bool SetProgressValue(double progress)" + }, + "csharp": { + "name": "SetProgressValue", + "signature": "public bool SetProgressValue(double progress)" + }, + "dart": { + "name": "setProgressValue", + "signature": "bool setProgressValue(double progress)" + }, + "go": { + "name": "SetProgressValue", + "signature": "func (wt *WindowTaskbar) SetProgressValue(progress float64) error" + }, + "js": { + "name": "setProgressValue", + "signature": "setProgressValue(progress: number): boolean" + }, + "python": { + "name": "set_progress_value", + "signature": "def set_progress_value(self, progress: float) -> bool:" + }, + "rust": { + "name": "set_progress_value", + "signature": "pub fn set_progress_value(&self, progress: f64) -> bool" + }, + "swift": { + "name": "setProgressValue", + "signature": "func setProgressValue(_ progress: Double) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::GetProgressValue", + "kind": "method", + "doc": { + "summary": "Gets the last progress fraction set via SetProgressValue().", + "returns": "Value in the range 0.0 to 1.0, or 0.0 when unset, unsupported, or the native window is gone.", + "notes": [ + { + "kind": "see", + "text": "SetProgressState() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "GetProgressValue", + "signature": "double GetProgressValue() const" + }, + "csharp": { + "name": "ProgressValue", + "signature": "public double ProgressValue" + }, + "dart": { + "name": "progressValue", + "signature": "double get progressValue" + }, + "go": { + "name": "ProgressValue", + "signature": "func (wt *WindowTaskbar) ProgressValue() float64" + }, + "js": { + "name": "progressValue", + "signature": "get progressValue(): number" + }, + "python": { + "name": "progress_value", + "signature": "@property\ndef progress_value(self) -> float:" + }, + "rust": { + "name": "progress_value", + "signature": "pub fn progress_value(&self) -> f64" + }, + "swift": { + "name": "progressValue", + "signature": "var progressValue: Double" + } + } + }, + { + "key": "WindowTaskbar::SetOverlayIcon", + "kind": "method", + "doc": { + "summary": "Sets a small overlay badge icon over the window's taskbar button.", + "details": "On Windows, this shares the primary window's overlay slot with Application::SetBadgeLabel(); the most recent call wins. Windows does not display overlay icons when small taskbar buttons are enabled in OS settings, though the call still succeeds.", + "params": [ + { + "name": "icon", + "text": "Image to display (recommended 16x16 at 96 DPI), or nullptr to remove the overlay icon." + }, + { + "name": "description", + "text": "Accessibility description read by screen readers. Ignored when `icon` is nullptr." + } + ], + "returns": "true if applied; false if unsupported, image conversion failed, or the native window is gone.", + "notes": [ + { + "kind": "note", + "text": "Platform availability:\n- macOS: ❌ Not supported - Always returns false (use Application::SetBadgeLabel).\n- Windows: ✅ Fully supported - ITaskbarList3::SetOverlayIcon.\n- Linux: ❌ Not supported - Always returns false (use Application::SetBadgeLabel).\n- Android: ❌ Not applicable - Always returns false.\n- iOS: ❌ Not applicable - Always returns false.\n- OpenHarmony: ❌ Not applicable - Always returns false." + } + ] + }, + "signatures": { + "cpp": { + "name": "SetOverlayIcon", + "signature": "bool SetOverlayIcon(std::shared_ptr icon, std::string description)" + }, + "csharp": { + "name": "SetOverlayIcon", + "signature": "public bool SetOverlayIcon(Image? icon, string description)" + }, + "dart": { + "name": "setOverlayIcon", + "signature": "bool setOverlayIcon(Image? icon, String description)" + }, + "go": { + "name": "SetOverlayIcon", + "signature": "func (wt *WindowTaskbar) SetOverlayIcon(icon *Image, description string) error" + }, + "js": { + "name": "setOverlayIcon", + "signature": "setOverlayIcon(icon: Image | null, description: string): boolean" + }, + "python": { + "name": "set_overlay_icon", + "signature": "def set_overlay_icon(self, icon: _image.Image | None, description: str) -> bool:" + }, + "rust": { + "name": "set_overlay_icon", + "signature": "pub fn set_overlay_icon(&self, icon: Option<&Image>, description: &str) -> bool" + }, + "swift": { + "name": "setOverlayIcon", + "signature": "func setOverlayIcon(_ icon: Image?, description: String) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::GetOverlayIcon", + "kind": "method", + "doc": { + "summary": "Gets the current overlay icon, or nullptr if none is set.", + "returns": "Shared pointer to the overlay Image, or nullptr if unset, unsupported, or the native window is gone.", + "notes": [ + { + "kind": "see", + "text": "SetOverlayIcon() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "GetOverlayIcon", + "signature": "std::shared_ptr GetOverlayIcon() const" + }, + "csharp": { + "name": "OverlayIcon", + "signature": "public Image? OverlayIcon" + }, + "dart": { + "name": "overlayIcon", + "signature": "Image? get overlayIcon" + }, + "go": { + "name": "OverlayIcon", + "signature": "func (wt *WindowTaskbar) OverlayIcon() *Image" + }, + "js": { + "name": "overlayIcon", + "signature": "get overlayIcon(): Image | null" + }, + "python": { + "name": "overlay_icon", + "signature": "@property\ndef overlay_icon(self) -> _image.Image | None:" + }, + "rust": { + "name": "overlay_icon", + "signature": "pub fn overlay_icon(&self) -> Option" + }, + "swift": { + "name": "overlayIcon", + "signature": "var overlayIcon: Image?" + } + } + }, + { + "key": "WindowTaskbar::GetOverlayIconDescription", + "kind": "method", + "doc": { + "summary": "Gets the accessibility description of the current overlay icon.", + "returns": "The description text, or empty string if unset or unsupported.", + "notes": [ + { + "kind": "see", + "text": "SetOverlayIcon() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "GetOverlayIconDescription", + "signature": "std::string GetOverlayIconDescription() const" + }, + "csharp": { + "name": "OverlayIconDescription", + "signature": "public string? OverlayIconDescription" + }, + "dart": { + "name": "overlayIconDescription", + "signature": "String? get overlayIconDescription" + }, + "go": { + "name": "OverlayIconDescription", + "signature": "func (wt *WindowTaskbar) OverlayIconDescription() string" + }, + "js": { + "name": "overlayIconDescription", + "signature": "get overlayIconDescription(): string" + }, + "python": { + "name": "overlay_icon_description", + "signature": "@property\ndef overlay_icon_description(self) -> str:" + }, + "rust": { + "name": "overlay_icon_description", + "signature": "pub fn overlay_icon_description(&self) -> Option" + }, + "swift": { + "name": "overlayIconDescription", + "signature": "var overlayIconDescription: String?" + } + } + }, + { + "key": "WindowTaskbar::AddThumbnailButton", + "kind": "method", + "doc": { + "summary": "Appends a button to the window's thumbnail toolbar.", + "params": [ + { + "name": "button", + "text": "Button to add; must be non-null and not already attached to a WindowTaskbar." + } + ], + "returns": "true if added; false if null, already attached, at the platform button limit (7 on Windows), unsupported, or the native window is gone.", + "notes": [ + { + "kind": "note", + "text": "Platform availability:\n- macOS: ❌ Not supported - Always returns false.\n- Windows: ✅ Fully supported - ITaskbarList3 thumbnail toolbar (max 7).\n- Linux: ❌ Not supported - Always returns false.\n- Android: ❌ Not applicable - Always returns false.\n- iOS: ❌ Not applicable - Always returns false.\n- OpenHarmony: ❌ Not applicable - Always returns false." + } + ] + }, + "signatures": { + "cpp": { + "name": "AddThumbnailButton", + "signature": "bool AddThumbnailButton(std::shared_ptr button)" + }, + "csharp": { + "name": "AddThumbnailButton", + "signature": "public bool AddThumbnailButton(TaskbarThumbnailButton? button)" + }, + "dart": { + "name": "addThumbnailButton", + "signature": "bool addThumbnailButton(TaskbarThumbnailButton? button)" + }, + "go": { + "name": "AddThumbnailButton", + "signature": "func (wt *WindowTaskbar) AddThumbnailButton(button *TaskbarThumbnailButton) error" + }, + "js": { + "name": "addThumbnailButton", + "signature": "addThumbnailButton(button: TaskbarThumbnailButton | null): boolean" + }, + "python": { + "name": "add_thumbnail_button", + "signature": "def add_thumbnail_button(self, button: TaskbarThumbnailButton | None) -> bool:" + }, + "rust": { + "name": "add_thumbnail_button", + "signature": "pub fn add_thumbnail_button(&self, button: Option<&TaskbarThumbnailButton>) -> bool" + }, + "swift": { + "name": "addThumbnailButton", + "signature": "func addThumbnailButton(_ button: TaskbarThumbnailButton?) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::InsertThumbnailButton", + "kind": "method", + "doc": { + "summary": "Inserts a button at the given zero-based index.", + "params": [ + { + "name": "index", + "text": "Insertion position in [0, GetThumbnailButtonCount()]." + }, + { + "name": "button", + "text": "Button to insert; must be non-null and not already attached." + } + ], + "returns": "true if inserted; false if index is out of range, button is null or already attached, at the platform limit, unsupported, or the native window is gone.", + "notes": [ + { + "kind": "see", + "text": "AddThumbnailButton() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "InsertThumbnailButton", + "signature": "bool InsertThumbnailButton(unsigned long index, std::shared_ptr button)" + }, + "csharp": { + "name": "InsertThumbnailButton", + "signature": "public bool InsertThumbnailButton(ulong index, TaskbarThumbnailButton? button)" + }, + "dart": { + "name": "insertThumbnailButton", + "signature": "bool insertThumbnailButton(int index, TaskbarThumbnailButton? button)" + }, + "go": { + "name": "InsertThumbnailButton", + "signature": "func (wt *WindowTaskbar) InsertThumbnailButton(index uint64, button *TaskbarThumbnailButton) error" + }, + "js": { + "name": "insertThumbnailButton", + "signature": "insertThumbnailButton(index: number, button: TaskbarThumbnailButton | null): boolean" + }, + "python": { + "name": "insert_thumbnail_button", + "signature": "def insert_thumbnail_button(\n self,\n index: int,\n button: TaskbarThumbnailButton | None,\n) -> bool:" + }, + "rust": { + "name": "insert_thumbnail_button", + "signature": "pub fn insert_thumbnail_button(&self, index: std::os::raw::c_ulong, button: Option<&TaskbarThumbnailButton>) -> bool" + }, + "swift": { + "name": "insertThumbnailButton", + "signature": "func insertThumbnailButton(_ index: CUnsignedLong, button: TaskbarThumbnailButton?) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::RemoveThumbnailButton", + "kind": "method", + "doc": { + "summary": "Removes the specified button from the thumbnail toolbar.", + "params": [ + { + "name": "button", + "text": "Button to remove." + } + ], + "returns": "true if the button was found and removed, false otherwise.", + "notes": [ + { + "kind": "see", + "text": "AddThumbnailButton() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "RemoveThumbnailButton", + "signature": "bool RemoveThumbnailButton(std::shared_ptr button)" + }, + "csharp": { + "name": "RemoveThumbnailButton", + "signature": "public bool RemoveThumbnailButton(TaskbarThumbnailButton? button)" + }, + "dart": { + "name": "removeThumbnailButton", + "signature": "bool removeThumbnailButton(TaskbarThumbnailButton? button)" + }, + "go": { + "name": "RemoveThumbnailButton", + "signature": "func (wt *WindowTaskbar) RemoveThumbnailButton(button *TaskbarThumbnailButton) error" + }, + "js": { + "name": "removeThumbnailButton", + "signature": "removeThumbnailButton(button: TaskbarThumbnailButton | null): boolean" + }, + "python": { + "name": "remove_thumbnail_button", + "signature": "def remove_thumbnail_button(self, button: TaskbarThumbnailButton | None) -> bool:" + }, + "rust": { + "name": "remove_thumbnail_button", + "signature": "pub fn remove_thumbnail_button(&self, button: Option<&TaskbarThumbnailButton>) -> bool" + }, + "swift": { + "name": "removeThumbnailButton", + "signature": "func removeThumbnailButton(_ button: TaskbarThumbnailButton?) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::RemoveThumbnailButtonById", + "kind": "method", + "doc": { + "summary": "Removes the thumbnail button with the given ID.", + "params": [ + { + "name": "button_id", + "text": "Identifier of the button to remove." + } + ], + "returns": "true if a matching button was found and removed, false otherwise.", + "notes": [ + { + "kind": "see", + "text": "AddThumbnailButton() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "RemoveThumbnailButtonById", + "signature": "bool RemoveThumbnailButtonById(TaskbarThumbnailButtonId button_id)" + }, + "csharp": { + "name": "RemoveThumbnailButtonById", + "signature": "public bool RemoveThumbnailButtonById(uint buttonId)" + }, + "dart": { + "name": "removeThumbnailButtonById", + "signature": "bool removeThumbnailButtonById(TaskbarThumbnailButtonId buttonId)" + }, + "go": { + "name": "RemoveThumbnailButtonByID", + "signature": "func (wt *WindowTaskbar) RemoveThumbnailButtonByID(buttonID TaskbarThumbnailButtonID) error" + }, + "js": { + "name": "removeThumbnailButtonById", + "signature": "removeThumbnailButtonById(buttonId: TaskbarThumbnailButtonId): boolean" + }, + "python": { + "name": "remove_thumbnail_button_by_id", + "signature": "def remove_thumbnail_button_by_id(\n self,\n button_id: TaskbarThumbnailButtonId,\n) -> bool:" + }, + "rust": { + "name": "remove_thumbnail_button_by_id", + "signature": "pub fn remove_thumbnail_button_by_id(&self, button_id: TaskbarThumbnailButtonId) -> bool" + }, + "swift": { + "name": "removeThumbnailButtonById", + "signature": "func removeThumbnailButtonById(_ buttonId: TaskbarThumbnailButtonId) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::RemoveThumbnailButtonAt", + "kind": "method", + "doc": { + "summary": "Removes the thumbnail button at the given zero-based index.", + "params": [ + { + "name": "index", + "text": "Position of the button to remove." + } + ], + "returns": "true if index was valid and the button was removed, false otherwise.", + "notes": [ + { + "kind": "see", + "text": "AddThumbnailButton() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "RemoveThumbnailButtonAt", + "signature": "bool RemoveThumbnailButtonAt(unsigned long index)" + }, + "csharp": { + "name": "RemoveThumbnailButtonAt", + "signature": "public bool RemoveThumbnailButtonAt(ulong index)" + }, + "dart": { + "name": "removeThumbnailButtonAt", + "signature": "bool removeThumbnailButtonAt(int index)" + }, + "go": { + "name": "RemoveThumbnailButtonAt", + "signature": "func (wt *WindowTaskbar) RemoveThumbnailButtonAt(index uint64) error" + }, + "js": { + "name": "removeThumbnailButtonAt", + "signature": "removeThumbnailButtonAt(index: number): boolean" + }, + "python": { + "name": "remove_thumbnail_button_at", + "signature": "def remove_thumbnail_button_at(self, index: int) -> bool:" + }, + "rust": { + "name": "remove_thumbnail_button_at", + "signature": "pub fn remove_thumbnail_button_at(&self, index: std::os::raw::c_ulong) -> bool" + }, + "swift": { + "name": "removeThumbnailButtonAt", + "signature": "func removeThumbnailButtonAt(_ index: CUnsignedLong) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::ClearThumbnailButtons", + "kind": "method", + "doc": { + "summary": "Removes all buttons from the thumbnail toolbar.", + "notes": [ + { + "kind": "see", + "text": "AddThumbnailButton() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "ClearThumbnailButtons", + "signature": "void ClearThumbnailButtons()" + }, + "csharp": { + "name": "ClearThumbnailButtons", + "signature": "public void ClearThumbnailButtons()" + }, + "dart": { + "name": "clearThumbnailButtons", + "signature": "void clearThumbnailButtons()" + }, + "go": { + "name": "ClearThumbnailButtons", + "signature": "func (wt *WindowTaskbar) ClearThumbnailButtons()" + }, + "js": { + "name": "clearThumbnailButtons", + "signature": "clearThumbnailButtons(): void" + }, + "python": { + "name": "clear_thumbnail_buttons", + "signature": "def clear_thumbnail_buttons(self) -> None:" + }, + "rust": { + "name": "clear_thumbnail_buttons", + "signature": "pub fn clear_thumbnail_buttons(&self)" + }, + "swift": { + "name": "clearThumbnailButtons", + "signature": "func clearThumbnailButtons() -> Void" + } + } + }, + { + "key": "WindowTaskbar::GetThumbnailButtonCount", + "kind": "method", + "doc": { + "summary": "Gets the number of buttons currently in the thumbnail toolbar.", + "returns": "Button count, or 0 when empty, unsupported, or window is gone.", + "notes": [ + { + "kind": "see", + "text": "AddThumbnailButton() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "GetThumbnailButtonCount", + "signature": "unsigned long GetThumbnailButtonCount() const" + }, + "csharp": { + "name": "ThumbnailButtonCount", + "signature": "public ulong ThumbnailButtonCount" + }, + "dart": { + "name": "thumbnailButtonCount", + "signature": "int get thumbnailButtonCount" + }, + "go": { + "name": "ThumbnailButtonCount", + "signature": "func (wt *WindowTaskbar) ThumbnailButtonCount() uint64" + }, + "js": { + "name": "thumbnailButtonCount", + "signature": "get thumbnailButtonCount(): number" + }, + "python": { + "name": "thumbnail_button_count", + "signature": "@property\ndef thumbnail_button_count(self) -> int:" + }, + "rust": { + "name": "thumbnail_button_count", + "signature": "pub fn thumbnail_button_count(&self) -> std::os::raw::c_ulong" + }, + "swift": { + "name": "thumbnailButtonCount", + "signature": "var thumbnailButtonCount: CUnsignedLong" + } + } + }, + { + "key": "WindowTaskbar::GetThumbnailButtonAt", + "kind": "method", + "doc": { + "summary": "Gets the thumbnail button at the given zero-based index.", + "params": [ + { + "name": "index", + "text": "Position in the toolbar." + } + ], + "returns": "Shared pointer to the button, or nullptr if index is out of range.", + "notes": [ + { + "kind": "see", + "text": "AddThumbnailButton() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "GetThumbnailButtonAt", + "signature": "std::shared_ptr GetThumbnailButtonAt(unsigned long index) const" + }, + "csharp": { + "name": "GetThumbnailButtonAt", + "signature": "public TaskbarThumbnailButton? GetThumbnailButtonAt(ulong index)" + }, + "dart": { + "name": "getThumbnailButtonAt", + "signature": "TaskbarThumbnailButton? getThumbnailButtonAt(int index)" + }, + "go": { + "name": "ThumbnailButtonAt", + "signature": "func (wt *WindowTaskbar) ThumbnailButtonAt(index uint64) *TaskbarThumbnailButton" + }, + "js": { + "name": "getThumbnailButtonAt", + "signature": "getThumbnailButtonAt(index: number): TaskbarThumbnailButton | null" + }, + "python": { + "name": "get_thumbnail_button_at", + "signature": "def get_thumbnail_button_at(self, index: int) -> TaskbarThumbnailButton | None:" + }, + "rust": { + "name": "get_thumbnail_button_at", + "signature": "pub fn get_thumbnail_button_at(&self, index: std::os::raw::c_ulong) -> Option" + }, + "swift": { + "name": "getThumbnailButtonAt", + "signature": "func getThumbnailButtonAt(_ index: CUnsignedLong) -> TaskbarThumbnailButton?" + } + } + }, + { + "key": "WindowTaskbar::GetThumbnailButtonById", + "kind": "method", + "doc": { + "summary": "Gets the thumbnail button with the given ID.", + "params": [ + { + "name": "button_id", + "text": "Identifier to look up." + } + ], + "returns": "Shared pointer to the button, or nullptr if not found.", + "notes": [ + { + "kind": "see", + "text": "AddThumbnailButton() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "GetThumbnailButtonById", + "signature": "std::shared_ptr GetThumbnailButtonById(TaskbarThumbnailButtonId button_id) const" + }, + "csharp": { + "name": "GetThumbnailButtonById", + "signature": "public TaskbarThumbnailButton? GetThumbnailButtonById(uint buttonId)" + }, + "dart": { + "name": "getThumbnailButtonById", + "signature": "TaskbarThumbnailButton? getThumbnailButtonById(TaskbarThumbnailButtonId buttonId)" + }, + "go": { + "name": "ThumbnailButtonByID", + "signature": "func (wt *WindowTaskbar) ThumbnailButtonByID(buttonID TaskbarThumbnailButtonID) *TaskbarThumbnailButton" + }, + "js": { + "name": "getThumbnailButtonById", + "signature": "getThumbnailButtonById(buttonId: TaskbarThumbnailButtonId): TaskbarThumbnailButton | null" + }, + "python": { + "name": "get_thumbnail_button_by_id", + "signature": "def get_thumbnail_button_by_id(\n self,\n button_id: TaskbarThumbnailButtonId,\n) -> TaskbarThumbnailButton | None:" + }, + "rust": { + "name": "get_thumbnail_button_by_id", + "signature": "pub fn get_thumbnail_button_by_id(&self, button_id: TaskbarThumbnailButtonId) -> Option" + }, + "swift": { + "name": "getThumbnailButtonById", + "signature": "func getThumbnailButtonById(_ buttonId: TaskbarThumbnailButtonId) -> TaskbarThumbnailButton?" + } + } + }, + { + "key": "WindowTaskbar::GetAllThumbnailButtons", + "kind": "method", + "doc": { + "summary": "Gets all buttons currently in the thumbnail toolbar in display order.", + "returns": "Vector of shared pointers to the attached buttons.", + "notes": [ + { + "kind": "see", + "text": "AddThumbnailButton() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "GetAllThumbnailButtons", + "signature": "std::vector> GetAllThumbnailButtons() const" + }, + "csharp": { + "name": "AllThumbnailButtons", + "signature": "public TaskbarThumbnailButton[] AllThumbnailButtons" + }, + "dart": { + "name": "allThumbnailButtons", + "signature": "List get allThumbnailButtons" + }, + "go": { + "name": "AllThumbnailButtons", + "signature": "func (wt *WindowTaskbar) AllThumbnailButtons() []*TaskbarThumbnailButton" + }, + "js": { + "name": "allThumbnailButtons", + "signature": "get allThumbnailButtons(): TaskbarThumbnailButton[]" + }, + "python": { + "name": "all_thumbnail_buttons", + "signature": "@property\ndef all_thumbnail_buttons(self) -> list[TaskbarThumbnailButton]:" + }, + "rust": { + "name": "all_thumbnail_buttons", + "signature": "pub fn all_thumbnail_buttons(&self) -> Vec" + }, + "swift": { + "name": "allThumbnailButtons", + "signature": "var allThumbnailButtons: [TaskbarThumbnailButton]" + } + } + }, + { + "key": "WindowTaskbar::StartFlashing", + "kind": "method", + "doc": { + "summary": "Flashes the window caption and/or taskbar button to draw attention.", + "params": [ + { + "name": "options", + "text": "Flash target, count, interval, and foreground auto-stop policy. Negative count or timeout_ms, or an invalid target enum, returns false." + } + ], + "returns": "true if the flash request was accepted; false if unsupported, invalid options, or the native window is gone.", + "notes": [ + { + "kind": "note", + "text": "Platform availability:\n- macOS: ❌ Not supported - Always returns false.\n- Windows: ✅ Fully supported - FlashWindowEx.\n- Linux: ❌ Not supported - Always returns false.\n- Android: ❌ Not applicable - Always returns false.\n- iOS: ❌ Not applicable - Always returns false.\n- OpenHarmony: ❌ Not applicable - Always returns false." + } + ] + }, + "signatures": { + "cpp": { + "name": "StartFlashing", + "signature": "bool StartFlashing(TaskbarFlashOptions options)" + }, + "csharp": { + "name": "StartFlashing", + "signature": "public bool StartFlashing(TaskbarFlashOptions options)" + }, + "dart": { + "name": "startFlashing", + "signature": "bool startFlashing(TaskbarFlashOptions options)" + }, + "go": { + "name": "StartFlashing", + "signature": "func (wt *WindowTaskbar) StartFlashing(options TaskbarFlashOptions) error" + }, + "js": { + "name": "startFlashing", + "signature": "startFlashing(options: TaskbarFlashOptions): boolean" + }, + "python": { + "name": "start_flashing", + "signature": "def start_flashing(self, options: TaskbarFlashOptions) -> bool:" + }, + "rust": { + "name": "start_flashing", + "signature": "pub fn start_flashing(&self, options: &TaskbarFlashOptions) -> bool" + }, + "swift": { + "name": "startFlashing", + "signature": "func startFlashing(_ options: TaskbarFlashOptions) -> Bool" + } + } + }, + { + "key": "WindowTaskbar::StopFlashing", + "kind": "method", + "doc": { + "summary": "Stops any ongoing flashing started on this window.", + "returns": "true if stopped (including when not flashing) on a supported platform; false if unsupported or the native window is gone.", + "notes": [ + { + "kind": "see", + "text": "StartFlashing() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "StopFlashing", + "signature": "bool StopFlashing()" + }, + "csharp": { + "name": "StopFlashing", + "signature": "public bool StopFlashing()" + }, + "dart": { + "name": "stopFlashing", + "signature": "bool stopFlashing()" + }, + "go": { + "name": "StopFlashing", + "signature": "func (wt *WindowTaskbar) StopFlashing() error" + }, + "js": { + "name": "stopFlashing", + "signature": "stopFlashing(): boolean" + }, + "python": { + "name": "stop_flashing", + "signature": "def stop_flashing(self) -> bool:" + }, + "rust": { + "name": "stop_flashing", + "signature": "pub fn stop_flashing(&self) -> bool" + }, + "swift": { + "name": "stopFlashing", + "signature": "func stopFlashing() -> Bool" + } + } + } + ] + }, + { + "key": "TaskbarFlashOptions", + "kind": "struct", + "doc": { + "summary": "Configuration for WindowTaskbar::StartFlashing().", + "details": "Defaults flash both the window caption and taskbar button continuously at the system blink rate until the window comes to the foreground." + }, + "signatures": { + "cpp": { + "name": "TaskbarFlashOptions", + "signature": "struct TaskbarFlashOptions" + }, + "csharp": { + "name": "TaskbarFlashOptions", + "signature": "public struct TaskbarFlashOptions" + }, + "dart": { + "name": "TaskbarFlashOptions", + "signature": "class TaskbarFlashOptions" + }, + "go": { + "name": "TaskbarFlashOptions", + "signature": "type TaskbarFlashOptions struct" + }, + "js": { + "name": "TaskbarFlashOptions", + "signature": "export interface TaskbarFlashOptions" + }, + "python": { + "name": "TaskbarFlashOptions", + "signature": "@dataclass\nclass TaskbarFlashOptions:" + }, + "rust": { + "name": "TaskbarFlashOptions", + "signature": "pub struct TaskbarFlashOptions" + }, + "swift": { + "name": "TaskbarFlashOptions", + "signature": "struct TaskbarFlashOptions" + } + }, + "members": [ + { + "key": "TaskbarFlashOptions::target", + "kind": "field", + "doc": { + "summary": "Which parts of the window to flash." + }, + "signatures": { + "cpp": { + "name": "target", + "signature": "TaskbarFlashTarget target" + }, + "csharp": { + "name": "Target", + "signature": "public TaskbarFlashTarget Target;" + }, + "dart": { + "name": "target", + "signature": "final TaskbarFlashTarget target" + }, + "go": { + "name": "Target", + "signature": "Target TaskbarFlashTarget" + }, + "js": { + "name": "target", + "signature": "target: TaskbarFlashTarget" + }, + "python": { + "name": "target", + "signature": "target: TaskbarFlashTarget = field(default_factory=lambda: TaskbarFlashTarget.ALL)" + }, + "rust": { + "name": "target", + "signature": "pub target: TaskbarFlashTarget" + }, + "swift": { + "name": "target", + "signature": "var target: TaskbarFlashTarget" + } + } + }, + { + "key": "TaskbarFlashOptions::count", + "kind": "field", + "doc": { + "summary": "Number of flashes; 0 flashes continuously until stopped or focused." + }, + "signatures": { + "cpp": { + "name": "count", + "signature": "int count" + }, + "csharp": { + "name": "Count", + "signature": "public int Count;" + }, + "dart": { + "name": "count", + "signature": "final int count" + }, + "go": { + "name": "Count", + "signature": "Count int32" + }, + "js": { + "name": "count", + "signature": "count: number" + }, + "python": { + "name": "count", + "signature": "count: int = 0" + }, + "rust": { + "name": "count", + "signature": "pub count: i32" + }, + "swift": { + "name": "count", + "signature": "var count: CInt" + } + } + }, + { + "key": "TaskbarFlashOptions::timeout_ms", + "kind": "field", + "doc": { + "summary": "Flash interval in milliseconds; 0 uses the system default blink rate." + }, + "signatures": { + "cpp": { + "name": "timeout_ms", + "signature": "int timeout_ms" + }, + "csharp": { + "name": "TimeoutMs", + "signature": "public int TimeoutMs;" + }, + "dart": { + "name": "timeoutMs", + "signature": "final int timeoutMs" + }, + "go": { + "name": "TimeoutMs", + "signature": "TimeoutMs int32" + }, + "js": { + "name": "timeoutMs", + "signature": "timeoutMs: number" + }, + "python": { + "name": "timeout_ms", + "signature": "timeout_ms: int = 0" + }, + "rust": { + "name": "timeout_ms", + "signature": "pub timeout_ms: i32" + }, + "swift": { + "name": "timeoutMs", + "signature": "var timeoutMs: CInt" + } + } + }, + { + "key": "TaskbarFlashOptions::stop_on_foreground", + "kind": "field", + "doc": { + "summary": "Automatically stop flashing when the window comes to the foreground." + }, + "signatures": { + "cpp": { + "name": "stop_on_foreground", + "signature": "bool stop_on_foreground" + }, + "csharp": { + "name": "StopOnForeground", + "signature": "public bool StopOnForeground;" + }, + "dart": { + "name": "stopOnForeground", + "signature": "final bool stopOnForeground" + }, + "go": { + "name": "StopOnForeground", + "signature": "StopOnForeground bool" + }, + "js": { + "name": "stopOnForeground", + "signature": "stopOnForeground: boolean" + }, + "python": { + "name": "stop_on_foreground", + "signature": "stop_on_foreground: bool = False" + }, + "rust": { + "name": "stop_on_foreground", + "signature": "pub stop_on_foreground: bool" + }, + "swift": { + "name": "stopOnForeground", + "signature": "var stopOnForeground: Bool" + } + } + } + ] + }, + { + "key": "TaskbarProgressState", + "kind": "enum", + "doc": { + "summary": "Progress indicator state shown on a window's taskbar button.", + "notes": [ + { + "kind": "see", + "text": "WindowTaskbar::SetProgressState() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "TaskbarProgressState", + "signature": "enum class TaskbarProgressState" + }, + "csharp": { + "name": "TaskbarProgressState", + "signature": "public enum TaskbarProgressState" + }, + "dart": { + "name": "TaskbarProgressState", + "signature": "enum TaskbarProgressState" + }, + "go": { + "name": "TaskbarProgressState", + "signature": "type TaskbarProgressState int32" + }, + "js": { + "name": "TaskbarProgressState", + "signature": "export const TaskbarProgressState =\nexport type TaskbarProgressState = (typeof TaskbarProgressState)[keyof typeof TaskbarProgressState]" + }, + "python": { + "name": "TaskbarProgressState", + "signature": "class TaskbarProgressState(enum.IntEnum):" + }, + "rust": { + "name": "TaskbarProgressState", + "signature": "pub enum TaskbarProgressState" + }, + "swift": { + "name": "TaskbarProgressState", + "signature": "enum TaskbarProgressState: CInt" + } + }, + "members": [ + { + "key": "TaskbarProgressState::None", + "kind": "variant", + "doc": { + "summary": "No progress indicator is shown." + }, + "signatures": { + "cpp": { + "name": "None", + "signature": "None = 0" + }, + "csharp": { + "name": "TaskbarProgressState.None", + "signature": "None = 0" + }, + "dart": { + "name": "TaskbarProgressState.none", + "signature": "none(0)" + }, + "go": { + "name": "TaskbarProgressStateNone", + "signature": "const TaskbarProgressStateNone TaskbarProgressState = 0" + }, + "js": { + "name": "TaskbarProgressState.None", + "signature": "None: 0" + }, + "python": { + "name": "NONE", + "signature": "NONE = 0" + }, + "rust": { + "name": "TaskbarProgressState::None", + "signature": "None = 0" + }, + "swift": { + "name": "none", + "signature": "case none = 0" + } + } + }, + { + "key": "TaskbarProgressState::Indeterminate", + "kind": "variant", + "doc": { + "summary": "Busy / marquee progress indicator without a determinate value." + }, + "signatures": { + "cpp": { + "name": "Indeterminate", + "signature": "Indeterminate = 1" + }, + "csharp": { + "name": "TaskbarProgressState.Indeterminate", + "signature": "Indeterminate = 1" + }, + "dart": { + "name": "TaskbarProgressState.indeterminate", + "signature": "indeterminate(1)" + }, + "go": { + "name": "TaskbarProgressStateIndeterminate", + "signature": "const TaskbarProgressStateIndeterminate TaskbarProgressState = 1" + }, + "js": { + "name": "TaskbarProgressState.Indeterminate", + "signature": "Indeterminate: 1" + }, + "python": { + "name": "INDETERMINATE", + "signature": "INDETERMINATE = 1" + }, + "rust": { + "name": "TaskbarProgressState::Indeterminate", + "signature": "Indeterminate = 1" + }, + "swift": { + "name": "indeterminate", + "signature": "case indeterminate = 1" + } + } + }, + { + "key": "TaskbarProgressState::Normal", + "kind": "variant", + "doc": { + "summary": "Normal progress indicator (green on Windows)." + }, + "signatures": { + "cpp": { + "name": "Normal", + "signature": "Normal = 2" + }, + "csharp": { + "name": "TaskbarProgressState.Normal", + "signature": "Normal = 2" + }, + "dart": { + "name": "TaskbarProgressState.normal", + "signature": "normal(2)" + }, + "go": { + "name": "TaskbarProgressStateNormal", + "signature": "const TaskbarProgressStateNormal TaskbarProgressState = 2" + }, + "js": { + "name": "TaskbarProgressState.Normal", + "signature": "Normal: 2" + }, + "python": { + "name": "NORMAL", + "signature": "NORMAL = 2" + }, + "rust": { + "name": "TaskbarProgressState::Normal", + "signature": "Normal = 2" + }, + "swift": { + "name": "normal", + "signature": "case normal = 2" + } + } + }, + { + "key": "TaskbarProgressState::Paused", + "kind": "variant", + "doc": { + "summary": "Paused progress indicator (yellow on Windows)." + }, + "signatures": { + "cpp": { + "name": "Paused", + "signature": "Paused = 3" + }, + "csharp": { + "name": "TaskbarProgressState.Paused", + "signature": "Paused = 3" + }, + "dart": { + "name": "TaskbarProgressState.paused", + "signature": "paused(3)" + }, + "go": { + "name": "TaskbarProgressStatePaused", + "signature": "const TaskbarProgressStatePaused TaskbarProgressState = 3" + }, + "js": { + "name": "TaskbarProgressState.Paused", + "signature": "Paused: 3" + }, + "python": { + "name": "PAUSED", + "signature": "PAUSED = 3" + }, + "rust": { + "name": "TaskbarProgressState::Paused", + "signature": "Paused = 3" + }, + "swift": { + "name": "paused", + "signature": "case paused = 3" + } + } + }, + { + "key": "TaskbarProgressState::Error", + "kind": "variant", + "doc": { + "summary": "Error progress indicator (red on Windows)." + }, + "signatures": { + "cpp": { + "name": "Error", + "signature": "Error = 4" + }, + "csharp": { + "name": "TaskbarProgressState.Error", + "signature": "Error = 4" + }, + "dart": { + "name": "TaskbarProgressState.error", + "signature": "error(4)" + }, + "go": { + "name": "TaskbarProgressStateError", + "signature": "const TaskbarProgressStateError TaskbarProgressState = 4" + }, + "js": { + "name": "TaskbarProgressState.Error", + "signature": "Error: 4" + }, + "python": { + "name": "ERROR", + "signature": "ERROR = 4" + }, + "rust": { + "name": "TaskbarProgressState::Error", + "signature": "Error = 4" + }, + "swift": { + "name": "error", + "signature": "case error = 4" + } + } + } + ] + }, + { + "key": "TaskbarFlashTarget", + "kind": "enum", + "doc": { + "summary": "Visual target to flash when requesting user attention.", + "notes": [ + { + "kind": "see", + "text": "WindowTaskbar::StartFlashing() for platform availability." + } + ] + }, + "signatures": { + "cpp": { + "name": "TaskbarFlashTarget", + "signature": "enum class TaskbarFlashTarget" + }, + "csharp": { + "name": "TaskbarFlashTarget", + "signature": "public enum TaskbarFlashTarget" + }, + "dart": { + "name": "TaskbarFlashTarget", + "signature": "enum TaskbarFlashTarget" + }, + "go": { + "name": "TaskbarFlashTarget", + "signature": "type TaskbarFlashTarget int32" + }, + "js": { + "name": "TaskbarFlashTarget", + "signature": "export const TaskbarFlashTarget =\nexport type TaskbarFlashTarget = (typeof TaskbarFlashTarget)[keyof typeof TaskbarFlashTarget]" + }, + "python": { + "name": "TaskbarFlashTarget", + "signature": "class TaskbarFlashTarget(enum.IntEnum):" + }, + "rust": { + "name": "TaskbarFlashTarget", + "signature": "pub enum TaskbarFlashTarget" + }, + "swift": { + "name": "TaskbarFlashTarget", + "signature": "enum TaskbarFlashTarget: CInt" + } + }, + "members": [ + { + "key": "TaskbarFlashTarget::All", + "kind": "variant", + "doc": { + "summary": "Flash both the window caption (title bar) and the taskbar button." + }, + "signatures": { + "cpp": { + "name": "All", + "signature": "All = 0" + }, + "csharp": { + "name": "TaskbarFlashTarget.All", + "signature": "All = 0" + }, + "dart": { + "name": "TaskbarFlashTarget.all", + "signature": "all(0)" + }, + "go": { + "name": "TaskbarFlashTargetAll", + "signature": "const TaskbarFlashTargetAll TaskbarFlashTarget = 0" + }, + "js": { + "name": "TaskbarFlashTarget.All", + "signature": "All: 0" + }, + "python": { + "name": "ALL", + "signature": "ALL = 0" + }, + "rust": { + "name": "TaskbarFlashTarget::All", + "signature": "All = 0" + }, + "swift": { + "name": "all", + "signature": "case all = 0" + } + } + }, + { + "key": "TaskbarFlashTarget::Caption", + "kind": "variant", + "doc": { + "summary": "Flash only the window caption (title bar)." + }, + "signatures": { + "cpp": { + "name": "Caption", + "signature": "Caption = 1" + }, + "csharp": { + "name": "TaskbarFlashTarget.Caption", + "signature": "Caption = 1" + }, + "dart": { + "name": "TaskbarFlashTarget.caption", + "signature": "caption(1)" + }, + "go": { + "name": "TaskbarFlashTargetCaption", + "signature": "const TaskbarFlashTargetCaption TaskbarFlashTarget = 1" + }, + "js": { + "name": "TaskbarFlashTarget.Caption", + "signature": "Caption: 1" + }, + "python": { + "name": "CAPTION", + "signature": "CAPTION = 1" + }, + "rust": { + "name": "TaskbarFlashTarget::Caption", + "signature": "Caption = 1" + }, + "swift": { + "name": "caption", + "signature": "case caption = 1" + } + } + }, + { + "key": "TaskbarFlashTarget::Taskbar", + "kind": "variant", + "doc": { + "summary": "Flash only the taskbar button." + }, + "signatures": { + "cpp": { + "name": "Taskbar", + "signature": "Taskbar = 2" + }, + "csharp": { + "name": "TaskbarFlashTarget.Taskbar", + "signature": "Taskbar = 2" + }, + "dart": { + "name": "TaskbarFlashTarget.taskbar", + "signature": "taskbar(2)" + }, + "go": { + "name": "TaskbarFlashTargetTaskbar", + "signature": "const TaskbarFlashTargetTaskbar TaskbarFlashTarget = 2" + }, + "js": { + "name": "TaskbarFlashTarget.Taskbar", + "signature": "Taskbar: 2" + }, + "python": { + "name": "TASKBAR", + "signature": "TASKBAR = 2" + }, + "rust": { + "name": "TaskbarFlashTarget::Taskbar", + "signature": "Taskbar = 2" + }, + "swift": { + "name": "taskbar", + "signature": "case taskbar = 2" + } + } + } + ] + }, + { + "key": "TaskbarEvent", + "kind": "event", + "doc": { + "summary": "Base class for all window taskbar events." + }, + "signatures": { + "cpp": { + "name": "TaskbarEvent", + "signature": "class TaskbarEvent : public Event" + }, + "csharp": { + "name": "TaskbarEvent", + "signature": "public abstract record TaskbarEvent" + }, + "dart": { + "name": "TaskbarEvent", + "signature": "sealed class TaskbarEvent" + }, + "go": { + "name": "TaskbarEvent", + "signature": "type TaskbarEvent struct" + }, + "js": { + "name": "TaskbarEvent", + "signature": "export type TaskbarEvent =" + }, + "python": { + "name": "TaskbarEvent", + "signature": "@dataclass(frozen=True)\nclass TaskbarEvent:" + }, + "rust": { + "name": "TaskbarEvent", + "signature": "pub enum TaskbarEvent" + }, + "swift": { + "name": "TaskbarEvent", + "signature": "enum TaskbarEvent" + } + }, + "members": [ + { + "key": "TaskbarThumbnailButtonClickedEvent", + "kind": "variant", + "doc": { + "summary": "Event emitted when a taskbar thumbnail toolbar button is clicked.", + "details": "Emitted asynchronously on the UI thread to both the clicked TaskbarThumbnailButton and its owning WindowTaskbar." + }, + "signatures": { + "cpp": { + "name": "TaskbarThumbnailButtonClickedEvent", + "signature": "class TaskbarThumbnailButtonClickedEvent : public TaskbarEvent" + }, + "csharp": { + "name": "TaskbarEvent.ThumbnailButtonClicked", + "signature": "public sealed record ThumbnailButtonClicked(uint ButtonId) : TaskbarEvent;" + }, + "dart": { + "name": "TaskbarThumbnailButtonClickedEvent", + "signature": "final class TaskbarThumbnailButtonClickedEvent extends TaskbarEvent" + }, + "go": { + "name": "TaskbarEventThumbnailButtonClicked", + "signature": "const TaskbarEventThumbnailButtonClicked TaskbarEventType = 0" + }, + "js": { + "name": "Extract", + "signature": "| { type: \"thumbnailButtonClicked\"; buttonId: TaskbarThumbnailButtonId }" + }, + "python": { + "name": "TaskbarThumbnailButtonClickedEvent", + "signature": "@dataclass(frozen=True)\nclass TaskbarThumbnailButtonClickedEvent(TaskbarEvent):" + }, + "rust": { + "name": "TaskbarEvent::ThumbnailButtonClicked", + "signature": "ThumbnailButtonClicked { button_id: TaskbarThumbnailButtonId }" + }, + "swift": { + "name": "thumbnailButtonClicked", + "signature": "case thumbnailButtonClicked(buttonId: TaskbarThumbnailButtonId)" + } + } + }, + { + "key": "TaskbarThumbnailButtonClickedEvent::ButtonId", + "kind": "field", + "parent": "TaskbarThumbnailButtonClickedEvent", + "doc": { + "summary": "Gets the ID of the thumbnail toolbar button that was clicked.", + "returns": "The clicked button's unique TaskbarThumbnailButtonId." + }, + "signatures": { + "cpp": { + "name": "ButtonId", + "signature": "TaskbarThumbnailButtonId GetButtonId() const" + }, + "csharp": { + "name": "ButtonId", + "signature": "uint ButtonId" + }, + "dart": { + "name": "buttonId", + "signature": "final TaskbarThumbnailButtonId buttonId" + }, + "go": { + "name": "ButtonID", + "signature": "ButtonID TaskbarThumbnailButtonID" + }, + "js": { + "name": "buttonId", + "signature": "buttonId: TaskbarThumbnailButtonId" + }, + "python": { + "name": "button_id", + "signature": "button_id: TaskbarThumbnailButtonId" + }, + "rust": { + "name": "button_id", + "signature": "button_id: TaskbarThumbnailButtonId" + }, + "swift": { + "name": "buttonId", + "signature": "var buttonId: TaskbarThumbnailButtonId" + } + } + } + ] + }, + { + "key": "TaskbarThumbnailButtonId", + "kind": "alias", + "doc": { + "summary": "Unique identifier for a taskbar thumbnail toolbar button." + }, + "signatures": { + "cpp": { + "name": "TaskbarThumbnailButtonId", + "signature": "using TaskbarThumbnailButtonId = unsigned int" + }, + "dart": { + "name": "TaskbarThumbnailButtonId", + "signature": "typedef TaskbarThumbnailButtonId = int" + }, + "go": { + "name": "TaskbarThumbnailButtonID", + "signature": "type TaskbarThumbnailButtonID uint32" + }, + "js": { + "name": "TaskbarThumbnailButtonId", + "signature": "export type TaskbarThumbnailButtonId = number" + }, + "python": { + "name": "TaskbarThumbnailButtonId", + "signature": "TaskbarThumbnailButtonId = int" + }, + "rust": { + "name": "TaskbarThumbnailButtonId", + "signature": "pub type TaskbarThumbnailButtonId = u32;" + }, + "swift": { + "name": "TaskbarThumbnailButtonId", + "signature": "typealias TaskbarThumbnailButtonId = UInt32" + } + } + } + ] +}