1
- use egui:: { ecolor:: * , Margin , Rounding , Stroke } ;
1
+ use egui:: { ecolor:: * , CornerRadius , Margin , Stroke } ;
2
2
3
3
/// Left or right alignment for tab add button.
4
4
#[ derive( Clone , Copy , Debug , PartialEq , Eq , Hash ) ]
@@ -53,7 +53,7 @@ pub struct Style {
53
53
pub dock_area_padding : Option < Margin > ,
54
54
55
55
pub main_surface_border_stroke : Stroke ,
56
- pub main_surface_border_rounding : Rounding ,
56
+ pub main_surface_border_rounding : CornerRadius ,
57
57
58
58
pub buttons : ButtonsStyle ,
59
59
pub separator : SeparatorStyle ,
@@ -168,8 +168,8 @@ pub struct TabBarStyle {
168
168
/// Show a scroll bar when tab bar overflows. By `Default` it's `true`.
169
169
pub show_scroll_bar_on_overflow : bool ,
170
170
171
- /// Tab rounding . By `Default` it's [`Rounding ::default`].
172
- pub rounding : Rounding ,
171
+ /// Tab corner_radius . By `Default` it's [`CornerRadius ::default`].
172
+ pub corner_radius : CornerRadius ,
173
173
174
174
/// Color of the line separating the tab name area from the tab content area.
175
175
/// By `Default` it's [`Color32::BLACK`].
@@ -227,8 +227,8 @@ pub struct TabInteractionStyle {
227
227
/// Color of the outline around tabs. By `Default` it's [`Color32::BLACK`].
228
228
pub outline_color : Color32 ,
229
229
230
- /// Tab rounding . By `Default` it's [`Rounding ::default`].
231
- pub rounding : Rounding ,
230
+ /// Tab corner radius . By `Default` it's [`CornerRadius ::default`].
231
+ pub corner_radius : CornerRadius ,
232
232
233
233
/// Colour of the tab's background. By `Default` it's [`Color32::WHITE`].
234
234
pub bg_fill : Color32 ,
@@ -247,8 +247,8 @@ pub struct TabBodyStyle {
247
247
/// The stroke of the tabs border. By `Default` it's ['Stroke::default'].
248
248
pub stroke : Stroke ,
249
249
250
- /// Tab rounding . By `Default` it's [`Rounding ::default`].
251
- pub rounding : Rounding ,
250
+ /// Tab corner radius . By `Default` it's [`CornerRadius ::default`].
251
+ pub corner_radius : CornerRadius ,
252
252
253
253
/// Colour of the tab's background. By `Default` it's [`Color32::WHITE`].
254
254
pub bg_fill : Color32 ,
@@ -335,7 +335,7 @@ pub struct LeafHighlighting {
335
335
pub color : Color32 ,
336
336
337
337
/// Rounding of the resulting rectangle.
338
- pub rounding : Rounding ,
338
+ pub corner_radius : CornerRadius ,
339
339
340
340
/// Stroke.
341
341
pub stroke : Stroke ,
@@ -349,7 +349,7 @@ impl Default for Style {
349
349
Self {
350
350
dock_area_padding : None ,
351
351
main_surface_border_stroke : Stroke :: new ( f32:: default ( ) , Color32 :: BLACK ) ,
352
- main_surface_border_rounding : Rounding :: default ( ) ,
352
+ main_surface_border_rounding : CornerRadius :: default ( ) ,
353
353
buttons : ButtonsStyle :: default ( ) ,
354
354
separator : SeparatorStyle :: default ( ) ,
355
355
tab_bar : TabBarStyle :: default ( ) ,
@@ -410,7 +410,7 @@ impl Default for TabBarStyle {
410
410
bg_fill : Color32 :: WHITE ,
411
411
height : 24.0 ,
412
412
show_scroll_bar_on_overflow : true ,
413
- rounding : Rounding :: default ( ) ,
413
+ corner_radius : CornerRadius :: default ( ) ,
414
414
hline_color : Color32 :: BLACK ,
415
415
fill_tab_bar : false ,
416
416
}
@@ -454,7 +454,7 @@ impl Default for TabInteractionStyle {
454
454
Self {
455
455
bg_fill : Color32 :: WHITE ,
456
456
outline_color : Color32 :: BLACK ,
457
- rounding : Rounding :: default ( ) ,
457
+ corner_radius : CornerRadius :: default ( ) ,
458
458
text_color : Color32 :: DARK_GRAY ,
459
459
}
460
460
}
@@ -463,9 +463,9 @@ impl Default for TabInteractionStyle {
463
463
impl Default for TabBodyStyle {
464
464
fn default ( ) -> Self {
465
465
Self {
466
- inner_margin : Margin :: same ( 4.0 ) ,
466
+ inner_margin : Margin :: same ( 4 ) ,
467
467
stroke : Stroke :: default ( ) ,
468
- rounding : Rounding :: default ( ) ,
468
+ corner_radius : CornerRadius :: default ( ) ,
469
469
bg_fill : Color32 :: WHITE ,
470
470
}
471
471
}
@@ -506,7 +506,7 @@ impl Default for LeafHighlighting {
506
506
fn default ( ) -> Self {
507
507
Self {
508
508
color : Color32 :: TRANSPARENT ,
509
- rounding : Rounding :: same ( 0. 0) ,
509
+ corner_radius : CornerRadius :: same ( 0 ) ,
510
510
stroke : Stroke :: NONE ,
511
511
expansion : 0.0 ,
512
512
}
@@ -537,7 +537,7 @@ impl Style {
537
537
pub fn from_egui ( style : & egui:: Style ) -> Self {
538
538
Self {
539
539
main_surface_border_stroke : Stroke :: NONE ,
540
- main_surface_border_rounding : Rounding :: ZERO ,
540
+ main_surface_border_rounding : CornerRadius :: ZERO ,
541
541
buttons : ButtonsStyle :: from_egui ( style) ,
542
542
separator : SeparatorStyle :: from_egui ( style) ,
543
543
tab_bar : TabBarStyle :: from_egui ( style) ,
@@ -617,16 +617,15 @@ impl TabBarStyle {
617
617
///
618
618
/// Fields overwritten by [`egui::Style`] are:
619
619
/// - [`TabBarStyle::bg_fill`]
620
- /// - [`TabBarStyle::rounding`]
621
620
/// - [`TabBarStyle::hline_color`]
622
621
pub fn from_egui ( style : & egui:: Style ) -> Self {
623
622
Self {
624
623
bg_fill : style. visuals . extreme_bg_color ,
625
- rounding : Rounding {
626
- nw : style. visuals . widgets . inactive . rounding . nw + 2.0 ,
627
- ne : style. visuals . widgets . inactive . rounding . ne + 2.0 ,
628
- sw : 0.0 ,
629
- se : 0.0 ,
624
+ corner_radius : CornerRadius {
625
+ nw : style. visuals . widgets . inactive . corner_radius . nw + 2 ,
626
+ ne : style. visuals . widgets . inactive . corner_radius . ne + 2 ,
627
+ sw : 0 ,
628
+ se : 0 ,
630
629
} ,
631
630
hline_color : style. visuals . widgets . noninteractive . bg_stroke . color ,
632
631
..TabBarStyle :: default ( )
@@ -661,16 +660,15 @@ impl TabInteractionStyle {
661
660
/// - [`TabInteractionStyle::outline_color`]
662
661
/// - [`TabInteractionStyle::bg_fill`]
663
662
/// - [`TabInteractionStyle::text_color`]
664
- /// - [`TabInteractionStyle::rounding`]
665
663
pub fn from_egui_active ( style : & egui:: Style ) -> Self {
666
664
Self {
667
665
outline_color : style. visuals . widgets . noninteractive . bg_stroke . color ,
668
666
bg_fill : style. visuals . window_fill ( ) ,
669
667
text_color : style. visuals . text_color ( ) ,
670
- rounding : Rounding {
671
- sw : 0.0 ,
672
- se : 0.0 ,
673
- ..style. visuals . widgets . active . rounding
668
+ corner_radius : CornerRadius {
669
+ sw : 0 ,
670
+ se : 0 ,
671
+ ..style. visuals . widgets . active . corner_radius
674
672
} ,
675
673
}
676
674
}
@@ -681,15 +679,11 @@ impl TabInteractionStyle {
681
679
/// - [`TabInteractionStyle::outline_color`]
682
680
/// - [`TabInteractionStyle::bg_fill`]
683
681
/// - [`TabInteractionStyle::text_color`]
684
- /// - [`TabInteractionStyle::rounding`]
685
682
pub fn from_egui_inactive ( style : & egui:: Style ) -> Self {
686
683
Self {
687
684
text_color : style. visuals . text_color ( ) ,
688
- bg_fill : egui:: ecolor:: tint_color_towards (
689
- style. visuals . window_fill ,
690
- style. visuals . extreme_bg_color ,
691
- ) ,
692
- outline_color : egui:: ecolor:: tint_color_towards (
685
+ bg_fill : tint_color_towards ( style. visuals . window_fill , style. visuals . extreme_bg_color ) ,
686
+ outline_color : tint_color_towards (
693
687
style. visuals . widgets . noninteractive . bg_stroke . color ,
694
688
style. visuals . extreme_bg_color ,
695
689
) ,
@@ -703,7 +697,6 @@ impl TabInteractionStyle {
703
697
/// - [`TabInteractionStyle::outline_color`]
704
698
/// - [`TabInteractionStyle::bg_fill`]
705
699
/// - [`TabInteractionStyle::text_color`]
706
- /// - [`TabInteractionStyle::rounding`]
707
700
pub fn from_egui_focused ( style : & egui:: Style ) -> Self {
708
701
Self {
709
702
text_color : style. visuals . strong_text_color ( ) ,
@@ -717,7 +710,6 @@ impl TabInteractionStyle {
717
710
/// - [`TabInteractionStyle::outline_color`]
718
711
/// - [`TabInteractionStyle::bg_fill`]
719
712
/// - [`TabInteractionStyle::text_color`]
720
- /// - [`TabInteractionStyle::rounding`]
721
713
pub fn from_egui_hovered ( style : & egui:: Style ) -> Self {
722
714
Self {
723
715
text_color : style. visuals . strong_text_color ( ) ,
@@ -732,7 +724,6 @@ impl TabInteractionStyle {
732
724
/// - [`TabInteractionStyle::outline_color`]
733
725
/// - [`TabInteractionStyle::bg_fill`]
734
726
/// - [`TabInteractionStyle::text_color`]
735
- /// - [`TabInteractionStyle::rounding`]
736
727
pub fn from_egui_active_with_kb_focus ( style : & egui:: Style ) -> Self {
737
728
Self {
738
729
text_color : style. visuals . strong_text_color ( ) ,
@@ -747,7 +738,6 @@ impl TabInteractionStyle {
747
738
/// - [`TabInteractionStyle::outline_color`]
748
739
/// - [`TabInteractionStyle::bg_fill`]
749
740
/// - [`TabInteractionStyle::text_color`]
750
- /// - [`TabInteractionStyle::rounding`]
751
741
pub fn from_egui_inactive_with_kb_focus ( style : & egui:: Style ) -> Self {
752
742
Self {
753
743
text_color : style. visuals . strong_text_color ( ) ,
@@ -762,7 +752,6 @@ impl TabInteractionStyle {
762
752
/// - [`TabInteractionStyle::outline_color`]
763
753
/// - [`TabInteractionStyle::bg_fill`]
764
754
/// - [`TabInteractionStyle::text_color`]
765
- /// - [`TabInteractionStyle::rounding`]
766
755
pub fn from_egui_focused_with_kb_focus ( style : & egui:: Style ) -> Self {
767
756
Self {
768
757
text_color : style. visuals . strong_text_color ( ) ,
@@ -778,13 +767,12 @@ impl TabBodyStyle {
778
767
/// Fields overwritten by [`egui::Style`] are:
779
768
/// - [`TabBodyStyle::inner_margin`]
780
769
/// - [`TabBodyStyle::stroke]
781
- /// - [`TabBodyStyle::rounding`]
782
770
/// - [`TabBodyStyle::bg_fill`]
783
771
pub fn from_egui ( style : & egui:: Style ) -> Self {
784
772
Self {
785
773
inner_margin : style. spacing . window_margin ,
786
774
stroke : style. visuals . widgets . noninteractive . bg_stroke ,
787
- rounding : style. visuals . widgets . active . rounding ,
775
+ corner_radius : style. visuals . widgets . active . corner_radius ,
788
776
bg_fill : style. visuals . window_fill ( ) ,
789
777
}
790
778
}
0 commit comments