Ashet OS

namespace: ashet.gui

Namespaces

Types

System Calls

syscall register_widget_type(in descriptor: *const WidgetDescriptor, out handle: WidgetType)
syscall create_window(in desktop: Desktop, in title: str, in min: Size, in max: Size, in startup: Size, in flags: CreateWindowFlags, out handle: Window)

Spawns a new window.

syscall get_window_title(in window: Window, in title_buf: ?[]u8, out title_len: usize)
syscall get_window_size(in window: Window, out size: Size)
syscall get_window_min_size(in window: Window, out min_size: Size)
syscall get_window_max_size(in window: Window, out max_size: Size)
syscall get_window_flags(in window: Window, out flags: WindowFlags)
syscall set_window_size(in window: Window, in size: Size, out actual_size: Size)

Sets the size of window and returns the new actual size.

Note:

This event is meant to be used from desktop APIs and will not automatically notify the window of the resize event.

syscall resize_window(in window: Window, in size: Size)

Resizes a window to the new size.

syscall set_window_title(in handle: Window, in title: str)

Changes a window title.

syscall mark_window_urgent(in handle: Window)

Notifies the desktop that a window wants attention from the user. This could just pop the window to the front, make it blink, show a small notification, ...

syscall create_widget(in window: Window, in uuid: *const UUID, out widget: Widget)

Create a new widget identified by uuid on the given window. Position and size of the widget are undetermined at start and a call to place_widget should be performed on success.

syscall place_widget(in widget: Widget, in desired: Rectangle, out actual: Rectangle)

Moves and resizes a widget in one.

Note:

The position of a widget is unrestricted, but its size may be restricted by the selected widget type.

syscall control_widget(in widget: Widget, in message: WidgetControlMessage)

Triggers the control event of the widget with the given message as a payload.

syscall notify_owner(in widget: Widget, in type: gui.WidgetNotifyID, in params: *const [4]usize)

Puts a widget_notify event into the event queue of the Window that owns widget. The parameters are passed as a WidgetNotifyEvent to the event queue.

syscall get_widget_data(in widget: Widget, out data: [*]align(16) u8)

Returns WidgetType-associated "opaque" data for this widget.

This is meant as a convenience tool to store additional information per widget like internal state and such.

The size of this must be known and cannot be queried.

syscall get_widget_bounds(in widget: Widget, out bounds: Rectangle)

Returns the current location and size of the provided widget.

syscall create_desktop(in name: str, in descriptor: *const DesktopDescriptor, out desktop: Desktop)

Creates a new desktop with the given name.

syscall get_desktop_name(in desktop: Desktop, in name_buf: ?[]u8, out name_len: usize)

Returns the name of the provided desktop.

syscall enumerate_desktops(in serverlist: ?[]Desktop, out count: usize)

Enumerates all available desktops.

syscall enumerate_desktop_windows(in desktop: Desktop, in window: ?[]Window, out count: usize)

Returns all windows for a desktop handle.

syscall get_desktop_data(in window: Window, out data: [*]align(16) u8)

Returns desktop-associated "opaque" data for this window.

This is meant as a convenience tool to store additional information per window like position on the screen, orientation, alignment, ...

The size of this must be known and cannot be queried.

syscall notify_message_box(in source: Desktop, in request_id: MessageBoxEvent.RequestID, in result: MessageBoxResult)

Notifies the system that a message box was confirmed by the user.

Note:

This function is meant to be implemented by a desktop server. Regular GUI applications should not use this function as they have no access to a MessageBoxEvent.RequestID.

syscall post_window_event(in window: Window, in event: WindowEvent)

Posts an event into the window event queue so the window owner can handle the event.

syscall send_notification(in desktop: Desktop, in message: str, in severity: NotificationSeverity)

Sends a notification to the provided desktop.

Asynchronous Operations

async_call ShowMessageBox(in desktop: Desktop, in message: str, in caption: str, in buttons: MessageBoxButtons, in icon: MessageBoxIcon, out result: MessageBoxResult)

Opens a message box popup window and prompts the user for response.

async_call GetWindowEvent(in window: Window, out event: WindowEvent)

Waits for an event on the given Window, completing as soon as an event arrived.