File tree Expand file tree Collapse file tree
examples/api/src/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' tauri ' : ' minor:feat'
3+ ' @tauri-apps/api ' : ' minor:feat'
4+ ---
5+
6+ Add Bring All to Front predefined menu item type
Original file line number Diff line number Diff line change @@ -642,6 +642,31 @@ macro_rules! shared_menu_builder {
642642 . push( PredefinedMenuItem :: services( self . manager, Some ( text. as_ref( ) ) ) . map( |i| i. kind( ) ) ) ;
643643 self
644644 }
645+
646+ /// Add Bring All to Front menu item to the menu.
647+ ///
648+ /// ## Platform-specific:
649+ ///
650+ /// - **Windows / Linux:** Unsupported.
651+ pub fn bring_all_to_front( mut self ) -> Self {
652+ self
653+ . items
654+ . push( PredefinedMenuItem :: bring_all_to_front( self . manager, None ) . map( |i| i. kind( ) ) ) ;
655+ self
656+ }
657+
658+ /// Add Bring All to Front menu item with specified text to the menu.
659+ ///
660+ /// ## Platform-specific:
661+ ///
662+ /// - **Windows / Linux:** Unsupported.
663+ pub fn bring_all_to_front_with_text<S : AsRef <str >>( mut self , text: S ) -> Self {
664+ self . items. push(
665+ PredefinedMenuItem :: bring_all_to_front( self . manager, Some ( text. as_ref( ) ) )
666+ . map( |i| i. kind( ) ) ,
667+ ) ;
668+ self
669+ }
645670 }
646671 } ;
647672}
Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ enum Predefined {
9191 Quit ,
9292 About ( Option < AboutMetadata > ) ,
9393 Services ,
94+ BringAllToFront ,
9495}
9596
9697#[ derive( Deserialize ) ]
@@ -303,6 +304,9 @@ impl PredefinedMenuItemPayload {
303304 PredefinedMenuItem :: about ( webview, self . text . as_deref ( ) , metadata)
304305 }
305306 Predefined :: Services => PredefinedMenuItem :: services ( webview, self . text . as_deref ( ) ) ,
307+ Predefined :: BringAllToFront => {
308+ PredefinedMenuItem :: bring_all_to_front ( webview, self . text . as_deref ( ) )
309+ }
306310 }
307311 }
308312}
Original file line number Diff line number Diff line change @@ -384,6 +384,29 @@ impl<R: Runtime> PredefinedMenuItem<R> {
384384 Ok ( Self ( Arc :: new ( item) ) )
385385 }
386386
387+ /// Bring All to Front menu item
388+ ///
389+ /// ## Platform-specific:
390+ ///
391+ /// - **Windows / Linux:** Unsupported.
392+ pub fn bring_all_to_front < M : Manager < R > > ( manager : & M , text : Option < & str > ) -> crate :: Result < Self > {
393+ let handle = manager. app_handle ( ) ;
394+ let app_handle = handle. clone ( ) ;
395+
396+ let text = text. map ( |t| t. to_owned ( ) ) ;
397+
398+ let item = run_main_thread ! ( handle, || {
399+ let item = muda:: PredefinedMenuItem :: bring_all_to_front( text. as_deref( ) ) ;
400+ PredefinedMenuItemInner {
401+ id: item. id( ) . clone( ) ,
402+ inner: Some ( item) ,
403+ app_handle,
404+ }
405+ } ) ?;
406+
407+ Ok ( Self ( Arc :: new ( item) ) )
408+ }
409+
387410 /// Returns a unique identifier associated with this menu item.
388411 pub fn id ( & self ) -> & MenuId {
389412 & self . 0 . id
Original file line number Diff line number Diff line change 3232 ' ShowAll' ,
3333 ' CloseWindow' ,
3434 ' Quit' ,
35- ' Services'
35+ ' Services' ,
36+ ' BringAllToFront'
3637 ]
3738
3839 function onKindChange (event ) {
Original file line number Diff line number Diff line change @@ -102,6 +102,7 @@ export interface PredefinedMenuItemOptions {
102102 | 'CloseWindow'
103103 | 'Quit'
104104 | 'Services'
105+ | 'BringAllToFront'
105106 | {
106107 About : AboutMetadata | null
107108 }
You can’t perform that action at this time.
0 commit comments