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