#![allow(
non_camel_case_types,
non_snake_case,
non_upper_case_globals,
)]
macro_rules! reexport {
($krate:ident) => {
pub mod $krate {
#,
").",
)]
pub use ::$krate::*;
}
};
}
reexport!(libc);
use ::libc::tm;
macro_rules! include_bindings {
($name:literal) => {
include!(concat!(env!("OUT_DIR"), "/", $name, ".rs"));
};
}
include_bindings!("bindings");
include_bindings!("bindings-control-sigs");
pub mod platform {
macro_rules! def_platform {
(
mod: $mod:tt,
platform: $platform:literal,
header: $header:literal,
os: $os:literal
$(
, prelude: {
$($prelude_item:item)*
}
)? $(,)?
) => {
#[doc = concat!("Additional features available on ", $platform, " platforms.")]
#[cfg(target_os = $os)]
pub mod $mod {
use crate::*;
$(
$($prelude_item)*
)?
include_bindings!($header);
}
};
}
def_platform! {
mod: darwin,
platform: "Darwin",
header: "bindings-darwin",
os: "macos",
prelude: {
reexport!(objc);
use ::objc::runtime::BOOL;
macro_rules! def_classes {
($($name:ident)*) => {
$(
pub type $name = ::objc::runtime::Object;
)*
};
}
def_classes! {
NSControl
NSString
NSView
}
pub type NSInteger = libc::c_long;
pub type NSUInteger = libc::c_ulong;
pub type NSControlSize = NSUInteger;
pub type NSLayoutConstraintOrientation = NSInteger;
pub type NSLayoutPriority = libc::c_float;
#[cfg(target_pointer_width = "64")]
pub type CGFloat = libc::c_double;
#[cfg(not(target_pointer_width = "64"))]
pub type CGFloat = libc::c_float;
},
}
def_platform! {
mod: unix,
platform: "Unix",
header: "bindings-unix",
os: "linux",
prelude: {
reexport!(glib_sys);
reexport!(gtk_sys);
use ::glib_sys::gboolean;
use ::gtk_sys::GtkContainer;
},
}
def_platform! {
mod: windows,
platform: "Windows",
header: "bindings-windows",
os: "windows",
prelude: {
reexport!(windows_sys);
use ::windows_sys::Win32::Foundation::{
BOOL,
HINSTANCE,
HWND,
RECT,
};
pub type DWORD = libc::c_ulong;
pub type LONG = libc::c_long;
pub type LONG_PTR = isize;
pub type LPCWSTR = *const WCHAR;
pub type LPVOID = *mut libc::c_void;
pub type WCHAR = libc::wchar_t;
},
}
}