use crate::screenshot::action::{ActionContext, ActionResult, ScreenAction, ToolCategory};
pub struct TextAction {
active: bool,
}
impl TextAction {
pub fn new() -> Self {
Self { active: false }
}
}
impl Default for TextAction {
fn default() -> Self {
Self::new()
}
}
impl ScreenAction for TextAction {
fn id(&self) -> &str {
"text"
}
fn name(&self) -> &str {
"Text"
}
fn icon_id(&self) -> Option<&str> {
Some("text")
}
fn category(&self) -> ToolCategory {
ToolCategory::Drawing
}
fn is_active(&self) -> bool {
self.active
}
fn set_active(&mut self, active: bool) {
self.active = active;
}
fn on_click(&mut self, _ctx: &ActionContext) -> ActionResult {
self.active = !self.active;
ActionResult::Continue
}
}