refactor: better tooltips and helper methods for managing subsurfaces/popups

This commit is contained in:
Ashley Wulber 2025-02-26 14:14:15 -05:00
parent 41bd495a56
commit 6f643d1d3a
No known key found for this signature in database
GPG key ID: 5216D4F46A90A820
7 changed files with 255 additions and 125 deletions

View file

@ -17,6 +17,11 @@ impl<M> From<M> for MessageWrapper<M> {
/// Ignore this message in your application. It will be intercepted.
#[derive(Clone)]
pub enum SurfaceMessage {
/// Create a subsurface with a view function accepting the App as a parameter
AppSubsurface(
std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
),
/// Create a subsurface with a view function
Subsurface(
std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
@ -50,6 +55,9 @@ pub enum SurfaceMessage {
impl std::fmt::Debug for SurfaceMessage {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::AppSubsurface(arg0, arg1) => {
f.debug_tuple("Subsurface").field(arg0).field(arg1).finish()
}
Self::Subsurface(arg0, arg1) => {
f.debug_tuple("Subsurface").field(arg0).field(arg1).finish()
}