WIP: start on Select

Antonio Scandurra created

Change summary

gpui/src/lib.rs          |  1 +
gpui/src/views.rs        |  3 +++
gpui/src/views/select.rs | 24 ++++++++++++++++++++++++
3 files changed, 28 insertions(+)

Detailed changes

gpui/src/lib.rs 🔗

@@ -7,6 +7,7 @@ mod test;
 pub use assets::*;
 pub mod elements;
 pub mod font_cache;
+pub mod views;
 pub use font_cache::FontCache;
 mod clipboard;
 pub use clipboard::ClipboardItem;

gpui/src/views/select.rs 🔗

@@ -0,0 +1,24 @@
+use crate::{elements::*, Entity, RenderContext, View};
+use std::ops::Range;
+
+pub struct Select {
+    selected_ix: Option<usize>,
+    render_selected_element: Box<dyn FnMut()>,
+    render_elements: Box<dyn FnMut(Range<usize>, &mut RenderContext<Self>)>,
+}
+
+pub enum Event {}
+
+impl Entity for Select {
+    type Event = Event;
+}
+
+impl View for Select {
+    fn ui_name() -> &'static str {
+        "Select"
+    }
+
+    fn render(&mut self, cx: &mut RenderContext<Self>) -> ElementBox {
+        todo!()
+    }
+}