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

idunn: what floats over a window: tooltips (the primary colour, small text), popovers (a card next to a widget) and dialogs (a card in the middle of the window over the overlay colour, with buttons at the bottom right; the window behind gets no input). More...

#include "idunn_internal.h"
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

Macros

#define TIP_PAD_X   10
#define TIP_PAD_Y   5
#define TIP_GAP   6
#define POPOVER_WIDTH   288
#define POPOVER_GAP   4
#define MARGIN   28

Functions

void idunn_tooltip_show (idunn_widget_t *w)
 show w's tooltip over it
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
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)
void idunn_dialog_dismiss (idunn_window_t *win)
 close the dialog in win (Escape)

Detailed Description

idunn: what floats over a window: tooltips (the primary colour, small text), popovers (a card next to a widget) and dialogs (a card in the middle of the window over the overlay colour, with buttons at the bottom right; the window behind gets no input).

Macro Definition Documentation

◆ TIP_PAD_X

#define TIP_PAD_X   10

◆ TIP_PAD_Y

#define TIP_PAD_Y   5

◆ TIP_GAP

#define TIP_GAP   6

◆ POPOVER_WIDTH

#define POPOVER_WIDTH   288

◆ POPOVER_GAP

#define POPOVER_GAP   4

◆ MARGIN

#define MARGIN   28

Function Documentation

◆ idunn_tooltip_show()

void idunn_tooltip_show ( idunn_widget_t * w)

show w's tooltip over it

◆ 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_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_dialog_dismiss()

void idunn_dialog_dismiss ( idunn_window_t * win)

close the dialog in win (Escape)