mirror of
https://github.com/google/blockly.git
synced 2026-01-07 17:10:11 +01:00
* Use goog.requireType when importing I* interfaces Interfaces have no code, so should never be referred to outside of (JSDoc) comments, and so the modules that define only interfaces never need to be goog.require'd - goog.requireType is always sufficient. This commit fixes imports of all modules whose name matches /(.*\.)?I[A-Z]*/ - i.e., the hungarian-notation named ones in core/interfaces/. * Use goog.requireType when only using import for type specifications Where a module is imported only to used in JSDoc comments it can (and should) be goog.requireType'd instead of goog.require'd. * Remove spurious eslint-disable no-unused-vars There were a few cases where modules were being imported with goog.require (because they are referred to in code, not just JSDoc comments) but were prefaced by a spurious eslint suppress. Remove these, restoring the invariant that an import gets an eslint if and only if it is a requireType. * Remove obsolete Closure Compiler error group stricterMissingRequire has been superceded by missingRequire, and now causes a Java null pointer exception if supplied.
140 lines
3.2 KiB
JavaScript
140 lines
3.2 KiB
JavaScript
/**
|
|
* @license
|
|
* Copyright 2020 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/**
|
|
* @fileoverview The interface for a toolbox.
|
|
* @author aschmiedt@google.com (Abby Schmiedt)
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
goog.module('Blockly.IToolbox');
|
|
goog.module.declareLegacyNamespace();
|
|
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
const IFlyout = goog.requireType('Blockly.IFlyout');
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
const IRegistrable = goog.requireType('Blockly.IRegistrable');
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
const IToolboxItem = goog.requireType('Blockly.IToolboxItem');
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
const WorkspaceSvg = goog.requireType('Blockly.WorkspaceSvg');
|
|
/* eslint-disable-next-line no-unused-vars */
|
|
const toolbox = goog.requireType('Blockly.utils.toolbox');
|
|
|
|
|
|
/**
|
|
* Interface for a toolbox.
|
|
* @extends {IRegistrable}
|
|
* @interface
|
|
*/
|
|
const IToolbox = function() {};
|
|
|
|
/**
|
|
* Initializes the toolbox.
|
|
* @return {void}
|
|
*/
|
|
IToolbox.prototype.init;
|
|
|
|
/**
|
|
* Fills the toolbox with new toolbox items and removes any old contents.
|
|
* @param {!toolbox.ToolboxInfo} toolboxDef Object holding information
|
|
* for creating a toolbox.
|
|
*/
|
|
IToolbox.prototype.render;
|
|
|
|
/**
|
|
* Gets the width of the toolbox.
|
|
* @return {number} The width of the toolbox.
|
|
*/
|
|
IToolbox.prototype.getWidth;
|
|
|
|
/**
|
|
* Gets the height of the toolbox.
|
|
* @return {number} The width of the toolbox.
|
|
*/
|
|
IToolbox.prototype.getHeight;
|
|
|
|
/**
|
|
* Gets the toolbox flyout.
|
|
* @return {?IFlyout} The toolbox flyout.
|
|
*/
|
|
IToolbox.prototype.getFlyout;
|
|
|
|
/**
|
|
* Gets the workspace for the toolbox.
|
|
* @return {!WorkspaceSvg} The parent workspace for the toolbox.
|
|
*/
|
|
IToolbox.prototype.getWorkspace;
|
|
|
|
/**
|
|
* Gets whether or not the toolbox is horizontal.
|
|
* @return {boolean} True if the toolbox is horizontal, false if the toolbox is
|
|
* vertical.
|
|
*/
|
|
IToolbox.prototype.isHorizontal;
|
|
|
|
/**
|
|
* Positions the toolbox based on whether it is a horizontal toolbox and whether
|
|
* the workspace is in rtl.
|
|
* @return {void}
|
|
*/
|
|
IToolbox.prototype.position;
|
|
|
|
/**
|
|
* Handles resizing the toolbox when a toolbox item resizes.
|
|
* @return {void}
|
|
*/
|
|
IToolbox.prototype.handleToolboxItemResize;
|
|
|
|
/**
|
|
* Unhighlights any previously selected item.
|
|
* @return {void}
|
|
*/
|
|
IToolbox.prototype.clearSelection;
|
|
|
|
/**
|
|
* Updates the category colours and background colour of selected categories.
|
|
* @return {void}
|
|
*/
|
|
IToolbox.prototype.refreshTheme;
|
|
|
|
/**
|
|
* 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.
|
|
* @return {void}
|
|
*/
|
|
IToolbox.prototype.refreshSelection;
|
|
|
|
/**
|
|
* Sets the visibility of the toolbox.
|
|
* @param {boolean} isVisible True if toolbox should be visible.
|
|
*/
|
|
IToolbox.prototype.setVisible;
|
|
|
|
/**
|
|
* Selects the toolbox item by it's position in the list of toolbox items.
|
|
* @param {number} position The position of the item to select.
|
|
* @return {void}
|
|
*/
|
|
IToolbox.prototype.selectItemByPosition;
|
|
|
|
/**
|
|
* Gets the selected item.
|
|
* @return {?IToolboxItem} The selected item, or null if no item is
|
|
* currently selected.
|
|
*/
|
|
IToolbox.prototype.getSelectedItem;
|
|
|
|
/**
|
|
* Disposes of this toolbox.
|
|
* @return {void}
|
|
*/
|
|
IToolbox.prototype.dispose;
|
|
|
|
exports = IToolbox;
|