Skip to main content

Module panel_menu

Module panel_menu 

Source
Expand description

The panel menu: one context menu for a panel wherever it is, docked (its tab, which egui_stack opens), floating (its title and its tabs) or detached (its window’s tabs).

Experimental: may change in any release (docs/stability.md).

It is a declared menu (MENU_PANEL), its entries made when it opens by list providers that read where the panel is, each running a workbench command with the panel in its arguments:

  • docked: Move to each area its rules allow, and Float when it may; floating or detached: Dock back (where it floated from); floating: Dock in each side bar and the bottom panel (palette.dock);
  • Detach into a window; Move to window ▸ (the detached windows, by their panels’ titles); Move group to window ▸ (its tab group whole, to a window or a new one);
  • Move to group ▸ (the docked tab groups, by their panels’ titles);
  • Zen this panel: the panel alone, full size, in its window (workbench.zen with the panel);
  • Close.

A floating panel’s menu opens through crate::menus::context_menu, so it is a pop.popup.open on the bus like every context menu.

A tab group has two more ways to open a panel in it, both asking pop.panel.open with here (the workbench.panel.open command):

  • the group menu (MENU_GROUP, a right click on the empty part of its tab bar): Open panel ▸, every panel its place allows that is not one of its tabs, an open one moving there;
  • the “+” at the end of its tab bar (DockControls::add_buttons): the closed panels its place allows (MENU_GROUP_ADD).

Both list first “New <panel>” for each panel declared with several instances its place allows (pop.panel.open with instance: "new"). The same entries, opening where the panel’s area is, are the list LIST_NEW_INSTANCES, in the View menu and for an application’s own Window menu (MenuItem::list).

Constants§

CMD_PANEL_CLOSE
Closes a panel (panel).
CMD_PANEL_DETACH
Moves a panel into a window of its own (panel; group: its tab group whole).
CMD_PANEL_DOCK_BACK
Docks a floating or detached panel back where it floated from (panel).
CMD_PANEL_FLOAT
Floats a docked panel, where its area is (panel; group: its tab group whole).
CMD_PANEL_MOVE
Docks a panel in an area (panel, area).
CMD_PANEL_MOVE_TO_GROUP
Docks a panel in the tab group holding group (panel, group).
CMD_PANEL_OPEN
Opens a panel through pop.panel.open (panel; place: last, the default, here or an area’s name; group: a panel of the tab group here means, else the focused panel’s).
CMD_PANEL_PICK
“Open panel…”: a quick pick in the command palette of every declared panel (and “New <panel>” for those declared with several), the chosen one opened where it was (workbench.panel.open, place: "last"). Ctrl+Shift+O.
LIST_NEW_INSTANCES
“New <panel>” for each panel declared with several instances, opening a new one in the panel’s area: in the View menu, and for an application’s Window menu.
MENU_GROUP
A tab group’s menu (args.group: a panel of the group): Open panel ▸.
MENU_GROUP_ADD
The menu under a tab bar’s “+” (args.group): the closed panels that may open in the group.
MENU_GROUP_OPEN
Its submenu listing the panels that may open in the group.
MENU_PANEL
The panel menu (args.panel: the panel it acts on).
MENU_PANEL_GROUPS
Its submenu listing the docked tab groups the panel may join.
MENU_PANEL_GROUP_WINDOWS
Its submenu moving the panel’s tab group into a window.
MENU_PANEL_WINDOWS
Its submenu listing the detached windows the panel may join.

Functions§

context_menu
Opens the panel menu on a widget’s secondary click (or Shift+F10 and the Menu key while it has the focus), as a context menu: a floating panel’s title, a tab of a floating group.
menu_args
The menu’s arguments for a panel: the panel, and which submenus have entries (has_windows, group_moves, has_groups).
panel_pick
“Open panel…”’s quick pick: “New <panel>” for each panel declared with several instances, then every declared panel by title, each opening where it was.