Skip to content

Commit

Permalink
Add AppKit bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Oct 9, 2022
1 parent 5cc9a04 commit 420f9a0
Show file tree
Hide file tree
Showing 274 changed files with 29,943 additions and 1 deletion.
1 change: 1 addition & 0 deletions header-translator/framework-includes.h
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
5 changes: 5 additions & 0 deletions icrate/src/AppKit/generated/AppKitDefines.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
use crate::Foundation::generated::NSObjCRuntime::*;
#[allow(unused_imports)]
use objc2::rc::{Id, Shared};
#[allow(unused_imports)]
use objc2::{extern_class, extern_methods, ClassType};
6 changes: 6 additions & 0 deletions icrate/src/AppKit/generated/AppKitErrors.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
use crate::AppKit::generated::AppKitDefines::*;
use crate::Foundation::generated::NSObject::*;
#[allow(unused_imports)]
use objc2::rc::{Id, Shared};
#[allow(unused_imports)]
use objc2::{extern_class, extern_methods, ClassType};
165 changes: 165 additions & 0 deletions icrate/src/AppKit/generated/NSATSTypesetter.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
use crate::AppKit::generated::NSParagraphStyle::*;
use crate::AppKit::generated::NSTypesetter::*;
#[allow(unused_imports)]
use objc2::rc::{Id, Shared};
#[allow(unused_imports)]
use objc2::{extern_class, extern_methods, ClassType};
extern_class!(
#[derive(Debug)]
pub struct NSATSTypesetter;
unsafe impl ClassType for NSATSTypesetter {
type Super = NSTypesetter;
}
);
extern_methods!(
unsafe impl NSATSTypesetter {
#[method_id(sharedTypesetter)]
pub unsafe fn sharedTypesetter() -> Id<NSATSTypesetter, Shared>;
}
);
extern_methods!(
#[doc = "NSPantherCompatibility"]
unsafe impl NSATSTypesetter {
#[method(lineFragmentRectForProposedRect:remainingRect:)]
pub unsafe fn lineFragmentRectForProposedRect_remainingRect(
&self,
proposedRect: NSRect,
remainingRect: NSRectPointer,
) -> NSRect;
}
);
extern_methods!(
#[doc = "NSPrimitiveInterface"]
unsafe impl NSATSTypesetter {
#[method(usesFontLeading)]
pub unsafe fn usesFontLeading(&self) -> bool;
#[method(setUsesFontLeading:)]
pub unsafe fn setUsesFontLeading(&self, usesFontLeading: bool);
#[method(typesetterBehavior)]
pub unsafe fn typesetterBehavior(&self) -> NSTypesetterBehavior;
#[method(setTypesetterBehavior:)]
pub unsafe fn setTypesetterBehavior(&self, typesetterBehavior: NSTypesetterBehavior);
#[method(hyphenationFactor)]
pub unsafe fn hyphenationFactor(&self) -> c_float;
#[method(setHyphenationFactor:)]
pub unsafe fn setHyphenationFactor(&self, hyphenationFactor: c_float);
#[method(lineFragmentPadding)]
pub unsafe fn lineFragmentPadding(&self) -> CGFloat;
#[method(setLineFragmentPadding:)]
pub unsafe fn setLineFragmentPadding(&self, lineFragmentPadding: CGFloat);
#[method_id(substituteFontForFont:)]
pub unsafe fn substituteFontForFont(&self, originalFont: &NSFont) -> Id<NSFont, Shared>;
#[method_id(textTabForGlyphLocation:writingDirection:maxLocation:)]
pub unsafe fn textTabForGlyphLocation_writingDirection_maxLocation(
&self,
glyphLocation: CGFloat,
direction: NSWritingDirection,
maxLocation: CGFloat,
) -> Option<Id<NSTextTab, Shared>>;
#[method(bidiProcessingEnabled)]
pub unsafe fn bidiProcessingEnabled(&self) -> bool;
#[method(setBidiProcessingEnabled:)]
pub unsafe fn setBidiProcessingEnabled(&self, bidiProcessingEnabled: bool);
#[method_id(attributedString)]
pub unsafe fn attributedString(&self) -> Option<Id<NSAttributedString, Shared>>;
#[method(setAttributedString:)]
pub unsafe fn setAttributedString(&self, attributedString: Option<&NSAttributedString>);
#[method(setParagraphGlyphRange:separatorGlyphRange:)]
pub unsafe fn setParagraphGlyphRange_separatorGlyphRange(
&self,
paragraphRange: NSRange,
paragraphSeparatorRange: NSRange,
);
#[method(paragraphGlyphRange)]
pub unsafe fn paragraphGlyphRange(&self) -> NSRange;
#[method(paragraphSeparatorGlyphRange)]
pub unsafe fn paragraphSeparatorGlyphRange(&self) -> NSRange;
#[method(layoutParagraphAtPoint:)]
pub unsafe fn layoutParagraphAtPoint(
&self,
lineFragmentOrigin: NonNull<NSPoint>,
) -> NSUInteger;
#[method(lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:)]
pub unsafe fn lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
&self,
glyphIndex: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[method(paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:)]
pub unsafe fn paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect(
&self,
glyphIndex: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[method(paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:)]
pub unsafe fn paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
&self,
glyphIndex: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[method_id(layoutManager)]
pub unsafe fn layoutManager(&self) -> Option<Id<NSLayoutManager, Shared>>;
#[method_id(currentTextContainer)]
pub unsafe fn currentTextContainer(&self) -> Option<Id<NSTextContainer, Shared>>;
#[method(setHardInvalidation:forGlyphRange:)]
pub unsafe fn setHardInvalidation_forGlyphRange(&self, flag: bool, glyphRange: NSRange);
#[method(getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:)]
pub unsafe fn getLineFragmentRect_usedRect_forParagraphSeparatorGlyphRange_atProposedOrigin(
&self,
lineFragmentRect: NonNull<NSRect>,
lineFragmentUsedRect: NonNull<NSRect>,
paragraphSeparatorGlyphRange: NSRange,
lineOrigin: NSPoint,
);
}
);
extern_methods!(
#[doc = "NSLayoutPhaseInterface"]
unsafe impl NSATSTypesetter {
#[method(willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:)]
pub unsafe fn willSetLineFragmentRect_forGlyphRange_usedRect_baselineOffset(
&self,
lineRect: NonNull<NSRect>,
glyphRange: NSRange,
usedRect: NonNull<NSRect>,
baselineOffset: NonNull<CGFloat>,
);
#[method(shouldBreakLineByWordBeforeCharacterAtIndex:)]
pub unsafe fn shouldBreakLineByWordBeforeCharacterAtIndex(
&self,
charIndex: NSUInteger,
) -> bool;
#[method(shouldBreakLineByHyphenatingBeforeCharacterAtIndex:)]
pub unsafe fn shouldBreakLineByHyphenatingBeforeCharacterAtIndex(
&self,
charIndex: NSUInteger,
) -> bool;
#[method(hyphenationFactorForGlyphAtIndex:)]
pub unsafe fn hyphenationFactorForGlyphAtIndex(&self, glyphIndex: NSUInteger) -> c_float;
#[method(hyphenCharacterForGlyphAtIndex:)]
pub unsafe fn hyphenCharacterForGlyphAtIndex(&self, glyphIndex: NSUInteger) -> UTF32Char;
#[method(boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:)]
pub unsafe fn boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex(
&self,
glyphIndex: NSUInteger,
textContainer: &NSTextContainer,
proposedRect: NSRect,
glyphPosition: NSPoint,
charIndex: NSUInteger,
) -> NSRect;
}
);
extern_methods!(
#[doc = "NSGlyphStorageInterface"]
unsafe impl NSATSTypesetter {
#[method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:)]
pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits(
&self,
glyphsRange: NSRange,
glyphBuffer: *mut NSGlyph,
charIndexBuffer: *mut NSUInteger,
inscribeBuffer: *mut NSGlyphInscription,
elasticBuffer: *mut bool,
) -> NSUInteger;
}
);
120 changes: 120 additions & 0 deletions icrate/src/AppKit/generated/NSAccessibility.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
use super::__exported::NSArray;
use super::__exported::NSString;
use super::__exported::NSView;
use crate::AppKit::generated::AppKitDefines::*;
use crate::AppKit::generated::AppKitDefines::*;
use crate::AppKit::generated::NSAccessibilityConstants::*;
use crate::AppKit::generated::NSAccessibilityCustomRotor::*;
use crate::AppKit::generated::NSAccessibilityElement::*;
use crate::AppKit::generated::NSAccessibilityProtocols::*;
use crate::AppKit::generated::NSErrors::*;
use crate::AppKit::generated::NSWorkspace::*;
use crate::Foundation::generated::NSGeometry::*;
use crate::Foundation::generated::NSObject::*;
#[allow(unused_imports)]
use objc2::rc::{Id, Shared};
#[allow(unused_imports)]
use objc2::{extern_class, extern_methods, ClassType};
extern_methods!(
#[doc = "NSAccessibility"]
unsafe impl NSObject {
#[method_id(accessibilityAttributeNames)]
pub unsafe fn accessibilityAttributeNames(
&self,
) -> Id<NSArray<NSAccessibilityAttributeName>, Shared>;
#[method_id(accessibilityAttributeValue:)]
pub unsafe fn accessibilityAttributeValue(
&self,
attribute: &NSAccessibilityAttributeName,
) -> Option<Id<Object, Shared>>;
#[method(accessibilityIsAttributeSettable:)]
pub unsafe fn accessibilityIsAttributeSettable(
&self,
attribute: &NSAccessibilityAttributeName,
) -> bool;
#[method(accessibilitySetValue:forAttribute:)]
pub unsafe fn accessibilitySetValue_forAttribute(
&self,
value: Option<&Object>,
attribute: &NSAccessibilityAttributeName,
);
#[method_id(accessibilityParameterizedAttributeNames)]
pub unsafe fn accessibilityParameterizedAttributeNames(
&self,
) -> Id<NSArray<NSAccessibilityParameterizedAttributeName>, Shared>;
#[method_id(accessibilityAttributeValue:forParameter:)]
pub unsafe fn accessibilityAttributeValue_forParameter(
&self,
attribute: &NSAccessibilityParameterizedAttributeName,
parameter: Option<&Object>,
) -> Option<Id<Object, Shared>>;
#[method_id(accessibilityActionNames)]
pub unsafe fn accessibilityActionNames(
&self,
) -> Id<NSArray<NSAccessibilityActionName>, Shared>;
#[method_id(accessibilityActionDescription:)]
pub unsafe fn accessibilityActionDescription(
&self,
action: &NSAccessibilityActionName,
) -> Option<Id<NSString, Shared>>;
#[method(accessibilityPerformAction:)]
pub unsafe fn accessibilityPerformAction(&self, action: &NSAccessibilityActionName);
#[method(accessibilityIsIgnored)]
pub unsafe fn accessibilityIsIgnored(&self) -> bool;
#[method_id(accessibilityHitTest:)]
pub unsafe fn accessibilityHitTest(&self, point: NSPoint) -> Option<Id<Object, Shared>>;
#[method_id(accessibilityFocusedUIElement)]
pub unsafe fn accessibilityFocusedUIElement(&self) -> Option<Id<Object, Shared>>;
#[method(accessibilityIndexOfChild:)]
pub unsafe fn accessibilityIndexOfChild(&self, child: &Object) -> NSUInteger;
#[method(accessibilityArrayAttributeCount:)]
pub unsafe fn accessibilityArrayAttributeCount(
&self,
attribute: &NSAccessibilityAttributeName,
) -> NSUInteger;
#[method_id(accessibilityArrayAttributeValues:index:maxCount:)]
pub unsafe fn accessibilityArrayAttributeValues_index_maxCount(
&self,
attribute: &NSAccessibilityAttributeName,
index: NSUInteger,
maxCount: NSUInteger,
) -> Id<NSArray, Shared>;
#[method(accessibilityNotifiesWhenDestroyed)]
pub unsafe fn accessibilityNotifiesWhenDestroyed(&self) -> bool;
}
);
extern_methods!(
#[doc = "NSWorkspaceAccessibilityDisplay"]
unsafe impl NSWorkspace {
#[method(accessibilityDisplayShouldIncreaseContrast)]
pub unsafe fn accessibilityDisplayShouldIncreaseContrast(&self) -> bool;
#[method(accessibilityDisplayShouldDifferentiateWithoutColor)]
pub unsafe fn accessibilityDisplayShouldDifferentiateWithoutColor(&self) -> bool;
#[method(accessibilityDisplayShouldReduceTransparency)]
pub unsafe fn accessibilityDisplayShouldReduceTransparency(&self) -> bool;
#[method(accessibilityDisplayShouldReduceMotion)]
pub unsafe fn accessibilityDisplayShouldReduceMotion(&self) -> bool;
#[method(accessibilityDisplayShouldInvertColors)]
pub unsafe fn accessibilityDisplayShouldInvertColors(&self) -> bool;
}
);
extern_methods!(
#[doc = "NSWorkspaceAccessibility"]
unsafe impl NSWorkspace {
#[method(isVoiceOverEnabled)]
pub unsafe fn isVoiceOverEnabled(&self) -> bool;
#[method(isSwitchControlEnabled)]
pub unsafe fn isSwitchControlEnabled(&self) -> bool;
}
);
extern_methods!(
#[doc = "NSAccessibilityAdditions"]
unsafe impl NSObject {
#[method(accessibilitySetOverrideValue:forAttribute:)]
pub unsafe fn accessibilitySetOverrideValue_forAttribute(
&self,
value: Option<&Object>,
attribute: &NSAccessibilityAttributeName,
) -> bool;
}
);
20 changes: 20 additions & 0 deletions icrate/src/AppKit/generated/NSAccessibilityConstants.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
use crate::AppKit::generated::AppKitDefines::*;
use crate::Foundation::generated::Foundation::*;
#[allow(unused_imports)]
use objc2::rc::{Id, Shared};
#[allow(unused_imports)]
use objc2::{extern_class, extern_methods, ClassType};
pub type NSAccessibilityAttributeName = NSString;
pub type NSAccessibilityParameterizedAttributeName = NSString;
pub type NSAccessibilityAnnotationAttributeKey = NSString;
pub type NSAccessibilityFontAttributeKey = NSString;
pub type NSAccessibilityOrientationValue = NSString;
pub type NSAccessibilitySortDirectionValue = NSString;
pub type NSAccessibilityRulerMarkerTypeValue = NSString;
pub type NSAccessibilityRulerUnitValue = NSString;
pub type NSAccessibilityActionName = NSString;
pub type NSAccessibilityNotificationName = NSString;
pub type NSAccessibilityRole = NSString;
pub type NSAccessibilitySubrole = NSString;
pub type NSAccessibilityNotificationUserInfoKey = NSString;
pub type NSAccessibilityLoadingToken = TodoProtocols;
46 changes: 46 additions & 0 deletions icrate/src/AppKit/generated/NSAccessibilityCustomAction.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
use crate::AppKit::generated::AppKitDefines::*;
use crate::Foundation::generated::Foundation::*;
#[allow(unused_imports)]
use objc2::rc::{Id, Shared};
#[allow(unused_imports)]
use objc2::{extern_class, extern_methods, ClassType};
extern_class!(
#[derive(Debug)]
pub struct NSAccessibilityCustomAction;
unsafe impl ClassType for NSAccessibilityCustomAction {
type Super = NSObject;
}
);
extern_methods!(
unsafe impl NSAccessibilityCustomAction {
#[method_id(initWithName:handler:)]
pub unsafe fn initWithName_handler(
&self,
name: &NSString,
handler: TodoBlock,
) -> Id<Self, Shared>;
#[method_id(initWithName:target:selector:)]
pub unsafe fn initWithName_target_selector(
&self,
name: &NSString,
target: &NSObject,
selector: Sel,
) -> Id<Self, Shared>;
#[method_id(name)]
pub unsafe fn name(&self) -> Id<NSString, Shared>;
#[method(setName:)]
pub unsafe fn setName(&self, name: &NSString);
#[method(handler)]
pub unsafe fn handler(&self) -> TodoBlock;
#[method(setHandler:)]
pub unsafe fn setHandler(&self, handler: TodoBlock);
#[method_id(target)]
pub unsafe fn target(&self) -> Option<Id<NSObject, Shared>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&NSObject>);
#[method(selector)]
pub unsafe fn selector(&self) -> Option<Sel>;
#[method(setSelector:)]
pub unsafe fn setSelector(&self, selector: Option<Sel>);
}
);

0 comments on commit 420f9a0

Please sign in to comment.