use crate::{
core::{bindings::KeyPress, hooks::Hook, xconnection::XConn},
draw::{DrawContext, Result},
};
pub mod bar;
pub mod base;
#[doc(inline)]
pub use bar::*;
#[doc(inline)]
pub use base::*;
pub trait Widget {
fn draw(
&mut self,
ctx: &mut dyn DrawContext,
screen: usize,
screen_has_focus: bool,
w: f64,
h: f64,
) -> Result<()>;
fn current_extent(&mut self, ctx: &mut dyn DrawContext, h: f64) -> Result<(f64, f64)>;
fn require_draw(&self) -> bool;
fn is_greedy(&self) -> bool;
}
pub trait HookableWidget<X>: Hook<X> + Widget
where
X: XConn,
{
}
impl<X, T> HookableWidget<X> for T
where
X: XConn,
T: Hook<X> + Widget,
{
}
pub trait KeyboardControlled {
fn handle_keypress(&mut self, k: KeyPress) -> Result<Option<KeyPress>>;
}