Add context menu for scene entries in the editor
The new context menu should appear when right-clicking on scene entry in the scene preview window:
The context menu should contain the following option:
- Show in Explorer - shows the scene file in standard OS file browser
- Close - closes the current scene
- Close all tabs - closes all scenes at once
Picking this. Work in progress.
also for unsaved new scenes, ideally there shouldn't be a Show Explorer option right?
@mrDIMAS I have created context menu, but I am not able to figure out how to trigger them on right click on tab. Have tried checking out exiting components but none have been helpful. Some input would be appreciated!
.with_context_menu when creating tabs should be enough
Tab appears to be an instance of ButtonBuilder, doesn't seem like it supports .with_context_menu
some gap in my understanding?
seems like the right-clicks on tab might be getting overridden by Button's default behaviour.
Right, then you can add the context menu to TabDefinition (context_menu: Option<RcUiNodeHandle>) then and handle it in the TabControl by passing context_menu to Header::build and calling .with_context_menu on WidgetBuilder of ButtonBuilder.
Have done exactly the same!
but right click isn't opening up the context menu.
please check this out: https://github.com/alwinsDen/Fyrox/pull/1/files#diff-692d1fcda147999f5580f747d9db80d492e937ebd0b71cc98c3c141e360ed22bR539
If I pass the same context menu to a content of TabDefinition inside a WidgetBuilder it works (e.g TextBuilder). So don't think issue is with the menus itself.
The issue is that Button widget marks MouseUp event as handled and the context menu handling routine ignores such events. For some reason Button widget can be pressed by any mouse button, but it should only be pressable by left mouse button. I'll fix this today and your code should work after my change.