1#![allow(dead_code)]
6#![allow(non_snake_case)]
7#![allow(clippy::too_many_arguments)]
8#![allow(clippy::missing_safety_doc)]
9
10#[repr(u64)]
11#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12pub enum HandleValue {
13 Invalid = 0,
14}
15#[repr(u32)]
16#[derive(Debug, Clone, Copy, PartialEq, Eq)]
17pub enum NodeType {
18 FlexBox = 0,
19 Text = 1,
20 Image = 2,
21 Svg = 3,
22 ScrollView = 4,
23 Grid = 5,
24}
25#[repr(u32)]
26#[derive(Debug, Clone, Copy, PartialEq, Eq)]
27pub enum Unit {
28 Pixel = 0,
29 Auto = 1,
30 Percent = 2,
31}
32#[repr(u32)]
33#[derive(Debug, Clone, Copy, PartialEq, Eq)]
34pub enum GridUnit {
35 Pixel = 0,
36 Auto = 1,
37 Star = 2,
38}
39#[repr(u32)]
40#[derive(Debug, Clone, Copy, PartialEq, Eq)]
41pub enum PositionType {
42 Relative = 0,
43 Absolute = 1,
44}
45#[repr(u32)]
46#[derive(Debug, Clone, Copy, PartialEq, Eq)]
47pub enum Visibility {
48 Normal = 0,
49 Hidden = 1,
50 Collapsed = 2,
51}
52#[repr(u32)]
53#[derive(Debug, Clone, Copy, PartialEq, Eq)]
54pub enum FlexDirection {
55 Column = 0,
56 Row = 1,
57}
58#[repr(u32)]
59#[derive(Debug, Clone, Copy, PartialEq, Eq)]
60pub enum FlexWrap {
61 NoWrap = 0,
62 Wrap = 1,
63 WrapReverse = 2,
64}
65#[repr(u32)]
66#[derive(Debug, Clone, Copy, PartialEq, Eq)]
67pub enum JustifyContent {
68 Start = 0,
69 Center = 1,
70 End = 2,
71}
72#[repr(u32)]
73#[derive(Debug, Clone, Copy, PartialEq, Eq)]
74pub enum AlignItems {
75 Start = 0,
76 Center = 1,
77 End = 2,
78 Stretch = 3,
79 None = 4,
80}
81#[repr(u32)]
82#[derive(Debug, Clone, Copy, PartialEq, Eq)]
83pub enum AlignSelf {
84 Auto = 0,
85 Start = 1,
86 Center = 2,
87 End = 3,
88 Stretch = 4,
89}
90#[repr(u32)]
91#[derive(Debug, Clone, Copy, PartialEq, Eq)]
92pub enum BorderStyle {
93 Solid = 0,
94 Dashed = 1,
95 Dotted = 2,
96}
97#[repr(u32)]
98#[derive(Debug, Clone, Copy, PartialEq, Eq)]
99pub enum ObjectFit {
100 Fill = 0,
101 Contain = 1,
102 Cover = 2,
103 None = 3,
104 ScaleDown = 4,
105}
106#[repr(u32)]
107#[derive(Debug, Clone, Copy, PartialEq, Eq)]
108pub enum ImageSamplingKind {
109 Linear = 0,
110 Nearest = 1,
111 LinearMipmapNearest = 2,
112 LinearMipmapLinear = 3,
113 CubicMitchell = 4,
114 CubicCatmullRom = 5,
115 Anisotropic = 6,
116}
117#[repr(u32)]
118#[derive(Debug, Clone, Copy, PartialEq, Eq)]
119pub enum TextAlign {
120 Left = 0,
121 Center = 1,
122 Right = 2,
123}
124#[repr(u32)]
125#[derive(Debug, Clone, Copy, PartialEq, Eq)]
126pub enum TextVerticalAlign {
127 Top = 0,
128 Center = 1,
129 Bottom = 2,
130}
131#[repr(u32)]
132#[derive(Debug, Clone, Copy, PartialEq, Eq)]
133pub enum TextOverflow {
134 Clip = 0,
135 Ellipsis = 1,
136 Fade = 2,
137}
138#[repr(u32)]
139#[derive(Debug, Clone, Copy, PartialEq, Eq)]
140pub enum Orientation {
141 None = 0,
142 Horizontal = 1,
143 Vertical = 2,
144}
145#[repr(u32)]
146#[derive(Debug, Clone, Copy, PartialEq, Eq)]
147pub enum KeyEventType {
148 Down = 1,
149 Up = 2,
150}
151#[repr(u32)]
152#[derive(Debug, Clone, Copy, PartialEq, Eq)]
153pub enum PointerEventType {
154 Down = 1,
155 Up = 2,
156 Move = 3,
157 Enter = 4,
158 Leave = 5,
159 Cancel = 6,
160}
161#[repr(u32)]
162#[derive(Debug, Clone, Copy, PartialEq, Eq)]
163pub enum KeyModifier {
164 Shift = 1 << 0,
165 Ctrl = 1 << 1,
166 Alt = 1 << 2,
167 Meta = 1 << 3,
168}
169#[repr(u32)]
170#[derive(Debug, Clone, Copy, PartialEq, Eq)]
171pub enum SemanticRole {
172 None = 0,
173 Button = 1,
174 Textbox = 2,
175 Link = 3,
176 Heading = 4,
177 Form = 5,
178 List = 6,
179 ListItem = 7,
180 Image = 8,
181 Dialog = 9,
182 StaticText = 10,
183 Checkbox = 11,
184 Radio = 12,
185 RadioGroup = 13,
186 Switch = 14,
187 Slider = 15,
188 ComboBox = 16,
189}
190#[repr(u32)]
191#[derive(Debug, Clone, Copy, PartialEq, Eq)]
192pub enum PlatformFamily {
193 Unknown = 0,
194 Apple = 1,
195 Windows = 2,
196 Linux = 3,
197}
198#[repr(u32)]
199#[derive(Debug, Clone, Copy, PartialEq, Eq)]
200pub enum HostEnvironment {
201 Unknown = 0,
202 Browser = 1,
203 Desktop = 2,
204 Headless = 3,
205}
206#[repr(u32)]
207#[derive(Debug, Clone, Copy, PartialEq, Eq)]
208pub enum HostCapability {
209 BrowserHistory = 1,
210 Reload = 2,
211 NewBrowsingContext = 4,
212 OpenExternalUri = 8,
213 ClipboardRead = 16,
214 ClipboardWrite = 32,
215 FileDialogs = 64,
216}
217#[repr(u32)]
218#[derive(Debug, Clone, Copy, PartialEq, Eq)]
219pub enum CursorStyle {
220 Default = 0,
221 Pointer = 1,
222 Text = 2,
223 Move = 3,
224 Grab = 4,
225 Grabbing = 5,
226 ResizeNS = 6,
227 ResizeEW = 7,
228}
229#[repr(u32)]
230#[derive(Debug, Clone, Copy, PartialEq, Eq)]
231pub enum SemanticCheckedState {
232 None = 0,
233 False = 1,
234 True = 2,
235 Mixed = 3,
236}
237
238#[cfg(any(target_arch = "wasm32", feature = "native-runtime"))]
239#[cfg_attr(target_arch = "wasm32", link(wasm_import_module = "effindom_v2_ui"))]
240unsafe extern "C" {
241 pub fn ui_get_abi_version() -> u32;
242 pub fn ui_arena_alloc(size: u32) -> usize;
243 pub fn ui_reset();
244 pub fn ui_create_node(type_: u32) -> u64;
245 pub fn ui_delete_node(handle: u64);
246 pub fn ui_set_node_id(handle: u64, utf8_id: *const u8, len: u32);
247 pub fn ui_set_semantic_role(handle: u64, role_enum: u32);
248 pub fn ui_set_semantic_label(handle: u64, utf8_label: *const u8, len: u32);
249 pub fn ui_set_semantic_checked(handle: u64, checked_state_enum: u32);
250 pub fn ui_set_semantic_selected(handle: u64, has_selected: bool, is_selected: bool);
251 pub fn ui_set_semantic_expanded(handle: u64, has_expanded: bool, is_expanded: bool);
252 pub fn ui_set_semantic_disabled(handle: u64, has_disabled: bool, is_disabled: bool);
253 pub fn ui_set_semantic_value_range(
254 handle: u64,
255 has_value_range: bool,
256 value_now: f32,
257 value_min: f32,
258 value_max: f32,
259 );
260 pub fn ui_set_semantic_orientation(handle: u64, orientation_enum: u32);
261 pub fn ui_request_semantic_announcement(handle: u64);
262 pub fn ui_push_semantic_scope(handle: u64) -> u32;
263 pub fn ui_remove_semantic_scope(token: u32);
264 pub fn ui_node_add_child(parent: u64, child: u64);
265 pub fn ui_node_remove_child(parent: u64, child: u64);
266 pub fn ui_set_is_portal(handle: u64, is_portal: bool);
267 pub fn ui_set_visibility(handle: u64, visibility_enum: u32);
268 pub fn ui_set_width(handle: u64, value: f32, unit_enum: u32);
269 pub fn ui_set_height(handle: u64, value: f32, unit_enum: u32);
270 pub fn ui_set_fill_width(handle: u64, fill: bool);
271 pub fn ui_set_fill_height(handle: u64, fill: bool);
272 pub fn ui_set_fill_width_percent(handle: u64, percent: f32);
273 pub fn ui_set_fill_height_percent(handle: u64, percent: f32);
274 pub fn ui_set_min_width(handle: u64, value: f32, unit_enum: u32);
275 pub fn ui_set_max_width(handle: u64, value: f32, unit_enum: u32);
276 pub fn ui_set_min_height(handle: u64, value: f32, unit_enum: u32);
277 pub fn ui_set_max_height(handle: u64, value: f32, unit_enum: u32);
278 pub fn ui_set_flex_direction(handle: u64, dir_enum: u32);
279 pub fn ui_set_flex_basis(handle: u64, basis: f32);
280 pub fn ui_set_justify_content(handle: u64, justify_enum: u32);
281 pub fn ui_set_align_items(handle: u64, align_enum: u32);
282 pub fn ui_set_align_self(handle: u64, align_enum: u32);
283 pub fn ui_set_padding(handle: u64, left: f32, top: f32, right: f32, bottom: f32);
284 pub fn ui_set_margin(handle: u64, left: f32, top: f32, right: f32, bottom: f32);
285 pub fn ui_set_position_type(handle: u64, pos_enum: u32);
286 pub fn ui_set_position(handle: u64, left: f32, top: f32, right: f32, bottom: f32);
287 pub fn ui_set_is_shared_size_scope(handle: u64, is_scope: bool);
288 pub fn ui_set_custom_drawable(handle: u64, is_custom_drawable: bool);
289 pub fn ui_set_flex_wrap(handle: u64, wrap_enum: u32);
290 pub fn ui_prepare_node(handle: u64) -> u32;
291 pub fn ui_set_dynamic_text_charset(handle: u64, utf8_charset: *const u8, len: u32);
292 pub fn ui_get_text_metrics(
293 handle: u64,
294 out_width: *mut f32,
295 out_height: *mut f32,
296 out_baseline: *mut f32,
297 out_line_count: *mut u32,
298 out_max_line_width: *mut f32,
299 ) -> bool;
300 pub fn ui_grid_set_columns(handle: u64, count: u32, values: *const f32, types: *const u8);
301 pub fn ui_grid_set_rows(handle: u64, count: u32, values: *const f32, types: *const u8);
302 pub fn ui_grid_set_column_shared_size_group(
303 handle: u64,
304 index: u32,
305 utf8_group: *const u8,
306 len: u32,
307 );
308 pub fn ui_grid_set_row_shared_size_group(
309 handle: u64,
310 index: u32,
311 utf8_group: *const u8,
312 len: u32,
313 );
314 pub fn ui_node_set_grid_placement(child: u64, row: u32, col: u32, row_span: u32, col_span: u32);
315 pub fn ui_set_bg_color(handle: u64, color: u32);
316 pub fn ui_set_box_style(
317 handle: u64,
318 bg_color: u32,
319 radius_tl: f32,
320 radius_tr: f32,
321 radius_br: f32,
322 radius_bl: f32,
323 border_width: f32,
324 border_color: u32,
325 border_style_enum: u32,
326 border_dash_on: f32,
327 border_dash_off: f32,
328 );
329 pub fn ui_set_clip_to_bounds(handle: u64, clip: bool);
330 pub fn ui_set_linear_gradient(
331 handle: u64,
332 sx: f32,
333 sy: f32,
334 ex: f32,
335 ey: f32,
336 stop_count: u32,
337 offsets: *const f32,
338 colors: *const u32,
339 );
340 pub fn ui_set_drop_shadow(
341 handle: u64,
342 color: u32,
343 offset_x: f32,
344 offset_y: f32,
345 blur_sigma: f32,
346 spread: f32,
347 );
348 pub fn ui_set_layer_effect(handle: u64, opacity: f32, blur_sigma: f32, blend_mode_enum: u32);
349 pub fn ui_set_background_blur(handle: u64, blur_sigma: f32);
350 pub fn ui_set_image(
351 handle: u64,
352 texture_id: u32,
353 object_fit_enum: u32,
354 sampling_kind: u32,
355 max_aniso: u32,
356 );
357 pub fn ui_set_image_nine(
358 handle: u64,
359 texture_id: u32,
360 inset_l: f32,
361 inset_t: f32,
362 inset_r: f32,
363 inset_b: f32,
364 sampling_kind: u32,
365 max_aniso: u32,
366 );
367 pub fn ui_set_svg(
368 handle: u64,
369 svg_id: u32,
370 tint_color: u32,
371 sampling_kind: u32,
372 max_aniso: u32,
373 );
374 pub fn ui_set_text(handle: u64, utf8_str: *const u8, len: u32);
375 pub fn ui_set_text_style_runs(handle: u64, run_count: u32, runs_words: *const u32);
376 pub fn ui_set_font(handle: u64, font_id: u32, size: f32);
377 pub fn ui_set_line_height(handle: u64, line_height: f32);
378 pub fn ui_set_text_color(handle: u64, color: u32);
379 pub fn ui_set_text_align(handle: u64, align_enum: u32);
380 pub fn ui_set_text_vertical_align(handle: u64, align_enum: u32);
381 pub fn ui_set_text_limits(handle: u64, max_chars: i32, max_lines: i32);
382 pub fn ui_set_text_wrapping(handle: u64, wrap: bool);
383 pub fn ui_set_text_overflow(handle: u64, overflow_enum: u32);
384 pub fn ui_set_text_overflow_fade(handle: u64, horizontal: bool, vertical: bool);
385 pub fn ui_set_text_obscured(handle: u64, is_password: bool);
386 pub fn ui_measure_text(
387 utf8_str: *const u8,
388 len: u32,
389 font_id: u32,
390 size: f32,
391 max_width: f32,
392 out_width: *mut f32,
393 out_height: *mut f32,
394 );
395 pub fn ui_set_interactive(handle: u64, interactive: bool);
396 pub fn ui_set_preserve_selection_on_pointer_down(handle: u64, preserve: bool);
397 pub fn ui_set_editor_command_keys(handle: u64, enabled: bool);
398 pub fn ui_set_editor_accepts_tab(handle: u64, enabled: bool);
399 pub fn ui_set_scroll_proxy_target(handle: u64, scroll_handle: u64);
400 pub fn ui_set_scroll_enabled(handle: u64, enabled_x: bool, enabled_y: bool);
401 pub fn ui_set_scroll_friction(handle: u64, friction: f32);
402 pub fn ui_set_smooth_scrolling(handle: u64, smooth_scrolling: bool);
403 pub fn ui_set_focusable(handle: u64, focusable: bool, tab_index: i32);
404 pub fn ui_request_focus(handle: u64);
405 pub fn ui_set_scroll_offset(handle: u64, offset_x: f32, offset_y: f32);
406 pub fn ui_set_scroll_content_size(handle: u64, content_width: f32, content_height: f32);
407 pub fn ui_set_selectable(handle: u64, selectable: bool, selection_color: u32);
408 pub fn ui_set_selection_area(handle: u64, is_area: bool);
409 pub fn ui_set_selection_area_barrier(handle: u64, is_barrier: bool);
410 pub fn ui_clear_selection(text_node_handle: u64);
411 pub fn ui_retarget_selection(from_text_node_handle: u64, to_text_node_handle: u64);
412 pub fn ui_is_point_in_selection(logical_x: f32, logical_y: f32) -> bool;
413 pub fn ui_set_text_selection_range(handle: u64, selection_start: u32, selection_end: u32);
414 pub fn ui_select_word_at(handle: u64, logical_x: f32, logical_y: f32) -> bool;
415 pub fn ui_get_text_snapshot_handle_count() -> u32;
416 pub fn ui_copy_text_snapshot_handles(out_handle_words: *mut u32, max_handle_count: u32) -> u32;
417 pub fn ui_set_text_find_match(handle: u64, start: u32, end: u32) -> bool;
418 pub fn ui_clear_text_find_match();
419 pub fn ui_push_text_find_highlight(handle: u64, start: u32, end: u32, color: u32) -> bool;
420 pub fn ui_clear_text_find_highlights();
421 pub fn ui_get_accessibility_text_info(
422 handle: u64,
423 out_revision: *mut u64,
424 out_character_count: *mut u32,
425 out_selection_start: *mut u32,
426 out_selection_end: *mut u32,
427 out_flags: *mut u32,
428 ) -> bool;
429 pub fn ui_get_accessibility_text_range_utf8_length(
430 handle: u64,
431 revision: u64,
432 start_character: u32,
433 end_character: u32,
434 out_utf8_length: *mut u32,
435 ) -> u32;
436 pub fn ui_copy_accessibility_text_range_utf8(
437 handle: u64,
438 revision: u64,
439 start_character: u32,
440 end_character: u32,
441 out_utf8: *mut u8,
442 buffer_length: u32,
443 ) -> u32;
444 pub fn ui_get_accessibility_text_range_rect_count(
445 handle: u64,
446 revision: u64,
447 start_character: u32,
448 end_character: u32,
449 out_rect_count: *mut u32,
450 ) -> u32;
451 pub fn ui_copy_accessibility_text_range_rects(
452 handle: u64,
453 revision: u64,
454 start_character: u32,
455 end_character: u32,
456 out_rect_words: *mut f32,
457 max_rect_count: u32,
458 out_rect_count: *mut u32,
459 ) -> u32;
460 pub fn ui_set_accessibility_text_selection(
461 handle: u64,
462 revision: u64,
463 start_character: u32,
464 end_character: u32,
465 ) -> u32;
466 pub fn ui_reveal_accessibility_text_range(
467 handle: u64,
468 revision: u64,
469 start_character: u32,
470 end_character: u32,
471 ) -> u32;
472 pub fn ui_replace_accessibility_text_range(
473 handle: u64,
474 revision: u64,
475 start_character: u32,
476 end_character: u32,
477 replacement_utf8: *const u8,
478 replacement_length: u32,
479 out_revision: *mut u64,
480 ) -> u32;
481 pub fn ui_get_text_document_utf8_length(handle: u64) -> u32;
482 pub fn ui_copy_text_document_utf8(handle: u64, out_utf8: *mut u8, buffer_length: u32) -> bool;
483 pub fn ui_get_text_visible_bounds(
484 handle: u64,
485 out_x: *mut f32,
486 out_y: *mut f32,
487 out_width: *mut f32,
488 out_height: *mut f32,
489 ) -> bool;
490 pub fn ui_get_text_range_rect_count(handle: u64, start: u32, end: u32) -> u32;
491 pub fn ui_copy_text_range_rects(
492 handle: u64,
493 start: u32,
494 end: u32,
495 out_rect_words: *mut f32,
496 max_rect_count: u32,
497 ) -> u32;
498 pub fn ui_copy_cross_selection_endpoint_rects(
499 area_handle: u64,
500 out_rect_words: *mut f32,
501 ) -> bool;
502 pub fn ui_begin_selection_endpoint_drag(handle: u64, endpoint: u32) -> bool;
503 pub fn ui_preserves_selection_on_pointer_down(handle: u64) -> bool;
504 pub fn ui_reveal_text_range(handle: u64, start: u32, end: u32) -> bool;
505 pub fn ui_clear_current_selection();
506 pub fn ui_copy_current_selection();
507 pub fn ui_can_undo_text_edit(handle: u64) -> bool;
508 pub fn ui_can_redo_text_edit(handle: u64) -> bool;
509 pub fn ui_has_text_selection(handle: u64) -> bool;
510 pub fn ui_undo_text_edit(handle: u64);
511 pub fn ui_redo_text_edit(handle: u64);
512 pub fn ui_copy_text_selection(handle: u64);
513 pub fn ui_cut_text_selection(handle: u64);
514 pub fn ui_paste_text(handle: u64);
515 pub fn ui_select_all_text(handle: u64);
516 pub fn ui_set_editable(handle: u64, editable: bool);
517 pub fn ui_set_caret_color(handle: u64, color: u32);
518 pub fn ui_commit_frame();
519 pub fn ui_has_pending_visual_work() -> bool;
520 pub fn ui_needs_animation_frame() -> bool;
521 pub fn ui_has_pointer_autoscroll() -> bool;
522 pub fn ui_selection_autoscroll(logical_x: f32, logical_y: f32, edge_threshold: f32) -> u64;
523 pub fn ui_on_pointer_event(
524 event_enum: u32,
525 handle: u64,
526 logical_x: f32,
527 logical_y: f32,
528 pointer_id: i32,
529 pointer_type: u32,
530 button: i32,
531 buttons: u32,
532 pressure: f32,
533 width: f32,
534 height: f32,
535 click_count: i32,
536 modifiers: u32,
537 ) -> bool;
538 pub fn ui_on_wheel_event(delta_x: f32, delta_y: f32);
539 pub fn ui_touch_scroll_begin(handle: u64, logical_x: f32, logical_y: f32, timestamp_ms: f64);
540 pub fn ui_touch_scroll_update(delta_x: f32, delta_y: f32, timestamp_ms: f64);
541 pub fn ui_wheel_scroll_can_consume(delta_x: f32, delta_y: f32) -> bool;
542 pub fn ui_touch_scroll_can_consume(delta_x: f32, delta_y: f32) -> bool;
543 pub fn ui_touch_scroll_end(timestamp_ms: f64);
544 pub fn ui_clear_momentum_scroll();
545 pub fn ui_touch_scroll_allows_pull_to_refresh() -> bool;
546 pub fn ui_set_coarse_pointer_mode(coarse_pointer_mode: bool);
547 pub fn ui_set_platform_family(platform_family: u32);
548 pub fn ui_on_key_event(type_enum: u32, key_utf8: *const u8, len: u32, modifiers: u32) -> bool;
549 pub fn ui_set_interaction_time(interaction_time_ms: u64);
550 pub fn ui_on_ime_update(handle: u64, utf8_str: *const u8, len: u32, caret_idx: u32);
551 pub fn ui_replace_text_range(
552 handle: u64,
553 start_idx: u32,
554 end_idx: u32,
555 utf8_str: *const u8,
556 len: u32,
557 caret_idx: u32,
558 );
559 pub fn ui_on_paste_text(handle: u64, utf8_str: *const u8, len: u32);
560 pub fn ui_font_loaded(font_id: u32);
561 pub fn ui_register_icu_data(bytes: *const u8, len: u32);
562 pub fn ui_register_font_fallback(font_id: u32, fallback_font_id: u32);
563 pub fn ui_unregister_font_fallback(font_id: u32, fallback_font_id: u32) -> bool;
564 pub fn ui_unregister_font(font_id: u32) -> bool;
565 pub fn ui_set_root(handle: u64);
566 pub fn ui_resize_window(logical_w: f32, logical_h: f32);
567 pub fn ui_register_font(font_id: u32, bytes: *const u8, len: u32) -> bool;
568 pub fn ui_get_command_buffer(out_length: *mut u32) -> *mut u32;
569 pub fn ui_get_semantic_buffer(out_length: *mut u32) -> *mut u32;
570 pub fn ui_get_debug_tree_buffer(out_length: *mut u32) -> *mut u32;
571 pub fn ui_get_live_fallback_font_buffer(out_length: *mut u32) -> *mut u32;
572 pub fn ui_get_bounds(
573 handle: u64,
574 out_x: *mut f32,
575 out_y: *mut f32,
576 out_width: *mut f32,
577 out_height: *mut f32,
578 ) -> bool;
579 pub fn ui_get_focused_handle() -> u64;
580 pub fn ui_get_visible_bounds(
581 handle: u64,
582 out_x: *mut f32,
583 out_y: *mut f32,
584 out_width: *mut f32,
585 out_height: *mut f32,
586 ) -> bool;
587 pub fn ui_set_host_callbacks(callbacks: *const u32);
588}
589
590#[cfg(any(target_arch = "wasm32", feature = "native-runtime"))]
591#[cfg_attr(target_arch = "wasm32", link(wasm_import_module = "fui_host"))]
592unsafe extern "C" {
593 pub fn request_render();
594 pub fn get_viewport_width() -> f32;
595 pub fn get_viewport_height() -> f32;
596 pub fn get_device_pixel_ratio() -> f32;
597 pub fn fui_set_application_caption(captionPtr: usize, captionLen: u32);
598 pub fn fui_set_pointer_capture(handle: u64);
599 pub fn fui_release_pointer_capture();
600 pub fn fui_reload_page();
601 pub fn fui_can_navigate_back() -> bool;
602 pub fn fui_can_navigate_forward() -> bool;
603 pub fn fui_navigate_back();
604 pub fn fui_navigate_forward();
605 pub fn fui_copy_text(ptr: usize, len: u32);
606 pub fn fui_register_text_input_metadata(
607 handle: u64,
608 isPassword: bool,
609 hintPtr: usize,
610 hintLen: u32,
611 );
612 pub fn fui_has_text_selection_snapshot(handle: u64) -> bool;
613 pub fn fui_freeze_text_selection_snapshot(handle: u64);
614 pub fn fui_copy_text_selection_snapshot(handle: u64) -> bool;
615 pub fn fui_cut_focused_text_selection() -> bool;
616 pub fn fui_cut_text_selection_snapshot(handle: u64) -> bool;
617 pub fn fui_cut_text_range_snapshot(handle: u64, start: u32, end: u32) -> bool;
618 pub fn fui_delete_focused_text_range(start: u32, end: u32) -> bool;
619 pub fn fui_commit_text_action_focus(handle: u64);
620 pub fn fui_load_svg(svgId: u32, ptr: usize, len: u32);
621 pub fn fui_load_texture(textureId: u32, ptr: usize, len: u32);
622 pub fn fui_release_svg(svgId: u32);
623 pub fn fui_release_texture(textureId: u32);
624 pub fn fui_bitmap_commit(
625 textureId: u32,
626 bytesPtr: usize,
627 bytesLen: u32,
628 width: u32,
629 height: u32,
630 );
631 pub fn fui_bitmap_commit_dirty(
632 textureId: u32,
633 bytesPtr: usize,
634 bytesLen: u32,
635 fullW: u32,
636 fullH: u32,
637 subX: u32,
638 subY: u32,
639 subW: u32,
640 subH: u32,
641 );
642 pub fn fui_bitmap_release(textureId: u32);
643 pub fn fui_render_node_to_rgba(
644 handle: u64,
645 width: u32,
646 height: u32,
647 outPtr: usize,
648 outCapacity: u32,
649 scale: f32,
650 x: f32,
651 y: f32,
652 ) -> u32;
653 pub fn fui_load_font(fontId: u32, ptr: usize, len: u32);
654 pub fn fui_start_timer(timerId: u32, delayMs: i32);
655 pub fn fui_cancel_timer(timerId: u32);
656 pub fn fui_set_cursor(style: u32);
657 pub fn fui_is_dark_mode() -> bool;
658 pub fn fui_get_accent_color() -> u32;
659 pub fn fui_get_platform_family() -> u32;
660 pub fn fui_get_host_environment() -> u32;
661 pub fn fui_get_host_capabilities() -> u32;
662 pub fn fui_is_coarse_pointer() -> bool;
663 pub fn fui_show_url_preview(ptr: usize, len: u32);
664 pub fn fui_hide_url_preview();
665 pub fn fui_navigate_to(ptr: usize, len: u32, openInNewTab: bool);
666 pub fn fui_set_persisted_scroll_offset(nodeIdPtr: usize, nodeIdLen: u32, x: f32, y: f32);
667 pub fn fui_try_get_persisted_scroll_offset(
668 nodeIdPtr: usize,
669 nodeIdLen: u32,
670 outX: usize,
671 outY: usize,
672 ) -> bool;
673 pub fn fui_set_persisted_state(
674 nodeIdPtr: usize,
675 nodeIdLen: u32,
676 kindPtr: usize,
677 kindLen: u32,
678 version: u32,
679 payloadPtr: usize,
680 payloadLen: u32,
681 );
682 pub fn fui_copy_persisted_state(
683 nodeIdPtr: usize,
684 nodeIdLen: u32,
685 kindPtr: usize,
686 kindLen: u32,
687 outVersionPtr: usize,
688 payloadPtr: usize,
689 payloadCapacity: u32,
690 ) -> i32;
691 pub fn fui_log(categoryPtr: usize, catLen: u32, msgPtr: usize, msgLen: u32);
692 pub fn fui_logs_enabled() -> bool;
693 pub fn fui_worker_start_string(
694 workerId: u32,
695 wasmPathPtr: usize,
696 wasmPathLen: u32,
697 entryPtr: usize,
698 entryLen: u32,
699 inputPtr: usize,
700 inputLen: u32,
701 );
702 pub fn fui_worker_cancel(workerId: u32);
703 pub fn fui_file_capabilities() -> u32;
704 pub fn fui_file_pick(requestId: u32, acceptPtr: usize, acceptLen: u32, multiple: bool);
705 pub fn fui_file_read_chunk(
706 requestId: u32,
707 fileIdPtr: usize,
708 fileIdLen: u32,
709 offsetBytes: u64,
710 maxBytes: u32,
711 );
712 pub fn fui_file_save_text(
713 requestId: u32,
714 suggestedNamePtr: usize,
715 suggestedNameLen: u32,
716 mimeTypePtr: usize,
717 mimeTypeLen: u32,
718 fileExtensionPtr: usize,
719 fileExtensionLen: u32,
720 textPtr: usize,
721 textLen: u32,
722 );
723 pub fn fui_file_save_bytes(
724 requestId: u32,
725 suggestedNamePtr: usize,
726 suggestedNameLen: u32,
727 mimeTypePtr: usize,
728 mimeTypeLen: u32,
729 fileExtensionPtr: usize,
730 fileExtensionLen: u32,
731 bytesPtr: usize,
732 bytesLen: u32,
733 );
734 pub fn fui_file_create_writer(
735 requestId: u32,
736 suggestedNamePtr: usize,
737 suggestedNameLen: u32,
738 mimeTypePtr: usize,
739 mimeTypeLen: u32,
740 fileExtensionPtr: usize,
741 fileExtensionLen: u32,
742 );
743 pub fn fui_file_writer_write_text(
744 requestId: u32,
745 writerIdPtr: usize,
746 writerIdLen: u32,
747 textPtr: usize,
748 textLen: u32,
749 );
750 pub fn fui_file_writer_write_bytes(
751 requestId: u32,
752 writerIdPtr: usize,
753 writerIdLen: u32,
754 bytesPtr: usize,
755 bytesLen: u32,
756 );
757 pub fn fui_file_writer_finish(requestId: u32, writerIdPtr: usize, writerIdLen: u32);
758 pub fn fui_file_process_worker_start(
759 requestId: u32,
760 workerWasmPathPtr: usize,
761 workerWasmPathLen: u32,
762 workerEntryPtr: usize,
763 workerEntryLen: u32,
764 fileIdPtr: usize,
765 fileIdLen: u32,
766 suggestedNamePtr: usize,
767 suggestedNameLen: u32,
768 chunkBytes: u32,
769 saveToPickedFile: bool,
770 );
771 pub fn fui_file_process_worker_cancel(requestId: u32);
772 pub fn fui_canvas_save(canvasPtr: usize);
773 pub fn fui_canvas_restore(canvasPtr: usize);
774 pub fn fui_canvas_translate(canvasPtr: usize, x: f32, y: f32);
775 pub fn fui_canvas_scale(canvasPtr: usize, sx: f32, sy: f32);
776 pub fn fui_canvas_rotate(canvasPtr: usize, degrees: f32);
777 pub fn fui_canvas_clip_rect(canvasPtr: usize, x: f32, y: f32, w: f32, h: f32);
778 pub fn fui_canvas_clip_round_rect(
779 canvasPtr: usize,
780 x: f32,
781 y: f32,
782 w: f32,
783 h: f32,
784 topLeft: f32,
785 topRight: f32,
786 bottomRight: f32,
787 bottomLeft: f32,
788 );
789 pub fn fui_canvas_draw_rect(
790 canvasPtr: usize,
791 x: f32,
792 y: f32,
793 w: f32,
794 h: f32,
795 fillColor: u32,
796 strokeColor: u32,
797 strokeWidth: f32,
798 );
799 pub fn fui_canvas_draw_circle(
800 canvasPtr: usize,
801 cx: f32,
802 cy: f32,
803 radius: f32,
804 fillColor: u32,
805 strokeColor: u32,
806 strokeWidth: f32,
807 );
808 pub fn fui_canvas_draw_line(
809 canvasPtr: usize,
810 x1: f32,
811 y1: f32,
812 x2: f32,
813 y2: f32,
814 color: u32,
815 strokeWidth: f32,
816 );
817 pub fn fui_canvas_draw_round_rect(
818 canvasPtr: usize,
819 x: f32,
820 y: f32,
821 w: f32,
822 h: f32,
823 rx: f32,
824 ry: f32,
825 fillColor: u32,
826 strokeColor: u32,
827 strokeWidth: f32,
828 );
829 pub fn fui_path_create() -> u32;
830 pub fn fui_path_destroy(pathId: u32);
831 pub fn fui_path_move_to(pathId: u32, x: f32, y: f32);
832 pub fn fui_path_line_to(pathId: u32, x: f32, y: f32);
833 pub fn fui_path_quad_to(pathId: u32, cx: f32, cy: f32, x: f32, y: f32);
834 pub fn fui_path_cubic_to(pathId: u32, cx1: f32, cy1: f32, cx2: f32, cy2: f32, x: f32, y: f32);
835 pub fn fui_path_close(pathId: u32);
836 pub fn fui_path_add_rect(pathId: u32, x: f32, y: f32, w: f32, h: f32);
837 pub fn fui_path_add_circle(pathId: u32, cx: f32, cy: f32, r: f32);
838 pub fn fui_canvas_draw_path(
839 canvasPtr: usize,
840 pathId: u32,
841 fillColor: u32,
842 strokeColor: u32,
843 strokeWidth: f32,
844 );
845 pub fn fui_canvas_draw_text_node(
846 canvasPtr: usize,
847 handleLo: u32,
848 handleHi: u32,
849 x: f32,
850 y: f32,
851 );
852 pub fn fui_canvas_draw_image(
853 canvasPtr: usize,
854 textureId: u32,
855 x: f32,
856 y: f32,
857 w: f32,
858 h: f32,
859 samplingKind: u32,
860 maxAniso: u32,
861 );
862 pub fn fui_canvas_draw_svg(canvasPtr: usize, svgId: u32, x: f32, y: f32, w: f32, h: f32);
863 pub fn fui_canvas_draw_batch(canvasPtr: usize, wordsPtr: usize, wordCount: u32);
864 pub fn fui_canvas_create_offscreen(width: u32, height: u32) -> u32;
865 pub fn fui_canvas_get_offscreen_ptr(offscreenId: u32) -> usize;
866 pub fn fui_canvas_read_offscreen_pixels(
867 offscreenId: u32,
868 outPtr: usize,
869 width: u32,
870 height: u32,
871 );
872 pub fn fui_canvas_destroy_offscreen(offscreenId: u32);
873}
874
875#[cfg(any(target_arch = "wasm32", feature = "native-runtime"))]
876#[cfg_attr(target_arch = "wasm32", link(wasm_import_module = "fui_fetch_host"))]
877unsafe extern "C" {
878 pub fn fui_fetch_start(
879 requestId: u32,
880 methodPtr: usize,
881 methodLen: u32,
882 urlPtr: usize,
883 urlLen: u32,
884 headersPtr: usize,
885 headersLen: u32,
886 bodyPtr: usize,
887 bodyLen: u32,
888 );
889 pub fn fui_fetch_cancel(requestId: u32);
890}