use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct GKMeshGraphTriangulationMode(pub NSUInteger);
bitflags::bitflags! {
impl GKMeshGraphTriangulationMode: NSUInteger {
#[doc(alias = "GKMeshGraphTriangulationModeVertices")]
const Vertices = 1<<0;
#[doc(alias = "GKMeshGraphTriangulationModeCenters")]
const Centers = 1<<1;
#[doc(alias = "GKMeshGraphTriangulationModeEdgeMidpoints")]
const EdgeMidpoints = 1<<2;
}
}
unsafe impl Encode for GKMeshGraphTriangulationMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for GKMeshGraphTriangulationMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(GKGraph, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
pub struct GKMeshGraph<NodeType: ?Sized = AnyObject>;
);
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
impl<NodeType: ?Sized + Message + AsRef<GKGraphNode2D>> GKMeshGraph<NodeType> {
#[inline]
pub unsafe fn cast_unchecked<NewNodeType: ?Sized + Message + AsRef<GKGraphNode2D>>(
&self,
) -> &GKMeshGraph<NewNodeType> {
unsafe { &*((self as *const Self).cast()) }
}
}
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
extern_conformance!(
unsafe impl<NodeType: ?Sized + NSCoding + AsRef<GKGraphNode2D>> NSCoding for GKMeshGraph<NodeType> {}
);
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
extern_conformance!(
unsafe impl<NodeType: ?Sized + AsRef<GKGraphNode2D>> NSCopying for GKMeshGraph<NodeType> {}
);
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
unsafe impl<NodeType: ?Sized + Message + AsRef<GKGraphNode2D>> CopyingHelper
for GKMeshGraph<NodeType>
{
type Result = Self;
}
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
extern_conformance!(
unsafe impl<NodeType: ?Sized + AsRef<GKGraphNode2D>> NSObjectProtocol for GKMeshGraph<NodeType> {}
);
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
extern_conformance!(
unsafe impl<NodeType: ?Sized + NSSecureCoding + AsRef<GKGraphNode2D>> NSSecureCoding
for GKMeshGraph<NodeType>
{
}
);
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
impl<NodeType: Message + AsRef<GKGraphNode2D>> GKMeshGraph<NodeType> {
extern_methods!(
#[cfg(feature = "GKObstacle")]
#[unsafe(method(obstacles))]
#[unsafe(method_family = none)]
pub unsafe fn obstacles(&self) -> Retained<NSArray<GKPolygonObstacle>>;
#[unsafe(method(bufferRadius))]
#[unsafe(method_family = none)]
pub unsafe fn bufferRadius(&self) -> c_float;
#[unsafe(method(triangulationMode))]
#[unsafe(method_family = none)]
pub unsafe fn triangulationMode(&self) -> GKMeshGraphTriangulationMode;
#[unsafe(method(setTriangulationMode:))]
#[unsafe(method_family = none)]
pub unsafe fn setTriangulationMode(&self, triangulation_mode: GKMeshGraphTriangulationMode);
#[unsafe(method(triangleCount))]
#[unsafe(method_family = none)]
pub unsafe fn triangleCount(&self) -> NSUInteger;
#[cfg(feature = "GKObstacle")]
#[unsafe(method(addObstacles:))]
#[unsafe(method_family = none)]
pub unsafe fn addObstacles(&self, obstacles: &NSArray<GKPolygonObstacle>);
#[cfg(feature = "GKObstacle")]
#[unsafe(method(removeObstacles:))]
#[unsafe(method_family = none)]
pub unsafe fn removeObstacles(&self, obstacles: &NSArray<GKPolygonObstacle>);
#[unsafe(method(connectNodeUsingObstacles:))]
#[unsafe(method_family = none)]
pub unsafe fn connectNodeUsingObstacles(&self, node: &NodeType);
#[unsafe(method(triangulate))]
#[unsafe(method_family = none)]
pub unsafe fn triangulate(&self);
#[unsafe(method(classForGenericArgumentAtIndex:))]
#[unsafe(method_family = none)]
pub unsafe fn classForGenericArgumentAtIndex(&self, index: NSUInteger)
-> &'static AnyClass;
);
}
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
impl<NodeType: Message + AsRef<GKGraphNode2D>> GKMeshGraph<NodeType> {
extern_methods!(
#[unsafe(method(graphWithNodes:))]
#[unsafe(method_family = none)]
pub unsafe fn graphWithNodes(nodes: &NSArray<GKGraphNode>) -> Retained<Self>;
#[unsafe(method(initWithNodes:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithNodes(
this: Allocated<Self>,
nodes: &NSArray<GKGraphNode>,
) -> Retained<Self>;
);
}
#[cfg(all(feature = "GKGraph", feature = "GKGraphNode"))]
impl<NodeType: Message + AsRef<GKGraphNode2D>> GKMeshGraph<NodeType> {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}