/*---------------------------------------------------------------------------------------------
 * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
 * See LICENSE.md in the project root for license terms and full copyright notice.
 *--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
 * @module Backstage
 */
import { BeEvent } from "@itwin/core-bentley";
import { CommandItemDef } from "../shared/CommandItemDef";
import { UiFramework } from "../UiFramework";
/** Controls backstage.
 * @internal
 */
export class InternalBackstageManager {
    constructor() {
        this._isOpen = false;
        /** Event raised when backstage is opened or closed. */
        this.onToggled = new BeEvent();
    }
    get isOpen() {
        return this._isOpen;
    }
    setIsOpen(isOpen) {
        if (isOpen === this._isOpen)
            return;
        this._isOpen = isOpen;
        this.onToggled.raiseEvent({
            isOpen,
        });
    }
    open() {
        this.setIsOpen(true);
    }
    close() {
        this.setIsOpen(false);
    }
    toggle() {
        this.setIsOpen(!this.isOpen);
    }
    /** Get CommandItemDef that will toggle display of Backstage and allow iconSpec to be overridden */
    getBackstageToggleCommand(overrideIconSpec) {
        return new CommandItemDef({
            commandId: "UiFramework.openBackstage",
            iconSpec: overrideIconSpec ? overrideIconSpec : "icon-home",
            labelKey: "UiFramework:commands.openBackstage",
            execute: () => {
                UiFramework.backstage.toggle();
            },
        });
    }
}
//# sourceMappingURL=InternalBackstageManager.js.map