use objc::runtime::*;
use objc::*;
use crate::coregraphics::CGFloat;
use crate::Raw;
pub struct UIFont {
object: *mut Object,
}
impl UIFont {
pub fn system_font_of_size(size: CGFloat) -> UIFont {
unsafe { UIFont::from_raw_retain(msg_send![class!(UIFont), systemFontOfSize: size]) }
}
pub fn bold_system_font_of_size(size: CGFloat) -> UIFont {
unsafe { UIFont::from_raw_retain(msg_send![class!(UIFont), boldSystemFontOfSize: size]) }
}
}
unsafe impl Send for UIFont {}
unsafe impl Sync for UIFont {}
impl Raw for UIFont {
unsafe fn from_raw(object: *mut Object) -> Self {
UIFont { object }
}
unsafe fn as_raw(&self) -> *mut Object {
self.object
}
}
impl Clone for UIFont {
fn clone(&self) -> Self {
unsafe { UIFont::from_raw_retain(self.as_raw()) }
}
}
impl Drop for UIFont {
fn drop(&mut self) {
unsafe { objc_release(self.object) }
}
}