File tree Expand file tree Collapse file tree 3 files changed +14
-7
lines changed
Expand file tree Collapse file tree 3 files changed +14
-7
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " tauri " : patch
3+ ---
4+
5+ Export ` MenuHandle ` and ` MenuEvent ` types on ` tauri::window ` .
Original file line number Diff line number Diff line change 66#[ cfg_attr( doc_cfg, doc( cfg( feature = "menu" ) ) ) ]
77pub ( crate ) mod menu;
88
9+ #[ cfg( feature = "menu" ) ]
10+ #[ cfg_attr( doc_cfg, doc( cfg( feature = "menu" ) ) ) ]
11+ pub use menu:: { MenuEvent , MenuHandle } ;
12+
913use crate :: {
1014 api:: config:: WindowUrl ,
1115 app:: AppHandle ,
@@ -307,13 +311,10 @@ impl<P: Params> Window<P> {
307311 /// Registers a menu event listener.
308312 #[ cfg( feature = "menu" ) ]
309313 #[ cfg_attr( doc_cfg, doc( cfg( feature = "menu" ) ) ) ]
310- pub fn on_menu_event < F : Fn ( menu:: MenuEvent < P :: MenuId > ) + Send + ' static > (
311- & self ,
312- f : F ,
313- ) -> uuid:: Uuid {
314+ pub fn on_menu_event < F : Fn ( MenuEvent < P :: MenuId > ) + Send + ' static > ( & self , f : F ) -> uuid:: Uuid {
314315 let menu_ids = self . manager . menu_ids ( ) ;
315316 self . window . dispatcher . on_menu_event ( move |event| {
316- f ( menu :: MenuEvent {
317+ f ( MenuEvent {
317318 menu_item_id : menu_ids. get ( & event. menu_item_id ) . unwrap ( ) . clone ( ) ,
318319 } )
319320 } )
@@ -323,8 +324,8 @@ impl<P: Params> Window<P> {
323324
324325 /// Gets a handle to the window menu.
325326 #[ cfg( feature = "menu" ) ]
326- pub fn menu_handle ( & self ) -> menu :: MenuHandle < P > {
327- menu :: MenuHandle {
327+ pub fn menu_handle ( & self ) -> MenuHandle < P > {
328+ MenuHandle {
328329 ids : self . manager . menu_ids ( ) ,
329330 dispatcher : self . dispatcher ( ) ,
330331 }
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ impl<P: Params> Clone for MenuItemHandle<P> {
5959}
6060
6161impl < P : Params > MenuHandle < P > {
62+ /// Gets a handle to the menu item that has the specified `id`.
6263 pub fn get_item ( & self , id : & P :: MenuId ) -> MenuItemHandle < P > {
6364 for ( raw, item_id) in self . ids . iter ( ) {
6465 if item_id == id {
You can’t perform that action at this time.
0 commit comments