YrXtals/include/yr_xtals.h

69 lines
2.6 KiB
C

#ifndef YR_XTALS_H
#define YR_XTALS_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
typedef struct ViewportHandle ViewportHandle;
/// Owns the iOS view's wgpu surface, iced renderer, and App state.
struct ViewportHandle *viewport_create(void *uiview, float width, float height, float scale);
void viewport_destroy(struct ViewportHandle *handle);
void viewport_render(struct ViewportHandle *handle);
void viewport_resize(struct ViewportHandle *handle, float width, float height, float scale);
/// pushes a single-pointer touch event with implicit-Left button into the iced runtime.
void viewport_touch_event(struct ViewportHandle *handle,
float x,
float y,
bool pressed,
bool moved);
void viewport_key_event(struct ViewportHandle *handle,
uint32_t key,
uint32_t modifiers,
bool pressed,
const char *text);
/// drains the pending-picker flag (0 none, 1 folder, 2 file) and returns the prior value.
uint8_t viewport_take_pending_pick(struct ViewportHandle *handle);
void viewport_apply_picked_folder(struct ViewportHandle *handle, const char *path);
void viewport_apply_picked_file(struct ViewportHandle *handle, const char *path);
void viewport_apply_picked_files(struct ViewportHandle *handle,
const char *const *paths,
size_t count);
/// drives the import progress bar, cleared by total=0.
void viewport_set_library_progress(struct ViewportHandle *handle,
uint32_t current,
uint32_t total);
/// pushes parallel arrays of placeholder titles and track-number tags (0 = unknown) into the sidebar.
void viewport_set_pending_titles(struct ViewportHandle *handle,
const char *const *titles,
const uint32_t *track_numbers,
size_t count);
/// fills in the file path of a pending track once export finishes.
void viewport_set_track_path(struct ViewportHandle *handle,
size_t idx,
const char *path);
/// pushes JPEG/PNG artwork bytes for a track through the art decode thread.
void viewport_set_track_art(struct ViewportHandle *handle,
size_t idx,
const uint8_t *bytes,
size_t len);
void viewport_free_string(char *s);
#endif