objc2_ui_kit/generated/UILetterformAwareAdjusting.rs
1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use objc2::__framework_prelude::*;
5
6use crate::*;
7
8/// Background
9///
10/// When fonts created with `+[UIFont preferredFontForTextStyle:]` are used, UILabel, UITextField, and nonscrollable
11/// UITextView will increase the height calculated in `-sizeThatFits:` and `-intrinsicContentSize` in the presence
12/// of tall scripts.
13///
14/// Even with this increase, there will be some extreme ascenders and descenders that extend beyond this height.
15///
16/// Furthermore, this increase only occurs for the text-style fonts, so for non-text-style fonts such cases will be markedly more common.
17///
18/// See also [Apple's documentation](https://developer.apple.com/documentation/uikit/uiletterformawaresizingrule?language=objc)
19// NS_ENUM
20#[repr(transparent)]
21#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
22pub struct UILetterformAwareSizingRule(pub NSInteger);
23impl UILetterformAwareSizingRule {
24 /// `UILetterformAwareSizingRuleTypographic`: `-sizeThatFits:` and `-intrinsicContentSize` results will work well for typographic alignment of edges and centers of the view frames, but extreme ascenders or descenders in tall scripts may not be accounted for
25 #[doc(alias = "UILetterformAwareSizingRuleTypographic")]
26 pub const Typographic: Self = Self(0);
27 /// `UILetterformAwareSizingRuleOversize`: `-sizeThatFits:` and `-intrinsicContentSize` results will account for extreme ascenders or descenders in tall scripts, but in such cases might not work well for typographic alignment of top and bottom edges and vertical centers of the view frames
28 #[doc(alias = "UILetterformAwareSizingRuleOversize")]
29 pub const Oversize: Self = Self(1);
30}
31
32unsafe impl Encode for UILetterformAwareSizingRule {
33 const ENCODING: Encoding = NSInteger::ENCODING;
34}
35
36unsafe impl RefEncode for UILetterformAwareSizingRule {
37 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_protocol!(
41 /// [Apple's documentation](https://developer.apple.com/documentation/uikit/uiletterformawareadjusting?language=objc)
42 pub unsafe trait UILetterformAwareAdjusting: NSObjectProtocol + MainThreadOnly {
43 /// `sizingRule` defaults to `UILetterformAwareSizingRuleTypographic` and determines what rule is used during the calculation of `-sizeThatFits:` and `-intrinsicContentSize`
44 #[unsafe(method(sizingRule))]
45 #[unsafe(method_family = none)]
46 fn sizingRule(&self) -> UILetterformAwareSizingRule;
47
48 /// Setter for [`sizingRule`][Self::sizingRule].
49 #[unsafe(method(setSizingRule:))]
50 #[unsafe(method_family = none)]
51 fn setSizingRule(&self, sizing_rule: UILetterformAwareSizingRule);
52 }
53);