ming_wm_lib/components/
mod.rs

1use std::vec::Vec;
2
3use crate::themes::ThemeInfo;
4use crate::messages::WindowMessage;
5use crate::window_manager_types::DrawInstructions;
6
7pub mod toggle_button;
8pub mod highlight_button;
9pub mod paragraph;
10pub mod press_button;
11
12pub trait Component<T> {
13  fn handle_message(&mut self, message: WindowMessage) -> Option<T>;
14  fn draw(&self, theme_info: &ThemeInfo) -> Vec<DrawInstructions>;
15
16  //properties
17  //focusing is a way for the *window* to know what component to send input, presses, etc
18  //focusing for components is purely to give a visual representation
19  fn focusable(&self) -> bool;
20  fn clickable(&self) -> bool;
21  //fn pressable(&self) -> bool; //touch
22  fn name(&self) -> &String; //should be unique
23}
24