mirror of
https://github.com/google/blockly.git
synced 2026-01-07 00:50:27 +01:00
* refactor: Remove uses of AnyDuringMigration from trashcan.ts. * refactor: Remove uses of AnyDuringMigration in bubble.ts. * refactor: Remove uses of AnyDuringMigration from connection_checker.ts. * refactor: Remove uses of AnyDuringMigration from connection_db.ts. * refactor: Remove uses of AnyDuringMigration in contextmenu_items.ts. * refactor: Remove uses of AnyDuringMigration from grid.ts. * refactor: Remove uses of AnyDuringMigration from i_drag_target.ts. * refactor: Remove uses of AnyDuringMigration from i_ast_node_location_svg.ts. * refactor: Remove uses of AnyDuringMigration from i_ast_node_location_with_block.ts. * refactor: Remove uses of AnyDuringMigration from i_autohideable.ts. * refactor: Remove uses of AnyDuringMigration from i_block_dragger.ts. * refactor: Remove uses of AnyDuringMigration from i_bounded_element.ts. * refactor: Remove uses of AnyDuringMigration from i_bubble.ts. * refactor: Remove uses of AnyDuringMigration from i_collapsible_toolbox_item.ts. * refactor: Remove uses of AnyDuringMigration from i_connection_checker.ts. * refactor: Remove uses of AnyDuringMigration from i_contextmenu.ts. * refactor: Remove uses of AnyDuringMigration in i_copyable.ts. * refactor: Remove uses of AnyDuringMigration from i_deleteable.ts. * refactor: Remove uses of AnyDuringMigration from i_delete_area.ts. * refactor: Remove uses of AnyDuringMigration in i_flyout.ts. * refactor: Remove uses of AnyDuringMigration in i_keyboard_accessible.ts. * refactor: Remove uses of AnyDuringMigration in i_metrics_manager.ts. * refactor: Remove uses of AnyDuringMigration from i_movable.ts. * refactor: Remove uses of AnyDuringMigration in i_positionable.ts. * refactor: Remove uses of AnyDuringMigration in i_selectable_toolbox_item.ts. * refactor: Remove uses of AnyDuringMigration from i_selectable.ts. * refactor: Remove uses of AnyDuringMigration in i_serializer.ts. * refactor: Remove uses of AnyDuringMigration from i_styleable.ts. * refactor: Remove uses of AnyDuringMigration in i_toolbox.ts. * refactor: Make non-null checks explicit.
128 lines
3.3 KiB
TypeScript
128 lines
3.3 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2020 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview The interface for a toolbox.
|
|
*/
|
|
|
|
/**
|
|
* The interface for a toolbox.
|
|
* @namespace Blockly.IToolbox
|
|
*/
|
|
import * as goog from '../../closure/goog/goog.js';
|
|
goog.declareModuleId('Blockly.IToolbox');
|
|
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
// Unused import preserved for side-effects. Remove if unneeded.
|
|
// import '../utils/toolbox.js';
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
// Unused import preserved for side-effects. Remove if unneeded.
|
|
// import './i_flyout.js';
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
// Unused import preserved for side-effects. Remove if unneeded.
|
|
// import './i_toolbox_item.js';
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
// Unused import preserved for side-effects. Remove if unneeded.
|
|
// import '../workspace_svg.js';
|
|
|
|
import type {IRegistrable} from './i_registrable.js';
|
|
import type {IToolboxItem} from './i_toolbox_item.js';
|
|
import type {ToolboxInfo} from '../utils/toolbox.js';
|
|
import type {IFlyout} from './i_flyout.js';
|
|
import type {WorkspaceSvg} from '../workspace_svg.js';
|
|
|
|
|
|
/**
|
|
* Interface for a toolbox.
|
|
* @alias Blockly.IToolbox
|
|
*/
|
|
export interface IToolbox extends IRegistrable {
|
|
/** Initializes the toolbox. */
|
|
init(): void;
|
|
|
|
/**
|
|
* Fills the toolbox with new toolbox items and removes any old contents.
|
|
* @param toolboxDef Object holding information for creating a toolbox.
|
|
*/
|
|
render(toolboxDef: ToolboxInfo): void;
|
|
|
|
/**
|
|
* Gets the width of the toolbox.
|
|
* @return The width of the toolbox.
|
|
*/
|
|
getWidth(): number;
|
|
|
|
/**
|
|
* Gets the height of the toolbox.
|
|
* @return The height of the toolbox.
|
|
*/
|
|
getHeight(): number;
|
|
|
|
/**
|
|
* Gets the toolbox flyout.
|
|
* @return The toolbox flyout.
|
|
*/
|
|
getFlyout(): IFlyout|null;
|
|
|
|
/**
|
|
* Gets the workspace for the toolbox.
|
|
* @return The parent workspace for the toolbox.
|
|
*/
|
|
getWorkspace(): WorkspaceSvg;
|
|
|
|
/**
|
|
* Gets whether or not the toolbox is horizontal.
|
|
* @return True if the toolbox is horizontal, false if the toolbox is
|
|
* vertical.
|
|
*/
|
|
isHorizontal(): boolean;
|
|
|
|
/**
|
|
* Positions the toolbox based on whether it is a horizontal toolbox and
|
|
* whether the workspace is in rtl.
|
|
*/
|
|
position(): void;
|
|
|
|
/** Handles resizing the toolbox when a toolbox item resizes. */
|
|
handleToolboxItemResize(): void;
|
|
|
|
/** Unhighlights any previously selected item. */
|
|
clearSelection(): void;
|
|
|
|
/**
|
|
* Updates the category colours and background colour of selected categories.
|
|
*/
|
|
refreshTheme(): void;
|
|
|
|
/**
|
|
* Updates the flyout's content without closing it. Should be used in
|
|
* response to a change in one of the dynamic categories, such as variables or
|
|
* procedures.
|
|
*/
|
|
refreshSelection(): void;
|
|
|
|
/**
|
|
* Sets the visibility of the toolbox.
|
|
* @param isVisible True if toolbox should be visible.
|
|
*/
|
|
setVisible(isVisible: boolean): void;
|
|
|
|
/**
|
|
* Selects the toolbox item by it's position in the list of toolbox items.
|
|
* @param position The position of the item to select.
|
|
*/
|
|
selectItemByPosition(position: number): void;
|
|
|
|
/**
|
|
* Gets the selected item.
|
|
* @return The selected item, or null if no item is currently selected.
|
|
*/
|
|
getSelectedItem(): IToolboxItem|null;
|
|
|
|
/** Disposes of this toolbox. */
|
|
dispose(): void;
|
|
}
|