Introduce a new Tooltip
element and a with_tooltip
helper
This commit is contained in:
parent
94fc28b29d
commit
982de971fa
5 changed files with 112 additions and 31 deletions
|
@ -31,7 +31,8 @@ use crate::{
|
|||
rect::RectF,
|
||||
vector::{vec2f, Vector2F},
|
||||
},
|
||||
json, DebugContext, Event, EventContext, LayoutContext, PaintContext, SizeConstraint,
|
||||
json, DebugContext, Event, EventContext, LayoutContext, PaintContext, RenderContext,
|
||||
SizeConstraint, View,
|
||||
};
|
||||
use core::panic;
|
||||
use json::ToJson;
|
||||
|
@ -155,6 +156,18 @@ pub trait Element {
|
|||
{
|
||||
FlexItem::new(self.boxed()).float()
|
||||
}
|
||||
|
||||
fn with_tooltip<T: View>(
|
||||
self,
|
||||
id: usize,
|
||||
tooltip: ElementBox,
|
||||
cx: &mut RenderContext<T>,
|
||||
) -> Tooltip
|
||||
where
|
||||
Self: 'static + Sized,
|
||||
{
|
||||
Tooltip::new(id, self.boxed(), tooltip, cx)
|
||||
}
|
||||
}
|
||||
|
||||
pub enum Lifecycle<T: Element> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue