Add hover styling support

This commit is contained in:
Nathan Sobo 2023-08-23 09:08:05 -06:00
parent 1bc4f22373
commit 569d99a5a1
8 changed files with 53 additions and 22 deletions

View file

@ -18,7 +18,7 @@ use cocoa::{
},
base::{id, nil, selector, BOOL, YES},
foundation::{
NSArray, NSAutoreleasePool, NSBundle, NSData, NSInteger, NSProcessInfo, NSString,
NSArray, NSAutoreleasePool, NSBundle, NSData, NSInteger, NSPoint, NSProcessInfo, NSString,
NSUInteger, NSURL,
},
};
@ -37,6 +37,7 @@ use objc::{
runtime::{Class, Object, Sel},
sel, sel_impl,
};
use pathfinder_geometry::vector::{vec2f, Vector2F};
use postage::oneshot;
use ptr::null_mut;
use std::{
@ -784,6 +785,11 @@ impl platform::Platform for MacPlatform {
Ok(())
}
fn mouse_position(&self) -> Vector2F {
let position: NSPoint = unsafe { msg_send![class!(NSEvent), mouseLocation] };
vec2f(position.x as f32, position.y as f32)
}
fn set_cursor_style(&self, style: CursorStyle) {
unsafe {
let new_cursor: id = match style {