@@ -73,14 +73,19 @@ pub trait Program: Sized {
7373 /// Returns the current [`Theme`] of the [`Application`].
7474 ///
7575 /// [`Theme`]: Self::Theme
76- fn theme ( & self , _state : & Self :: State ) -> Self :: Theme {
76+ fn theme ( & self , _state : & Self :: State , _id : iced_core :: window :: Id ) -> Self :: Theme {
7777 Self :: Theme :: default ( )
7878 }
7979
8080 /// Returns the current `Style` of the [`Theme`].
8181 ///
8282 /// [`Theme`]: Self::Theme
83- fn style ( & self , _state : & Self :: State , theme : & Self :: Theme ) -> crate :: Appearance {
83+ fn style (
84+ & self ,
85+ _state : & Self :: State ,
86+ theme : & Self :: Theme ,
87+ _id : iced_core:: window:: Id ,
88+ ) -> crate :: Appearance {
8489 theme. default_style ( )
8590 }
8691
@@ -169,12 +174,12 @@ pub trait Program: Sized {
169174 self . program . subscription ( & self . state )
170175 }
171176
172- fn theme ( & self ) -> Self :: Theme {
173- self . program . theme ( & self . state )
177+ fn theme ( & self , id : iced_core :: window :: Id ) -> Self :: Theme {
178+ self . program . theme ( & self . state , id )
174179 }
175180
176- fn style ( & self , theme : & Self :: Theme ) -> crate :: Appearance {
177- self . program . style ( & self . state , theme)
181+ fn style ( & self , theme : & Self :: Theme , id : iced_core :: window :: Id ) -> crate :: Appearance {
182+ self . program . style ( & self . state , theme, id )
178183 }
179184
180185 fn scale_factor ( & self , window : iced_core:: window:: Id ) -> f64 {
@@ -421,16 +426,21 @@ fn with_namespace<P: Program>(
421426 self . program . view ( state, window)
422427 }
423428
424- fn theme ( & self , state : & Self :: State ) -> Self :: Theme {
425- self . program . theme ( state)
429+ fn theme ( & self , state : & Self :: State , id : iced_core :: window :: Id ) -> Self :: Theme {
430+ self . program . theme ( state, id )
426431 }
427432
428433 fn subscription ( & self , state : & Self :: State ) -> iced:: Subscription < Self :: Message > {
429434 self . program . subscription ( state)
430435 }
431436
432- fn style ( & self , state : & Self :: State , theme : & Self :: Theme ) -> crate :: Appearance {
433- self . program . style ( state, theme)
437+ fn style (
438+ & self ,
439+ state : & Self :: State ,
440+ theme : & Self :: Theme ,
441+ id : iced_core:: window:: Id ,
442+ ) -> crate :: Appearance {
443+ self . program . style ( state, theme, id)
434444 }
435445
436446 fn scale_factor ( & self , state : & Self :: State , window : iced_core:: window:: Id ) -> f64 {
@@ -482,12 +492,17 @@ pub fn with_subscription<P: Program>(
482492 self . program . namespace ( state)
483493 }
484494
485- fn theme ( & self , state : & Self :: State ) -> Self :: Theme {
486- self . program . theme ( state)
495+ fn theme ( & self , state : & Self :: State , id : iced_core :: window :: Id ) -> Self :: Theme {
496+ self . program . theme ( state, id )
487497 }
488498
489- fn style ( & self , state : & Self :: State , theme : & Self :: Theme ) -> crate :: Appearance {
490- self . program . style ( state, theme)
499+ fn style (
500+ & self ,
501+ state : & Self :: State ,
502+ theme : & Self :: Theme ,
503+ id : iced_core:: window:: Id ,
504+ ) -> crate :: Appearance {
505+ self . program . style ( state, theme, id)
491506 }
492507
493508 fn scale_factor ( & self , state : & Self :: State , window : iced_core:: window:: Id ) -> f64 {
@@ -503,7 +518,7 @@ pub fn with_subscription<P: Program>(
503518
504519pub fn with_theme < P : Program > (
505520 program : P ,
506- f : impl Fn ( & P :: State ) -> P :: Theme ,
521+ f : impl Fn ( & P :: State , iced_core :: window :: Id ) -> P :: Theme ,
507522) -> impl Program < State = P :: State , Message = P :: Message , Theme = P :: Theme > {
508523 struct WithTheme < P , F > {
509524 program : P ,
@@ -512,16 +527,16 @@ pub fn with_theme<P: Program>(
512527
513528 impl < P : Program , F > Program for WithTheme < P , F >
514529 where
515- F : Fn ( & P :: State ) -> P :: Theme ,
530+ F : Fn ( & P :: State , iced_core :: window :: Id ) -> P :: Theme ,
516531 {
517532 type State = P :: State ;
518533 type Message = P :: Message ;
519534 type Theme = P :: Theme ;
520535 type Renderer = P :: Renderer ;
521536 type Executor = P :: Executor ;
522537
523- fn theme ( & self , state : & Self :: State ) -> Self :: Theme {
524- ( self . theme ) ( state)
538+ fn theme ( & self , state : & Self :: State , id : iced_core :: window :: Id ) -> Self :: Theme {
539+ ( self . theme ) ( state, id )
525540 }
526541 fn remove_id ( & self , state : & mut Self :: State , id : iced_core:: window:: Id ) {
527542 self . program . remove_id ( state, id)
@@ -546,8 +561,13 @@ pub fn with_theme<P: Program>(
546561 self . program . subscription ( state)
547562 }
548563
549- fn style ( & self , state : & Self :: State , theme : & Self :: Theme ) -> crate :: Appearance {
550- self . program . style ( state, theme)
564+ fn style (
565+ & self ,
566+ state : & Self :: State ,
567+ theme : & Self :: Theme ,
568+ id : iced_core:: window:: Id ,
569+ ) -> crate :: Appearance {
570+ self . program . style ( state, theme, id)
551571 }
552572
553573 fn scale_factor ( & self , state : & Self :: State , window : iced_core:: window:: Id ) -> f64 {
@@ -560,7 +580,7 @@ pub fn with_theme<P: Program>(
560580
561581pub fn with_style < P : Program > (
562582 program : P ,
563- f : impl Fn ( & P :: State , & P :: Theme ) -> crate :: Appearance ,
583+ f : impl Fn ( & P :: State , & P :: Theme , iced_core :: window :: Id ) -> crate :: Appearance ,
564584) -> impl Program < State = P :: State , Message = P :: Message , Theme = P :: Theme > {
565585 struct WithStyle < P , F > {
566586 program : P ,
@@ -569,16 +589,21 @@ pub fn with_style<P: Program>(
569589
570590 impl < P : Program , F > Program for WithStyle < P , F >
571591 where
572- F : Fn ( & P :: State , & P :: Theme ) -> crate :: Appearance ,
592+ F : Fn ( & P :: State , & P :: Theme , iced_core :: window :: Id ) -> crate :: Appearance ,
573593 {
574594 type State = P :: State ;
575595 type Message = P :: Message ;
576596 type Theme = P :: Theme ;
577597 type Renderer = P :: Renderer ;
578598 type Executor = P :: Executor ;
579599
580- fn style ( & self , state : & Self :: State , theme : & Self :: Theme ) -> crate :: Appearance {
581- ( self . style ) ( state, theme)
600+ fn style (
601+ & self ,
602+ state : & Self :: State ,
603+ theme : & Self :: Theme ,
604+ id : iced_core:: window:: Id ,
605+ ) -> crate :: Appearance {
606+ ( self . style ) ( state, theme, id)
582607 }
583608
584609 fn namespace ( & self , state : & Self :: State ) -> String {
@@ -603,8 +628,8 @@ pub fn with_style<P: Program>(
603628 self . program . subscription ( state)
604629 }
605630
606- fn theme ( & self , state : & Self :: State ) -> Self :: Theme {
607- self . program . theme ( state)
631+ fn theme ( & self , state : & Self :: State , id : iced_core :: window :: Id ) -> Self :: Theme {
632+ self . program . theme ( state, id )
608633 }
609634
610635 fn scale_factor ( & self , state : & Self :: State , window : iced_core:: window:: Id ) -> f64 {
@@ -656,12 +681,17 @@ pub fn with_scale_factor<P: Program>(
656681 self . program . subscription ( state)
657682 }
658683
659- fn theme ( & self , state : & Self :: State ) -> Self :: Theme {
660- self . program . theme ( state)
684+ fn theme ( & self , state : & Self :: State , id : iced_core :: window :: Id ) -> Self :: Theme {
685+ self . program . theme ( state, id )
661686 }
662687
663- fn style ( & self , state : & Self :: State , theme : & Self :: Theme ) -> crate :: Appearance {
664- self . program . style ( state, theme)
688+ fn style (
689+ & self ,
690+ state : & Self :: State ,
691+ theme : & Self :: Theme ,
692+ id : iced_core:: window:: Id ,
693+ ) -> crate :: Appearance {
694+ self . program . style ( state, theme, id)
665695 }
666696
667697 fn scale_factor ( & self , state : & Self :: State , window : iced_core:: window:: Id ) -> f64 {
@@ -717,12 +747,17 @@ pub fn with_executor<P: Program, E: iced_futures::Executor>(
717747 self . program . subscription ( state)
718748 }
719749
720- fn theme ( & self , state : & Self :: State ) -> Self :: Theme {
721- self . program . theme ( state)
750+ fn theme ( & self , state : & Self :: State , id : iced_core :: window :: Id ) -> Self :: Theme {
751+ self . program . theme ( state, id )
722752 }
723753
724- fn style ( & self , state : & Self :: State , theme : & Self :: Theme ) -> crate :: Appearance {
725- self . program . style ( state, theme)
754+ fn style (
755+ & self ,
756+ state : & Self :: State ,
757+ theme : & Self :: Theme ,
758+ id : iced_core:: window:: Id ,
759+ ) -> crate :: Appearance {
760+ self . program . style ( state, theme, id)
726761 }
727762
728763 fn scale_factor ( & self , state : & Self :: State , window : iced_core:: window:: Id ) -> f64 {
@@ -816,7 +851,7 @@ impl<P: Program> Daemon<P> {
816851 /// Sets the style logic of the [`Application`].
817852 pub fn style (
818853 self ,
819- f : impl Fn ( & P :: State , & P :: Theme ) -> crate :: Appearance ,
854+ f : impl Fn ( & P :: State , & P :: Theme , iced_core :: window :: Id ) -> crate :: Appearance ,
820855 ) -> Daemon < impl Program < State = P :: State , Message = P :: Message , Theme = P :: Theme > > {
821856 Daemon {
822857 raw : with_style ( self . raw , f) ,
@@ -837,7 +872,7 @@ impl<P: Program> Daemon<P> {
837872 /// Sets the theme logic of the [`Application`].
838873 pub fn theme (
839874 self ,
840- f : impl Fn ( & P :: State ) -> P :: Theme ,
875+ f : impl Fn ( & P :: State , iced_core :: window :: Id ) -> P :: Theme ,
841876 ) -> Daemon < impl Program < State = P :: State , Message = P :: Message , Theme = P :: Theme > > {
842877 Daemon {
843878 raw : with_theme ( self . raw , f) ,
0 commit comments