This commit is contained in:
KCaverly
2023-10-31 11:32:56 -04:00
parent 5550e80c4e
commit 68a1c7ce4c
5 changed files with 110 additions and 111 deletions
+3 -3
View File
@@ -120,7 +120,7 @@ type FrameCallback = Box<dyn FnOnce(&mut WindowContext) + Send>;
type Handler = Box<dyn FnMut(&mut AppContext) -> bool + Send + 'static>;
type Listener = Box<dyn FnMut(&dyn Any, &mut AppContext) -> bool + Send + 'static>;
type QuitHandler = Box<dyn FnMut(&mut AppContext) -> BoxFuture<'static, ()> + Send + 'static>;
type ReleaseListener = Box<dyn FnMut(&mut dyn Any, &mut AppContext) + Send + 'static>;
type ReleaseListener = Box<dyn FnOnce(&mut dyn Any, &mut AppContext) + Send + 'static>;
pub struct AppContext {
this: Weak<Mutex<AppContext>>,
@@ -408,7 +408,7 @@ impl AppContext {
for (entity_id, mut entity) in dropped {
self.observers.remove(&entity_id);
self.event_listeners.remove(&entity_id);
for mut release_callback in self.release_listeners.remove(&entity_id) {
for release_callback in self.release_listeners.remove(&entity_id) {
release_callback(&mut entity, self);
}
}
@@ -697,7 +697,7 @@ impl AppContext {
pub fn observe_release<E, T>(
&mut self,
handle: &E,
mut on_release: impl FnMut(&mut T, &mut AppContext) + Send + 'static,
on_release: impl FnOnce(&mut T, &mut AppContext) + Send + 'static,
) -> Subscription
where
E: Entity<T>,
+5 -5
View File
@@ -393,18 +393,18 @@ impl Bind for WindowBounds {
}
};
todo!()
// statement.bind(
// &region.map(|region| {
// (
// region.min_x(),
// region.min_y(),
// region.width(),
// region.height(),
// region.origin.x,
// region.origin.y,
// region.size.width,
// region.size.height,
// )
// }),
// next_index,
// )
todo!()
}
}
+1 -1
View File
@@ -1675,7 +1675,7 @@ impl<'a, 'w, V: 'static> ViewContext<'a, 'w, V> {
pub fn on_release(
&mut self,
mut on_release: impl FnMut(&mut V, &mut WindowContext) + Send + 'static,
on_release: impl FnOnce(&mut V, &mut WindowContext) + Send + 'static,
) -> Subscription {
let window_handle = self.window.handle;
self.app.release_listeners.insert(