@@ -547,42 +547,50 @@ impl WidgetInfo {
547
547
}
548
548
549
549
#[ allow( clippy:: needless_pass_by_value) ]
550
- pub fn labeled ( typ : WidgetType , label : impl ToString ) -> Self {
550
+ pub fn labeled ( typ : WidgetType , enabled : bool , label : impl ToString ) -> Self {
551
551
Self {
552
+ enabled,
552
553
label : Some ( label. to_string ( ) ) ,
553
554
..Self :: new ( typ)
554
555
}
555
556
}
556
557
557
558
/// checkboxes, radio-buttons etc
558
559
#[ allow( clippy:: needless_pass_by_value) ]
559
- pub fn selected ( typ : WidgetType , selected : bool , label : impl ToString ) -> Self {
560
+ pub fn selected ( typ : WidgetType , enabled : bool , selected : bool , label : impl ToString ) -> Self {
560
561
Self {
562
+ enabled,
561
563
label : Some ( label. to_string ( ) ) ,
562
564
selected : Some ( selected) ,
563
565
..Self :: new ( typ)
564
566
}
565
567
}
566
568
567
- pub fn drag_value ( value : f64 ) -> Self {
569
+ pub fn drag_value ( enabled : bool , value : f64 ) -> Self {
568
570
Self {
571
+ enabled,
569
572
value : Some ( value) ,
570
573
..Self :: new ( WidgetType :: DragValue )
571
574
}
572
575
}
573
576
574
577
#[ allow( clippy:: needless_pass_by_value) ]
575
- pub fn slider ( value : f64 , label : impl ToString ) -> Self {
578
+ pub fn slider ( enabled : bool , value : f64 , label : impl ToString ) -> Self {
576
579
let label = label. to_string ( ) ;
577
580
Self {
581
+ enabled,
578
582
label : if label. is_empty ( ) { None } else { Some ( label) } ,
579
583
value : Some ( value) ,
580
584
..Self :: new ( WidgetType :: Slider )
581
585
}
582
586
}
583
587
584
588
#[ allow( clippy:: needless_pass_by_value) ]
585
- pub fn text_edit ( prev_text_value : impl ToString , text_value : impl ToString ) -> Self {
589
+ pub fn text_edit (
590
+ enabled : bool ,
591
+ prev_text_value : impl ToString ,
592
+ text_value : impl ToString ,
593
+ ) -> Self {
586
594
let text_value = text_value. to_string ( ) ;
587
595
let prev_text_value = prev_text_value. to_string ( ) ;
588
596
let prev_text_value = if text_value == prev_text_value {
@@ -591,6 +599,7 @@ impl WidgetInfo {
591
599
Some ( prev_text_value)
592
600
} ;
593
601
Self {
602
+ enabled,
594
603
current_text_value : Some ( text_value) ,
595
604
prev_text_value,
596
605
..Self :: new ( WidgetType :: TextEdit )
@@ -599,10 +608,12 @@ impl WidgetInfo {
599
608
600
609
#[ allow( clippy:: needless_pass_by_value) ]
601
610
pub fn text_selection_changed (
611
+ enabled : bool ,
602
612
text_selection : std:: ops:: RangeInclusive < usize > ,
603
613
current_text_value : impl ToString ,
604
614
) -> Self {
605
615
Self {
616
+ enabled,
606
617
text_selection : Some ( text_selection) ,
607
618
current_text_value : Some ( current_text_value. to_string ( ) ) ,
608
619
..Self :: new ( WidgetType :: TextEdit )
0 commit comments