@@ -11,6 +11,7 @@ use crate::{
1111 frame_state:: FrameState ,
1212 input_state:: * ,
1313 layers:: GraphicLayers ,
14+ menu:: ContextMenuSystem ,
1415 mutex:: { Mutex , MutexGuard } ,
1516 * ,
1617} ;
@@ -303,6 +304,15 @@ impl CtxRef {
303304 pub fn debug_painter ( & self ) -> Painter {
304305 Self :: layer_painter ( self , LayerId :: debug ( ) )
305306 }
307+
308+ pub ( crate ) fn show_context_menu (
309+ & self ,
310+ response : & Response ,
311+ add_contents : impl FnOnce ( & mut Ui ) ,
312+ ) {
313+ self . context_menu_system ( )
314+ . context_menu ( response, add_contents) ;
315+ }
306316}
307317
308318// ----------------------------------------------------------------------------
@@ -329,6 +339,7 @@ pub struct Context {
329339 fonts : Option < Arc < Fonts > > ,
330340 memory : Arc < Mutex < Memory > > ,
331341 animation_manager : Arc < Mutex < AnimationManager > > ,
342+ context_menu_system : Arc < Mutex < ContextMenuSystem > > ,
332343
333344 input : InputState ,
334345
@@ -357,6 +368,7 @@ impl Clone for Context {
357368 output : self . output . clone ( ) ,
358369 paint_stats : self . paint_stats . clone ( ) ,
359370 repaint_requests : self . repaint_requests . load ( SeqCst ) . into ( ) ,
371+ context_menu_system : self . context_menu_system . clone ( ) ,
360372 }
361373 }
362374}
@@ -375,6 +387,10 @@ impl Context {
375387 self . memory . lock ( )
376388 }
377389
390+ pub ( crate ) fn context_menu_system ( & self ) -> MutexGuard < ' _ , ContextMenuSystem > {
391+ self . context_menu_system . lock ( )
392+ }
393+
378394 pub ( crate ) fn graphics ( & self ) -> MutexGuard < ' _ , GraphicLayers > {
379395 self . graphics . lock ( )
380396 }
0 commit comments