-
Notifications
You must be signed in to change notification settings - Fork 920
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
415 additions
and
324 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use objc2::foundation::NSObject; | ||
use objc2::{extern_class, ClassType}; | ||
|
||
extern_class!( | ||
#[derive(Debug, PartialEq, Eq, Hash)] | ||
pub(crate) struct UIEvent; | ||
|
||
unsafe impl ClassType for UIEvent { | ||
type Super = NSObject; | ||
} | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
use objc2::encode::{Encode, Encoding}; | ||
use objc2::foundation::{CGFloat, CGPoint, NSInteger, NSObject}; | ||
use objc2::{extern_class, extern_methods, ClassType}; | ||
|
||
use super::UIView; | ||
|
||
extern_class!( | ||
#[derive(Debug, PartialEq, Eq, Hash)] | ||
pub(crate) struct UITouch; | ||
|
||
unsafe impl ClassType for UITouch { | ||
type Super = NSObject; | ||
} | ||
); | ||
|
||
extern_methods!( | ||
unsafe impl UITouch { | ||
#[sel(locationInView:)] | ||
pub fn locationInView(&self, view: Option<&UIView>) -> CGPoint; | ||
|
||
#[sel(type)] | ||
pub fn type_(&self) -> UITouchType; | ||
|
||
#[sel(force)] | ||
pub fn force(&self) -> CGFloat; | ||
|
||
#[sel(maximumPossibleForce)] | ||
pub fn maximumPossibleForce(&self) -> CGFloat; | ||
|
||
#[sel(altitudeAngle)] | ||
pub fn altitudeAngle(&self) -> CGFloat; | ||
|
||
#[sel(phase)] | ||
pub fn phase(&self) -> UITouchPhase; | ||
} | ||
); | ||
|
||
#[derive(Debug, PartialEq, Eq)] | ||
#[allow(dead_code)] | ||
#[repr(isize)] | ||
pub enum UITouchType { | ||
Direct = 0, | ||
Indirect, | ||
Pencil, | ||
} | ||
|
||
unsafe impl Encode for UITouchType { | ||
const ENCODING: Encoding = NSInteger::ENCODING; | ||
} | ||
|
||
#[derive(Debug)] | ||
#[allow(dead_code)] | ||
#[repr(isize)] | ||
pub enum UITouchPhase { | ||
Began = 0, | ||
Moved, | ||
Stationary, | ||
Ended, | ||
Cancelled, | ||
} | ||
|
||
unsafe impl Encode for UITouchPhase { | ||
const ENCODING: Encoding = NSInteger::ENCODING; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use objc2::encode::{Encode, Encoding}; | ||
use objc2::foundation::{NSInteger, NSObject}; | ||
use objc2::{extern_class, extern_methods, ClassType}; | ||
|
||
extern_class!( | ||
#[derive(Debug, PartialEq, Eq, Hash)] | ||
pub(crate) struct UITraitCollection; | ||
|
||
unsafe impl ClassType for UITraitCollection { | ||
type Super = NSObject; | ||
} | ||
); | ||
|
||
extern_methods!( | ||
unsafe impl UITraitCollection { | ||
#[sel(forceTouchCapability)] | ||
pub fn forceTouchCapability(&self) -> UIForceTouchCapability; | ||
} | ||
); | ||
|
||
#[derive(Debug, PartialEq, Eq)] | ||
#[allow(dead_code)] | ||
#[repr(isize)] | ||
pub enum UIForceTouchCapability { | ||
Unknown = 0, | ||
Unavailable, | ||
Available, | ||
} | ||
|
||
unsafe impl Encode for UIForceTouchCapability { | ||
const ENCODING: Encoding = NSInteger::ENCODING; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.