graphix-package-gui 0.9.0

A dataflow language for UIs and network programming, GUI package
Documentation
/// A keyboard shortcut combining modifier keys with a character key.
type Shortcut;

/// Create a keyboard shortcut. Key must be exactly one character (e.g. "N", "S").
/// Returns an error for invalid keys.
val shortcut: fn(
  ?#ctrl: bool,
  ?#shift: bool,
  ?#alt: bool,
  ?#logo: bool,
  key: string
) -> [Shortcut, Error<`InvalidKey(string)>];

type MenuAction = {
  label: &string,
  shortcut: &[Shortcut, null],
  on_click: &fn(e: null) -> Any,
  disabled: &bool
};

type MenuItem = [`Action(MenuAction), `Divider];

type MenuGroup = {
  label: &string,
  items: &Array<MenuItem>
};

type MenuBar = {
  menus: &Array<MenuGroup>,
  width: &Length
};

val action: fn(
  ?#on_click: fn(e: null) -> Any,
  ?#shortcut: &[Shortcut, null],
  ?#disabled: &bool,
  label: &string
) -> MenuItem;

val divider: fn() -> MenuItem;

val menu: fn(label: &string, items: &Array<MenuItem>) -> MenuGroup;

type ContextMenu = { child: &Widget, items: &Array<MenuItem> };

val context_menu: fn(items: &Array<MenuItem>, child: &Widget) -> Widget;

val bar: fn(?#width: &Length, menus: &Array<MenuGroup>) -> Widget