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

idunn: rows and columns (a small CSS flexbox) and spacers. More...

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

Macros

#define UNIT   4

Functions

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)
bool idunn_is_column (const idunn_widget_t *w)
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_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_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_widget_t * idunn_card_box (int gap, int padding, idunn_shadow_t shadow)
 a box with the card look and another shadow (popovers: md, dialogs: window)
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_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_spacer (void)
 empty space that grows (put it between children to push them apart).
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).

Detailed Description

idunn: rows and columns (a small CSS flexbox) and spacers.

a box measures its children, gives the free space along it to the children that grow, and places them with the gap between them. across the box a child is stretched or aligned.

when a row is too narrow, the children that can shrink (text and the boxes it is in) give up room in proportion to their size, as flex-shrink does. nothing else shrinks, as in CSS, where an item is not made smaller than its content: a column that is too short overflows.

Macro Definition Documentation

◆ UNIT

#define UNIT   4

Function Documentation

◆ 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_is_column()

bool idunn_is_column ( const idunn_widget_t * w)

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

idunn_widget_t * idunn_card_box ( int gap,
int padding,
idunn_shadow_t shadow )

a box with the card look and another shadow (popovers: md, dialogs: window)

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

idunn_widget_t * idunn_spacer ( void )

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

◆ 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).