|
ginnOS
The reference: libc, the libraries and the kernel
|
idunn: what the widget classes share (not for apps). More...
Go to the source code of this file.
Data Structures | |
| struct | idunn_event_t |
| struct | idunn_anim_t |
| a transition of one value (0 to 1) with the CSS ease-out curve. More... | |
| struct | idunn_class_t |
| struct | idunn_widget |
| struct | idunn_context |
| struct | idunn_window |
| struct | idunn_edit_t |
Macros | |
| #define | IDUNN_FOCUSABLE 0x01u |
| #define | IDUNN_INTERACTIVE 0x02u |
| #define | IDUNN_SHRINKS 0x04u |
| #define | IDUNN_TEXT_INPUT 0x08u |
| #define | IDUNN_CLIPS 0x10u |
| #define | IDUNN_TAKES_TAB 0x20u |
| #define | IDUNN_OWN_LOOK 0x40u |
| #define | IDUNN_HOVER 0x01u |
| #define | IDUNN_PRESSED 0x02u |
| #define | IDUNN_FOCUSED 0x04u |
| #define | IDUNN_DISABLED 0x08u |
| #define | IDUNN_ERROR 0x10u |
| #define | IDUNN_HIDDEN 0x20u |
| #define | IDUNN_DAMAGE_MAX 8 |
Enumerations | |
| enum | idunn_event_type_t { IDUNN_EV_CLICK , IDUNN_EV_KEY , IDUNN_EV_PRESS , IDUNN_EV_DRAG , IDUNN_EV_RELEASE , IDUNN_EV_SCROLL , IDUNN_EV_FOCUS , IDUNN_EV_BLUR , IDUNN_EV_TIMER , IDUNN_EV_PASTE , IDUNN_EV_MOTION , IDUNN_EV_MENU } |
| enum | idunn_edit_result_t { IDUNN_EDIT_IGNORED , IDUNN_EDIT_USED , IDUNN_EDIT_MOVED , IDUNN_EDIT_CHANGED } |
| enum | idunn_side_t { IDUNN_SIDE_BELOW , IDUNN_SIDE_ABOVE , IDUNN_SIDE_RIGHT } |
Functions | |
| void | idunn_window_add_damage (idunn_window_t *win, gfx_rect_t r) |
| add a rect of the window that must be drawn again | |
| int | idunn_window_draw_parts (idunn_window_t *win, gfx_rect_t parts[IDUNN_DAMAGE_MAX+1]) |
| lay out and draw what changed, part by part. | |
| void | idunn_window_move_pixels (idunn_widget_t *w, gfx_rect_t area, int32_t dy) |
| move the pixels of a rect of the window up (dy < 0) or down, as when its content scrolls: what stays in it is not drawn again, only the strip that comes into view. | |
| bragi_face_t * | idunn_face (idunn_context_t *ctx, idunn_text_t style) |
| const icon_t * | idunn_icon (idunn_context_t *ctx, const char *name, int32_t size) |
| const icon_t * | idunn_picture (idunn_context_t *ctx, const char *name, int32_t size) |
| a colour icon of the Tela set (files, folders, apps), cached | |
| idunn_widget_t * | idunn_widget_new (const idunn_class_t *cls, void *data, uint32_t flags) |
| void | idunn_measure (idunn_widget_t *w, int32_t max_width, int32_t *width, int32_t *height) |
| void | idunn_place (idunn_widget_t *w, gfx_rect_t rect) |
| void | idunn_dirty (idunn_widget_t *w) |
| void | idunn_dirty_rect (idunn_widget_t *w, gfx_rect_t rect) |
| draw a part of w again (a row of a list), with room for a ring | |
| void | idunn_relayout (idunn_widget_t *w) |
| void | idunn_set_window (idunn_widget_t *w, idunn_window_t *win) |
| bool | idunn_is_column (const idunn_widget_t *w) |
| void | idunn_window_use_buffer (idunn_window_t *win, gfx_buffer_t *buf) |
| void | idunn_window_free_widgets (idunn_window_t *win) |
| uint8_t | idunn_hover_amount (idunn_widget_t *w) |
| the hover and press looks now (0 to 255), for drawing | |
| uint8_t | idunn_press_amount (idunn_widget_t *w) |
| bool | idunn_ring_visible (const idunn_widget_t *w) |
| true when the focus ring shows | |
| void | idunn_anim_to (idunn_anim_t *a, float to, uint32_t now, uint32_t duration) |
| float | idunn_anim_value (const idunn_anim_t *a, uint32_t now) |
| bool | idunn_anim_running (const idunn_anim_t *a, uint32_t now) |
| void | idunn_draw_text (idunn_context_t *ctx, gfx_buffer_t *buf, idunn_text_t style, int32_t x, int32_t y, int32_t max_width, const char *text, gfx_color_t color) |
| a line of text in a style with the top of its line box at y; it ends with "..." if it is wider than max_width (0: any width). | |
| bool | idunn_send (idunn_widget_t *w, const idunn_event_t *ev) |
| send an event to a widget: true if it used it | |
| void | idunn_wake (idunn_widget_t *w, uint32_t at) |
| a TIMER event for w at a time (ms, as window->now); one time per widget | |
| void | idunn_copy (idunn_widget_t *w, const char *text, size_t length) |
| put text on the clipboard; ask for its text (a PASTE event comes) | |
| void | idunn_paste (idunn_widget_t *w) |
| bool | idunn_edit_set (idunn_edit_t *e, const char *text, size_t length) |
| void | idunn_edit_free (idunn_edit_t *e) |
| size_t | idunn_edit_start (const idunn_edit_t *e) |
| size_t | idunn_edit_end (const idunn_edit_t *e) |
| size_t | idunn_edit_prev (const idunn_edit_t *e, size_t pos) |
| size_t | idunn_edit_next (const idunn_edit_t *e, size_t pos) |
| size_t | idunn_edit_word_left (const idunn_edit_t *e, size_t pos) |
| size_t | idunn_edit_word_right (const idunn_edit_t *e, size_t pos) |
| void | idunn_edit_move (idunn_edit_t *e, size_t pos, bool extend) |
| void | idunn_edit_select_word (idunn_edit_t *e, size_t pos) |
| bool | idunn_edit_insert (idunn_edit_t *e, const char *text, size_t length) |
| replace the selection with text | |
| void | idunn_edit_delete (idunn_edit_t *e, bool forward, bool word) |
| delete the selection, or a character or a word before or after the caret | |
| idunn_edit_result_t | idunn_edit_key (idunn_widget_t *w, idunn_edit_t *e, const idunn_event_t *ev, bool multiline) |
| the keys of editing: arrows, Home, End, Backspace, Delete, Ctrl+A/C/X/V, typing | |
| bool | idunn_edit_paste (idunn_edit_t *e, const char *text, size_t length, bool multiline) |
| insert clipboard text (a single line keeps one line) | |
| void | idunn_option_measure (idunn_widget_t *w, int32_t control_w, int32_t control_h, const char *label, int32_t *width, int32_t *height) |
| gfx_rect_t | idunn_option_control (const idunn_widget_t *w, int32_t control_w, int32_t control_h) |
| void | idunn_option_draw_label (idunn_widget_t *w, gfx_buffer_t *buf, int32_t control_w, const char *label) |
| gfx_color_t | idunn_option_border (const idunn_theme_t *t) |
| the border of check boxes and radios (firmer than inputs in dark mode) | |
| void | idunn_reveal (idunn_widget_t *w, gfx_rect_t r) |
| scroll the views w is in so that r (in the window) can be seen: a focused widget, the current row of a list. | |
| bool | idunn_shown (const idunn_widget_t *w) |
| true if w and its parents are not hidden | |
| idunn_window_t * | idunn_popup_open (idunn_widget_t *owner, idunn_widget_t *root, gfx_rect_t anchor, idunn_side_t side, int32_t margin, bool tooltip) |
| open a popup window next to anchor (a rect in owner's window) with root in it, margin pixels of room around root for its shadow. | |
| void | idunn_popup_close (idunn_window_t *popup) |
| close a popup and the popups it has open. | |
| void | idunn_reap (idunn_context_t *ctx) |
| free the closed popups (the app loop does it before each event) | |
| void | idunn_popup_close_all (idunn_window_t *popup) |
| close a popup and the popups it came from (a chosen menu item) | |
| idunn_window_t * | idunn_menu_open (idunn_menu_t *menu, idunn_widget_t *owner, gfx_rect_t anchor, int current, void(*on_closed)(void *data), void *data) |
| open a menu next to anchor (a rect in owner's window), with item current (or -1) as the current one; on_closed (or NULL) is called when it closes. | |
| void | idunn_focus (idunn_widget_t *w) |
| give w the keyboard (without the ring) | |
| void | idunn_focus_first (idunn_widget_t *w) |
| give the keyboard to the first widget that takes it in w | |
| void | idunn_tooltip_show (idunn_widget_t *w) |
| show w's tooltip over it | |
| 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) | |
| void | idunn_dialog_dismiss (idunn_window_t *win) |
| close the dialog in win (Escape) | |
| void | idunn_draw_well (idunn_widget_t *w, gfx_buffer_t *buf) |
| the well of a text input: fill, inset shadow, border and ring (text_field.c) | |
| void | idunn_draw_shadow (const idunn_theme_t *t, gfx_buffer_t *buf, gfx_rect_t box, int32_t radius, idunn_shadow_t which) |
| all the layers of a shadow token around a round box | |
| void | idunn_draw_ring (const idunn_widget_t *w, gfx_buffer_t *buf, gfx_rect_t box, int32_t radius) |
| the 3 px focus ring around a round box | |
| int32_t | idunn_overdraw (const idunn_theme_t *theme) |
| how far drawing goes out of a widget's rect (rings and shadows) | |
| int | idunn_list_columns_at (const idunn_widget_t *list, int32_t *name_x, int32_t *row_x, int32_t *left, int32_t *right) |
| the columns of a list view, in the window (for its heads). | |
| bool | idunn_list_column_left (const idunn_widget_t *list, int column) |
| true if a column of a list is drawn at its left | |
| void | idunn_list_set_heads (idunn_widget_t *list, idunn_widget_t *heads) |
| the heads over a list (NULL: none); the list draws them again on layout | |
| void | idunn_list_heads_forget (idunn_widget_t *heads) |
| the list of these heads is freed | |
| void | idunn_draw_picture (const idunn_theme_t *t, gfx_buffer_t *buf, const icon_t *icon, int32_t x, int32_t y, uint8_t opacity) |
| draw a Tela picture. | |
idunn: what the widget classes share (not for apps).
| #define IDUNN_FOCUSABLE 0x01u |
| #define IDUNN_INTERACTIVE 0x02u |
| #define IDUNN_SHRINKS 0x04u |
| #define IDUNN_TEXT_INPUT 0x08u |
| #define IDUNN_CLIPS 0x10u |
| #define IDUNN_TAKES_TAB 0x20u |
| #define IDUNN_OWN_LOOK 0x40u |
| #define IDUNN_HOVER 0x01u |
| #define IDUNN_PRESSED 0x02u |
| #define IDUNN_FOCUSED 0x04u |
| #define IDUNN_DISABLED 0x08u |
| #define IDUNN_ERROR 0x10u |
| #define IDUNN_HIDDEN 0x20u |
| #define IDUNN_DAMAGE_MAX 8 |
| enum idunn_event_type_t |
| enum idunn_edit_result_t |
| enum idunn_side_t |
| void idunn_window_add_damage | ( | idunn_window_t * | win, |
| gfx_rect_t | r ) |
add a rect of the window that must be drawn again
| int idunn_window_draw_parts | ( | idunn_window_t * | win, |
| gfx_rect_t | parts[IDUNN_DAMAGE_MAX+1] ) |
lay out and draw what changed, part by part.
| void idunn_window_move_pixels | ( | idunn_widget_t * | w, |
| gfx_rect_t | area, | ||
| int32_t | dy ) |
move the pixels of a rect of the window up (dy < 0) or down, as when its content scrolls: what stays in it is not drawn again, only the strip that comes into view.
w is the widget the rect belongs to (its clip).
| bragi_face_t * idunn_face | ( | idunn_context_t * | ctx, |
| idunn_text_t | style ) |
| const icon_t * idunn_icon | ( | idunn_context_t * | ctx, |
| const char * | name, | ||
| int32_t | size ) |
| const icon_t * idunn_picture | ( | idunn_context_t * | ctx, |
| const char * | name, | ||
| int32_t | size ) |
a colour icon of the Tela set (files, folders, apps), cached
| idunn_widget_t * idunn_widget_new | ( | const idunn_class_t * | cls, |
| void * | data, | ||
| uint32_t | flags ) |
| void idunn_measure | ( | idunn_widget_t * | w, |
| int32_t | max_width, | ||
| int32_t * | width, | ||
| int32_t * | height ) |
| void idunn_place | ( | idunn_widget_t * | w, |
| gfx_rect_t | rect ) |
| void idunn_dirty | ( | idunn_widget_t * | w | ) |
| void idunn_dirty_rect | ( | idunn_widget_t * | w, |
| gfx_rect_t | rect ) |
draw a part of w again (a row of a list), with room for a ring
| void idunn_relayout | ( | idunn_widget_t * | w | ) |
| void idunn_set_window | ( | idunn_widget_t * | w, |
| idunn_window_t * | win ) |
| bool idunn_is_column | ( | const idunn_widget_t * | w | ) |
| void idunn_window_use_buffer | ( | idunn_window_t * | win, |
| gfx_buffer_t * | buf ) |
| void idunn_window_free_widgets | ( | idunn_window_t * | win | ) |
| uint8_t idunn_hover_amount | ( | idunn_widget_t * | w | ) |
the hover and press looks now (0 to 255), for drawing
| uint8_t idunn_press_amount | ( | idunn_widget_t * | w | ) |
| bool idunn_ring_visible | ( | const idunn_widget_t * | w | ) |
true when the focus ring shows
| void idunn_anim_to | ( | idunn_anim_t * | a, |
| float | to, | ||
| uint32_t | now, | ||
| uint32_t | duration ) |
| float idunn_anim_value | ( | const idunn_anim_t * | a, |
| uint32_t | now ) |
| bool idunn_anim_running | ( | const idunn_anim_t * | a, |
| uint32_t | now ) |
| void idunn_draw_text | ( | idunn_context_t * | ctx, |
| gfx_buffer_t * | buf, | ||
| idunn_text_t | style, | ||
| int32_t | x, | ||
| int32_t | y, | ||
| int32_t | max_width, | ||
| const char * | text, | ||
| gfx_color_t | color ) |
a line of text in a style with the top of its line box at y; it ends with "..." if it is wider than max_width (0: any width).
| bool idunn_send | ( | idunn_widget_t * | w, |
| const idunn_event_t * | ev ) |
send an event to a widget: true if it used it
| void idunn_wake | ( | idunn_widget_t * | w, |
| uint32_t | at ) |
a TIMER event for w at a time (ms, as window->now); one time per widget
| void idunn_copy | ( | idunn_widget_t * | w, |
| const char * | text, | ||
| size_t | length ) |
put text on the clipboard; ask for its text (a PASTE event comes)
| void idunn_paste | ( | idunn_widget_t * | w | ) |
| bool idunn_edit_set | ( | idunn_edit_t * | e, |
| const char * | text, | ||
| size_t | length ) |
| void idunn_edit_free | ( | idunn_edit_t * | e | ) |
| size_t idunn_edit_start | ( | const idunn_edit_t * | e | ) |
| size_t idunn_edit_end | ( | const idunn_edit_t * | e | ) |
| size_t idunn_edit_prev | ( | const idunn_edit_t * | e, |
| size_t | pos ) |
| size_t idunn_edit_next | ( | const idunn_edit_t * | e, |
| size_t | pos ) |
| size_t idunn_edit_word_left | ( | const idunn_edit_t * | e, |
| size_t | pos ) |
| size_t idunn_edit_word_right | ( | const idunn_edit_t * | e, |
| size_t | pos ) |
| void idunn_edit_move | ( | idunn_edit_t * | e, |
| size_t | pos, | ||
| bool | extend ) |
| void idunn_edit_select_word | ( | idunn_edit_t * | e, |
| size_t | pos ) |
| bool idunn_edit_insert | ( | idunn_edit_t * | e, |
| const char * | text, | ||
| size_t | length ) |
replace the selection with text
| void idunn_edit_delete | ( | idunn_edit_t * | e, |
| bool | forward, | ||
| bool | word ) |
delete the selection, or a character or a word before or after the caret
| idunn_edit_result_t idunn_edit_key | ( | idunn_widget_t * | w, |
| idunn_edit_t * | e, | ||
| const idunn_event_t * | ev, | ||
| bool | multiline ) |
the keys of editing: arrows, Home, End, Backspace, Delete, Ctrl+A/C/X/V, typing
| bool idunn_edit_paste | ( | idunn_edit_t * | e, |
| const char * | text, | ||
| size_t | length, | ||
| bool | multiline ) |
insert clipboard text (a single line keeps one line)
| void idunn_option_measure | ( | idunn_widget_t * | w, |
| int32_t | control_w, | ||
| int32_t | control_h, | ||
| const char * | label, | ||
| int32_t * | width, | ||
| int32_t * | height ) |
| gfx_rect_t idunn_option_control | ( | const idunn_widget_t * | w, |
| int32_t | control_w, | ||
| int32_t | control_h ) |
| void idunn_option_draw_label | ( | idunn_widget_t * | w, |
| gfx_buffer_t * | buf, | ||
| int32_t | control_w, | ||
| const char * | label ) |
| gfx_color_t idunn_option_border | ( | const idunn_theme_t * | t | ) |
the border of check boxes and radios (firmer than inputs in dark mode)
| void idunn_reveal | ( | idunn_widget_t * | w, |
| gfx_rect_t | r ) |
scroll the views w is in so that r (in the window) can be seen: a focused widget, the current row of a list.
| bool idunn_shown | ( | const idunn_widget_t * | w | ) |
true if w and its parents are not hidden
| idunn_window_t * idunn_popup_open | ( | idunn_widget_t * | owner, |
| idunn_widget_t * | root, | ||
| gfx_rect_t | anchor, | ||
| idunn_side_t | side, | ||
| int32_t | margin, | ||
| bool | tooltip ) |
open a popup window next to anchor (a rect in owner's window) with root in it, margin pixels of room around root for its shadow.
a popup that owner's window has open already is closed first.
| void idunn_popup_close | ( | idunn_window_t * | popup | ) |
close a popup and the popups it has open.
it is freed by idunn_reap: the event that closed it can still be using it.
| void idunn_reap | ( | idunn_context_t * | ctx | ) |
free the closed popups (the app loop does it before each event)
| void idunn_popup_close_all | ( | idunn_window_t * | popup | ) |
close a popup and the popups it came from (a chosen menu item)
| idunn_window_t * idunn_menu_open | ( | idunn_menu_t * | menu, |
| idunn_widget_t * | owner, | ||
| gfx_rect_t | anchor, | ||
| int | current, | ||
| void(* | on_closed )(void *data), | ||
| void * | data ) |
open a menu next to anchor (a rect in owner's window), with item current (or -1) as the current one; on_closed (or NULL) is called when it closes.
| void idunn_focus | ( | idunn_widget_t * | w | ) |
give w the keyboard (without the ring)
| void idunn_focus_first | ( | idunn_widget_t * | w | ) |
give the keyboard to the first widget that takes it in w
| void idunn_tooltip_show | ( | idunn_widget_t * | w | ) |
show w's tooltip over it
| 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)
| void idunn_dialog_dismiss | ( | idunn_window_t * | win | ) |
close the dialog in win (Escape)
| void idunn_draw_well | ( | idunn_widget_t * | w, |
| gfx_buffer_t * | buf ) |
the well of a text input: fill, inset shadow, border and ring (text_field.c)
| void idunn_draw_shadow | ( | const idunn_theme_t * | t, |
| gfx_buffer_t * | buf, | ||
| gfx_rect_t | box, | ||
| int32_t | radius, | ||
| idunn_shadow_t | which ) |
all the layers of a shadow token around a round box
| void idunn_draw_ring | ( | const idunn_widget_t * | w, |
| gfx_buffer_t * | buf, | ||
| gfx_rect_t | box, | ||
| int32_t | radius ) |
the 3 px focus ring around a round box
| int32_t idunn_overdraw | ( | const idunn_theme_t * | theme | ) |
how far drawing goes out of a widget's rect (rings and shadows)
| int idunn_list_columns_at | ( | const idunn_widget_t * | list, |
| int32_t * | name_x, | ||
| int32_t * | row_x, | ||
| int32_t * | left, | ||
| int32_t * | right ) |
the columns of a list view, in the window (for its heads).
| name_x | where the names start. |
| row_x | where the rows start. |
| left,right | the edges of each column (COLUMNS_MAX at most). |
| bool idunn_list_column_left | ( | const idunn_widget_t * | list, |
| int | column ) |
true if a column of a list is drawn at its left
| void idunn_list_set_heads | ( | idunn_widget_t * | list, |
| idunn_widget_t * | heads ) |
the heads over a list (NULL: none); the list draws them again on layout
| void idunn_list_heads_forget | ( | idunn_widget_t * | heads | ) |
the list of these heads is freed
| void idunn_draw_picture | ( | const idunn_theme_t * | t, |
| gfx_buffer_t * | buf, | ||
| const icon_t * | icon, | ||
| int32_t | x, | ||
| int32_t | y, | ||
| uint8_t | opacity ) |
draw a Tela picture.
in the light theme a faint edge of its own shape goes under it, so a white page (a text file) shows on a white ground.