The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
idunn_internal.h
Go to the documentation of this file.
1#pragma once
2
3/**
4 * @file idunn_internal.h
5 * @brief idunn: what the widget classes share (not for apps).
6 */
7
8#include "idunn.h"
9
10#include <bragi.h>
11#include <icon.h>
12
13// widget flags (what it can do)
14#define IDUNN_FOCUSABLE 0x01u // Tab and a click give it the keyboard
15#define IDUNN_INTERACTIVE 0x02u // it gets hover, presses and clicks
16#define IDUNN_SHRINKS 0x04u // it can be narrower than it wants (text with "...")
17#define IDUNN_TEXT_INPUT 0x08u // it takes typing: the ring shows after a click too
18#define IDUNN_CLIPS 0x10u // its children are drawn and hit only inside its rect
19#define IDUNN_TAKES_TAB 0x20u // Tab goes to it, not to the next widget (a terminal)
20#define IDUNN_OWN_LOOK 0x40u // it draws its own hover, press and focus (a canvas)
21
22// widget states
23#define IDUNN_HOVER 0x01u
24#define IDUNN_PRESSED 0x02u
25#define IDUNN_FOCUSED 0x04u
26#define IDUNN_DISABLED 0x08u
27#define IDUNN_ERROR 0x10u // a field with a wrong value
28#define IDUNN_HIDDEN 0x20u // not drawn, not laid out in a box, no input
29
30#define IDUNN_DAMAGE_MAX 8 // damaged rects a window keeps apart
31
32/** add a rect of the window that must be drawn again */
34
35/**
36 * lay out and draw what changed, part by part.
37 * @return how many parts were drawn (in parts).
38 */
40
41/**
42 * move the pixels of a rect of the window up (dy < 0) or down, as when its
43 * content scrolls: what stays in it is not drawn again, only the strip
44 * that comes into view. w is the widget the rect belongs to (its clip).
45 */
47
48typedef enum
49{
50 IDUNN_EV_CLICK, // a press and a release on the widget (or Enter or Space)
51 IDUNN_EV_KEY, // a key press for the focused widget (and then its parents)
52 IDUNN_EV_PRESS, // the left button went down on it: x, y, mods, clicks
53 IDUNN_EV_DRAG, // the pointer moved with the button down after a press on it: x, y
54 IDUNN_EV_RELEASE, // the button went up after a press on it: x, y
55 IDUNN_EV_SCROLL, // the wheel over it (then its parents): steps, up is positive
56 IDUNN_EV_FOCUS, // it got the keyboard
57 IDUNN_EV_BLUR, // it lost the keyboard
58 IDUNN_EV_TIMER, // the time it asked for with idunn_wake came
59 IDUNN_EV_PASTE, // the clipboard text it asked for with idunn_paste: text, length
60 IDUNN_EV_MOTION, // the pointer moved over it (no button down): x, y
61 IDUNN_EV_MENU, // the right button went down on it (then its parents): x, y, mods
63
64typedef struct
65{
67 uint16_t code; // KEY: the Linux key code
68 uint32_t mods; // KEY, PRESS: IDUNN_MOD_
69 const char *text; // KEY: the characters it types (UTF-8), or ""; PASTE: the text
70 size_t length; // PASTE: the bytes of text
71 int32_t x; // PRESS, DRAG, RELEASE: the pointer in the window
73 int clicks; // PRESS: 1, 2 (a double click) or 3
74 int32_t steps; // SCROLL
76
77/**
78 * a transition of one value (0 to 1) with the CSS ease-out curve.
79 */
80typedef struct
81{
82 float from;
83 float to;
85 uint32_t duration; // ms; 0: no transition
87
88typedef struct
89{
90 const char *name;
91 /** the size it wants, in pixels; max_width is the width there is (for text that wraps) */
92 void (*measure)(idunn_widget_t *w, int32_t max_width, int32_t *width, int32_t *height);
93 /** place the children in w->rect (boxes) */
95 /** draw in w->rect; the children are drawn after it */
96 void (*draw)(idunn_widget_t *w, gfx_buffer_t *buf);
97 /** draw over the children (a scroll bar), in the same clip as them */
99 /** @return true if the widget used the event */
101 /**
102 * scroll so that r (a rect of a widget in w) can be seen.
103 * @return where r is after the scroll.
104 */
106 /**
107 * the part of w that looks different when the pointer comes or goes
108 * (optional: all of w). a large widget that shows hover in a small
109 * part (a scroll bar, a list row) is then not drawn again whole.
110 */
112 /**
113 * before each frame is drawn (optional): move things that glide (a
114 * scroll view), when the pixels in the buffer can still be moved
115 */
117 /** free w->data */
118 void (*free)(idunn_widget_t *w);
120
122{
124 idunn_window_t *window; // NULL until the tree is in a window
129 gfx_rect_t rect; // in the window, after layout
132 uint32_t cursor; // IDUNN_CURSOR_ over it
133 int grow; // a share of the free space in its box (0: none)
134 int32_t width; // a size it must have, in design pixels (0: its own)
136 idunn_anim_t hover; // 0 to 1: the hover look
137 idunn_anim_t press; // 0 to 1: the pressed look
138 char *tooltip; // shown over it after a while under the pointer, or NULL
139 idunn_callback_t on_menu; // a right click on it that no child used (idunn_on_menu)
141 idunn_callback_t on_middle; // a middle click on it (idunn_on_middle_click)
142 idunn_widget_key_t on_key; // keys for it before it gets them (idunn_on_key)
143 void *key_data;
145 void *data; // the class's own state
146};
147
149{
151 bragi_font_t *fonts[4]; // Inter 400, 500, 600 and JetBrains Mono
153 icon_set_t *icons; // Lucide
154 icon_set_t *pictures; // Tela (colour), opened when first needed
156 char icon_dir[200]; // where the packs are
157 struct icon_entry *icon_cache;
158 idunn_window_t *dead; // closed popups, to be freed
159 idunn_widget_t **dead_widgets; // closed dialogs, to be freed
162};
163
165{
170 idunn_widget_t *hover; // the interactive widget under the pointer
171 idunn_widget_t *pressed; // from a press until the release
172 idunn_widget_t *focus; // it gets the keys
173 bool focus_visible; // the focus ring shows (after a key, not a click)
175 bool laying_out; // in layout(): a widget that moves or changes size is drawn again
176 bool animating; // a transition runs: draw the next frame too
177 gfx_rect_t damage; // what must be drawn again: all of it
178 gfx_rect_t damage_list[IDUNN_DAMAGE_MAX]; // and in parts (far apart ones stay apart)
180 gfx_rect_t moved; // pixels moved in the buffer: not drawn again, but sent
181 uint32_t now; // ms, for transitions
182 uint32_t cursor; // the pointer shape now
183
184 // a double click: the last press
189 // the last right press, where a context menu opens
192
193 // keys no widget used (idunn_window_on_key)
196
197 // the close button (idunn_window_on_close)
198 bool (*on_close)(idunn_window_t *win, void *data);
200
201 // times widgets asked to be woken at (idunn_wake)
202 struct
203 {
205 uint32_t at;
206 } timers[8];
207
208 // the clipboard: the window server's (app.c sets these), or a string
209 // of the window's own
210 void (*clipboard_set)(idunn_window_t *win, const char *text, size_t length);
215
216 // a tooltip waits to show over this widget
219 uint32_t tip_closed; // when the last tooltip went (the next comes at once)
220
221 // a dialog (dialog.c): over the window, it gets all the input
223 idunn_widget_t *modal_return; // the focus before it
224
225 // popups (popup.c): a window has at most one popup open (a menu, and
226 // the menu its sub-menu); a popup has the window it came from
229 bool transparent; // a popup: see-through outside its card
230 const gfx_buffer_t *backdrop; // a screen window: its ground (idunn_screen_window_new)
231 int32_t margin; // a popup: room for the shadow around the root
232 gfx_rect_t anchor; // a popup: the rect in the opener it is next to
233 int side; // IDUNN_SIDE_
235 bool dead; // closed: freed by idunn_reap, after the event it came from
237 void (*closed)(idunn_window_t *popup); // before a popup goes away
239 // make, place and free popups: heimdall's in an app, offscreen ones in tests
240 idunn_window_t *(*popup_new)(idunn_window_t *win, int32_t width, int32_t height, bool tooltip);
243
244 // for app.c
246 void *heim;
248};
249
250// the context
252const icon_t *idunn_icon(idunn_context_t *ctx, const char *name, int32_t size);
253/** a colour icon of the Tela set (files, folders, apps), cached */
254const icon_t *idunn_picture(idunn_context_t *ctx, const char *name, int32_t size);
255
256static inline idunn_context_t *idunn_ctx(const idunn_widget_t *w)
257{
258 return w->window->ctx;
259}
260
261static inline const idunn_theme_t *idunn_theme(const idunn_widget_t *w)
262{
263 return &w->window->ctx->theme;
264}
265
266// widgets
268void idunn_measure(idunn_widget_t *w, int32_t max_width, int32_t *width, int32_t *height);
271/** draw a part of w again (a row of a list), with room for a ring */
275bool idunn_is_column(const idunn_widget_t *w);
276
277// windows (for app.c)
280
281/** the hover and press looks now (0 to 255), for drawing */
284/** true when the focus ring shows */
286
287void idunn_anim_to(idunn_anim_t *a, float to, uint32_t now, uint32_t duration);
288float idunn_anim_value(const idunn_anim_t *a, uint32_t now);
289bool idunn_anim_running(const idunn_anim_t *a, uint32_t now);
290
291// drawing
292
293/**
294 * a line of text in a style with the top of its line box at y; it ends
295 * with "..." if it is wider than max_width (0: any width).
296 */
298 int32_t y, int32_t max_width, const char *text, gfx_color_t color);
299
300/** send an event to a widget: true if it used it */
301bool idunn_send(idunn_widget_t *w, const idunn_event_t *ev);
302
303/** a TIMER event for w at a time (ms, as window->now); one time per widget */
305
306/** put text on the clipboard; ask for its text (a PASTE event comes) */
307void idunn_copy(idunn_widget_t *w, const char *text, size_t length);
309
310// editable text (text_edit.c)
311
312typedef struct
313{
314 char *text; // zero-terminated
315 size_t length;
316 size_t capacity;
317 size_t caret; // byte offsets
318 size_t anchor; // the other end of the selection
320
321typedef enum
322{
323 IDUNN_EDIT_IGNORED, // not a key for editing
324 IDUNN_EDIT_USED, // used, nothing changed (a copy)
325 IDUNN_EDIT_MOVED, // the caret or the selection moved
326 IDUNN_EDIT_CHANGED, // the text changed
328
329bool idunn_edit_set(idunn_edit_t *e, const char *text, size_t length);
331size_t idunn_edit_start(const idunn_edit_t *e);
332size_t idunn_edit_end(const idunn_edit_t *e);
333size_t idunn_edit_prev(const idunn_edit_t *e, size_t pos);
334size_t idunn_edit_next(const idunn_edit_t *e, size_t pos);
335size_t idunn_edit_word_left(const idunn_edit_t *e, size_t pos);
336size_t idunn_edit_word_right(const idunn_edit_t *e, size_t pos);
337void idunn_edit_move(idunn_edit_t *e, size_t pos, bool extend);
338void idunn_edit_select_word(idunn_edit_t *e, size_t pos);
339/** replace the selection with text */
340bool idunn_edit_insert(idunn_edit_t *e, const char *text, size_t length);
341/** delete the selection, or a character or a word before or after the caret */
342void idunn_edit_delete(idunn_edit_t *e, bool forward, bool word);
343/** the keys of editing: arrows, Home, End, Backspace, Delete, Ctrl+A/C/X/V, typing */
345 bool multiline);
346/** insert clipboard text (a single line keeps one line) */
347bool idunn_edit_paste(idunn_edit_t *e, const char *text, size_t length, bool multiline);
348
349// options: a small control with a label to its right (option.c)
350void idunn_option_measure(idunn_widget_t *w, int32_t control_w, int32_t control_h,
351 const char *label, int32_t *width, int32_t *height);
352gfx_rect_t idunn_option_control(const idunn_widget_t *w, int32_t control_w, int32_t control_h);
354 const char *label);
355/** the border of check boxes and radios (firmer than inputs in dark mode) */
357
358/**
359 * scroll the views w is in so that r (in the window) can be seen: a
360 * focused widget, the current row of a list.
361 */
363
364/** true if w and its parents are not hidden */
365bool idunn_shown(const idunn_widget_t *w);
366
367// popups (popup.c)
368typedef enum
369{
370 IDUNN_SIDE_BELOW, // as the HEIM_SIDE_ values
374
375/**
376 * open a popup window next to anchor (a rect in owner's window) with root
377 * in it, margin pixels of room around root for its shadow. a popup that
378 * owner's window has open already is closed first.
379 * @return the popup, or NULL.
380 */
382 idunn_side_t side, int32_t margin, bool tooltip);
383/**
384 * close a popup and the popups it has open. it is freed by idunn_reap:
385 * the event that closed it can still be using it.
386 */
388/** free the closed popups (the app loop does it before each event) */
389void idunn_reap(idunn_context_t *ctx);
390/** close a popup and the popups it came from (a chosen menu item) */
392/**
393 * open a menu next to anchor (a rect in owner's window), with item current
394 * (or -1) as the current one; on_closed (or NULL) is called when it closes.
395 */
397 int current, void (*on_closed)(void *data), void *data);
398
399/** give w the keyboard (without the ring) */
401/** give the keyboard to the first widget that takes it in w */
403
404
405// floating.c
406/** show w's tooltip over it */
408/** a box with the card look and another shadow (popovers: md, dialogs: window) */
409idunn_widget_t *idunn_card_box(int gap, int padding, idunn_shadow_t shadow);
410/** close the dialog in win (Escape) */
412
413/** the well of a text input: fill, inset shadow, border and ring (text_field.c) */
415
416/** all the layers of a shadow token around a round box */
417void idunn_draw_shadow(const idunn_theme_t *t, gfx_buffer_t *buf, gfx_rect_t box, int32_t radius,
418 idunn_shadow_t which);
419
420/** the 3 px focus ring around a round box */
421void idunn_draw_ring(const idunn_widget_t *w, gfx_buffer_t *buf, gfx_rect_t box, int32_t radius);
422
423/** how far drawing goes out of a widget's rect (rings and shadows) */
425
426/**
427 * the columns of a list view, in the window (for its heads).
428 * @param name_x where the names start.
429 * @param row_x where the rows start.
430 * @param left, right the edges of each column (COLUMNS_MAX at most).
431 * @return the column count (0 for a grid).
432 */
433int idunn_list_columns_at(const idunn_widget_t *list, int32_t *name_x, int32_t *row_x,
434 int32_t *left, int32_t *right);
435/** true if a column of a list is drawn at its left */
436bool idunn_list_column_left(const idunn_widget_t *list, int column);
437/** the heads over a list (NULL: none); the list draws them again on layout */
439/** the list of these heads is freed */
441
442/**
443 * draw a Tela picture. in the light theme a faint edge of its own shape
444 * goes under it, so a white page (a text file) shows on a white ground.
445 */
446void idunn_draw_picture(const idunn_theme_t *t, gfx_buffer_t *buf, const icon_t *icon,
447 int32_t x, int32_t y, uint8_t opacity);
bragi: TrueType text for libgfx buffers.
struct bragi_face bragi_face_t
Definition bragi.h:26
struct bragi_font bragi_font_t
Definition bragi.h:25
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
Definition context.c:140
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
Definition context.c:185
bragi_face_t * idunn_face(idunn_context_t *ctx, idunn_text_t style)
Definition context.c:98
const icon_t * idunn_icon(idunn_context_t *ctx, const char *name, int32_t size)
Definition context.c:135
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 m...
Definition context.c:152
int32_t idunn_overdraw(const idunn_theme_t *theme)
how far drawing goes out of a widget's rect (rings and shadows)
Definition context.c:180
void idunn_tooltip_show(idunn_widget_t *w)
show w's tooltip over it
Definition floating.c:64
void idunn_dialog_dismiss(idunn_window_t *win)
close the dialog in win (Escape)
Definition floating.c:286
uint32_t gfx_color_t
a premultiplied ARGB colour, 0xAARRGGBB.
Definition gfx.h:30
icons from the icon packs in /usr/share/icons.
struct icon_set icon_set_t
Definition icon.h:24
uint8_t flags
Definition idt.c:3
idunn: the widget toolkit of ginnOS.
void(*) idunn_callback_t(idunn_widget_t *widget, void *data)
Definition idunn.h:39
struct idunn_app idunn_app_t
Definition idunn.h:34
struct idunn_menu idunn_menu_t
a menu: items the app adds, shown in a popup by idunn_menu_popup
Definition idunn.h:623
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.
Definition idunn.h:182
struct idunn_widget idunn_widget_t
Definition idunn.h:37
struct idunn_window idunn_window_t
Definition idunn.h:36
struct idunn_context idunn_context_t
Definition idunn.h:35
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.
Definition idunn.h:174
idunn_widget_t * idunn_widget_new(const idunn_class_t *cls, void *data, uint32_t flags)
Definition widget.c:12
void idunn_edit_select_word(idunn_edit_t *e, size_t pos)
Definition text_edit.c:102
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
Definition window.c:364
void idunn_focus_first(idunn_widget_t *w)
give the keyboard to the first widget that takes it in w
Definition window.c:801
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 ...
Definition widget.c:289
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)
Definition text_edit.c:234
bool idunn_shown(const idunn_widget_t *w)
true if w and its parents are not hidden
Definition widget.c:279
size_t idunn_edit_end(const idunn_edit_t *e)
Definition text_edit.c:52
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)
Definition text_field.c:193
uint8_t idunn_press_amount(idunn_widget_t *w)
Definition widget.c:330
uint8_t idunn_hover_amount(idunn_widget_t *w)
the hover and press looks now (0 to 255), for drawing
Definition widget.c:325
void idunn_paste(idunn_widget_t *w)
Definition window.c:407
size_t idunn_edit_next(const idunn_edit_t *e, size_t pos)
Definition text_edit.c:67
float idunn_anim_value(const idunn_anim_t *a, uint32_t now)
Definition widget.c:343
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
Definition list.c:1062
void idunn_edit_free(idunn_edit_t *e)
Definition text_edit.c:41
bool idunn_edit_insert(idunn_edit_t *e, const char *text, size_t length)
replace the selection with text
Definition text_edit.c:118
bool idunn_edit_set(idunn_edit_t *e, const char *text, size_t length)
Definition text_edit.c:26
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
Definition text_edit.c:141
void idunn_set_window(idunn_widget_t *w, idunn_window_t *win)
Definition widget.c:138
void idunn_focus(idunn_widget_t *w)
give w the keyboard (without the ring)
Definition window.c:775
bool idunn_is_column(const idunn_widget_t *w)
Definition layout.c:279
void idunn_reap(idunn_context_t *ctx)
free the closed popups (the app loop does it before each event)
Definition popup.c:88
void idunn_relayout(idunn_widget_t *w)
Definition widget.c:298
size_t idunn_edit_start(const idunn_edit_t *e)
Definition text_edit.c:47
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
Definition text_edit.c:153
void idunn_option_draw_label(idunn_widget_t *w, gfx_buffer_t *buf, int32_t control_w, const char *label)
Definition option.c:37
void idunn_measure(idunn_widget_t *w, int32_t max_width, int32_t *width, int32_t *height)
Definition widget.c:195
bool idunn_ring_visible(const idunn_widget_t *w)
true when the focus ring shows
Definition widget.c:306
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).
Definition list.c:1024
size_t idunn_edit_word_left(const idunn_edit_t *e, size_t pos)
Definition text_edit.c:77
size_t idunn_edit_word_right(const idunn_edit_t *e, size_t pos)
Definition text_edit.c:86
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)
Definition window.c:387
void idunn_place(idunn_widget_t *w, gfx_rect_t rect)
Definition widget.c:208
void idunn_dirty(idunn_widget_t *w)
Definition widget.c:225
gfx_rect_t idunn_option_control(const idunn_widget_t *w, int32_t control_w, int32_t control_h)
Definition option.c:29
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.
Definition window.c:269
#define IDUNN_DAMAGE_MAX
Definition idunn_internal.h:30
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 ...
Definition window.c:218
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; ...
Definition menu.c:535
idunn_edit_result_t
Definition idunn_internal.h:322
@ IDUNN_EDIT_IGNORED
Definition idunn_internal.h:323
@ IDUNN_EDIT_CHANGED
Definition idunn_internal.h:326
@ IDUNN_EDIT_USED
Definition idunn_internal.h:324
@ IDUNN_EDIT_MOVED
Definition idunn_internal.h:325
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 ...
Definition popup.c:29
void idunn_window_free_widgets(idunn_window_t *win)
Definition window.c:34
void idunn_popup_close(idunn_window_t *popup)
close a popup and the popups it has open.
Definition popup.c:72
bool idunn_send(idunn_widget_t *w, const idunn_event_t *ev)
send an event to a widget: true if it used it
Definition window.c:568
void idunn_window_use_buffer(idunn_window_t *win, gfx_buffer_t *buf)
Definition window.c:61
void idunn_edit_move(idunn_edit_t *e, size_t pos, bool extend)
Definition text_edit.c:95
void idunn_list_heads_forget(idunn_widget_t *heads)
the list of these heads is freed
Definition list_heads.c:201
bool idunn_list_column_left(const idunn_widget_t *list, int column)
true if a column of a list is drawn at its left
Definition list.c:1047
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
Definition option.c:56
size_t idunn_edit_prev(const idunn_edit_t *e, size_t pos)
Definition text_edit.c:57
void idunn_popup_close_all(idunn_window_t *popup)
close a popup and the popups it came from (a chosen menu item)
Definition popup.c:102
bool idunn_anim_running(const idunn_anim_t *a, uint32_t now)
Definition widget.c:353
void idunn_anim_to(idunn_anim_t *a, float to, uint32_t now, uint32_t duration)
Definition widget.c:335
gfx_color_t idunn_option_border(const idunn_theme_t *t)
the border of check boxes and radios (firmer than inputs in dark mode)
Definition option.c:50
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)
Definition layout.c:323
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
Definition widget.c:230
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.
Definition widget.c:382
idunn_side_t
Definition idunn_internal.h:369
@ IDUNN_SIDE_BELOW
Definition idunn_internal.h:370
@ IDUNN_SIDE_ABOVE
Definition idunn_internal.h:371
@ IDUNN_SIDE_RIGHT
Definition idunn_internal.h:372
void idunn_window_add_damage(idunn_window_t *win, gfx_rect_t r)
add a rect of the window that must be drawn again
Definition window.c:95
idunn_event_type_t
Definition idunn_internal.h:49
@ IDUNN_EV_TIMER
Definition idunn_internal.h:58
@ IDUNN_EV_MOTION
Definition idunn_internal.h:60
@ IDUNN_EV_KEY
Definition idunn_internal.h:51
@ IDUNN_EV_DRAG
Definition idunn_internal.h:53
@ IDUNN_EV_BLUR
Definition idunn_internal.h:57
@ IDUNN_EV_FOCUS
Definition idunn_internal.h:56
@ IDUNN_EV_PASTE
Definition idunn_internal.h:59
@ IDUNN_EV_RELEASE
Definition idunn_internal.h:54
@ IDUNN_EV_CLICK
Definition idunn_internal.h:50
@ IDUNN_EV_MENU
Definition idunn_internal.h:61
@ IDUNN_EV_SCROLL
Definition idunn_internal.h:55
@ IDUNN_EV_PRESS
Definition idunn_internal.h:52
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)
Definition option.c:12
idunn_shadow_t
Definition idunn_theme.h:86
idunn_text_t
Definition idunn_theme.h:63
@ IDUNN_TEXT_COUNT
Definition idunn_theme.h:73
unsigned int uint32_t
Definition fb.h:17
unsigned char uint8_t
Definition fb.h:18
unsigned short uint16_t
Definition stdint.h:13
int int32_t
Definition stdint.h:14
#define bool
Definition stdbool.h:8
Definition gfx.h:41
Definition gfx.h:33
Definition icon.h:27
a transition of one value (0 to 1) with the CSS ease-out curve.
Definition idunn_internal.h:81
uint32_t duration
Definition idunn_internal.h:85
uint32_t start
Definition idunn_internal.h:84
float to
Definition idunn_internal.h:83
float from
Definition idunn_internal.h:82
Definition idunn_internal.h:89
void(*) measure(idunn_widget_t *w, int32_t max_width, int32_t *width, int32_t *height)
the size it wants, in pixels; max_width is the width there is (for text that wraps)
Definition idunn_internal.h:92
bool(*) event(idunn_widget_t *w, const idunn_event_t *ev)
Definition idunn_internal.h:100
void(*) frame(idunn_widget_t *w)
before each frame is drawn (optional): move things that glide (a scroll view), when the pixels in the...
Definition idunn_internal.h:116
void(*) layout(idunn_widget_t *w)
place the children in w->rect (boxes)
Definition idunn_internal.h:94
gfx_rect_t(*) hover_area(idunn_widget_t *w)
the part of w that looks different when the pointer comes or goes (optional: all of w).
Definition idunn_internal.h:111
void(*) free(idunn_widget_t *w)
free w->data
Definition idunn_internal.h:118
void(*) draw(idunn_widget_t *w, gfx_buffer_t *buf)
draw in w->rect; the children are drawn after it
Definition idunn_internal.h:96
gfx_rect_t(*) reveal(idunn_widget_t *w, gfx_rect_t r)
scroll so that r (a rect of a widget in w) can be seen.
Definition idunn_internal.h:105
const char * name
Definition idunn_internal.h:90
void(*) draw_over(idunn_widget_t *w, gfx_buffer_t *buf)
draw over the children (a scroll bar), in the same clip as them
Definition idunn_internal.h:98
Definition idunn_internal.h:149
bragi_font_t * fonts[4]
Definition idunn_internal.h:151
bragi_face_t * faces[IDUNN_TEXT_COUNT]
Definition idunn_internal.h:152
idunn_widget_t ** dead_widgets
Definition idunn_internal.h:159
idunn_window_t * dead
Definition idunn_internal.h:158
int dead_capacity
Definition idunn_internal.h:161
icon_set_t * pictures
Definition idunn_internal.h:154
icon_set_t * icons
Definition idunn_internal.h:153
struct icon_entry * icon_cache
Definition idunn_internal.h:157
char icon_dir[200]
Definition idunn_internal.h:156
idunn_theme_t theme
Definition idunn_internal.h:150
int dead_count
Definition idunn_internal.h:160
bool pictures_tried
Definition idunn_internal.h:155
Definition idunn_internal.h:313
size_t capacity
Definition idunn_internal.h:316
char * text
Definition idunn_internal.h:314
size_t length
Definition idunn_internal.h:315
size_t anchor
Definition idunn_internal.h:318
size_t caret
Definition idunn_internal.h:317
Definition idunn_internal.h:65
int32_t x
Definition idunn_internal.h:71
int32_t y
Definition idunn_internal.h:72
size_t length
Definition idunn_internal.h:70
int32_t steps
Definition idunn_internal.h:74
int clicks
Definition idunn_internal.h:73
uint16_t code
Definition idunn_internal.h:67
uint32_t mods
Definition idunn_internal.h:68
idunn_event_type_t type
Definition idunn_internal.h:66
const char * text
Definition idunn_internal.h:69
Definition idunn_theme.h:96
Definition idunn_internal.h:122
char * tooltip
Definition idunn_internal.h:138
int32_t height
Definition idunn_internal.h:135
idunn_anim_t press
Definition idunn_internal.h:137
idunn_widget_t ** children
Definition idunn_internal.h:126
idunn_window_t * window
Definition idunn_internal.h:124
void * key_data
Definition idunn_internal.h:143
const idunn_class_t * cls
Definition idunn_internal.h:123
int32_t width
Definition idunn_internal.h:134
uint32_t flags
Definition idunn_internal.h:130
void * data
Definition idunn_internal.h:145
idunn_callback_t on_middle
Definition idunn_internal.h:141
uint32_t state
Definition idunn_internal.h:131
idunn_anim_t hover
Definition idunn_internal.h:136
uint32_t cursor
Definition idunn_internal.h:132
idunn_callback_t on_menu
Definition idunn_internal.h:139
void * middle_data
Definition idunn_internal.h:144
idunn_widget_t * parent
Definition idunn_internal.h:125
void * menu_data
Definition idunn_internal.h:140
int grow
Definition idunn_internal.h:133
int child_capacity
Definition idunn_internal.h:128
int child_count
Definition idunn_internal.h:127
gfx_rect_t rect
Definition idunn_internal.h:129
idunn_widget_key_t on_key
Definition idunn_internal.h:142
Definition idunn_internal.h:165
bool(*) on_close(idunn_window_t *win, void *data)
Definition idunn_internal.h:198
char * clipboard
Definition idunn_internal.h:212
void(*) closed(idunn_window_t *popup)
Definition idunn_internal.h:237
const gfx_buffer_t * backdrop
Definition idunn_internal.h:230
idunn_widget_t * hover
Definition idunn_internal.h:170
bool tooltip
Definition idunn_internal.h:234
idunn_widget_t * root
Definition idunn_internal.h:169
void * on_key_data
Definition idunn_internal.h:195
void * heim
Definition idunn_internal.h:246
bool needs_layout
Definition idunn_internal.h:174
bool laying_out
Definition idunn_internal.h:175
int clicks
Definition idunn_internal.h:188
void(*) clipboard_get(idunn_window_t *win)
Definition idunn_internal.h:211
int32_t margin
Definition idunn_internal.h:231
void(*) popup_place(idunn_window_t *popup)
Definition idunn_internal.h:241
idunn_widget_t * focus
Definition idunn_internal.h:172
uint32_t press_time
Definition idunn_internal.h:185
int32_t press_y
Definition idunn_internal.h:187
idunn_key_hook_t on_key
Definition idunn_internal.h:194
uint32_t tip_at
Definition idunn_internal.h:218
idunn_app_t * app
Definition idunn_internal.h:245
bool own_buffer
Definition idunn_internal.h:168
bool focus_visible
Definition idunn_internal.h:173
struct idunn_window::@350241363146226344320174315125001064320276063050 timers[8]
gfx_buffer_t * buffer
Definition idunn_internal.h:167
void * popup_data
Definition idunn_internal.h:238
bool dead
Definition idunn_internal.h:235
uint32_t now
Definition idunn_internal.h:181
int32_t menu_x
Definition idunn_internal.h:190
idunn_widget_t * modal
Definition idunn_internal.h:222
idunn_widget_t * pressed
Definition idunn_internal.h:171
idunn_window_t * opener
Definition idunn_internal.h:228
uint32_t tip_closed
Definition idunn_internal.h:219
size_t clipboard_length
Definition idunn_internal.h:213
void(*) popup_free(idunn_window_t *popup)
Definition idunn_internal.h:242
idunn_window_t * next
Definition idunn_internal.h:247
idunn_widget_t * tip_widget
Definition idunn_internal.h:217
idunn_window_t * popup
Definition idunn_internal.h:227
uint32_t cursor
Definition idunn_internal.h:182
gfx_rect_t anchor
Definition idunn_internal.h:232
int side
Definition idunn_internal.h:233
idunn_widget_t * paste_to
Definition idunn_internal.h:214
idunn_context_t * ctx
Definition idunn_internal.h:166
int32_t menu_y
Definition idunn_internal.h:191
idunn_widget_t * modal_return
Definition idunn_internal.h:223
int32_t press_x
Definition idunn_internal.h:186
bool transparent
Definition idunn_internal.h:229
void * on_close_data
Definition idunn_internal.h:199
gfx_rect_t damage_list[IDUNN_DAMAGE_MAX]
Definition idunn_internal.h:178
void(*) clipboard_set(idunn_window_t *win, const char *text, size_t length)
Definition idunn_internal.h:210
int damage_count
Definition idunn_internal.h:179
gfx_rect_t moved
Definition idunn_internal.h:180
gfx_rect_t damage
Definition idunn_internal.h:177
bool animating
Definition idunn_internal.h:176
idunn_window_t * next_dead
Definition idunn_internal.h:236