"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Widget
 */
Object.defineProperty(exports, "__esModule", { value: true });
exports.ReviewToolWidget = void 0;
const React = require("react");
const Backstage_1 = require("../backstage/Backstage");
const CoreToolDefinitions_1 = require("../tools/CoreToolDefinitions");
const SelectionContextItemDef_1 = require("../selection/SelectionContextItemDef");
const ItemMap_1 = require("../shared/ItemMap");
const ToolWidget_1 = require("./ToolWidget");
/** Default Tool Widget for standard "review" applications. Provides standard tools to review, and measure elements.
 * This definition will also show a overflow button if there is not enough room to display all the toolbar buttons.
 * @beta
 */
class ReviewToolWidget extends React.Component {
    constructor() {
        super(...arguments);
        this._horizontalToolbarItems = this.props.showCategoryAndModelsContextTools ?
            new ItemMap_1.ItemList([
                CoreToolDefinitions_1.CoreTools.clearSelectionItemDef,
                SelectionContextItemDef_1.SelectionContextToolDefinitions.hideSectionToolGroup,
                SelectionContextItemDef_1.SelectionContextToolDefinitions.isolateSelectionToolGroup,
                SelectionContextItemDef_1.SelectionContextToolDefinitions.emphasizeElementsItemDef,
            ])
            :
                new ItemMap_1.ItemList([
                    CoreToolDefinitions_1.CoreTools.clearSelectionItemDef,
                    SelectionContextItemDef_1.SelectionContextToolDefinitions.hideElementsItemDef,
                    SelectionContextItemDef_1.SelectionContextToolDefinitions.isolateElementsItemDef,
                    SelectionContextItemDef_1.SelectionContextToolDefinitions.emphasizeElementsItemDef,
                ]);
        this._verticalToolbarItems = new ItemMap_1.ItemList([
            CoreToolDefinitions_1.CoreTools.selectElementCommand,
            CoreToolDefinitions_1.CoreTools.measureToolGroup,
            CoreToolDefinitions_1.CoreTools.sectionToolGroup,
        ]);
    }
    render() {
        let appButtonCommandItemDef = Backstage_1.Backstage.backstageToggleCommand; // eslint-disable-line deprecation/deprecation
        if (this.props.iconSpec) {
            appButtonCommandItemDef = Backstage_1.Backstage.getBackstageToggleCommand(this.props.iconSpec); // eslint-disable-line deprecation/deprecation
        }
        const horizontalToolbarItems = new ItemMap_1.ItemList();
        // istanbul ignore else
        if (this.props.prefixHorizontalItems)
            horizontalToolbarItems.addItems(this.props.prefixHorizontalItems);
        // istanbul ignore else
        if (this._horizontalToolbarItems)
            horizontalToolbarItems.addItems(this._horizontalToolbarItems);
        // istanbul ignore else
        if (this.props.suffixHorizontalItems)
            horizontalToolbarItems.addItems(this.props.suffixHorizontalItems);
        const verticalToolbarItems = new ItemMap_1.ItemList();
        // istanbul ignore else
        if (this.props.prefixVerticalItems)
            verticalToolbarItems.addItems(this.props.prefixVerticalItems);
        // istanbul ignore else
        if (this._verticalToolbarItems)
            verticalToolbarItems.addItems(this._verticalToolbarItems);
        // istanbul ignore else
        if (this.props.suffixVerticalItems)
            verticalToolbarItems.addItems(this.props.suffixVerticalItems);
        return (React.createElement(ToolWidget_1.ToolWidget // eslint-disable-line deprecation/deprecation
        , { appButton: appButtonCommandItemDef, horizontalItems: horizontalToolbarItems, verticalItems: verticalToolbarItems }));
    }
}
exports.ReviewToolWidget = ReviewToolWidget;
//# sourceMappingURL=ReviewToolWidget.js.map