use crate::prelude::*;
use geo::point;
pub type CursorStyle = crossterm::cursor::SetCursorStyle;
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct Cursor {
pos: U16Pos,
blinking: bool,
hidden: bool,
style: CursorStyle,
}
impl Cursor {
pub fn new(
pos: U16Pos,
blinking: bool,
hidden: bool,
style: CursorStyle,
) -> Self {
Cursor {
pos,
blinking,
hidden,
style,
}
}
pub fn pos(&self) -> &U16Pos {
&self.pos
}
pub fn set_pos(&mut self, pos: U16Pos) {
self.pos = pos;
}
pub fn blinking(&self) -> bool {
self.blinking
}
pub fn set_blinking(&mut self, blinking: bool) {
self.blinking = blinking;
}
pub fn hidden(&self) -> bool {
self.hidden
}
pub fn set_hidden(&mut self, hidden: bool) {
self.hidden = hidden;
}
pub fn style(&self) -> CursorStyle {
self.style
}
pub fn set_style(&mut self, style: CursorStyle) {
self.style = style;
}
}
impl Default for Cursor {
fn default() -> Self {
Cursor {
pos: point! {x:0_u16, y:0_u16},
blinking: false,
hidden: false,
style: CursorStyle::SteadyBlock,
}
}
}