use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub const NSShowControlGlyphs: c_uint = 1 << 0;
pub const NSShowInvisibleGlyphs: c_uint = 1 << 1;
pub const NSWantsBidiLevels: c_uint = 1 << 2;
extern_protocol!(
pub unsafe trait NSGlyphStorage {
#[cfg(feature = "NSFont")]
#[unsafe(method(insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:))]
#[unsafe(method_family = none)]
unsafe fn insertGlyphs_length_forStartingGlyphAtIndex_characterIndex(
&self,
glyphs: NonNull<NSGlyph>,
length: NSUInteger,
glyph_index: NSUInteger,
char_index: NSUInteger,
);
#[unsafe(method(setIntAttribute:value:forGlyphAtIndex:))]
#[unsafe(method_family = none)]
fn setIntAttribute_value_forGlyphAtIndex(
&self,
attribute_tag: NSInteger,
val: NSInteger,
glyph_index: NSUInteger,
);
#[unsafe(method(attributedString))]
#[unsafe(method_family = none)]
fn attributedString(&self) -> Retained<NSAttributedString>;
#[unsafe(method(layoutOptions))]
#[unsafe(method_family = none)]
fn layoutOptions(&self) -> NSUInteger;
}
);
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSGlyphGenerator;
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSGlyphGenerator {}
);
impl NSGlyphGenerator {
extern_methods!(
#[unsafe(method(generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex:))]
#[unsafe(method_family = none)]
pub unsafe fn generateGlyphsForGlyphStorage_desiredNumberOfCharacters_glyphIndex_characterIndex(
&self,
glyph_storage: &ProtocolObject<dyn NSGlyphStorage>,
n_chars: NSUInteger,
glyph_index: *mut NSUInteger,
char_index: *mut NSUInteger,
);
#[unsafe(method(sharedGlyphGenerator))]
#[unsafe(method_family = none)]
pub fn sharedGlyphGenerator() -> Retained<NSGlyphGenerator>;
);
}
impl NSGlyphGenerator {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSGlyphGenerator {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}