use super::*;
use std::fmt;
#[cfg(target_family = "windows")]
pub type fmx_int64 = i64;
#[cfg(target_family = "unix")]
pub type fmx_int64 = i32;
#[cfg(target_family = "windows")]
pub type fmx_uint64 = u64;
#[cfg(target_family = "unix")]
pub type fmx_uint64 = u32;
#[cfg(target_family = "windows")]
pub type fmx_unusedid = i16;
#[cfg(target_family = "unix")]
pub type fmx_unusedid = i32;
pub type fmx_ptrtype = u64;
pub type fmx_ExternCallSwitch = u8;
pub type fmx_ScriptControl = u8;
pub type fmx_IdleLevel = u8;
pub type fmx_ExternCallProc = Option<unsafe extern "C" fn(arg1: *mut fmx_ExternCallStruct)>;
pub type fmx_CurrentEnvCall = Option<unsafe extern "C" fn(env: *mut fmx_ExprEnv) -> FMError>;
pub type fmx_fontface = u16;
pub type fmx_fontid = u16;
pub type fmx_fontsize = u16;
pub type fmx_colorchannel = u8;
pub type fmx_colorchannel16 = u16;
pub type fmx_fontscript = u16;
pub type fmx_ExtPluginType = Option<
extern "C" fn(
functionId: i16,
env: *const fmx_ExprEnv,
parms: *const fmx_DataVect,
result: *mut fmx_Data,
) -> FMError,
>;
pub type fmx_StartScriptCall = Option<
unsafe extern "C" fn(
fileName: *const fmx_Text,
scriptName: *const fmx_Text,
control: ScriptControl,
parameter: *const fmx_Data,
) -> FMError,
>;
#[derive(Debug, Clone, Copy)]
#[repr(i8)]
pub enum fmx_boolean {
False = 0,
True = 1,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct fmx_Locale {
_address: u8,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct fmx_QuadChar {
_address: u8,
}
#[cfg_attr(target_os = "macos", link(kind = "framework", name = "FMWrapper"))]
#[cfg_attr(target_os = "windows", link(kind = "static", name = "FMWrapper"))]
#[cfg_attr(target_os = "linux", link(kind = "dylib", name = "FMWrapper"))]
extern "C" {
#[allow(dead_code)]
fn FM_QuadChar_Constructor1(_x: *mut fmx__fmxcpt) -> *mut fmx_QuadChar;
fn FM_QuadChar_Constructor2(
c0: i8,
c1: i8,
c2: i8,
c3: i8,
_x: *mut fmx__fmxcpt,
) -> *mut fmx_QuadChar;
#[allow(dead_code)]
fn FM_QuadChar_Constructor3(
value: *const fmx_QuadChar,
_x: *mut fmx__fmxcpt,
) -> *mut fmx_QuadChar;
#[allow(dead_code)]
fn FM_QuadChar_operatorAS(
_self: *mut fmx_QuadChar,
value: *const fmx_QuadChar,
_x: *mut fmx__fmxcpt,
) -> *const fmx_QuadChar;
#[allow(dead_code)]
fn FM_QuadChar_operatorAR(_self: *mut fmx_QuadChar, i: i32, _x: *mut fmx__fmxcpt) -> u8;
#[allow(dead_code)]
fn FM_QuadChar_operatorCAR(_self: *const fmx_QuadChar, i: i32, _x: *mut fmx__fmxcpt) -> u8;
#[allow(dead_code)]
fn FM_QuadChar_operatorEQ(
_self: *const fmx_QuadChar,
value: *const fmx_QuadChar,
_x: *mut fmx__fmxcpt,
) -> bool;
#[allow(dead_code)]
fn FM_QuadChar_operatorNE(
_self: *const fmx_QuadChar,
value: *const fmx_QuadChar,
_x: *mut fmx__fmxcpt,
) -> bool;
#[allow(dead_code)]
fn FM_QuadChar_operatorLT(
_self: *const fmx_QuadChar,
value: *const fmx_QuadChar,
_x: *mut fmx__fmxcpt,
) -> bool;
#[allow(dead_code)]
fn FM_QuadChar_operatorLE(
_self: *const fmx_QuadChar,
value: *const fmx_QuadChar,
_x: *mut fmx__fmxcpt,
) -> bool;
#[allow(dead_code)]
fn FM_QuadChar_operatorGT(
_self: *const fmx_QuadChar,
value: *const fmx_QuadChar,
_x: *mut fmx__fmxcpt,
) -> bool;
#[allow(dead_code)]
fn FM_QuadChar_operatorGE(
_self: *const fmx_QuadChar,
value: *const fmx_QuadChar,
_x: *mut fmx__fmxcpt,
) -> bool;
#[allow(dead_code)]
fn FM_QuadChar_GetMacType(_self: *const fmx_QuadChar, _x: *mut fmx__fmxcpt) -> u32;
#[allow(dead_code)]
fn FM_QuadChar_SetMacType(_self: *mut fmx_QuadChar, value: u32, _x: *mut fmx__fmxcpt);
fn FM_QuadChar_Delete(_self: *mut fmx_QuadChar, _x: *mut fmx__fmxcpt);
fn FM_Locale_Delete(_self: *mut fmx_Locale, _x: *mut fmx__fmxcpt);
fn FM_Locale_Constructor1(inputType: LocaleType, _x: *mut fmx__fmxcpt) -> *mut fmx_Locale;
#[allow(dead_code)]
fn FM_Locale_operatorAS(
_self: *mut fmx_Locale,
rhs: *const fmx_Locale,
_x: *mut fmx__fmxcpt,
) -> *mut fmx_Locale;
}
pub struct Locale {
pub(crate) ptr: *mut fmx_Locale,
drop: bool,
}
impl Locale {
pub fn new(input_type: LocaleType) -> Self {
let mut _x = fmx__fmxcpt::new();
let ptr = unsafe { FM_Locale_Constructor1(input_type, &mut _x) };
_x.check();
Self { ptr, drop: true }
}
pub fn from_ptr(ptr: *const fmx_Locale) -> Self {
Self {
ptr: ptr as *mut fmx_Locale,
drop: false,
}
}
}
impl Drop for Locale {
fn drop(&mut self) {
if self.drop {
let mut _x = fmx__fmxcpt::new();
unsafe { FM_Locale_Delete(self.ptr, &mut _x) };
_x.check();
}
}
}
impl Default for Locale {
fn default() -> Self {
Locale::new(LocaleType::System)
}
}
pub struct QuadChar {
pub(crate) ptr: *mut fmx_QuadChar,
drop: bool,
}
impl QuadChar {
pub fn new(bytes: &[u8; 4]) -> Self {
let mut _x = fmx__fmxcpt::new();
let b: &[i8; 4] = unsafe { &*(bytes as *const [u8; 4] as *const [i8; 4]) };
let ptr = unsafe { FM_QuadChar_Constructor2(b[0], b[1], b[2], b[3], &mut _x) };
_x.check();
Self { ptr, drop: true }
}
pub fn empty() -> Self {
let mut _x = fmx__fmxcpt::new();
let ptr = unsafe { FM_QuadChar_Constructor1(&mut _x) };
_x.check();
Self { ptr, drop: true }
}
}
impl Drop for QuadChar {
fn drop(&mut self) {
if self.drop {
let mut _x = fmx__fmxcpt::new();
unsafe { FM_QuadChar_Delete(self.ptr, &mut _x) };
_x.check();
}
}
}
#[repr(i32)]
pub enum LocaleType {
None = 0, System = 1, UnicodeRaw = 2, UnicodeStandard = 3, Catalog = 4, CAT = 16, HRV = 17, CES = 18, DAN = 19, NLD = 20, ENG = 21, FIN = 22, FINFMI = 23, FRA = 24, DEU = 25, DEUDictionary = 26, ELL = 27, HUN = 28, ISL = 29, ITA = 30, JPN = 31, NOR = 32, POL = 33, POR = 34, RON = 35, RUS = 36, SLK = 37, SLV = 38, SPA = 39, SPATraditional = 40, SWE = 41, SWEFMI = 42, TUR = 43, UKR = 44,
CHI = 45, CHIStroke = 46,
KOR = 76,
HE = 47, HI = 48, AR = 49, ET = 50, LT = 51, LV = 52, SR = 53, FA = 54, BG = 55, VI = 56, TH = 57, ELLMixed = 58, BEN = 59, TEL = 60, MAR = 61, TAM = 62, GUJ = 63, KAN = 64, MAL = 65, PAN = 67,
ORI = 66, SIN = 68, URD = 69, DIV = 70, BUR = 71, SAN = 72, LAO = 73, KHM = 74, BOD = 75,
Invalid = 0xFFFF,
}
impl fmt::Display for QuadChar {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let mut _x = fmx__fmxcpt::new();
let mut bytes: Vec<u8> = Vec::with_capacity(4);
for i in 0..4 {
let c = unsafe { FM_QuadChar_operatorAR(self.ptr, i, &mut _x) };
bytes.push(c);
_x.check();
}
let str = unsafe { String::from_utf8_unchecked(bytes) };
write!(f, "{}", str)
}
}