@@ -31,9 +31,9 @@ use crate::{menu::*, Icon, Manager, Runtime};
3131/// .copy()
3232/// .paste()
3333/// .separator()
34- /// .text("MenuItem 2")
35- /// .check("CheckMenuItem 2")
36- /// .icon("IconMenuItem 2", app.default_window_icon().cloned().unwrap())
34+ /// .text("item2", " MenuItem 2")
35+ /// .check("checkitem2", " CheckMenuItem 2")
36+ /// .icon("iconitem2", " IconMenuItem 2", app.default_window_icon().cloned().unwrap())
3737/// .build()?;
3838/// menu.append(&submenu)?;
3939/// app.set_menu(menu);
@@ -104,26 +104,26 @@ impl<'m, R: Runtime, M: Manager<R>> SubmenuBuilder<'m, R, M> {
104104 }
105105
106106 /// Add a [MenuItem] to the submenu.
107- pub fn text < S : AsRef < str > > ( mut self , text : S ) -> Self {
107+ pub fn text < I : Into < MenuId > , S : AsRef < str > > ( mut self , id : I , text : S ) -> Self {
108108 self
109109 . items
110- . push ( MenuItem :: new ( self . manager , text, true , None ) . kind ( ) ) ;
110+ . push ( MenuItem :: with_id ( self . manager , id , text, true , None ) . kind ( ) ) ;
111111 self
112112 }
113113
114114 /// Add a [CheckMenuItem] to the submenu.
115- pub fn check < S : AsRef < str > > ( mut self , text : S ) -> Self {
115+ pub fn check < I : Into < MenuId > , S : AsRef < str > > ( mut self , id : I , text : S ) -> Self {
116116 self
117117 . items
118- . push ( CheckMenuItem :: new ( self . manager , text, true , true , None ) . kind ( ) ) ;
118+ . push ( CheckMenuItem :: with_id ( self . manager , id , text, true , true , None ) . kind ( ) ) ;
119119 self
120120 }
121121
122122 /// Add an [IconMenuItem] to the submenu.
123- pub fn icon < S : AsRef < str > > ( mut self , text : S , icon : Icon ) -> Self {
123+ pub fn icon < I : Into < MenuId > , S : AsRef < str > > ( mut self , id : I , text : S , icon : Icon ) -> Self {
124124 self
125125 . items
126- . push ( IconMenuItem :: new ( self . manager , text, true , Some ( icon) , None ) . kind ( ) ) ;
126+ . push ( IconMenuItem :: with_id ( self . manager , id , text, true , Some ( icon) , None ) . kind ( ) ) ;
127127 self
128128 }
129129
@@ -132,10 +132,15 @@ impl<'m, R: Runtime, M: Manager<R>> SubmenuBuilder<'m, R, M> {
132132 /// ## Platform-specific:
133133 ///
134134 /// - **Windows / Linux**: Unsupported.
135- pub fn native_icon < S : AsRef < str > > ( mut self , text : S , icon : NativeIcon ) -> Self {
136- self
137- . items
138- . push ( IconMenuItem :: with_native_icon ( self . manager , text, true , Some ( icon) , None ) . kind ( ) ) ;
135+ pub fn native_icon < I : Into < MenuId > , S : AsRef < str > > (
136+ mut self ,
137+ id : I ,
138+ text : S ,
139+ icon : NativeIcon ,
140+ ) -> Self {
141+ self . items . push (
142+ IconMenuItem :: with_id_and_native_icon ( self . manager , id, text, true , Some ( icon) , None ) . kind ( ) ,
143+ ) ;
139144 self
140145 }
141146
0 commit comments