+ManagedView
And some games with rust traits
This commit is contained in:
parent
2182cb2656
commit
2d1d75f482
8 changed files with 75 additions and 73 deletions
|
@ -1,7 +1,7 @@
|
|||
use editor::Editor;
|
||||
use gpui::{
|
||||
div, prelude::*, uniform_list, Component, Div, MouseButton, Render, Task,
|
||||
UniformListScrollHandle, View, ViewContext, WindowContext,
|
||||
div, prelude::*, uniform_list, AppContext, Component, Div, FocusHandle, FocusableView,
|
||||
MouseButton, Render, Task, UniformListScrollHandle, View, ViewContext, WindowContext,
|
||||
};
|
||||
use std::{cmp, sync::Arc};
|
||||
use ui::{prelude::*, v_stack, Divider, Label, TextColor};
|
||||
|
@ -35,6 +35,12 @@ pub trait PickerDelegate: Sized + 'static {
|
|||
) -> Self::ListItem;
|
||||
}
|
||||
|
||||
impl<D: PickerDelegate> FocusableView for Picker<D> {
|
||||
fn focus_handle(&self, cx: &AppContext) -> FocusHandle {
|
||||
self.editor.focus_handle(cx)
|
||||
}
|
||||
}
|
||||
|
||||
impl<D: PickerDelegate> Picker<D> {
|
||||
pub fn new(delegate: D, cx: &mut ViewContext<Self>) -> Self {
|
||||
let editor = cx.build_view(|cx| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue