2020-06-15 03:18:29 +02:00
|
|
|
import { ToolbarButton } from '@ohif/ui';
|
2022-07-27 18:39:04 +02:00
|
|
|
import ToolbarDivider from './Toolbar/ToolbarDivider.tsx';
|
|
|
|
|
import ToolbarLayoutSelector from './Toolbar/ToolbarLayoutSelector.tsx';
|
|
|
|
|
import ToolbarSplitButton from './Toolbar/ToolbarSplitButton.tsx';
|
2020-06-15 03:18:29 +02:00
|
|
|
|
|
|
|
|
export default function getToolbarModule({ commandsManager, servicesManager }) {
|
|
|
|
|
const toolbarService = servicesManager.services.ToolBarService;
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
|
{
|
|
|
|
|
name: 'ohif.divider',
|
|
|
|
|
defaultComponent: ToolbarDivider,
|
2020-09-15 03:18:46 +02:00
|
|
|
clickHandler: () => {},
|
2020-06-15 03:18:29 +02:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'ohif.action',
|
|
|
|
|
defaultComponent: ToolbarButton,
|
2020-09-15 03:18:46 +02:00
|
|
|
clickHandler: () => {},
|
2020-06-15 03:18:29 +02:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'ohif.radioGroup',
|
|
|
|
|
defaultComponent: ToolbarButton,
|
2020-09-15 03:18:46 +02:00
|
|
|
clickHandler: () => {},
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: 'ohif.splitButton',
|
|
|
|
|
defaultComponent: ToolbarSplitButton,
|
|
|
|
|
clickHandler: () => {},
|
2020-06-15 03:18:29 +02:00
|
|
|
},
|
2020-06-15 06:51:36 +02:00
|
|
|
{
|
|
|
|
|
name: 'ohif.layoutSelector',
|
|
|
|
|
defaultComponent: ToolbarLayoutSelector,
|
2020-09-15 03:18:46 +02:00
|
|
|
clickHandler: (evt, clickedBtn, btnSectionName) => {},
|
2020-06-15 06:51:36 +02:00
|
|
|
},
|
2020-06-15 03:18:29 +02:00
|
|
|
{
|
|
|
|
|
name: 'ohif.toggle',
|
|
|
|
|
defaultComponent: ToolbarButton,
|
|
|
|
|
requiredConfig: [],
|
|
|
|
|
optionalConfig: [],
|
|
|
|
|
requiredProps: [],
|
|
|
|
|
optionalProps: [],
|
|
|
|
|
clickHandler: (evt, clickedBtn, btnSectionName) => {
|
|
|
|
|
const { props } = clickedBtn;
|
|
|
|
|
const allButtons = toolbarService.getButtons();
|
|
|
|
|
const thisButton = allButtons[clickedBtn.id];
|
|
|
|
|
|
|
|
|
|
// Set our clicked button to active
|
|
|
|
|
thisButton.props.isActive = !thisButton.props.isActive;
|
|
|
|
|
|
|
|
|
|
// Run button logic/command
|
2020-08-19 21:24:07 +02:00
|
|
|
commandsManager.runCommand(props.commandName, props.commandOptions);
|
|
|
|
|
|
2020-06-15 06:51:36 +02:00
|
|
|
// What if just toggled "content"?
|
|
|
|
|
// commandName OR content?
|
2020-06-15 03:18:29 +02:00
|
|
|
|
|
|
|
|
// Set buttons & trigger notification
|
|
|
|
|
toolbarService.setButtons(allButtons);
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
];
|
2020-05-13 14:22:08 +02:00
|
|
|
}
|