WIP: start on Select

This commit is contained in:
Antonio Scandurra 2021-08-30 20:15:16 +02:00
parent ef89ceae4d
commit ff01b52819
3 changed files with 28 additions and 0 deletions

View file

@ -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;

3
gpui/src/views.rs Normal file
View file

@ -0,0 +1,3 @@
mod select;
pub use select::*;

24
gpui/src/views/select.rs Normal file
View file

@ -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!()
}
}