22
33pub mod button;
44pub mod label;
5+ pub mod toggle_button;
56
67use crate :: themes:: basic:: {
78 button:: {
89 styled_button, styled_button_stretched, ButtonStyle , StyledButton , StyledButtonStretched ,
910 } ,
1011 label:: { styled_label, LabelStyle , StyledLabel } ,
12+ toggle_button:: {
13+ styled_toggle_button, styled_toggle_button_stretched, StyledToggleButton ,
14+ StyledToggleButtonStretched , ToggleButtonStyle ,
15+ } ,
1116} ;
1217use embedded_graphics:: prelude:: PixelColor ;
1318
@@ -17,6 +22,7 @@ pub trait BasicTheme: Sized {
1722 type LabelStyle : LabelStyle < Self :: PixelColor > ;
1823 type PrimaryButton : ButtonStyle < Self :: PixelColor > ;
1924 type SecondaryButton : ButtonStyle < Self :: PixelColor > ;
25+ type ToggleButton : ToggleButtonStyle < Self :: PixelColor > ;
2026
2127 fn label < S : AsRef < str > > ( label : S ) -> StyledLabel < S , Self :: PixelColor > {
2228 styled_label :: < Self , Self :: LabelStyle , _ > ( label)
@@ -37,6 +43,16 @@ pub trait BasicTheme: Sized {
3743 fn secondary_button_stretched ( label : & ' static str ) -> StyledButtonStretched < Self :: PixelColor > {
3844 styled_button_stretched :: < Self , Self :: SecondaryButton > ( label)
3945 }
46+
47+ fn toggle_button ( label : & ' static str ) -> StyledToggleButton < Self :: PixelColor > {
48+ styled_toggle_button :: < Self , Self :: ToggleButton > ( label)
49+ }
50+
51+ fn toggle_button_stretched (
52+ label : & ' static str ,
53+ ) -> StyledToggleButtonStretched < Self :: PixelColor > {
54+ styled_toggle_button_stretched :: < Self , Self :: ToggleButton > ( label)
55+ }
4056}
4157
4258/// This macro is used to define the theme structure.
@@ -51,6 +67,7 @@ macro_rules! impl_theme {
5167 $theme_module:: $color_mod:: SecondaryButton ,
5268 } ,
5369 label:: $theme_module:: $color_mod:: Label ,
70+ toggle_button:: $theme_module:: $color_mod:: ToggleButton ,
5471 BasicTheme ,
5572 } ;
5673
@@ -61,6 +78,7 @@ macro_rules! impl_theme {
6178 type LabelStyle = Label ;
6279 type PrimaryButton = PrimaryButton ;
6380 type SecondaryButton = SecondaryButton ;
81+ type ToggleButton = ToggleButton ;
6482 }
6583 }
6684 } ;
0 commit comments