Constructor

Toolbox

new Toolbox(workspace)

Class for a Toolbox. Creates the toolbox's DOM.

Parameter

workspace

Blockly.Workspace

The workspace in which to create new blocks.

Value must not be null.

Classes

Properties

height

number

Height of the toolbox, which changes only in horizontal layout.

HtmlDiv

non-null Element

HtmlDiv

Element

HTML container for the Toolbox menu.

HtmlDiv

non-null Element

RTL

boolean

Is RTL vs LTR.

toolboxPosition

number

Position of the toolbox and flyout relative to the workspace.

width

number

Width of the toolbox, which changes only in vertical layout.

Methods

addStyle

package

addStyle(style)

Adds a style on the toolbox. Usually used to change the cursor.

Parameter

style

string

The name of the class to add.

clearSelection

clearSelection()

Unhighlight any previously specified option.

dispose

dispose()

Dispose of this toolbox.

getClientRect

getClientRect() returns goog.math.Rect

Return the deletion rectangle for this toolbox.

Returns

goog.math.Rect Rectangle in which to delete.

getHeight

getHeight() returns number

Get the height of the toolbox.

Returns

number The width of the toolbox.

getWidth

getWidth() returns number

Get the width of the toolbox.

Returns

number The width of the toolbox.

init

init()

Initializes the toolbox.

position

position()

Move the toolbox to the edge.

refreshSelection

refreshSelection()

Update the flyout's contents without closing it. Should be used in response to a change in one of the dynamic categories, such as variables or procedures.

removeStyle

package

removeStyle(style)

Removes a style from the toolbox. Usually used to change the cursor.

Parameter

style

string

The name of the class to remove.

setColourFromStyle_

setColourFromStyle_(styleName, childOut, categoryName)

Retrieves and sets the colour for the category using the style name. The category colour is set from the colour style attribute.

Parameter

styleName

string

Name of the style.

childOut

Blockly.Toolbox.TreeNode

The child to set the hexColour on.

Value must not be null.

categoryName

string

Name of the toolbox category.

updateColourFromTheme

updateColourFromTheme()

Updates the category colours and background colour of selected categories.