use crate::command::{ExitDir, Side};
use crate::doc::Document;
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Rect {
pub x: f64,
pub y: f64,
pub width: f64,
pub height: f64,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct Metrics {
pub width: f64,
pub height: f64,
pub baseline: f64,
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct HostObject {
pub token: u32,
pub rect: Rect,
}
pub struct RenderOutput {
pub ir: mathtex_ir::Fragment,
pub caret: Rect,
pub selection: Vec<Rect>,
pub placeholders: Vec<Rect>,
pub metrics: Metrics,
pub menu: Option<crate::menu::MenuView>,
pub host_objects: Vec<HostObject>,
}
pub trait Host {
fn typeset(&self, latex: &str) -> mathtex_ir::Fragment;
fn on_change(&self, doc: &Document);
fn on_exit(&self, dir: ExitDir);
fn request_close(&self);
fn on_render(&self);
fn on_object_enter(&self, token: u32, side: Side) -> bool {
let _ = (token, side);
false
}
}