1<!DOCTYPE html>
2<html lang="en">
3<head>
4<meta charset="UTF-8">
5<meta name="viewport" content="width=device-width, initial-scale=1.0">
6<title>X11 GUI Library — Documentation</title>
7<style>
8:root{--bg:#202020;--bg2:#2b2b2b;--bg3:#383838;--tx:#fff;--tx2:#9d9d9d;--ac:#0078d4;--ach:#2488e0;--bd:#3b3b3b;--r:8px}
9*{margin:0;padding:0;box-sizing:border-box}
10body{font-family:'Segoe UI',system-ui,sans-serif;background:var(--bg);color:var(--tx);display:flex}
11::-webkit-scrollbar{width:8px}::-webkit-scrollbar-thumb{background:var(--bg3);border-radius:4px}
12.sb{width:260px;position:fixed;inset:0 auto 0 0;background:var(--bg2);border-right:1px solid var(--bd);padding:16px 12px;overflow-y:auto}
13.logo{font-size:17px;font-weight:600;padding:6px 12px 18px;display:flex;gap:10px;align-items:center}
14.logo .sq{width:22px;height:22px;background:var(--ac);border-radius:5px}
15#q{width:100%;background:var(--bg);border:1px solid var(--bd);border-radius:6px;color:var(--tx);padding:8px 10px;font-size:13px;margin-bottom:12px;outline:none}
16#q:focus{border-color:var(--ac)}
17.nv{display:block;width:100%;text-align:left;background:none;border:none;color:var(--tx2);padding:10px 12px;border-radius:6px;font-size:14px;cursor:pointer;margin-bottom:2px;position:relative}
18.nv:hover{background:var(--bg3);color:var(--tx)}
19.nv.on{background:var(--bg3);color:var(--tx)}
20.nv.on::before{content:'';position:absolute;left:0;top:8px;bottom:8px;width:3px;background:var(--ac);border-radius:2px}
21main{margin-left:260px;flex:1;padding:32px 40px;max-width:1100px}
22h1{font-size:28px;font-weight:600;margin-bottom:6px}
23h2{font-size:20px;font-weight:600;margin:26px 0 10px}
24h3{font-size:15px;font-weight:600;margin:18px 0 8px}
25p,li{color:var(--tx2);font-size:14px;line-height:1.7}
26ul{padding-left:20px;margin:8px 0}
27.card{background:var(--bg2);border:1px solid var(--bd);border-radius:var(--r);padding:20px;margin:14px 0}
28table{width:100%;border-collapse:collapse;margin:12px 0;font-size:13px}
29th,td{padding:8px 10px;text-align:left;border-bottom:1px solid var(--bd);color:var(--tx2);vertical-align:top}
30th{color:var(--tx);background:var(--bg3)}
31code{font-family:'Cascadia Code',Consolas,monospace;font-size:12.5px;color:#4cc2ff}
32pre{background:#1a1a1a;border:1px solid var(--bd);border-radius:var(--r);padding:14px;overflow-x:auto;margin:10px 0}
33pre code{color:#e8e8e8;line-height:1.6}
34.cb{position:relative}
35.cp{position:absolute;top:8px;right:8px;background:var(--bg3);border:1px solid var(--bd);color:var(--tx2);border-radius:5px;padding:3px 10px;font-size:11px;cursor:pointer}
36.cp:hover{background:var(--ac);color:#fff}
37.page{display:none}.page.on{display:block}
38.badge{display:inline-block;background:var(--ac);color:#fff;border-radius:4px;padding:2px 8px;font-size:11px;margin-right:6px}
39.tip{border-left:3px solid var(--ac);background:var(--bg2);padding:12px 16px;border-radius:0 6px 6px 0;margin:12px 0}
40.warn{border-left:3px solid #f59e0b;background:var(--bg2);padding:12px 16px;border-radius:0 6px 6px 0;margin:12px 0}
41</style>
42</head>
43<body>
44
45<aside class="sb">
46 <div class="logo"><div class="sq"></div>X11 GUI Library</div>
47 <input id="q" placeholder="Search...">
48 <button class="nv on" data-p="start"> Getting Started</button>
49 <button class="nv" data-p="window">🪟 Window &amp; Pages</button>
50 <button class="nv" data-p="widgets">🧩 Widgets</button>
51 <button class="nv" data-p="themes">🎨 Themes &amp; Customization</button>
52 <button class="nv" data-p="custom">🛠 Custom Widgets</button>
53 <button class="nv" data-p="events">📡 Events</button>
54 <button class="nv" data-p="anim">✨ Animations</button>
55 <button class="nv" data-p="debug">🐞 Debug &amp; Performance</button>
56 <button class="nv" data-p="api">📚 API Reference</button>
57</aside>
58
59<main>
60
61<!-- ============ START ============ -->
62<section id="p-start" class="page on">
63<h1>Getting Started</h1>
64<p>Lightweight X11 GUI library for C++20 with software rendering, dirty-rectangle partial updates, TTF fonts (FreeType), two built-in themes (WIN11 / TERMINAL) and smooth animations.</p>
65<div class="card">
66<h3>Features</h3>
67<ul>
68<li>Partial redraw (dirty rectangles) — only changed regions repaint</li>
69<li>Double buffering — no flicker</li>
70<li>TTF fonts via FreeType with cached 1-bit masks (fast text)</li>
71<li>Two themes: <code>WIN11</code> and <code>TERMINAL</code>, fully customizable</li>
72<li>Animations: hover, press, push-down, check, dropdown</li>
73<li>EventBus + per-widget callbacks</li>
74<li>Debug overlay, dirty-rect visualization, click markers (F1–F6)</li>
75</ul>
76</div>
77<h2>Build</h2>
78<pre><code>find_package(X11 REQUIRED)
79find_package(Freetype REQUIRED)
80
81add_executable(host
82 main.cpp
83 libs/gui/core/event_bus.cpp
84 libs/gui/core/raw_picture.cpp
85 libs/gui/core/font_manager.cpp
86 libs/gui/core/theme.cpp
87 libs/gui/widgets/widget.cpp
88 libs/gui/widgets/draw_basic.cpp
89 libs/gui/widgets/draw_toggles.cpp
90 libs/gui/widgets/draw_lists.cpp
91 libs/gui/window.cpp
92 libs/gui/demo.cpp
93)
94target_include_directories(host PRIVATE libs/gui ${X11_INCLUDE_DIR})
95target_link_libraries(host PRIVATE ${X11_LIBRARIES} Freetype::Freetype)</code></pre>
96<h2>Quick start</h2>
97<pre><code>#include "gui.h"
98int main() {
99 gui::set_theme(gui::ThemeStyle::WIN11);
100 gui::window win("My App");
101 win.set_font("SGr-Iosevka-Regular.ttc");
102 win.set_default_icon();
103
104 win.configur_page("main", [](gui::page&amp; p) {
105 gui::WidgetData b;
106 b.id = "btn"; b.text = "Hello";
107 b.x = 100; b.y = 100; b.width = 300; b.height = 70;
108 p.Button(b);
109 }, true);
110
111 gui::EventBus::get().on("button.click", [](const gui::EventData&amp; e) {
112 std::cout &lt;&lt; "clicked: " &lt;&lt; e.source_id &lt;&lt; "\n";
113 });
114
115 while (win.running()) win.update();
116}</code></pre>
117<div class="tip">Put <code>SGr-Iosevka-Regular.ttc</code> (or any TTF/TTC) next to the binary. If not found, a fallback X11 core font is used.</div>
118</section>
119
120<!-- ============ WINDOW ============ -->
121<section id="p-window" class="page">
122<h1>Window &amp; Pages</h1>
123<h2>gui::window</h2>
124<table>
125<tr><th>Method</th><th>Description</th></tr>
126<tr><td><code>window(title)</code></td><td>Create X11 window (1600×900), backbuffer, load font</td></tr>
127<tr><td><code>update()</code></td><td>Process events + render one frame (call in a loop)</td></tr>
128<tr><td><code>running()</code></td><td>false after WM_DELETE (close button)</td></tr>
129<tr><td><code>set_font(path)</code></td><td>Load TTF/TTC font</td></tr>
130<tr><td><code>set_font_size(px)</code></td><td>Global font size (default 32)</td></tr>
131<tr><td><code>set_icon(path)</code> / <code>set_icon(pic)</code> / <code>set_default_icon()</code></td><td>Window icon (_NET_WM_ICON)</td></tr>
132<tr><td><code>set_max_fps(n)</code></td><td>Frame cap (default 240)</td></tr>
133<tr><td><code>on_key</code></td><td>std::function&lt;void(KeySym)&gt; — custom hotkeys (F6+)</td></tr>
134</table>
135<h2>Pages &amp; tabs</h2>
136<pre><code>// tabs (left column)
137gui::WidgetData tab; tab.id = "main"; tab.text = "main";
138tab.on_window_click = [&amp;win](gui::window&amp; w){ w.openPAGE("main"); };
139win.addTAB_BUTTON(tab);
140
141// pages
142win.addPAGE("main");
143win.configur_page("main", [](gui::page&amp; p){ /* fill widgets */ }, true);
144win.openPAGE("main");</code></pre>
145<div class="tip">Only the <b>active page</b> is ticked and rendered — inactive pages cost zero CPU.</div>
146<h2>Finding widgets</h2>
147<pre><code>gui::Widget* w = win.find("btn"); // search all pages
148if (w) { w->setValue(0.7f); win.mark_dirty(100,100,300,70); }</code></pre>
149</section>
150
151<!-- ============ WIDGETS ============ -->
152<section id="p-widgets" class="page">
153<h1>Widgets</h1>
154<h2>WidgetData fields</h2>
155<table>
156<tr><th>Field</th><th>Default</th><th>Meaning</th></tr>
157<tr><td><code>id, text</code></td><td>""</td><td>identifier / label</td></tr>
158<tr><td><code>x,y,width,height</code></td><td>0,0,200,60</td><td>geometry (2× scale)</td></tr>
159<tr><td><code>bg_color, fg_color, frame_color</code></td><td>0</td><td>0 = take from theme, else override</td></tr>
160<tr><td><code>font_size</code></td><td>0</td><td>0 = theme size, else per-widget</td></tr>
161<tr><td><code>primary</code></td><td>false</td><td>accent-colored button</td></tr>
162<tr><td><code>checked</code></td><td>false</td><td>checkbox / radio state</td></tr>
163<tr><td><code>value, target_value</code></td><td>0</td><td>slider / progress (0..1)</td></tr>
164<tr><td><code>items</code></td><td>[]</td><td>listbox / dropdown entries</td></tr>
165<tr><td><code>picture</code></td><td>null</td><td>RawPicture for sprite / raw widgets</td></tr>
166<tr><td><code>on_change / on_page_click / on_window_click</code></td><td>null</td><td>callbacks</td></tr>
167</table>
168<h2>Factory methods (on page or any container)</h2>
169<pre><code>p.Button(d); p.Label(d); p.Input(d); p.Checkbox(d); p.Radiobutton(d);
170p.Slider(d); p.Progressbar(d); p.Listbox(d); p.Dropdown(d);
171p.TreeView(d); p.TreeNode(d); p.ScrollView(d);
172p.RawPictureWidget(d); p.SpriteButton(d);</code></pre>
173<h2>Examples</h2>
174<pre><code>// accent button
175gui::WidgetData b; b.id="go"; b.text="Run"; b.primary=true;
176b.x=100; b.y=100; b.width=300; b.height=70;
177p.Button(b);
178
179// input field (click to focus, bottom line + blinking caret)
180gui::WidgetData i; i.id="name"; i.x=100; i.y=200; i.width=500; i.height=68;
181p.Input(i);
182
183// slider drives progress
184gui::WidgetData s; s.id="vol"; s.x=100; s.y=300; s.width=600; s.height=48; s.value=0.4f;
185p.Slider(s);
186gui::WidgetData pr; pr.id="prog"; pr.x=100; pr.y=380; pr.width=600; pr.height=44;
187p.Progressbar(pr);</code></pre>
188<h2>Nested containers</h2>
189<pre><code>auto&amp; sv = p.ScrollView(d); // returns Widget&amp;
190sv.Button(inner); // children live inside
191auto&amp; tv = p.TreeView(d);
192auto&amp; n1 = tv.TreeNode(n); // node
193n1.Label(child); // leaf inside node</code></pre>
194</section>
195
196<!-- ============ THEMES ============ -->
197<section id="p-themes" class="page">
198<h1>Themes &amp; Customization</h1>
199<h2>Switch built-in themes</h2>
200<pre><code>gui::set_theme(gui::ThemeStyle::WIN11); // rounded, blue accent
201gui::set_theme(gui::ThemeStyle::TERMINAL); // square, green accent
202// hotkey F6 toggles at runtime (see demo)</code></pre>
203<h2>Theme struct (all tunable)</h2>
204<pre><code>struct Theme {
205 ThemeStyle style;
206 int radius, radius_sm, font_size; // 12/8/32 (win11), 0/0/32 (term)
207 uint32_t window_bg, panel_bg, text, text_dim;
208 uint32_t btn, btn_h, btn_p, border, border_h; // button + hover + press
209 uint32_t accent, accent_h, accent_p, on_accent;
210 uint32_t input_bg, focus;
211 uint32_t track, prog_bg;
212 uint32_t list_bg, list_h, list_sel, list_sel_text;
213 uint32_t tab_bg, tab_h, tab_active;
214};
215const Theme&amp; theme(); // current</code></pre>
216<h2>Per-widget override (beats theme)</h2>
217<pre><code>gui::WidgetData d;
218d.bg_color = 0x332211; // non-zero overrides theme
219d.fg_color = 0xFFCC00;
220d.frame_color = 0x00FF88;
221d.font_size = 40; // per-widget size</code></pre>
222<div class="tip">Rule: <code>0</code> = use theme. Any other value = your override. This is the <code>C(override, theme)</code> helper in <code>widget.h</code>.</div>
223<h2>Where theme values live</h2>
224<p>Edit <code>libs/gui/core/theme.cpp</code> — the two static structs <code>t_win11</code> / <code>t_term</code>. Field order matches the struct above (e.g. the pair <code>input_bg, focus</code> is the 14th/15th value).</p>
225</section>
226
227<!-- ============ CUSTOM ============ -->
228<section id="p-custom" class="page">
229<h1>Custom Widgets</h1>
230<p>Three levels of extension, from easy to full.</p>
231<h2>1. Restyle an existing widget (no code change)</h2>
232<pre><code>gui::WidgetData d;
233d.type = gui::WidgetType::BUTTON; // or set via factory
234d.bg_color = 0x402020; d.frame_color = 0xFF4444; d.font_size = 28;
235p.Button(d);</code></pre>
236<h2>2. Compose with RawPicture (sprite button)</h2>
237<pre><code>auto pic = std::make_shared&lt;gui::RawPicture&gt;(300, 100, 32);
238pic-&gt;clear(0x202020);
239pic-&gt;fillRoundRect(0,0,300,100,16,0x0078D4);
240pic-&gt;drawText(win.display(), 20, 30, "Custom", 0xFFFFFF, 1);
241gui::WidgetData d; d.picture = pic; d.width=300; d.height=100;
242p.SpriteButton(d); // still clickable, emits button.click</code></pre>
243<h2>3. Add a brand-new widget type</h2>
244<ol>
245<li><code>widget.h</code>: add enum value <code>WidgetType::MY_WIDGET</code></li>
246<li><code>widget.h</code>: add factory decl <code>Widget&amp; MyWidget(WidgetData);</code></li>
247<li><code>widget.cpp</code>: implement factory (<code>a.type = ...; return add_widget(...)</code>)</li>
248<li>draw: add a case in <code>Widget::draw</code> dispatch → your <code>wdraw::my(...)</code></li>
249<li>input: add a case in <code>Widget::handle_press</code> (return 1 consumed / 2 capture)</li>
250</ol>
251<pre><code>// widget.cpp factory
252Widget&amp; combat::MyWidget(WidgetData a){ a.type=WidgetType::MY_WIDGET; return add_widget(std::move(a)); }
253
254// draw dispatch (Widget::draw)
255case WidgetType::MY_WIDGET: wdraw::my(d, win, gc, *this, ax, ay); break;
256
257// your renderer (any draw_*.cpp)
258void wdraw::my(Display* d, Drawable win, GC gc, const Widget&amp; w, int ax, int ay) {
259 const auto&amp; t = theme();
260 XSetForeground(d, gc, t.accent);
261 x_fill_round(d, win, gc, ax, ay, w.data.width, w.data.height, t.radius);
262 gui_text(d, win, gc, ax+12, gui_base_c(ay, w.data.height, t.font_size),
263 w.data.text, t.on_accent, t.font_size);
264}</code></pre>
265<div class="warn">Declare your <code>wdraw::my</code> in <code>widget.h</code> and, if it needs protected <code>widgets</code>, add it as <code>friend</code> of <code>combat</code> (like basic/toggles/lists).</div>
266</section>
267
268<!-- ============ EVENTS ============ -->
269<section id="p-events" class="page">
270<h1>Events</h1>
271<h2>EventBus</h2>
272<pre><code>int tok = gui::EventBus::get().on("button.click", [](const gui::EventData&amp; e){ ... });
273gui::EventBus::get().off(tok);
274gui::EventBus::get().emit("my.event", {"id","text",0.5f,1,true});</code></pre>
275<h2>Built-in events</h2>
276<table>
277<tr><th>Event</th><th>Data</th></tr>
278<tr><td><code>button.click</code></td><td>source_id, text</td></tr>
279<tr><td><code>checkbox.change</code></td><td>source_id, flag</td></tr>
280<tr><td><code>radio.change</code></td><td>source_id, flag=true</td></tr>
281<tr><td><code>slider.change</code></td><td>source_id, value 0..1</td></tr>
282<tr><td><code>list.select</code></td><td>source_id, text, index</td></tr>
283<tr><td><code>dropdown.select</code></td><td>source_id, text, index</td></tr>
284<tr><td><code>tree.toggle</code></td><td>source_id, flag=expanded</td></tr>
285<tr><td><code>input.submit</code></td><td>source_id, text (Enter)</td></tr>
286<tr><td><code>page.open</code></td><td>source_id = page name</td></tr>
287</table>
288<h2>Per-widget callbacks (alternative)</h2>
289<pre><code>d.on_change = []{ ... }; // value/state changed
290d.on_page_click = [](gui::page&amp; p){ ... }; // button clicked
291d.on_window_click= [](gui::window&amp; w){ ... };</code></pre>
292<h2>Global logger (debug)</h2>
293<pre><code>gui::EventBus::get().set_global_logger([](const std::string&amp; e, const gui::EventData&amp; d){
294 std::cout &lt;&lt; "[LOG] " &lt;&lt; e &lt;&lt; "\n";
295});</code></pre>
296</section>
297
298<!-- ============ ANIM ============ -->
299<section id="p-anim" class="page">
300<h1>Animations</h1>
301<p>All animation state lives in <code>struct Widget</code> as 0..1 floats, advanced in <code>Widget::tick(dt)</code> and applied in <code>Widget::draw()</code>.</p>
302<table>
303<tr><th>Field</th><th>Drives</th><th>Where applied</th></tr>
304<tr><td><code>hover_a</code></td><td>hover highlight</td><td>draw_basic / toggles color mix</td></tr>
305<tr><td><code>press_a</code></td><td>press darkening</td><td>draw_basic color mix</td></tr>
306<tr><td><code>push_a</code></td><td>push-down offset (6px)</td><td><code>Widget::draw</code>: <code>ay += ease(push_a)*6</code></td></tr>
307<tr><td><code>check_a</code></td><td>checkmark / radio dot reveal</td><td>draw_toggles</td></tr>
308<tr><td><code>anim</code></td><td>dropdown open/close</td><td>draw_lists popup height</td></tr>
309<tr><td><code>cursor_timer / cursor_visible</code></td><td>input caret blink (0.5s)</td><td>draw_basic</td></tr>
310</table>
311<h2>Tune speed</h2>
312<pre><code>// Widget::tick — the speed constants
313hover_a = approach(hover_a, hovered?1:0, dt, 10); // higher = snappier
314push_a = approach(push_a, pressed?1:0, dt, 18);
315check_a = approach(check_a, checked?1:0, dt, 10);</code></pre>
316<h2>Disable push-down (e.g. for slider)</h2>
317<pre><code>// Widget::draw
318int ay = data.y + oy + (data.type == WidgetType::SLIDER ? 0 : (int)(ease(push_a)*6));</code></pre>
319<h2>Remove color flicker (design rule)</h2>
320<div class="tip">Colors fed into <code>x_fill_round</code>/<code>x_draw_round</code>/<code>XDrawArc</code> must NOT depend on animated <code>hover_a</code>/<code>press_a</code>. Keep animation in safe places: checkmark lines, radio dot, slider thumb position, push-down offset. This is why checkbox/radio use static border colors.</div>
321</section>
322
323<!-- ============ DEBUG ============ -->
324<section id="p-debug" class="page">
325<h1>Debug &amp; Performance</h1>
326<h2>Hotkeys</h2>
327<table>
328<tr><th>Key</th><th>Action</th></tr>
329<tr><td>F1</td><td>Debug overlay (FPS, widgets, partial updates, mouse, event log)</td></tr>
330<tr><td>F2</td><td>Dirty-rect visualization (XOR flash of repainted regions)</td></tr>
331<tr><td>F3</td><td>Click markers (red cross at click point)</td></tr>
332<tr><td>F4</td><td>Widget bounds (magenta outlines)</td></tr>
333<tr><td>F5</td><td>Console event logging</td></tr>
334<tr><td>F6</td><td>Toggle theme WIN11 ↔ TERMINAL (via <code>on_key</code>)</td></tr>
335</table>
336<h2>Programmatic access</h2>
337<pre><code>win.debug().show_debug_overlay = true;
338win.debug().show_dirty_rects = true;
339win.debug().max_log_size = 30;
340std::cout &lt;&lt; win.debug().fps &lt;&lt; "\n";
341
342win.mark_dirty(x,y,w,h); // invalidate a region
343win.mark_all_dirty(); // full repaint</code></pre>
344<h2>Why it's fast</h2>
345<ul>
346<li><b>Dirty rectangles</b> — only changed regions redraw; <code>Partial updates</code> counter shows it</li>
347<li><b>Only active page</b> is ticked/rendered</li>
348<li><b>Text cache</b> — strings rendered once to 1-bit masks, drawn with one <code>XFillRectangle</code> (no XGetImage)</li>
349<li><b>Overlay throttle</b> — debug panel refreshes at 10 Hz</li>
350<li><b>Idle sleep</b> — <code>usleep(10ms)</code> when nothing is dirty → ~0% CPU at rest</li>
351<li><b>Frame cap</b> — <code>set_max_fps()</code>, default 240</li>
352</ul>
353<div class="warn">F2 flashes only visualize <i>user</i> dirty rects (snapshot taken before flash/marker/overlay rects) — no feedback loop, FPS stays high.</div>
354</section>
355
356<!-- ============ API ============ -->
357<section id="p-api" class="page">
358<h1>API Reference</h1>
359<h2>gui::window</h2>
360<pre><code>window(title) / ~window()
361update() running() display()
362addTAB_BUTTON(d) addPAGE(n) configur_page(n, fn, active) openPAGE(n)
363find(id) set_focus(w)
364set_font(p) set_font_size(px) set_icon(p|pic) set_default_icon() set_max_fps(n)
365debug() mark_dirty(x,y,w,h) mark_all_dirty()
366std::function&lt;void(KeySym)&gt; on_key;</code></pre>
367<h2>gui::combat (container base: page, Widget)</h2>
368<pre><code>Button/Label/Input/Checkbox/Radiobutton/Slider/Progressbar/
369Listbox/Dropdown/TreeView/TreeNode/ScrollView/RawPictureWidget/SpriteButton
370visit(fn) find(id) find_at(x,y) count_widgets()
371tick(dt) render_all(...) render_dirty(...) mark_all_dirty(...)
372process_press(...) process_wheel(...)</code></pre>
373<h2>gui::Widget</h2>
374<pre><code>WidgetData data;
375float hover_a, press_a, check_a, push_a, anim, phase;
376bool hovered, pressed, focused, cursor_visible, open_target;
377float cursor_timer;
378setValue(v) getValue()
379tick(dt) draw(...) draw_popup(...)
380handle_press/drag/release/wheel(...)
381contains(...) content_height() mark_dirty(...)</code></pre>
382<h2>gui::RawPicture</h2>
383<pre><code>create(w,h,bits) clear(c) setPixel/getPixel/blendPixel
384drawLine/drawRect/fillRect/fillRoundRect
385drawCircle/fillCircle/fillTriangle/fillPolygon
386drawText(dpy,x,y,t,c,scale) blit(src,dx,dy)
387load(path) // BMP 24/32, PPM P6
388present(dpy,win,gc,dx,dy)</code></pre>
389<h2>gui::FontManager</h2>
390<pre><code>FontManager::get()
391load(path) available() set_default_size(px) default_size()
392ascent/descent/line_height/text_width(size)
393draw(RawPicture&amp;,...) draw(Display*,Drawable,GC,...)</code></pre>
394<h2>gui::EventBus / gui::DirtyRegion / gui::Theme</h2>
395<pre><code>EventBus::get().on/off/emit/set_global_logger
396DirtyRegion: add/mark_all/is_dirty/intersects/get/clear
397theme() set_theme(ThemeStyle)</code></pre>
398</section>
399
400</main>
401
402<script>
403function go(id){
404 document.querySelectorAll('.page').forEach(p=>p.classList.remove('on'));
405 document.querySelectorAll('.nv').forEach(n=>n.classList.remove('on'));
406 document.getElementById('p-'+id).classList.add('on');
407 document.querySelector('[data-p="'+id+'"]').classList.add('on');
408 window.scrollTo(0,0);
409}
410document.querySelectorAll('.nv').forEach(n=>n.onclick=()=>go(n.dataset.p));
411
412// wrap every <pre> with copy button
413document.querySelectorAll('pre').forEach(pre=>{
414 const wrap=document.createElement('div'); wrap.className='cb';
415 pre.parentNode.insertBefore(wrap,pre); wrap.appendChild(pre);
416 const b=document.createElement('button'); b.className='cp'; b.textContent='Copy';
417 b.onclick=()=>{ navigator.clipboard.writeText(pre.innerText).then(()=>{
418 b.textContent='Copied!'; setTimeout(()=>b.textContent='Copy',1200);
419 });};
420 wrap.appendChild(b);
421});
422
423// sidebar search
424document.getElementById('q').addEventListener('input',e=>{
425 const t=e.target.value.toLowerCase();
426 document.querySelectorAll('.nv').forEach(n=>{
427 n.style.display = n.textContent.toLowerCase().includes(t) ? 'block' : 'none';
428 });
429});
430</script>
431</body>
432</html>