@@ -14,7 +14,7 @@ use iced_core::layout::{Layout, Limits, Node};
1414use iced_core:: mouse:: { self , Button as MouseButton , Event as MouseEvent } ;
1515use iced_core:: overlay:: { self , Overlay } ;
1616use iced_core:: widget:: { Tree , Widget } ;
17- use iced_core:: { self , Clipboard , Element , Event , Length , Point , Rectangle , Text } ;
17+ use iced_core:: { self , Clipboard , Element , Event , Length , Point , Rectangle } ;
1818use iced_core:: { Color , Shell } ;
1919use iced_graphics:: geometry:: { LineCap , LineDash , LineJoin , Path , Stroke , Style } ;
2020use lyon_geom:: QuadraticBezierSegment ;
@@ -25,7 +25,12 @@ use std::marker::PhantomData;
2525use vek:: Vec2 ;
2626
2727impl < ' a > ChannelRef < ' a > {
28- pub fn render < M : ' a + Clone , T : ' a , R : ' a + WidgetRenderer > ( & self ) -> Element < ' a , M , T , R > {
28+ pub fn render < M , T , R > ( & self ) -> Element < ' a , M , T , R >
29+ where
30+ M : ' a + Clone ,
31+ T : ' a + iced:: widget:: text:: Catalog ,
32+ R : ' a + WidgetRenderer ,
33+ {
2934 Text :: new ( self . title . to_string ( ) ) . size ( style:: consts:: TEXT_SIZE_REGULAR ) . into ( )
3035 }
3136}
@@ -58,7 +63,12 @@ pub struct NodeElement<'a, M: 'a + Clone, T: 'a, R: 'a + WidgetRenderer> {
5863 element_tree : Element < ' a , M , T , R > ,
5964}
6065
61- impl < ' a , M : ' a + Clone , T : ' a , R : ' a + WidgetRenderer > NodeElementBuilder < ' a , M , T , R > {
66+ impl < ' a , M , T , R > NodeElementBuilder < ' a , M , T , R >
67+ where
68+ M : ' a + Clone ,
69+ T : ' a + iced:: widget:: text:: Catalog ,
70+ R : ' a + WidgetRenderer ,
71+ {
6272 pub fn new ( index : NodeIndex , state : & ' a mut NodeElementState ) -> Self {
6373 Self {
6474 index,
@@ -160,7 +170,12 @@ impl<'a, M: 'a + Clone, T: 'a, R: 'a + WidgetRenderer> NodeElementBuilder<'a, M,
160170 }
161171}
162172
163- impl < ' a , M : ' a + Clone , T : ' a , R : ' a + WidgetRenderer > NodeElement < ' a , M , T , R > {
173+ impl < ' a , M , T , R > NodeElement < ' a , M , T , R >
174+ where
175+ M : ' a + Clone ,
176+ T : ' a + iced:: widget:: text:: Catalog ,
177+ R : ' a + WidgetRenderer ,
178+ {
164179 pub fn builder ( index : NodeIndex , state : & ' a mut NodeElementState ) -> NodeElementBuilder < ' a , M , T , R > {
165180 NodeElementBuilder :: new ( index, state)
166181 }
@@ -223,7 +238,12 @@ impl<'a, M: 'a + Clone, T: 'a, R: 'a + WidgetRenderer> NodeElement<'a, M, T, R>
223238 }
224239}
225240
226- impl < ' a , M : ' a + Clone , T : ' a , R : ' a + WidgetRenderer > Widget < M , T , R > for NodeElement < ' a , M , T , R > {
241+ impl < ' a , M , T , R > Widget < M , T , R > for NodeElement < ' a , M , T , R >
242+ where
243+ M : ' a + Clone ,
244+ T : ' a + iced:: widget:: text:: Catalog ,
245+ R : ' a + WidgetRenderer ,
246+ {
227247 fn size ( & self ) -> Size < iced:: Length > {
228248 Size :: new ( self . width , self . height )
229249 }
@@ -234,7 +254,7 @@ impl<'a, M: 'a + Clone, T: 'a, R: 'a + WidgetRenderer> Widget<M, T, R> for NodeE
234254 // .max_height(self.extents[1])
235255 // .width(self.width)
236256 // .height(self.height);
237- self . element_tree . layout ( renderer, limits)
257+ self . element_tree . as_widget ( ) . layout ( state , renderer, limits)
238258 }
239259
240260 fn draw (
@@ -266,19 +286,22 @@ impl<'a, M: 'a + Clone, T: 'a, R: 'a + WidgetRenderer> Widget<M, T, R> for NodeE
266286 . on_event ( state, event, layout, cursor, renderer, clipboard, shell, viewport)
267287 }
268288
269- fn overlay (
270- & mut self ,
271- state : & mut Tree ,
289+ fn overlay < ' b > (
290+ & ' b mut self ,
291+ state : & ' b mut Tree ,
272292 layout : Layout < ' _ > ,
273293 renderer : & R ,
274294 translation : Vector ,
275- ) -> Option < Element < ' _ , M , T , R > > {
276- self . element_tree . overlay ( state, layout)
295+ ) -> Option < overlay :: Element < ' b , M , T , R > > {
296+ self . element_tree . as_widget_mut ( ) . overlay ( state, layout, renderer , translation )
277297 }
278298}
279299
280- impl < ' a , M : ' a + Clone , T : ' a , R : ' a + WidgetRenderer > From < NodeElement < ' a , M , T , R > >
281- for Element < ' a , M , T , R >
300+ impl < ' a , M , T , R > From < NodeElement < ' a , M , T , R > > for Element < ' a , M , T , R >
301+ where
302+ M : ' a + Clone ,
303+ T : ' a + iced:: widget:: text:: Catalog ,
304+ R : ' a + WidgetRenderer ,
282305{
283306 fn from ( other : NodeElement < ' a , M , T , R > ) -> Self {
284307 Element :: new ( other)
@@ -326,8 +349,11 @@ impl<M: Clone, R: WidgetRenderer> FloatingPanesBehaviour<M, R> {
326349 }
327350}
328351
329- impl < ' a , M : Clone + ' a , T : ' a , R : ' a + WidgetRenderer > floating_panes:: FloatingPanesBehaviour < ' a , M , T , R >
330- for FloatingPanesBehaviour < M , R >
352+ impl < ' a , M , T , R > floating_panes:: FloatingPanesBehaviour < ' a , M , T , R > for FloatingPanesBehaviour < M , R >
353+ where
354+ M : Clone + ' a ,
355+ T : ' a + iced:: widget:: text:: Catalog + iced:: widget:: container:: Catalog ,
356+ R : ' a + WidgetRenderer ,
331357{
332358 type FloatingPaneIndex = NodeIndex ;
333359 type FloatingPaneBehaviourData = FloatingPaneBehaviourData ;
@@ -351,7 +377,7 @@ impl<'a, M: Clone + 'a, T: 'a, R: 'a + WidgetRenderer> floating_panes::FloatingP
351377 panes : & mut FloatingPanes < ' a , M , T , R , Self > ,
352378 state : & mut Tree ,
353379 event : Event ,
354- layout : Layout < ' _ > ,
380+ layout : FloatingPanesLayout < ' _ > ,
355381 cursor : Cursor ,
356382 renderer : & R ,
357383 clipboard : & mut dyn Clipboard ,
@@ -398,7 +424,7 @@ impl<'a, M: Clone + 'a, T: 'a, R: 'a + WidgetRenderer> floating_panes::FloatingP
398424 }
399425 }
400426
401- NodeElement :: < M , R > :: is_channel_selected (
427+ NodeElement :: < M , T , R > :: is_channel_selected (
402428 channel_layout. clone ( ) ,
403429 channel_ref. direction ,
404430 cursor_position,
@@ -426,7 +452,7 @@ impl<'a, M: Clone + 'a, T: 'a, R: 'a + WidgetRenderer> floating_panes::FloatingP
426452 let layout_from = layout
427453 . panes ( )
428454 . nth (
429- NodeElement :: < M , R > :: get_layout_index_from_channel (
455+ NodeElement :: < M , T , R > :: get_layout_index_from_channel (
430456 panes,
431457 connection. from ( ) ,
432458 )
@@ -436,7 +462,7 @@ impl<'a, M: Clone + 'a, T: 'a, R: 'a + WidgetRenderer> floating_panes::FloatingP
436462 let layout_to = layout
437463 . panes ( )
438464 . nth (
439- NodeElement :: < M , R > :: get_layout_index_from_channel (
465+ NodeElement :: < M , T , R > :: get_layout_index_from_channel (
440466 panes,
441467 connection. to ( ) ,
442468 )
@@ -555,7 +581,7 @@ impl<'a, M: Clone + 'a, T: 'a, R: 'a + WidgetRenderer> floating_panes::FloatingP
555581 layout : Layout < ' _ > ,
556582 renderer : & R ,
557583 translation : Vector ,
558- ) -> Option < Element < ' b , M , T , R > > {
584+ ) -> Option < overlay :: Element < ' b , M , T , R > > {
559585 let mut errors = panes
560586 . behaviour_state
561587 . highlight
@@ -589,7 +615,7 @@ impl<'a, M: Clone + 'a, T: 'a, R: 'a + WidgetRenderer> floating_panes::FloatingP
589615
590616 for error in errors {
591617 let display = error. display ( ) ;
592- let mut error_element = Column :: < M , R > :: new ( )
618+ let mut error_element = Column :: < M , T , R > :: new ( )
593619 . max_width ( 512 )
594620 . push ( Text :: new ( display. title . to_string ( ) ) . size ( style:: consts:: TEXT_SIZE_TITLE ) )
595621 . push ( Text :: new ( display. description . to_string ( ) ) . size ( style:: consts:: TEXT_SIZE_REGULAR ) ) ;
@@ -601,17 +627,18 @@ impl<'a, M: Clone + 'a, T: 'a, R: 'a + WidgetRenderer> floating_panes::FloatingP
601627 ) ;
602628 }
603629
604- let mut container = Container :: new ( Margin :: new ( error_element, style:: consts:: SPACING ) ) ;
630+ let mut container =
631+ Container :: < M , T , R > :: new ( Margin :: new ( error_element, style:: consts:: SPACING ) ) ;
605632
606- if let Some ( style) = panes. behaviour . tooltip_style . as_ref ( ) {
607- container = container. style ( style. container_style ( ) ) ;
608- }
633+ // if let Some(style) = panes.behaviour.tooltip_style.as_ref() {
634+ // container = container.style(style.container_style());
635+ // }
609636
610637 column = column. push ( container) ;
611638 }
612639
613640 let position: Point = panes. state . cursor_position . into_array ( ) . into ( ) ;
614- let overlay = WidgetOverlay :: < M , R , _ > :: new (
641+ let overlay = WidgetOverlay :: < M , T , R , _ > :: new (
615642 column,
616643 WidgetOverlayAlignment { top : true , left : false } ,
617644 position,
0 commit comments