Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-view/src/compositor.rs')
-rw-r--r--helix-view/src/compositor.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/helix-view/src/compositor.rs b/helix-view/src/compositor.rs
index 55a15844..e367e54e 100644
--- a/helix-view/src/compositor.rs
+++ b/helix-view/src/compositor.rs
@@ -46,9 +46,33 @@ pub mod term {
}
}
+#[cfg(feature = "ui")]
+pub mod ui {
+ use super::*;
+ pub type Surface = ();
+
+ pub struct RenderContext<'a> {
+ pub editor: &'a Editor,
+ // pub surface: &'a mut Surface,
+ pub scroll: Option<usize>,
+ }
+
+ pub trait Render {
+ /// Render the component onto the provided surface.
+ fn render(&mut self, area: Rect, ctx: &mut RenderContext) {
+ // TODO:
+ }
+
+ // TODO: make required_size be layout() instead and part of this trait?
+ }
+}
+
#[cfg(feature = "term")]
pub use term::*;
+#[cfg(feature = "ui")]
+pub use ui::*;
+
pub trait Component: Any + AnyComponent + Render {
/// Process input events, return true if handled.
fn handle_event(&mut self, _event: Event, _ctx: &mut Context) -> EventResult {