The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
idunn.h File Reference

idunn: the widget toolkit of ginnOS. More...

#include "idunn_theme.h"
#include <gfx.h>
#include <heimdall_proto.h>
#include <stdbool.h>
#include <stdint.h>

Go to the source code of this file.

Data Structures

struct  idunn_input_t
 input for a canvas. More...
struct  idunn_canvas_hooks_t
 what a canvas does; each hook can be NULL. More...

Macros

#define IDUNN_CURSOR_ARROW   0
#define IDUNN_CURSOR_TEXT   1
#define IDUNN_CURSOR_HAND   2
#define IDUNN_MOD_SHIFT   0x01
#define IDUNN_MOD_CTRL   0x02
#define IDUNN_MOD_ALT   0x04
#define IDUNN_KEY_ESCAPE   1
#define IDUNN_KEY_BACKSPACE   14
#define IDUNN_KEY_TAB   15
#define IDUNN_KEY_ENTER   28
#define IDUNN_KEY_A   30
#define IDUNN_KEY_X   45
#define IDUNN_KEY_C   46
#define IDUNN_KEY_V   47
#define IDUNN_KEY_SPACE   57
#define IDUNN_KEY_HOME   102
#define IDUNN_KEY_UP   103
#define IDUNN_KEY_PAGEUP   104
#define IDUNN_KEY_LEFT   105
#define IDUNN_KEY_RIGHT   106
#define IDUNN_KEY_END   107
#define IDUNN_KEY_DOWN   108
#define IDUNN_KEY_PAGEDOWN   109
#define IDUNN_KEY_DELETE   111
#define IDUNN_WATCH_MAX   4
#define IDUNN_PROGRESS_MAX   1000

Typedefs

typedef struct idunn_app idunn_app_t
typedef struct idunn_context idunn_context_t
typedef struct idunn_window idunn_window_t
typedef struct idunn_widget idunn_widget_t
typedef void(*) idunn_callback_t(idunn_widget_t *widget, void *data)
typedef bool(*) idunn_widget_key_t(idunn_widget_t *w, uint16_t code, uint32_t mods, void *data)
 keys for a widget (when it or a child has the keyboard) before the widget gets them.
typedef bool(*) idunn_key_hook_t(idunn_window_t *win, uint16_t code, uint32_t mods, const char *text, void *data)
 keys that no widget used (the focused one and its parents): the window's own shortcuts.
typedef void(*) idunn_edit_done_t(idunn_widget_t *list, int item, const char *text, void *data)
 what an edit in place gives: the new text, or NULL when it was taken back (Escape).
typedef struct idunn_menu idunn_menu_t
 a menu: items the app adds, shown in a popup by idunn_menu_popup
typedef void(*) idunn_file_done_t(const char *path, void *data)
 the path chosen in a file dialog (the dialog is closed already)

Enumerations

enum  idunn_align_t {
  IDUNN_START , IDUNN_CENTER , IDUNN_END , IDUNN_STRETCH ,
  IDUNN_SPACE_BETWEEN
}
enum  idunn_variant_t {
  IDUNN_PRIMARY , IDUNN_SECONDARY , IDUNN_OUTLINE , IDUNN_GHOST ,
  IDUNN_DESTRUCTIVE , IDUNN_LINK
}
enum  idunn_size_t { IDUNN_SIZE_DEFAULT , IDUNN_SIZE_SMALL , IDUNN_SIZE_LARGE }
enum  idunn_check_t { IDUNN_UNCHECKED , IDUNN_CHECKED , IDUNN_MIXED }
enum  idunn_badge_t { IDUNN_BADGE_DEFAULT , IDUNN_BADGE_SECONDARY , IDUNN_BADGE_OUTLINE , IDUNN_BADGE_DESTRUCTIVE }
enum  idunn_file_mode_t { IDUNN_FILE_OPEN , IDUNN_FILE_SAVE }
enum  idunn_pointer_t {
  IDUNN_POINTER_MOTION , IDUNN_POINTER_PRESS , IDUNN_POINTER_RELEASE , IDUNN_POINTER_LEAVE ,
  IDUNN_POINTER_MENU , IDUNN_POINTER_MIDDLE
}
enum  idunn_input_type_t {
  IDUNN_INPUT_KEY , IDUNN_INPUT_PRESS , IDUNN_INPUT_DRAG , IDUNN_INPUT_RELEASE ,
  IDUNN_INPUT_MOTION , IDUNN_INPUT_SCROLL , IDUNN_INPUT_PASTE , IDUNN_INPUT_FOCUS ,
  IDUNN_INPUT_BLUR , IDUNN_INPUT_TIMER
}

Functions

idunn_app_t * idunn_app_new (const char *name)
 connect to the window server and read the theme.
heim_conn_t * idunn_app_conn (const idunn_app_t *app)
 the connection to the window server, for calls idunn does not wrap (the shell's heim_shell_start, for example).
void idunn_app_on_event (idunn_app_t *app, void(*on_event)(idunn_app_t *app, const heim_msg_t *msg, void *data), void *data)
 get the events that are about no window of the app (the shell's HEIM_EV_WINDOW, HEIM_EV_WINDOW_APP, HEIM_EV_WINDOW_GONE), and HEIM_EV_SETTINGS (after idunn applied a new theme).
void idunn_app_every (idunn_app_t *app, uint32_t period, void(*every)(void *data), void *data)
 call every(data) each period ms while the app runs (a clock).
void idunn_app_watch (idunn_app_t *app, int fd, void(*ready)(int fd, void *data), void *data)
 call ready(fd, data) when fd can be read (or has hung up) while the app runs: a pty, a pipe.
void idunn_app_paste (idunn_app_t *app, void(*got)(const char *text, size_t length, void *data), void *data)
 ask for the clipboard's text for the program itself (not a widget): got gets it when it comes ("" when the clipboard is empty).
int idunn_app_run (idunn_app_t *app)
 run until the last window is closed or idunn_app_quit.
void idunn_app_quit (idunn_app_t *app)
void idunn_app_set_theme (idunn_app_t *app, const idunn_theme_t *theme)
 use another theme in all windows of the app (they are drawn again).
bool idunn_app_save_theme (idunn_app_t *app, const char *key, const char *value)
 change a theme setting (mode, accent, radius, font_size, scale, motion) in the user's theme file.
const idunn_theme_t * idunn_app_theme (const idunn_app_t *app)
idunn_window_t * idunn_window_new (idunn_app_t *app, const char *title, int32_t width, int32_t height)
 a window with a title bar; it shows when the app runs.
idunn_window_t * idunn_screen_window_new (idunn_app_t *app, const gfx_buffer_t *backdrop)
 a window as large as the screen with no title bar (a login screen).
idunn_window_t * idunn_panel_new (idunn_app_t *app, int32_t height)
 a panel of the desktop shell: no title bar, at the bottom of the screen, as wide as the screen, above the windows (HEIM_WINDOW_PANEL).
void idunn_window_set_root (idunn_window_t *win, idunn_widget_t *root)
 the widget that fills the window (a row or a column, usually).
void idunn_free_later (idunn_widget_t *w)
 free w (and its children) after the event that is running: for a widget that may be in its own callback (a button that rebuilds the view it is in).
void idunn_on_key (idunn_widget_t *w, idunn_widget_key_t on_key, void *data)
void idunn_window_on_key (idunn_window_t *win, idunn_key_hook_t on_key, void *data)
void idunn_window_close (idunn_window_t *win)
 close and free the window (and its widgets).
void idunn_window_on_close (idunn_window_t *win, bool(*on_close)(idunn_window_t *win, void *data), void *data)
 the close button (or the shell's Close): on_close returns true to let the window close, false to keep it (to ask about unsaved changes first, and close it later with idunn_window_close).
void idunn_window_set_title (idunn_window_t *win, const char *title)
 a new title in the window's title bar (and the shell's window list).
idunn_widget_t * idunn_row (int gap, int padding)
 a box that puts its children in a row (left to right) or a column (top to bottom), like a CSS flexbox.
idunn_widget_t * idunn_column (int gap, int padding)
void idunn_box_set_align (idunn_widget_t *box, idunn_align_t align, idunn_align_t justify)
 how a box places its children: align across it (default: stretch) and justify along it (default: start).
void idunn_box_set_padding (idunn_widget_t *box, int vertical, int horizontal)
 other paddings for the sides of a box, in units: across and along.
void idunn_box_set_background (idunn_widget_t *box, idunn_color_t color)
 a background for a box, a colour token (by default it has none).
void idunn_box_set_keep_end (idunn_widget_t *box, bool keep_end)
 a row that is too short for its children shows the last ones: the first go out of view on the left, whole (a path bar keeps the folder that is open in view).
idunn_widget_t * idunn_card (int gap)
 a card: a column on the card colour with a border, the large radius and a small shadow, 24 pixels inside.
void idunn_card_set_glass (idunn_widget_t *card, bool glass)
 frosted glass: the card is see-through, lighter than what is under it, with a thin light edge and a larger shadow (over a blurred picture, as on a login screen).
void idunn_card_header (idunn_widget_t *card, const char *title, const char *description)
 a title and a muted description (or NULL) at the top of a card.
idunn_widget_t * idunn_scroll_view (idunn_widget_t *child)
 a scroll view: the child can be taller than the view.
int32_t idunn_scroll_view_offset (const idunn_widget_t *view)
void idunn_scroll_view_scroll_to (idunn_widget_t *view, int32_t offset)
idunn_widget_t * idunn_spacer (void)
 empty space that grows (put it between children to push them apart).
idunn_widget_t * idunn_add (idunn_widget_t *parent, idunn_widget_t *child)
 add child at the end of parent.
void idunn_widget_free (idunn_widget_t *w)
 take a widget out of its parent and free it and its children.
idunn_widget_t * idunn_grow (idunn_widget_t *w, int weight)
 let a widget take a share of the free space along its box.
void idunn_set_size (idunn_widget_t *w, int32_t width, int32_t height)
 a size a widget must have, in design pixels (0: its own size).
void idunn_set_hidden (idunn_widget_t *w, bool hidden)
 a hidden widget is not drawn, takes no room in its box and gets no input.
void idunn_set_disabled (idunn_widget_t *w, bool disabled)
 a disabled widget is drawn at half opacity and gets no input.
void idunn_on_menu (idunn_widget_t *w, idunn_callback_t on_menu, void *data)
 on_menu on a right click on the widget or in it, when no widget in it used the click (a list view uses it on its items: idunn_list_view_on_menu).
void idunn_on_middle_click (idunn_widget_t *w, idunn_callback_t on_middle, void *data)
 on_middle on a press of the middle button on the widget or in it (the nearest widget that has one): a task button closes its window.
void idunn_set_error (idunn_widget_t *w, bool error)
 a control with a wrong value: its border and ring are red (a field sets this on its control with idunn_field_set_error).
idunn_widget_t * idunn_label (const char *text, idunn_text_t style)
 text in a style; it ends with "..." when it is too wide, or wraps.
void idunn_label_set_text (idunn_widget_t *label, const char *text)
void idunn_label_set_color (idunn_widget_t *label, idunn_color_t color)
void idunn_label_set_wrap (idunn_widget_t *label, bool wrap)
idunn_widget_t * idunn_button (const char *text, idunn_variant_t variant, idunn_callback_t on_click, void *data)
 a button; on_click gets the button and data.
idunn_widget_t * idunn_icon_button (const char *icon, idunn_variant_t variant, idunn_callback_t on_click, void *data)
 a square button with only an icon (a Lucide name).
void idunn_button_set_icon (idunn_widget_t *button, const char *icon)
 an icon (a Lucide name) before the text.
void idunn_button_set_picture (idunn_widget_t *button, const char *picture)
 a picture in its own colours (a Tela name, an app's icon) before the text
void idunn_button_set_active (idunn_widget_t *button, bool active)
 the button is on (a task's window is active, a toggle is on): a filled look with a short accent line under it.
void idunn_button_set_dim (idunn_widget_t *button, bool dim)
 the content muted (a task whose window is minimized)
void idunn_button_set_pill (idunn_widget_t *button, bool pill)
 round ends: the radius is half the height
void idunn_button_set_glass (idunn_widget_t *button, bool glass)
 see-through, lighter than what is under it (over a picture)
void idunn_button_set_tile (idunn_widget_t *button, bool tile)
 a tile: the icon larger, over the text in small type (Restart, Power off)
void idunn_button_set_size (idunn_widget_t *button, idunn_size_t size)
void idunn_button_set_text (idunn_widget_t *button, const char *text)
void idunn_button_set_variant (idunn_widget_t *button, idunn_variant_t variant)
void idunn_button_set_align (idunn_widget_t *button, idunn_align_t align)
 where the icon and text go: IDUNN_CENTER (the default) or IDUNN_START (side bar items, menu-like lists).
idunn_widget_t * idunn_separator (void)
 a 1 pixel line: across a column, or down a row.
idunn_widget_t * idunn_text_field (const char *placeholder)
 a one-line text field, 32 pixels high.
const char * idunn_text_field_text (const idunn_widget_t *field)
 the text (UTF-8); valid until the text changes
void idunn_text_field_set_text (idunn_widget_t *field, const char *text)
void idunn_text_field_set_plain (idunn_widget_t *field, bool plain)
 select bytes start to end (the caret at end); typing replaces them.
void idunn_text_field_set_pill (idunn_widget_t *field, bool pill)
 a pill: round ends, see-through (over a picture, as on a login screen), no border, the text in the middle while it fits.
void idunn_text_field_set_secret (idunn_widget_t *field, bool secret)
 a password field: a bullet for each character, and no Copy or Cut
int32_t idunn_text_field_text_width (idunn_widget_t *field)
 the width of the field's text in pixels (0 before it is in a window)
void idunn_text_field_select (idunn_widget_t *field, size_t start, size_t end)
void idunn_text_field_set_icon (idunn_widget_t *field, const char *icon)
 an icon (a Lucide name) at the start, as in a search field
void idunn_text_field_on_change (idunn_widget_t *field, idunn_callback_t on_change, void *data)
 on_change after every change of the text; on_submit on Enter
void idunn_text_field_on_submit (idunn_widget_t *field, idunn_callback_t on_submit, void *data)
void idunn_text_field_on_blur (idunn_widget_t *field, idunn_callback_t on_blur, void *data)
 on_blur when the field loses the keyboard
idunn_widget_t * idunn_text_area (const char *placeholder, int rows)
 a text area: lines that wrap, Enter for a new line; it scrolls.
const char * idunn_text_area_text (const idunn_widget_t *area)
void idunn_text_area_set_text (idunn_widget_t *area, const char *text)
void idunn_text_area_on_change (idunn_widget_t *area, idunn_callback_t on_change, void *data)
idunn_widget_t * idunn_check_box (const char *label, bool checked, idunn_callback_t on_change, void *data)
 a check box with a label to its right (a click on the label clicks it).
idunn_check_t idunn_check_box_state (const idunn_widget_t *box)
void idunn_check_box_set_state (idunn_widget_t *box, idunn_check_t state)
idunn_widget_t * idunn_radio_group (const char *const *labels, int count, int chosen, idunn_callback_t on_change, void *data)
 a group of choices with round buttons, one chosen; one Tab stop, the arrows move the choice.
int idunn_radio_group_chosen (const idunn_widget_t *group)
void idunn_radio_group_choose (idunn_widget_t *group, int chosen)
void idunn_radio_group_set_row (idunn_widget_t *group, bool row)
idunn_widget_t * idunn_switch (const char *label, bool on, idunn_callback_t on_change, void *data)
 a switch with a label to its right; it slides when it changes.
bool idunn_switch_on (const idunn_widget_t *sw)
void idunn_switch_set_on (idunn_widget_t *sw, bool on)
idunn_widget_t * idunn_slider (int32_t min, int32_t max, int32_t step, int32_t value, idunn_callback_t on_change, void *data)
 a slider from min to max in steps (the arrows move it by one step).
int32_t idunn_slider_value (const idunn_widget_t *slider)
void idunn_slider_set_value (idunn_widget_t *slider, int32_t value)
idunn_widget_t * idunn_badge (const char *text, idunn_badge_t variant)
 a badge: a short word in a small pill
idunn_widget_t * idunn_icon_view (const char *name, int32_t size, idunn_color_t color)
 a Lucide icon on its own, size points, in a colour token
idunn_widget_t * idunn_empty_state (const char *icon, const char *title, const char *text)
 an empty state: an icon on a muted square, a title and a muted line (or NULL), in the middle of its space.
idunn_widget_t * idunn_progress (void)
 a progress bar across its box; value 0 to IDUNN_PROGRESS_MAX
void idunn_progress_set (idunn_widget_t *progress, int32_t value)
idunn_widget_t * idunn_tabs (idunn_callback_t on_change, void *data)
 tabs: a strip of names and the page of the active one below it.
idunn_widget_t * idunn_tabs_add (idunn_widget_t *tabs, const char *name, idunn_widget_t *page)
 add a tab with its page (the tabs own it); the first one is active
int idunn_tabs_active (const idunn_widget_t *tabs)
void idunn_tabs_set_active (idunn_widget_t *tabs, int active)
idunn_widget_t * idunn_list_view (void)
 a list view: rows with a Lucide icon (or NULL), text and a muted second text on the right (or NULL).
idunn_widget_t * idunn_grid_view (void)
 a grid view: the same, as tiles of a 48 point Tela icon (a file or folder icon name) with the name below; it wraps to the width.
int idunn_list_view_add (idunn_widget_t *list, const char *icon, const char *text, const char *detail)
void idunn_list_view_clear (idunn_widget_t *list)
void idunn_list_view_set_item (idunn_widget_t *list, int item, const char *icon, const char *text, const char *detail)
 change an item; only its row is drawn again, and only when something differs (a list that is filled again each second, as in a monitor).
void idunn_list_view_set_count (idunn_widget_t *list, int count)
 keep only the first count items (a smaller count than now)
int idunn_list_view_count (const idunn_widget_t *list)
const char * idunn_list_view_text (const idunn_widget_t *list, int item)
void idunn_list_view_set_multiple (idunn_widget_t *list, bool multiple)
 many items can be selected (Ctrl, Shift, Ctrl+A)
void idunn_list_view_set_pictures (idunn_widget_t *list, bool pictures)
 rows with a Tela icon (a file or folder icon name) in colour, not a Lucide one
void idunn_list_view_set_framed (idunn_widget_t *list, bool framed)
 a border, the large radius and the card colour around the items
bool idunn_list_view_selected (const idunn_widget_t *list, int item)
void idunn_list_view_select (idunn_widget_t *list, int item, bool selected)
int idunn_list_view_current (const idunn_widget_t *list)
 the item with the keyboard, or -1
void idunn_list_view_on_select (idunn_widget_t *list, idunn_callback_t on_select, void *data)
 on_select after the selection changes; on_activate on a double click or Enter
void idunn_list_view_on_activate (idunn_widget_t *list, idunn_callback_t on_activate, void *data)
bool idunn_list_view_edit (idunn_widget_t *list, int item, size_t start, size_t end, idunn_edit_done_t done, void *data)
 edit an item's text in place (a rename): a text field over it with the bytes start to end selected ((size_t)-1: to the end).
void idunn_list_view_set_columns (idunn_widget_t *list, const int32_t *widths, int count)
 columns at the right of the rows: an item's detail is split at tabs, and each part is drawn at the right of its column (numbers line up).
idunn_widget_t * idunn_list_heads (idunn_widget_t *list, const char *const *names, int count, idunn_callback_t on_click, void *data)
 heads over the columns of a list view, which line up with it.
int idunn_list_heads_clicked (const idunn_widget_t *heads)
 the head that was clicked: 0 for the names, 1 and on for the columns
void idunn_list_heads_set_order (idunn_widget_t *heads, int head, bool descending)
 show the order on a head (an arrow), or on none with head -1
void idunn_list_view_set_columns_left (idunn_widget_t *list, uint32_t mask)
 draw some columns at their left, for text (a date, a type); the others stay at their right, for numbers.
void idunn_list_view_go_to (idunn_widget_t *list, int item)
 make an item the current one and select only it, as the arrow keys do
int idunn_list_view_columns (const idunn_widget_t *list)
 the items in a line (1 for a list, more for a grid)
bool idunn_list_view_editing (const idunn_widget_t *list)
 true while an item is edited in place
void idunn_list_view_set_single_click (idunn_widget_t *list, bool single)
 one click activates an item (a launcher); the arrow keys only move
void idunn_list_view_on_menu (idunn_widget_t *list, idunn_callback_t on_menu, void *data)
 on_menu on a right click: on an item that is not selected, it selects only that item first; on no item, nothing stays selected.
int idunn_list_view_item_at (const idunn_widget_t *list, int32_t x, int32_t y)
 the item at a point of the window, or -1
idunn_menu_t * idunn_menu_new (void)
void idunn_menu_free (idunn_menu_t *menu)
 free a menu (not while it is open) and its sub-menus
int idunn_menu_add (idunn_menu_t *menu, const char *icon, const char *text, const char *shortcut, idunn_callback_t on_choose, void *data)
 an item: a Lucide icon (or NULL), text and a shortcut to show (or NULL).
int idunn_menu_add_check (idunn_menu_t *menu, const char *text, bool checked, idunn_callback_t on_choose, void *data)
 an item with a check that a choice turns on and off
void idunn_menu_add_separator (idunn_menu_t *menu)
int idunn_menu_add_sub (idunn_menu_t *menu, const char *icon, const char *text, idunn_menu_t *sub)
 an item that opens a sub-menu (the menu owns it)
void idunn_menu_set_disabled (idunn_menu_t *menu, int item, bool disabled)
bool idunn_menu_checked (const idunn_menu_t *menu, int item)
void idunn_menu_set_checked (idunn_menu_t *menu, int item, bool checked)
void idunn_menu_set_min_width (idunn_menu_t *menu, int32_t width)
 the least width of the menu, in design pixels (160 by default)
void idunn_menu_popup (idunn_menu_t *menu, idunn_widget_t *owner)
 open the menu under a widget (a button's on_click does it)
void idunn_menu_popup_at_pointer (idunn_menu_t *menu, idunn_widget_t *owner)
 open the menu where the last right click was (a context menu)
idunn_widget_t * idunn_select (const char *const *choices, int count, int chosen, idunn_callback_t on_change, void *data)
 a select: a field with the chosen value; it opens a menu of the choices.
int idunn_select_chosen (const idunn_widget_t *select)
void idunn_select_choose (idunn_widget_t *select, int chosen)
void idunn_select_set_placeholder (idunn_widget_t *select, const char *text)
void idunn_set_tooltip (idunn_widget_t *w, const char *text)
 a tooltip: shown over the widget after 600 ms under the pointer (NULL: none)
void idunn_popover (idunn_widget_t *owner, idunn_widget_t *content)
 a popover: content in a card under owner; a press outside it or Escape closes it.
void idunn_popover_close (idunn_widget_t *inside)
 close the popover a widget is in
void idunn_file_dialog (idunn_widget_t *owner, idunn_file_mode_t mode, const char *title, const char *path, idunn_file_done_t done, void *data)
 a dialog to choose a file: the folder's items as a list, a button to the folder above, and to save, a field with the name.
idunn_widget_t * idunn_dialog (const char *title, const char *description)
 a dialog: a card with a title and a description (or NULL), in the middle of the window over the overlay colour.
idunn_widget_t * idunn_dialog_content (idunn_widget_t *dialog)
idunn_widget_t * idunn_dialog_add_button (idunn_widget_t *dialog, const char *text, idunn_variant_t variant, idunn_callback_t on_click, void *data)
 a button at the bottom right: Cancel as outline, the action primary or destructive
void idunn_dialog_open (idunn_widget_t *owner, idunn_widget_t *dialog)
 show a dialog over the window of owner; the window owns it then
void idunn_dialog_close (idunn_widget_t *dialog)
idunn_widget_t * idunn_field (const char *label, idunn_widget_t *control, const char *help)
 a form row: a label above the control and help text below it (or NULL).
void idunn_field_set_error (idunn_widget_t *field, const char *message)
 show an error: the message in red under the control, and the control's border and ring red.
idunn_context_t * idunn_context_new (const idunn_theme_t *theme, const char *font_dir, const char *icon_pack)
 fonts and icons for a theme.
void idunn_context_free (idunn_context_t *ctx)
void idunn_context_set_theme (idunn_context_t *ctx, const idunn_theme_t *theme)
idunn_window_t * idunn_window_offscreen (idunn_context_t *ctx, int32_t width, int32_t height)
 a window that draws into its own buffer, of that many pixels.
void idunn_window_resize (idunn_window_t *win, int32_t width, int32_t height)
 a new size for the window's buffer (the window lays out again).
gfx_buffer_t * idunn_window_buffer (const idunn_window_t *win)
gfx_rect_t idunn_window_draw (idunn_window_t *win)
 lay out and draw what changed.
void idunn_window_invalidate (idunn_window_t *win)
 the whole window must be drawn again (after a theme change).
void idunn_window_pointer (idunn_window_t *win, idunn_pointer_t kind, int32_t x, int32_t y, uint32_t mods)
 the pointer moved, or the left button went down or up, at (x, y), with these modifier keys held (Shift+click extends a selection).
void idunn_window_scroll (idunn_window_t *win, int32_t x, int32_t y, int32_t steps)
 the wheel turned over (x, y): steps, up is positive.
void idunn_window_paste (idunn_window_t *win, const char *text, size_t length)
 the clipboard text a widget asked for came (from the window server).
uint32_t idunn_window_next_wake (const idunn_window_t *win)
 the next time (ms) the window must be ticked for a timer, or 0 for none.
void idunn_window_key (idunn_window_t *win, uint16_t code, uint32_t mods, const char *text)
 a key press (or repeat).
bool idunn_window_tick (idunn_window_t *win, uint32_t now)
 the time now in ms, for transitions.
uint32_t idunn_window_cursor (const idunn_window_t *win)
 the pointer shape for where the pointer is (IDUNN_CURSOR_).
idunn_widget_t * idunn_window_focus (const idunn_window_t *win)
 the widget with the keyboard focus, or NULL.
idunn_widget_t * idunn_canvas (const idunn_canvas_hooks_t *hooks, void *data)
 a widget the program draws itself: a terminal, a game.
void idunn_canvas_damage (idunn_widget_t *canvas, gfx_rect_t r)
 draw a rect of the canvas again (canvas coordinates)
void idunn_canvas_update (idunn_widget_t *canvas)
 a frame soon, so the frame hook runs (new data came)
void idunn_canvas_move (idunn_widget_t *canvas, gfx_rect_t area, int32_t dy)
 in the frame hook: move the pixels of area up (dy < 0) or down; the strip that comes into view is damaged.
void idunn_canvas_copy (idunn_widget_t *canvas, const char *text, size_t length)
 put text on the clipboard; ask for its text (an IDUNN_INPUT_PASTE comes)
void idunn_canvas_paste (idunn_widget_t *canvas)
void idunn_canvas_wake (idunn_widget_t *canvas, uint32_t ms)
 an IDUNN_INPUT_TIMER in ms (one at a time; a new call moves it)
void idunn_canvas_set_cursor (idunn_widget_t *canvas, uint32_t shape)
 the pointer shape over the canvas (IDUNN_CURSOR_)
void idunn_set_focus (idunn_widget_t *w)
 give the keyboard to a widget in a window (a canvas at the start).
gfx_rect_t idunn_widget_rect (const idunn_widget_t *w)
 where a widget is in its window, after layout.

Detailed Description

idunn: the widget toolkit of ginnOS.

an app makes a tree of widgets (rows and columns of labels, buttons and so on), puts it in a window and runs the app loop. widgets keep their state between frames; the toolkit lays them out, draws only what changed, in step with the screen, and sends the pointer and the keys to them. the look comes from the theme (idunn_theme.h).

idunn_app_t *app = idunn_app_new("Files"); idunn_window_t *win = idunn_window_new(app, "Files", 720, 480); idunn_widget_t *col = idunn_column(4, 6); idunn_add(col, idunn_label("Rename file", IDUNN_TEXT_HEADING)); idunn_add(col, idunn_button("Rename", IDUNN_PRIMARY, on_rename, NULL)); idunn_window_set_root(win, col); return idunn_app_run(app);

sizes are in design pixels (the theme's scale makes them larger); gaps and paddings are in space units of 4 design pixels.

Macro Definition Documentation

◆ IDUNN_CURSOR_ARROW

#define IDUNN_CURSOR_ARROW   0

◆ IDUNN_CURSOR_TEXT

#define IDUNN_CURSOR_TEXT   1

◆ IDUNN_CURSOR_HAND

#define IDUNN_CURSOR_HAND   2

◆ IDUNN_MOD_SHIFT

#define IDUNN_MOD_SHIFT   0x01

◆ IDUNN_MOD_CTRL

#define IDUNN_MOD_CTRL   0x02

◆ IDUNN_MOD_ALT

#define IDUNN_MOD_ALT   0x04

◆ IDUNN_KEY_ESCAPE

#define IDUNN_KEY_ESCAPE   1

◆ IDUNN_KEY_BACKSPACE

#define IDUNN_KEY_BACKSPACE   14

◆ IDUNN_KEY_TAB

#define IDUNN_KEY_TAB   15

◆ IDUNN_KEY_ENTER

#define IDUNN_KEY_ENTER   28

◆ IDUNN_KEY_A

#define IDUNN_KEY_A   30

◆ IDUNN_KEY_X

#define IDUNN_KEY_X   45

◆ IDUNN_KEY_C

#define IDUNN_KEY_C   46

◆ IDUNN_KEY_V

#define IDUNN_KEY_V   47

◆ IDUNN_KEY_SPACE

#define IDUNN_KEY_SPACE   57

◆ IDUNN_KEY_HOME

#define IDUNN_KEY_HOME   102

◆ IDUNN_KEY_UP

#define IDUNN_KEY_UP   103

◆ IDUNN_KEY_PAGEUP

#define IDUNN_KEY_PAGEUP   104

◆ IDUNN_KEY_LEFT

#define IDUNN_KEY_LEFT   105

◆ IDUNN_KEY_RIGHT

#define IDUNN_KEY_RIGHT   106

◆ IDUNN_KEY_END

#define IDUNN_KEY_END   107

◆ IDUNN_KEY_DOWN

#define IDUNN_KEY_DOWN   108

◆ IDUNN_KEY_PAGEDOWN

#define IDUNN_KEY_PAGEDOWN   109

◆ IDUNN_KEY_DELETE

#define IDUNN_KEY_DELETE   111

◆ IDUNN_WATCH_MAX

#define IDUNN_WATCH_MAX   4

◆ IDUNN_PROGRESS_MAX

#define IDUNN_PROGRESS_MAX   1000

Typedef Documentation

◆ idunn_app_t

typedef struct idunn_app idunn_app_t

◆ idunn_context_t

◆ idunn_window_t

typedef struct idunn_window idunn_window_t

◆ idunn_widget_t

typedef struct idunn_widget idunn_widget_t

◆ idunn_callback_t

typedef void(*) idunn_callback_t(idunn_widget_t *widget, void *data)

◆ idunn_widget_key_t

typedef bool(*) idunn_widget_key_t(idunn_widget_t *w, uint16_t code, uint32_t mods, void *data)

keys for a widget (when it or a child has the keyboard) before the widget gets them.

return true to use the key (the widget does not get it), false to let it go on as before.

◆ idunn_key_hook_t

typedef bool(*) idunn_key_hook_t(idunn_window_t *win, uint16_t code, uint32_t mods, const char *text, void *data)

keys that no widget used (the focused one and its parents): the window's own shortcuts.

on_key returns true when it used the key. code is a Linux key code, mods IDUNN_MOD_, text what it types or "".

◆ idunn_edit_done_t

typedef void(*) idunn_edit_done_t(idunn_widget_t *list, int item, const char *text, void *data)

what an edit in place gives: the new text, or NULL when it was taken back (Escape).

it comes after the event, so the list can be made again.

◆ idunn_menu_t

typedef struct idunn_menu idunn_menu_t

a menu: items the app adds, shown in a popup by idunn_menu_popup

◆ idunn_file_done_t

typedef void(*) idunn_file_done_t(const char *path, void *data)

the path chosen in a file dialog (the dialog is closed already)

Enumeration Type Documentation

◆ idunn_align_t

Enumerator
IDUNN_START 
IDUNN_CENTER 
IDUNN_END 
IDUNN_STRETCH 
IDUNN_SPACE_BETWEEN 

◆ idunn_variant_t

Enumerator
IDUNN_PRIMARY 
IDUNN_SECONDARY 
IDUNN_OUTLINE 
IDUNN_GHOST 
IDUNN_DESTRUCTIVE 
IDUNN_LINK 

◆ idunn_size_t

Enumerator
IDUNN_SIZE_DEFAULT 
IDUNN_SIZE_SMALL 
IDUNN_SIZE_LARGE 

◆ idunn_check_t

Enumerator
IDUNN_UNCHECKED 
IDUNN_CHECKED 
IDUNN_MIXED 

◆ idunn_badge_t

Enumerator
IDUNN_BADGE_DEFAULT 
IDUNN_BADGE_SECONDARY 
IDUNN_BADGE_OUTLINE 
IDUNN_BADGE_DESTRUCTIVE 

◆ idunn_file_mode_t

Enumerator
IDUNN_FILE_OPEN 
IDUNN_FILE_SAVE 

◆ idunn_pointer_t

Enumerator
IDUNN_POINTER_MOTION 
IDUNN_POINTER_PRESS 
IDUNN_POINTER_RELEASE 
IDUNN_POINTER_LEAVE 
IDUNN_POINTER_MENU 
IDUNN_POINTER_MIDDLE 

◆ idunn_input_type_t

Enumerator
IDUNN_INPUT_KEY 
IDUNN_INPUT_PRESS 
IDUNN_INPUT_DRAG 
IDUNN_INPUT_RELEASE 
IDUNN_INPUT_MOTION 
IDUNN_INPUT_SCROLL 
IDUNN_INPUT_PASTE 
IDUNN_INPUT_FOCUS 
IDUNN_INPUT_BLUR 
IDUNN_INPUT_TIMER 

Function Documentation

◆ idunn_app_new()

idunn_app_t * idunn_app_new ( const char * name)

connect to the window server and read the theme.

Parameters
namethe program's id, the name of its .app file ("idunn-gallery"): the shell shows its icon with its windows.
Returns
the app, or NULL (no server, or no fonts).

◆ idunn_app_conn()

heim_conn_t * idunn_app_conn ( const idunn_app_t * app)

the connection to the window server, for calls idunn does not wrap (the shell's heim_shell_start, for example).

◆ idunn_app_on_event()

void idunn_app_on_event ( idunn_app_t * app,
void(* on_event )(idunn_app_t *app, const heim_msg_t *msg, void *data),
void * data )

get the events that are about no window of the app (the shell's HEIM_EV_WINDOW, HEIM_EV_WINDOW_APP, HEIM_EV_WINDOW_GONE), and HEIM_EV_SETTINGS (after idunn applied a new theme).

◆ idunn_app_every()

void idunn_app_every ( idunn_app_t * app,
uint32_t period,
void(* every )(void *data),
void * data )

call every(data) each period ms while the app runs (a clock).

one per app; a new call replaces it, period 0 stops it.

◆ idunn_app_watch()

void idunn_app_watch ( idunn_app_t * app,
int fd,
void(* ready )(int fd, void *data),
void * data )

call ready(fd, data) when fd can be read (or has hung up) while the app runs: a pty, a pipe.

at most IDUNN_WATCH_MAX at a time; ready NULL stops watching fd.

◆ idunn_app_paste()

void idunn_app_paste ( idunn_app_t * app,
void(* got )(const char *text, size_t length, void *data),
void * data )

ask for the clipboard's text for the program itself (not a widget): got gets it when it comes ("" when the clipboard is empty).

◆ idunn_app_run()

int idunn_app_run ( idunn_app_t * app)

run until the last window is closed or idunn_app_quit.

Returns
the exit status for main.

◆ idunn_app_quit()

void idunn_app_quit ( idunn_app_t * app)

◆ idunn_app_set_theme()

void idunn_app_set_theme ( idunn_app_t * app,
const idunn_theme_t * theme )

use another theme in all windows of the app (they are drawn again).

◆ idunn_app_save_theme()

bool idunn_app_save_theme ( idunn_app_t * app,
const char * key,
const char * value )

change a theme setting (mode, accent, radius, font_size, scale, motion) in the user's theme file.

every app and the window decorations change.

Returns
false if the file cannot be written; this app changes then.

◆ idunn_app_theme()

const idunn_theme_t * idunn_app_theme ( const idunn_app_t * app)

◆ idunn_window_new()

idunn_window_t * idunn_window_new ( idunn_app_t * app,
const char * title,
int32_t width,
int32_t height )

a window with a title bar; it shows when the app runs.

Parameters
widththe size of its content, in design pixels.

◆ idunn_screen_window_new()

idunn_window_t * idunn_screen_window_new ( idunn_app_t * app,
const gfx_buffer_t * backdrop )

a window as large as the screen with no title bar (a login screen).

Parameters
backdropthe picture under the widgets, as large as the screen (or NULL: the surface colour). it must stay until the app ends.

◆ idunn_panel_new()

idunn_window_t * idunn_panel_new ( idunn_app_t * app,
int32_t height )

a panel of the desktop shell: no title bar, at the bottom of the screen, as wide as the screen, above the windows (HEIM_WINDOW_PANEL).

Parameters
heightin design pixels.

◆ idunn_window_set_root()

void idunn_window_set_root ( idunn_window_t * win,
idunn_widget_t * root )

the widget that fills the window (a row or a column, usually).

the window owns the tree from now on.

◆ idunn_free_later()

void idunn_free_later ( idunn_widget_t * w)

free w (and its children) after the event that is running: for a widget that may be in its own callback (a button that rebuilds the view it is in).

◆ idunn_on_key()

void idunn_on_key ( idunn_widget_t * w,
idunn_widget_key_t on_key,
void * data )

◆ idunn_window_on_key()

void idunn_window_on_key ( idunn_window_t * win,
idunn_key_hook_t on_key,
void * data )

◆ idunn_window_close()

void idunn_window_close ( idunn_window_t * win)

close and free the window (and its widgets).

◆ idunn_window_on_close()

void idunn_window_on_close ( idunn_window_t * win,
bool(* on_close )(idunn_window_t *win, void *data),
void * data )

the close button (or the shell's Close): on_close returns true to let the window close, false to keep it (to ask about unsaved changes first, and close it later with idunn_window_close).

◆ idunn_window_set_title()

void idunn_window_set_title ( idunn_window_t * win,
const char * title )

a new title in the window's title bar (and the shell's window list).

◆ idunn_row()

idunn_widget_t * idunn_row ( int gap,
int padding )

a box that puts its children in a row (left to right) or a column (top to bottom), like a CSS flexbox.

Parameters
gapthe space between children, in units (4 design pixels).
paddingthe space inside the box, in units.

◆ idunn_column()

idunn_widget_t * idunn_column ( int gap,
int padding )

◆ idunn_box_set_align()

void idunn_box_set_align ( idunn_widget_t * box,
idunn_align_t align,
idunn_align_t justify )

how a box places its children: align across it (default: stretch) and justify along it (default: start).

◆ idunn_box_set_padding()

void idunn_box_set_padding ( idunn_widget_t * box,
int vertical,
int horizontal )

other paddings for the sides of a box, in units: across and along.

◆ idunn_box_set_background()

void idunn_box_set_background ( idunn_widget_t * box,
idunn_color_t color )

a background for a box, a colour token (by default it has none).

◆ idunn_box_set_keep_end()

void idunn_box_set_keep_end ( idunn_widget_t * box,
bool keep_end )

a row that is too short for its children shows the last ones: the first go out of view on the left, whole (a path bar keeps the folder that is open in view).

◆ idunn_card()

idunn_widget_t * idunn_card ( int gap)

a card: a column on the card colour with a border, the large radius and a small shadow, 24 pixels inside.

Parameters
gapthe space between its children, in units.

◆ idunn_card_set_glass()

void idunn_card_set_glass ( idunn_widget_t * card,
bool glass )

frosted glass: the card is see-through, lighter than what is under it, with a thin light edge and a larger shadow (over a blurred picture, as on a login screen).

◆ idunn_card_header()

void idunn_card_header ( idunn_widget_t * card,
const char * title,
const char * description )

a title and a muted description (or NULL) at the top of a card.

◆ idunn_scroll_view()

idunn_widget_t * idunn_scroll_view ( idunn_widget_t * child)

a scroll view: the child can be taller than the view.

the view takes the height it is given (let it grow, or give it a size), as a CSS box with min-height 0. the wheel, the keys its children do not use and a thin scroll bar scroll it; Tab scrolls the focus into view.

◆ idunn_scroll_view_offset()

int32_t idunn_scroll_view_offset ( const idunn_widget_t * view)

◆ idunn_scroll_view_scroll_to()

void idunn_scroll_view_scroll_to ( idunn_widget_t * view,
int32_t offset )

◆ idunn_spacer()

idunn_widget_t * idunn_spacer ( void )

empty space that grows (put it between children to push them apart).

◆ idunn_add()

idunn_widget_t * idunn_add ( idunn_widget_t * parent,
idunn_widget_t * child )

add child at the end of parent.

Returns
child.

◆ idunn_widget_free()

void idunn_widget_free ( idunn_widget_t * w)

take a widget out of its parent and free it and its children.

◆ idunn_grow()

idunn_widget_t * idunn_grow ( idunn_widget_t * w,
int weight )

let a widget take a share of the free space along its box.

Returns
w.

◆ idunn_set_size()

void idunn_set_size ( idunn_widget_t * w,
int32_t width,
int32_t height )

a size a widget must have, in design pixels (0: its own size).

◆ idunn_set_hidden()

void idunn_set_hidden ( idunn_widget_t * w,
bool hidden )

a hidden widget is not drawn, takes no room in its box and gets no input.

◆ idunn_set_disabled()

void idunn_set_disabled ( idunn_widget_t * w,
bool disabled )

a disabled widget is drawn at half opacity and gets no input.

◆ idunn_on_menu()

void idunn_on_menu ( idunn_widget_t * w,
idunn_callback_t on_menu,
void * data )

on_menu on a right click on the widget or in it, when no widget in it used the click (a list view uses it on its items: idunn_list_view_on_menu).

open a menu with idunn_menu_popup_at_pointer.

◆ idunn_on_middle_click()

void idunn_on_middle_click ( idunn_widget_t * w,
idunn_callback_t on_middle,
void * data )

on_middle on a press of the middle button on the widget or in it (the nearest widget that has one): a task button closes its window.

◆ idunn_set_error()

void idunn_set_error ( idunn_widget_t * w,
bool error )

a control with a wrong value: its border and ring are red (a field sets this on its control with idunn_field_set_error).

◆ idunn_label()

idunn_widget_t * idunn_label ( const char * text,
idunn_text_t style )

text in a style; it ends with "..." when it is too wide, or wraps.

◆ idunn_label_set_text()

void idunn_label_set_text ( idunn_widget_t * label,
const char * text )

◆ idunn_label_set_color()

void idunn_label_set_color ( idunn_widget_t * label,
idunn_color_t color )

◆ idunn_label_set_wrap()

void idunn_label_set_wrap ( idunn_widget_t * label,
bool wrap )

◆ idunn_button()

idunn_widget_t * idunn_button ( const char * text,
idunn_variant_t variant,
idunn_callback_t on_click,
void * data )

a button; on_click gets the button and data.

Parameters
textthe label, or NULL for an icon button.

◆ idunn_icon_button()

idunn_widget_t * idunn_icon_button ( const char * icon,
idunn_variant_t variant,
idunn_callback_t on_click,
void * data )

a square button with only an icon (a Lucide name).

◆ idunn_button_set_icon()

void idunn_button_set_icon ( idunn_widget_t * button,
const char * icon )

an icon (a Lucide name) before the text.

◆ idunn_button_set_picture()

void idunn_button_set_picture ( idunn_widget_t * button,
const char * picture )

a picture in its own colours (a Tela name, an app's icon) before the text

◆ idunn_button_set_active()

void idunn_button_set_active ( idunn_widget_t * button,
bool active )

the button is on (a task's window is active, a toggle is on): a filled look with a short accent line under it.

◆ idunn_button_set_dim()

void idunn_button_set_dim ( idunn_widget_t * button,
bool dim )

the content muted (a task whose window is minimized)

◆ idunn_button_set_pill()

void idunn_button_set_pill ( idunn_widget_t * button,
bool pill )

round ends: the radius is half the height

◆ idunn_button_set_glass()

void idunn_button_set_glass ( idunn_widget_t * button,
bool glass )

see-through, lighter than what is under it (over a picture)

◆ idunn_button_set_tile()

void idunn_button_set_tile ( idunn_widget_t * button,
bool tile )

a tile: the icon larger, over the text in small type (Restart, Power off)

◆ idunn_button_set_size()

void idunn_button_set_size ( idunn_widget_t * button,
idunn_size_t size )

◆ idunn_button_set_text()

void idunn_button_set_text ( idunn_widget_t * button,
const char * text )

◆ idunn_button_set_variant()

void idunn_button_set_variant ( idunn_widget_t * button,
idunn_variant_t variant )

◆ idunn_button_set_align()

void idunn_button_set_align ( idunn_widget_t * button,
idunn_align_t align )

where the icon and text go: IDUNN_CENTER (the default) or IDUNN_START (side bar items, menu-like lists).

◆ idunn_separator()

idunn_widget_t * idunn_separator ( void )

a 1 pixel line: across a column, or down a row.

◆ idunn_text_field()

idunn_widget_t * idunn_text_field ( const char * placeholder)

a one-line text field, 32 pixels high.

Parameters
placeholderthe muted text it shows when it is empty, or NULL.

◆ idunn_text_field_text()

const char * idunn_text_field_text ( const idunn_widget_t * field)

the text (UTF-8); valid until the text changes

◆ idunn_text_field_set_text()

void idunn_text_field_set_text ( idunn_widget_t * field,
const char * text )

◆ idunn_text_field_set_plain()

void idunn_text_field_set_plain ( idunn_widget_t * field,
bool plain )

select bytes start to end (the caret at end); typing replaces them.

(size_t)-1 is the end of the text. a plain field: a thin box around the text, with little padding and no ring (a name that is changed in place, as in a file list).

◆ idunn_text_field_set_pill()

void idunn_text_field_set_pill ( idunn_widget_t * field,
bool pill )

a pill: round ends, see-through (over a picture, as on a login screen), no border, the text in the middle while it fits.

◆ idunn_text_field_set_secret()

void idunn_text_field_set_secret ( idunn_widget_t * field,
bool secret )

a password field: a bullet for each character, and no Copy or Cut

◆ idunn_text_field_text_width()

int32_t idunn_text_field_text_width ( idunn_widget_t * field)

the width of the field's text in pixels (0 before it is in a window)

◆ idunn_text_field_select()

void idunn_text_field_select ( idunn_widget_t * field,
size_t start,
size_t end )

◆ idunn_text_field_set_icon()

void idunn_text_field_set_icon ( idunn_widget_t * field,
const char * icon )

an icon (a Lucide name) at the start, as in a search field

◆ idunn_text_field_on_change()

void idunn_text_field_on_change ( idunn_widget_t * field,
idunn_callback_t on_change,
void * data )

on_change after every change of the text; on_submit on Enter

◆ idunn_text_field_on_submit()

void idunn_text_field_on_submit ( idunn_widget_t * field,
idunn_callback_t on_submit,
void * data )

◆ idunn_text_field_on_blur()

void idunn_text_field_on_blur ( idunn_widget_t * field,
idunn_callback_t on_blur,
void * data )

on_blur when the field loses the keyboard

◆ idunn_text_area()

idunn_widget_t * idunn_text_area ( const char * placeholder,
int rows )

a text area: lines that wrap, Enter for a new line; it scrolls.

Parameters
rowsthe lines it shows (its height), 0 for 4.

◆ idunn_text_area_text()

const char * idunn_text_area_text ( const idunn_widget_t * area)

◆ idunn_text_area_set_text()

void idunn_text_area_set_text ( idunn_widget_t * area,
const char * text )

◆ idunn_text_area_on_change()

void idunn_text_area_on_change ( idunn_widget_t * area,
idunn_callback_t on_change,
void * data )

◆ idunn_check_box()

idunn_widget_t * idunn_check_box ( const char * label,
bool checked,
idunn_callback_t on_change,
void * data )

a check box with a label to its right (a click on the label clicks it).

on_change comes after a click or Space.

◆ idunn_check_box_state()

idunn_check_t idunn_check_box_state ( const idunn_widget_t * box)

◆ idunn_check_box_set_state()

void idunn_check_box_set_state ( idunn_widget_t * box,
idunn_check_t state )

◆ idunn_radio_group()

idunn_widget_t * idunn_radio_group ( const char *const * labels,
int count,
int chosen,
idunn_callback_t on_change,
void * data )

a group of choices with round buttons, one chosen; one Tab stop, the arrows move the choice.

in a column (or a row: idunn_radio_group_set_row).

Parameters
chosenthe index of the chosen one, or -1 for none.

◆ idunn_radio_group_chosen()

int idunn_radio_group_chosen ( const idunn_widget_t * group)

◆ idunn_radio_group_choose()

void idunn_radio_group_choose ( idunn_widget_t * group,
int chosen )

◆ idunn_radio_group_set_row()

void idunn_radio_group_set_row ( idunn_widget_t * group,
bool row )

◆ idunn_switch()

idunn_widget_t * idunn_switch ( const char * label,
bool on,
idunn_callback_t on_change,
void * data )

a switch with a label to its right; it slides when it changes.

◆ idunn_switch_on()

bool idunn_switch_on ( const idunn_widget_t * sw)

◆ idunn_switch_set_on()

void idunn_switch_set_on ( idunn_widget_t * sw,
bool on )

◆ idunn_slider()

idunn_widget_t * idunn_slider ( int32_t min,
int32_t max,
int32_t step,
int32_t value,
idunn_callback_t on_change,
void * data )

a slider from min to max in steps (the arrows move it by one step).

◆ idunn_slider_value()

int32_t idunn_slider_value ( const idunn_widget_t * slider)

◆ idunn_slider_set_value()

void idunn_slider_set_value ( idunn_widget_t * slider,
int32_t value )

◆ idunn_badge()

idunn_widget_t * idunn_badge ( const char * text,
idunn_badge_t variant )

a badge: a short word in a small pill

◆ idunn_icon_view()

idunn_widget_t * idunn_icon_view ( const char * name,
int32_t size,
idunn_color_t color )

a Lucide icon on its own, size points, in a colour token

◆ idunn_empty_state()

idunn_widget_t * idunn_empty_state ( const char * icon,
const char * title,
const char * text )

an empty state: an icon on a muted square, a title and a muted line (or NULL), in the middle of its space.

add buttons to it for actions.

◆ idunn_progress()

idunn_widget_t * idunn_progress ( void )

a progress bar across its box; value 0 to IDUNN_PROGRESS_MAX

◆ idunn_progress_set()

void idunn_progress_set ( idunn_widget_t * progress,
int32_t value )

◆ idunn_tabs()

idunn_widget_t * idunn_tabs ( idunn_callback_t on_change,
void * data )

tabs: a strip of names and the page of the active one below it.

the strip is one Tab stop; the arrows change the tab.

◆ idunn_tabs_add()

idunn_widget_t * idunn_tabs_add ( idunn_widget_t * tabs,
const char * name,
idunn_widget_t * page )

add a tab with its page (the tabs own it); the first one is active

◆ idunn_tabs_active()

int idunn_tabs_active ( const idunn_widget_t * tabs)

◆ idunn_tabs_set_active()

void idunn_tabs_set_active ( idunn_widget_t * tabs,
int active )

◆ idunn_list_view()

idunn_widget_t * idunn_list_view ( void )

a list view: rows with a Lucide icon (or NULL), text and a muted second text on the right (or NULL).

put it in a scroll view when it is long.

◆ idunn_grid_view()

idunn_widget_t * idunn_grid_view ( void )

a grid view: the same, as tiles of a 48 point Tela icon (a file or folder icon name) with the name below; it wraps to the width.

◆ idunn_list_view_add()

int idunn_list_view_add ( idunn_widget_t * list,
const char * icon,
const char * text,
const char * detail )
Returns
the index of the new item, or -1

◆ idunn_list_view_clear()

void idunn_list_view_clear ( idunn_widget_t * list)

◆ idunn_list_view_set_item()

void idunn_list_view_set_item ( idunn_widget_t * list,
int item,
const char * icon,
const char * text,
const char * detail )

change an item; only its row is drawn again, and only when something differs (a list that is filled again each second, as in a monitor).

◆ idunn_list_view_set_count()

void idunn_list_view_set_count ( idunn_widget_t * list,
int count )

keep only the first count items (a smaller count than now)

◆ idunn_list_view_count()

int idunn_list_view_count ( const idunn_widget_t * list)

◆ idunn_list_view_text()

const char * idunn_list_view_text ( const idunn_widget_t * list,
int item )

◆ idunn_list_view_set_multiple()

void idunn_list_view_set_multiple ( idunn_widget_t * list,
bool multiple )

many items can be selected (Ctrl, Shift, Ctrl+A)

◆ idunn_list_view_set_pictures()

void idunn_list_view_set_pictures ( idunn_widget_t * list,
bool pictures )

rows with a Tela icon (a file or folder icon name) in colour, not a Lucide one

◆ idunn_list_view_set_framed()

void idunn_list_view_set_framed ( idunn_widget_t * list,
bool framed )

a border, the large radius and the card colour around the items

◆ idunn_list_view_selected()

bool idunn_list_view_selected ( const idunn_widget_t * list,
int item )

◆ idunn_list_view_select()

void idunn_list_view_select ( idunn_widget_t * list,
int item,
bool selected )

◆ idunn_list_view_current()

int idunn_list_view_current ( const idunn_widget_t * list)

the item with the keyboard, or -1

◆ idunn_list_view_on_select()

void idunn_list_view_on_select ( idunn_widget_t * list,
idunn_callback_t on_select,
void * data )

on_select after the selection changes; on_activate on a double click or Enter

◆ idunn_list_view_on_activate()

void idunn_list_view_on_activate ( idunn_widget_t * list,
idunn_callback_t on_activate,
void * data )

◆ idunn_list_view_edit()

bool idunn_list_view_edit ( idunn_widget_t * list,
int item,
size_t start,
size_t end,
idunn_edit_done_t done,
void * data )

edit an item's text in place (a rename): a text field over it with the bytes start to end selected ((size_t)-1: to the end).

Enter, or the keyboard going elsewhere, keeps the text; Escape takes it back.

Returns
false when the item is not there or the list is not shown.

◆ idunn_list_view_set_columns()

void idunn_list_view_set_columns ( idunn_widget_t * list,
const int32_t * widths,
int count )

columns at the right of the rows: an item's detail is split at tabs, and each part is drawn at the right of its column (numbers line up).

Parameters
widthsthe columns' widths in design pixels, left to right.

◆ idunn_list_heads()

idunn_widget_t * idunn_list_heads ( idunn_widget_t * list,
const char *const * names,
int count,
idunn_callback_t on_click,
void * data )

heads over the columns of a list view, which line up with it.

a click on a head calls on_click; idunn_list_heads_clicked tells which.

Parameters
namesthe name column's head, then one for each column of idunn_list_view_set_columns.

◆ idunn_list_heads_clicked()

int idunn_list_heads_clicked ( const idunn_widget_t * heads)

the head that was clicked: 0 for the names, 1 and on for the columns

◆ idunn_list_heads_set_order()

void idunn_list_heads_set_order ( idunn_widget_t * heads,
int head,
bool descending )

show the order on a head (an arrow), or on none with head -1

◆ idunn_list_view_set_columns_left()

void idunn_list_view_set_columns_left ( idunn_widget_t * list,
uint32_t mask )

draw some columns at their left, for text (a date, a type); the others stay at their right, for numbers.

bit c is column c.

◆ idunn_list_view_go_to()

void idunn_list_view_go_to ( idunn_widget_t * list,
int item )

make an item the current one and select only it, as the arrow keys do

◆ idunn_list_view_columns()

int idunn_list_view_columns ( const idunn_widget_t * list)

the items in a line (1 for a list, more for a grid)

◆ idunn_list_view_editing()

bool idunn_list_view_editing ( const idunn_widget_t * list)

true while an item is edited in place

◆ idunn_list_view_set_single_click()

void idunn_list_view_set_single_click ( idunn_widget_t * list,
bool single )

one click activates an item (a launcher); the arrow keys only move

◆ idunn_list_view_on_menu()

void idunn_list_view_on_menu ( idunn_widget_t * list,
idunn_callback_t on_menu,
void * data )

on_menu on a right click: on an item that is not selected, it selects only that item first; on no item, nothing stays selected.

open a menu with idunn_menu_popup_at_pointer.

◆ idunn_list_view_item_at()

int idunn_list_view_item_at ( const idunn_widget_t * list,
int32_t x,
int32_t y )

the item at a point of the window, or -1

◆ idunn_menu_new()

idunn_menu_t * idunn_menu_new ( void )

◆ idunn_menu_free()

void idunn_menu_free ( idunn_menu_t * menu)

free a menu (not while it is open) and its sub-menus

◆ idunn_menu_add()

int idunn_menu_add ( idunn_menu_t * menu,
const char * icon,
const char * text,
const char * shortcut,
idunn_callback_t on_choose,
void * data )

an item: a Lucide icon (or NULL), text and a shortcut to show (or NULL).

on_choose gets the widget the menu was opened for.

Returns
the index of the item.

◆ idunn_menu_add_check()

int idunn_menu_add_check ( idunn_menu_t * menu,
const char * text,
bool checked,
idunn_callback_t on_choose,
void * data )

an item with a check that a choice turns on and off

◆ idunn_menu_add_separator()

void idunn_menu_add_separator ( idunn_menu_t * menu)

◆ idunn_menu_add_sub()

int idunn_menu_add_sub ( idunn_menu_t * menu,
const char * icon,
const char * text,
idunn_menu_t * sub )

an item that opens a sub-menu (the menu owns it)

◆ idunn_menu_set_disabled()

void idunn_menu_set_disabled ( idunn_menu_t * menu,
int item,
bool disabled )

◆ idunn_menu_checked()

bool idunn_menu_checked ( const idunn_menu_t * menu,
int item )

◆ idunn_menu_set_checked()

void idunn_menu_set_checked ( idunn_menu_t * menu,
int item,
bool checked )

◆ idunn_menu_set_min_width()

void idunn_menu_set_min_width ( idunn_menu_t * menu,
int32_t width )

the least width of the menu, in design pixels (160 by default)

◆ idunn_menu_popup()

void idunn_menu_popup ( idunn_menu_t * menu,
idunn_widget_t * owner )

open the menu under a widget (a button's on_click does it)

◆ idunn_menu_popup_at_pointer()

void idunn_menu_popup_at_pointer ( idunn_menu_t * menu,
idunn_widget_t * owner )

open the menu where the last right click was (a context menu)

◆ idunn_select()

idunn_widget_t * idunn_select ( const char *const * choices,
int count,
int chosen,
idunn_callback_t on_change,
void * data )

a select: a field with the chosen value; it opens a menu of the choices.

Parameters
chosenthe index of the chosen one, or -1 (the placeholder shows).

◆ idunn_select_chosen()

int idunn_select_chosen ( const idunn_widget_t * select)

◆ idunn_select_choose()

void idunn_select_choose ( idunn_widget_t * select,
int chosen )

◆ idunn_select_set_placeholder()

void idunn_select_set_placeholder ( idunn_widget_t * select,
const char * text )

◆ idunn_set_tooltip()

void idunn_set_tooltip ( idunn_widget_t * w,
const char * text )

a tooltip: shown over the widget after 600 ms under the pointer (NULL: none)

◆ idunn_popover()

void idunn_popover ( idunn_widget_t * owner,
idunn_widget_t * content )

a popover: content in a card under owner; a press outside it or Escape closes it.

the popover owns content. it is 288 wide, or as wide as content when content has a larger width (idunn_set_size).

◆ idunn_popover_close()

void idunn_popover_close ( idunn_widget_t * inside)

close the popover a widget is in

◆ idunn_file_dialog()

void idunn_file_dialog ( idunn_widget_t * owner,
idunn_file_mode_t mode,
const char * title,
const char * path,
idunn_file_done_t done,
void * data )

a dialog to choose a file: the folder's items as a list, a button to the folder above, and to save, a field with the name.

nothing is called when it is cancelled.

Parameters
paththe folder to start in, or (to save) the whole path of the file, whose name is then in the field.

◆ idunn_dialog()

idunn_widget_t * idunn_dialog ( const char * title,
const char * description )

a dialog: a card with a title and a description (or NULL), in the middle of the window over the overlay colour.

add content to idunn_dialog_content, then the buttons; a button closes the dialog and then calls its on_click (with the dialog). Escape closes it too.

◆ idunn_dialog_content()

idunn_widget_t * idunn_dialog_content ( idunn_widget_t * dialog)

◆ idunn_dialog_add_button()

idunn_widget_t * idunn_dialog_add_button ( idunn_widget_t * dialog,
const char * text,
idunn_variant_t variant,
idunn_callback_t on_click,
void * data )

a button at the bottom right: Cancel as outline, the action primary or destructive

◆ idunn_dialog_open()

void idunn_dialog_open ( idunn_widget_t * owner,
idunn_widget_t * dialog )

show a dialog over the window of owner; the window owns it then

◆ idunn_dialog_close()

void idunn_dialog_close ( idunn_widget_t * dialog)

◆ idunn_field()

idunn_widget_t * idunn_field ( const char * label,
idunn_widget_t * control,
const char * help )

a form row: a label above the control and help text below it (or NULL).

the field owns the control.

◆ idunn_field_set_error()

void idunn_field_set_error ( idunn_widget_t * field,
const char * message )

show an error: the message in red under the control, and the control's border and ring red.

NULL takes it away (the help text comes back).

◆ idunn_context_new()

idunn_context_t * idunn_context_new ( const idunn_theme_t * theme,
const char * font_dir,
const char * icon_pack )

fonts and icons for a theme.

Parameters
font_dirthe directory with inter/ and jetbrains-mono/.
icon_packthe Lucide pack, or NULL (no icons).
Returns
the context, or NULL (no fonts).

◆ idunn_context_free()

void idunn_context_free ( idunn_context_t * ctx)

◆ idunn_context_set_theme()

void idunn_context_set_theme ( idunn_context_t * ctx,
const idunn_theme_t * theme )

◆ idunn_window_offscreen()

idunn_window_t * idunn_window_offscreen ( idunn_context_t * ctx,
int32_t width,
int32_t height )

a window that draws into its own buffer, of that many pixels.

◆ idunn_window_resize()

void idunn_window_resize ( idunn_window_t * win,
int32_t width,
int32_t height )

a new size for the window's buffer (the window lays out again).

◆ idunn_window_buffer()

gfx_buffer_t * idunn_window_buffer ( const idunn_window_t * win)

◆ idunn_window_draw()

gfx_rect_t idunn_window_draw ( idunn_window_t * win)

lay out and draw what changed.

Returns
the part of the buffer that changed (empty: none).

◆ idunn_window_invalidate()

void idunn_window_invalidate ( idunn_window_t * win)

the whole window must be drawn again (after a theme change).

◆ idunn_window_pointer()

void idunn_window_pointer ( idunn_window_t * win,
idunn_pointer_t kind,
int32_t x,
int32_t y,
uint32_t mods )

the pointer moved, or the left button went down or up, at (x, y), with these modifier keys held (Shift+click extends a selection).

◆ idunn_window_scroll()

void idunn_window_scroll ( idunn_window_t * win,
int32_t x,
int32_t y,
int32_t steps )

the wheel turned over (x, y): steps, up is positive.

◆ idunn_window_paste()

void idunn_window_paste ( idunn_window_t * win,
const char * text,
size_t length )

the clipboard text a widget asked for came (from the window server).

◆ idunn_window_next_wake()

uint32_t idunn_window_next_wake ( const idunn_window_t * win)

the next time (ms) the window must be ticked for a timer, or 0 for none.

◆ idunn_window_key()

void idunn_window_key ( idunn_window_t * win,
uint16_t code,
uint32_t mods,
const char * text )

a key press (or repeat).

Parameters
codea Linux key code (KEY_ in sys/input.h).
textthe characters it types (UTF-8), or "".

◆ idunn_window_tick()

bool idunn_window_tick ( idunn_window_t * win,
uint32_t now )

the time now in ms, for transitions.

Returns
true while a transition runs (draw again in a frame).

◆ idunn_window_cursor()

uint32_t idunn_window_cursor ( const idunn_window_t * win)

the pointer shape for where the pointer is (IDUNN_CURSOR_).

◆ idunn_window_focus()

idunn_widget_t * idunn_window_focus ( const idunn_window_t * win)

the widget with the keyboard focus, or NULL.

◆ idunn_canvas()

idunn_widget_t * idunn_canvas ( const idunn_canvas_hooks_t * hooks,
void * data )

a widget the program draws itself: a terminal, a game.

it takes the keyboard (Tab too), the pointer and the wheel. it is as large as its box lets it grow, or idunn_set_size.

◆ idunn_canvas_damage()

void idunn_canvas_damage ( idunn_widget_t * canvas,
gfx_rect_t r )

draw a rect of the canvas again (canvas coordinates)

◆ idunn_canvas_update()

void idunn_canvas_update ( idunn_widget_t * canvas)

a frame soon, so the frame hook runs (new data came)

◆ idunn_canvas_move()

void idunn_canvas_move ( idunn_widget_t * canvas,
gfx_rect_t area,
int32_t dy )

in the frame hook: move the pixels of area up (dy < 0) or down; the strip that comes into view is damaged.

◆ idunn_canvas_copy()

void idunn_canvas_copy ( idunn_widget_t * canvas,
const char * text,
size_t length )

put text on the clipboard; ask for its text (an IDUNN_INPUT_PASTE comes)

◆ idunn_canvas_paste()

void idunn_canvas_paste ( idunn_widget_t * canvas)

◆ idunn_canvas_wake()

void idunn_canvas_wake ( idunn_widget_t * canvas,
uint32_t ms )

an IDUNN_INPUT_TIMER in ms (one at a time; a new call moves it)

◆ idunn_canvas_set_cursor()

void idunn_canvas_set_cursor ( idunn_widget_t * canvas,
uint32_t shape )

the pointer shape over the canvas (IDUNN_CURSOR_)

◆ idunn_set_focus()

void idunn_set_focus ( idunn_widget_t * w)

give the keyboard to a widget in a window (a canvas at the start).

◆ idunn_widget_rect()

gfx_rect_t idunn_widget_rect ( const idunn_widget_t * w)

where a widget is in its window, after layout.