sussudio
Version:
An unofficial VS Code Internal API
66 lines (65 loc) • 2.98 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IContextMenuProvider } from "../../contextmenu.mjs";
import { ActionBar, ActionsOrientation, IActionViewItemProvider } from "../actionbar/actionbar.mjs";
import { AnchorAlignment } from "../contextview/contextview.mjs";
import { Action, IAction, IActionRunner } from "../../../common/actions.mjs";
import { CSSIcon } from "../../../common/codicons.mjs";
import { ResolvedKeybinding } from "../../../common/keybindings.mjs";
import { Disposable } from "../../../common/lifecycle.mjs";
import "../../../../css!./toolbar.mjs";
export interface IToolBarOptions {
orientation?: ActionsOrientation;
actionViewItemProvider?: IActionViewItemProvider;
ariaLabel?: string;
getKeyBinding?: (action: IAction) => ResolvedKeybinding | undefined;
actionRunner?: IActionRunner;
toggleMenuTitle?: string;
anchorAlignmentProvider?: () => AnchorAlignment;
renderDropdownAsChildElement?: boolean;
moreIcon?: CSSIcon;
allowContextMenu?: boolean;
}
/**
* A widget that combines an action bar for primary actions and a dropdown for secondary actions.
*/
export declare class ToolBar extends Disposable {
private options;
protected readonly actionBar: ActionBar;
private toggleMenuAction;
private toggleMenuActionViewItem;
private submenuActionViewItems;
private hasSecondaryActions;
private readonly lookupKeybindings;
private readonly element;
private _onDidChangeDropdownVisibility;
readonly onDidChangeDropdownVisibility: import("../../../common/event.mjs").Event<boolean>;
private disposables;
constructor(container: HTMLElement, contextMenuProvider: IContextMenuProvider, options?: IToolBarOptions);
set actionRunner(actionRunner: IActionRunner);
get actionRunner(): IActionRunner;
set context(context: unknown);
getElement(): HTMLElement;
focus(): void;
getItemsWidth(): number;
getItemAction(indexOrElement: number | HTMLElement): IAction | undefined;
getItemWidth(index: number): number;
getItemsLength(): number;
setAriaLabel(label: string): void;
setActions(primaryActions: ReadonlyArray<IAction>, secondaryActions?: ReadonlyArray<IAction>): void;
isEmpty(): boolean;
private getKeybindingLabel;
private clear;
dispose(): void;
}
export declare class ToggleMenuAction extends Action {
static readonly ID = "toolbar.toggle.more";
private _menuActions;
private toggleDropdownMenu;
constructor(toggleDropdownMenu: () => void, title?: string);
run(): Promise<void>;
get menuActions(): ReadonlyArray<IAction>;
set menuActions(actions: ReadonlyArray<IAction>);
}